123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <template>
- <div id="index">
- <index-detail
- :info="info"
- :map="map"
- :zixunList="gndtList"
- :noticeList="tzggList"
- :lawList="zhzczdList"
- :xinpinList="xinpinList"
- :chuangxinList="chuangxinList"
- :linkList="linkList"
- ></index-detail>
- </div>
- </template>
- <script>
- import indexDetail from '@/components/index.vue';
- import { createNamespacedHelpers, mapGetters } from 'vuex';
- const { mapActions: mapSite } = createNamespacedHelpers('site');
- const { mapActions: mapLink } = createNamespacedHelpers('link');
- const { mapActions: mapAffairsColumn } = createNamespacedHelpers('affairsColumn');
- const { mapActions: mapAffairsNews } = createNamespacedHelpers('affairsNews');
- const { mapActions: mapPolicyColumn } = createNamespacedHelpers('policyColumn');
- const { mapActions: mapPolicyNews } = createNamespacedHelpers('policyNews');
- export default {
- name: 'index',
- props: {},
- components: {
- indexDetail,
- },
- data: () => ({
- info: {},
- map: require('@/assets/map.jpg'),
- gndtList: [],
- tzggList: [],
- zhzczdList: [
- {
- title: '尼日利亚传统领袖:尼应学习借鉴中国自贸区建设经验',
- date: '2019-12-25',
- },
- {
- title: '八条数据',
- date: '2019-12-25',
- },
- ],
- linkList: [],
- xinpinList: [
- {
- title: '科技超市(产品)',
- date: '2019-12-25',
- },
- {
- title: '六条数据',
- date: '2019-12-25',
- },
- ],
- chuangxinList: [
- {
- title: '科技超市(产品)',
- date: '2019-12-25',
- },
- {
- title: '六条数据',
- date: '2019-12-25',
- },
- ],
- }),
- created() {
- this.searchSite();
- this.searchLink();
- this.searchAffairs();
- this.searchPolicy();
- },
- computed: {},
- methods: {
- ...mapSite(['showInfo']),
- ...mapLink(['query']),
- ...mapAffairsColumn({ affairsColumnList: 'query', affairsColumnInfo: 'fetch' }),
- ...mapAffairsNews({ affairsNews: 'query' }),
- ...mapPolicyColumn({ policyColumnList: 'query', policyColumnInfo: 'fetch' }),
- ...mapPolicyNews({ policyNews: '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 searchLink({ ...info } = {}) {
- const res = await this.query({ ...info });
- if (this.$checkRes(res)) {
- this.$set(this, `linkList`, res.data);
- }
- },
- // 最新資訊,通知公告(所属科技政务,国内动态,通知公告)
- async searchAffairs({ ...info } = {}) {
- const res = await this.affairsColumnList({ ...info });
- for (const val of res.data) {
- this.tpxwSearch({ column_id: val.id, site: val.site });
- }
- },
- async tpxwSearch({ skip = 0, limit = 8, column_id, site } = {}) {
- if (site === 'gndt') {
- const res = await this.affairsNews({ skip, limit, column_id: column_id });
- for (const val of res.data) {
- const result = await this.affairsColumnInfo(val.column_id);
- val.column_name = result.data.name;
- }
- this.$set(this, `${site}List`, res.data);
- } else if (site === 'tzgg') {
- const res = await this.affairsNews({ skip, limit, column_id: column_id });
- for (const val of res.data) {
- const result = await this.affairsColumnInfo(val.column_id);
- val.column_name = result.data.name;
- }
- this.$set(this, `${site}List`, res.data);
- }
- },
- // 政策法规(所属科技政策,综合政策指导)
- async searchPolicy({ ...info } = {}) {
- const res = await this.policyColumnList({ ...info });
- for (const val of res.data) {
- this.zhzcdPolicy({ column_id: val.id, site: val.site });
- }
- },
- async zhzcdPolicy({ skip = 0, limit = 8, column_id, site } = {}) {
- if (site === 'zhzczd') {
- const res = await this.policyNews({ skip, limit, column_id: column_id });
- for (const val of res.data) {
- const result = await this.policyColumnInfo(val.column_id);
- val.column_name = result.data.name;
- }
- this.$set(this, `${site}List`, res.data);
- }
- },
- },
- };
- </script>
- <style lang="scss" scoped></style>
|