<template>
  <div id="adviserList">
    <enterprisedg-detail
      :info="info"
      :recruitData="recruitData"
      :liebiaoList="liebiaoList"
      @onsave="onsaveClick"
      :columnName="columnName"
    ></enterprisedg-detail>
  </div>
</template>

<script>
import enterprisedgDetail from '@/components/enterprise/enterpisedg.vue';
import { createNamespacedHelpers, mapGetters } from 'vuex';
const { mapActions: mapSite } = createNamespacedHelpers('site');

const { mapActions: mapRecruit } = createNamespacedHelpers('enterpriseproject');
export default {
  name: 'adviserList',
  props: {},
  components: {
    enterprisedgDetail,
  },
  data: () => ({
    info: {},
    liebiaoList: [{ name: '基本信息' }, { name: '消息管理' }, { name: '我的发布' }, { name: '我的订购' }, { name: '注销账号' }],
    columnName: '',
    recruitData: [],
  }),
  created() {
    this.searchSite();
    this.searchColumn();
  },
  computed: {},
  methods: {
    ...mapSite(['showInfo']),
    ...mapRecruit({ recruitList: 'query' }),
    // 查询站点信息
    async searchSite() {
      let res = await this.showInfo();
      let object = JSON.parse(JSON.stringify(res.data));
      if (object) {
        this.$set(this, `info`, res.data);
      } else {
        this.$message.error(res.errmsg ? res.errmsg : 'error');
      }
    },
    // 查询科技政务栏目

    async searchColumn({ skip = 0, limit = 10, column_id } = {}) {
      const res = await this.recruitList({ skip, limit, column_id: this.$route.query.id });
      console.log();
      if (this.$checkRes(res)) {
        this.$set(this, `recruitData`, res.data);
        console.log(res.data);
      }
    },

    async onsaveClick({ id }) {
      console.log(id);
      if (id === '基本信息') {
        this.$router.push({ path: '/enterprise/enterprisejb' });
      } else if (id === '消息管理') {
        this.$router.push({ path: '/enterprise/enterprisexx' });
      } else if (id === '我的发布') {
        this.$router.push({ path: '/enterprise/enterprisefabu' });
      } else if (id === '我的订购') {
        this.$router.push({ path: '/enterprise/enterprisedg' });
      }
    },
  },
};
</script>

<style lang="less" scoped></style>
