<template>
  <div id="model-3">
    <el-row class="list" @click.native="toDetail">
      <el-col :span="8" class="image">
        <el-image :src="kjpx" fit="fit"></el-image>
      </el-col>
      <el-col :span="16" class="info">
        <el-col :span="24" class="title">
          {{ data.title }}
        </el-col>
        <el-col :span="24" class="other">
          <p>
            更新时间：<span>{{ data.publish_time || '暂无' }}</span>
          </p>
          <p>
            信息来源：<span>{{ data.origin || '暂无' }}</span>
          </p>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'model-3',
  props: {
    data: { type: Object, default: () => {} },
    router: { type: String },
  },
  components: {},
  data: function () {
    return {
      kjpx: require('@a/kjpx.jpg'),
    };
  },
  created() {},
  methods: {
    toDetail() {
      this.$router.push({ path: this.router ? this.router : this.detailRouter, query: { id: this.data._id } });
    },
  },
  computed: {
    ...mapState(['user', 'menuParams']),
    pageTitle() {
      return `${this.$route.meta.title}`;
    },
    detailRouter() {
      const key = this.$route.meta.key;
      return `/${key}/detail`;
    },
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
};
</script>

<style lang="less" scoped>
.list {
  padding: 10px 5px;
  background: #fff;
  margin: 0 0 5px 0;
  border-radius: 5px;
  .image {
    text-align: center;
    .el-image {
      border: 1px solid #f9f9f9;
      border-radius: 5px;
    }
  }
  .info {
    padding: 0 5px;
    .title {
      font-size: 15px;
      font-weight: bold;
      margin: 0 0 5px 0;
      overflow: hidden;
      text-overflow: ellipsis;
      -webkit-line-clamp: 2;
      word-break: break-all;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      max-height: 40px;
    }
    .other {
      p {
        padding: 0 0 5px 0;
        color: #666;
        font-size: 14px;
        span {
          color: #000;
        }
      }
    }
  }
}
</style>
