<template>
  <div id="index">
    <el-row>
      <el-col :span="24" class="main">
        <div class="w_1200">
          <el-col :span="24" class="bt">{{ noticeInfo.title }}</el-col>
          <el-col :span="24" class="date">
            <span>来源：{{ noticeInfo.source }}</span>
            <span>发布时间：{{ noticeInfo.create_time }}</span>
          </el-col>
          <el-col :span="24" class="content" v-html="noticeInfo.content"></el-col>
          <el-col :span="24" class="sb">
            <el-button type="primary" size="mini" @click="click(noticeInfo.id)">技术需求%科技成果信息征集填报</el-button>
          </el-col>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
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;
}
.main {
  margin: 0 0 30px 0;
}
.bt {
  font-size: 30px;
  text-align: center;
  padding: 60px 0 20px 0;
}
.date {
  text-align: center;
  font-size: 18px;
  span {
    margin: 0 10px;
  }
}
.content {
  margin: 15px 0;
}
</style>
