<template>
  <div id="model-2">
    <el-row>
      <el-col :span="24" class="main">
        <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click.native="detail(item.id)">
          <el-col :span="6" class="image">
            <el-carousel height="110px" arrow="never" indicator-position="none" :interval="2000" v-if="item.image.length > 0">
              <el-carousel-item v-for="(tag, index) in item.image" :key="index">
                <el-image :src="tag.url"> </el-image>
              </el-carousel-item>
            </el-carousel>
            <el-image :src="noImage" v-else></el-image>
          </el-col>
          <el-col :span="18" class="info">
            <el-col :span="24" class="title">
              {{ item.title }}
            </el-col>
            <el-col :span="24" class="other">
              <el-col :span="12" class="text textOver">
                信息来源：<span>{{ item.origin }}</span>
              </el-col>
              <el-col :span="12" class="text textOver">
                发布时间：<span>{{ item.release_time }}</span>
              </el-col>
            </el-col>
          </el-col>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'model-2',
  props: {
    list: { type: Array, default: () => [] },
  },
  components: {},
  data: function () {
    return {
      noImage: require('@a/noImg.jpg'),
    };
  },
  created() {},
  methods: {
    detail(id) {
      this.$router.push({ path: './list', query: { index: this.index, id } });
    },
  },
  computed: {
    ...mapState(['user']),
    index() {
      return parseInt(this.$route.query.index) || 0;
    },
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  .list {
    padding: 6px 10px;
    border-bottom: 1px dashed #ccc;
    .image {
      height: 110px;
      .el-image {
        height: 110px;
        border: 1px solid #f1f1f1;
      }
    }
    .info {
      padding: 0 10px;
      .title {
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-line-clamp: 3;
        word-break: break-all;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        font-size: 16px;
        margin: 0 0 5px 0;
      }
      .other {
        .text {
          font-size: 14px;
          color: #666;
          span {
            color: #000;
          }
        }
      }
    }
  }
  .list:hover {
    cursor: pointer;
    .info {
      .title {
        color: #409eff;
        font-weight: bold;
      }
    }
  }
}
</style>
