<template>
  <div id="model-0">
    <el-row>
      <el-col :span="24" class="main">
        <el-col :span="24" class="btn">
          <slot></slot>
        </el-col>
        <el-col :span="24" class="info">
          <el-col :span="24" class="title">
            {{ data.title }}
          </el-col>
          <el-col :span="24" class="other">
            <el-col :span="12" class="text">
              信息来源：<span>{{ data.origin }}</span>
            </el-col>
            <el-col :span="12" class="text">
              发布时间：<span>{{ data.publish_time }}</span>
            </el-col>
          </el-col>
          <el-col :span="24" class="video" v-if="data.filepath">
            <video :src="getImage(data.filepath)" controls="controls">your browser does not support the video tag</video>
          </el-col>
          <el-col :span="24" class="content">
            <p v-html="data.content"></p>
          </el-col>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
const _ = require('lodash');
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'model-0',
  props: {
    data: { type: Object },
  },
  components: {},
  data: function () {
    return {};
  },
  created() {},
  methods: {
    getImage(data) {
      if (_.map(data, 'url')[0]) {
        return _.map(data, 'url')[0];
      }
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  .btn {
    text-align: right;
    margin: 0 0 10px 0;
  }
  .info {
    .title {
      font-size: 18px;
      text-align: center;
      font-weight: bold;
      margin: 0 0 15px 0;
    }
    .other {
      margin: 0 0 15px 0;
      .text {
        font-size: 14px;
        color: #666;
        text-align: right;
        padding: 0 10px;
        span {
          color: #000;
        }
      }
      .text:nth-child(2) {
        text-align: left;
      }
    }
    .video {
      text-align: center;
      height: 260px;
      overflow: hidden;
      margin: 0 0 15px 0;
      video {
        width: 50%;
        height: 260px;
        overflow: hidden;
      }
    }
    .content {
      font-size: 16px;
      text-indent: 2rem;
      margin: 0 0 15px 0;
    }
  }
}
</style>
