<template>
  <div id="index">
    <el-row>
      <el-col :span="24">
        <div class="w_1200">
          <el-col class="bt">{{ noticeInfo.title }}</el-col>
          <el-col :span="5" class="ly">来源：{{ noticeInfo.source }}</el-col>
          <el-col :span="5" class="time">时间：{{ noticeInfo.create_time }}</el-col>
          <el-col :span="24" class="content" v-html="noticeInfo.content"></el-col>
          <el-col :span="24">
            <el-button type="primary" @click="clickk">信息申报</el-button>
          </el-col>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
import productForm from './productForm.vue';
const { mapActions: notice } = createNamespacedHelpers('notice');
export default {
  name: 'index',
  props: {},
  components: {},
  data: function() {
    return {
      noticeInfo: {},
    };
  },
  created() {
    this.search();
  },
  methods: {
    ...notice(['query']),
    // 列表
    async search({ skip = 0, limit = 10, ...info } = {}) {
      let arr = await this.query({ skip, limit, ...info });
      this.$set(this, `noticeInfo`, arr.data[0]);
    },
    click(id) {
      this.$router.push({ path: '/notice/productForm', query: { id: id } });
    },
  },
  computed: {
    ...mapState(['user']),
    pageTitle() {
      return `${this.$route.meta.title}`;
    },
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
};
</script>

<style lang="less" scoped>
.w_1200 {
  width: 80%;
  margin: 0 auto;
}
.bt {
  font-size: 36px;
  text-align: center;
  margin-top: 50px;
}
.ly {
  margin: 20px 120px 0 480px;
  font-size: 24px;
}
.time {
  margin-top: 20px;
  font-size: 24px;
}
.content {
  margin-top: 20px;
  text-indent: 5em;
}
</style>
