guhongwei 4 년 전
부모
커밋
f888054248
2개의 변경된 파일13개의 추가작업 그리고 27개의 파일을 삭제
  1. 2 0
      src/store/index.js
  2. 11 27
      src/views/market/index.vue

+ 2 - 0
src/store/index.js

@@ -10,6 +10,7 @@ import organization from '@common/src/store/organization';
 import expert from '@common/src/store/expert';
 // 产品
 import product from '@common/src/store/product';
+import productIndex from '@common/src/store/productIndex';
 // 展会
 import dock from '@common/src/store/dock';
 // 展会图文
@@ -61,6 +62,7 @@ export default new Vuex.Store({
     organization,
     expert,
     product,
+    productIndex,
     dock,
     dockUser,
     trainLive,

+ 11 - 27
src/views/market/index.vue

@@ -47,11 +47,7 @@ import expert from './index/expert.vue';
 import technology from './index/technology.vue';
 import roadshow from './index/roadshow.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions: product } = createNamespacedHelpers('product');
-const { mapActions: mapPatent } = createNamespacedHelpers('patent');
-const { mapActions: mapExpert } = createNamespacedHelpers('expert');
-const { mapActions: mapRoadShow } = createNamespacedHelpers('roadShow');
-
+const { mapActions: productIndex } = createNamespacedHelpers('productIndex');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -87,29 +83,17 @@ export default {
     await this.search();
   },
   methods: {
-    ...product({ productQuery: 'query' }),
-    ...mapPatent({ patentQuery: 'query' }),
-    ...mapExpert({ expertQuery: 'query' }),
-    ...mapRoadShow({ roadShowQuery: 'query' }),
+    ...productIndex(['query']),
     async search({ skip = 0, limit = 10, ...info } = {}) {
-      // 技术成果
-      let res = await this.productQuery({ skip, limit: 6, status: '2', type: '1', ...info });
-      if (this.$checkRes(res)) this.$set(this, `achieveList`, res.data);
-      // 科技需求
-      res = await this.productQuery({ skip, limit: 6, status: '2', type: '0', ...info });
-      if (this.$checkRes(res)) this.$set(this, `technologyList`, res.data);
-      // 商务服务
-      res = await this.productQuery({ skip, limit: 5, status: '2', type: '2', ...info });
-      if (this.$checkRes(res)) this.$set(this, `businessList`, res.data);
-      // e专利
-      res = await this.patentQuery({ skip, limit: 6, ...info });
-      if (this.$checkRes(res)) this.$set(this, `patentList`, res.data);
-      // 专家智库
-      res = await this.expertQuery({ skip, limit: 8, ...info });
-      if (this.$checkRes(res)) this.$set(this, `expertList`, res.data);
-      // 项目路演
-      res = await this.roadShowQuery({ skip, limit: 5, ...info });
-      if (this.$checkRes(res)) this.$set(this, `roadshowList`, res.data);
+      let res = await this.query({ ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `achieveList`, res.data.achieve);
+        this.$set(this, `technologyList`, res.data.require);
+        this.$set(this, `businessList`, res.data.serve);
+        this.$set(this, `patentList`, res.data.patent);
+        this.$set(this, `expertList`, res.data.expert);
+        this.$set(this, `roadshowList`, res.data.roadShow);
+      }
     },
   },
   computed: {