guhongwei 4 years ago
parent
commit
d114a4e651
2 changed files with 37 additions and 6 deletions
  1. 27 3
      src/views/market/index.vue
  2. 10 3
      src/views/market/parts/list.vue

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

@@ -25,7 +25,7 @@
           </el-col>
           </el-col>
           <el-col :span="24" class="common thr">
           <el-col :span="24" class="common thr">
             <el-col :span="12" class="left">
             <el-col :span="12" class="left">
-              <top topText="技需求"></top>
+              <top topText="技需求"></top>
               <list type="5" :list="fiveList"></list>
               <list type="5" :list="fiveList"></list>
             </el-col>
             </el-col>
             <el-col :span="12" class="left">
             <el-col :span="12" class="left">
@@ -42,7 +42,9 @@
 <script>
 <script>
 import top from './parts/top.vue';
 import top from './parts/top.vue';
 import list from './parts/list.vue';
 import list from './parts/list.vue';
+const { productType } = require('@common/dict/index');
 import { mapState, createNamespacedHelpers } from 'vuex';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: product } = createNamespacedHelpers('product');
 export default {
 export default {
   name: 'index',
   name: 'index',
   props: {},
   props: {},
@@ -125,10 +127,32 @@ export default {
           informationdesc: '不知道是神呢',
           informationdesc: '不知道是神呢',
         },
         },
       ],
       ],
+      productType: productType,
     };
     };
   },
   },
-  created() {},
-  methods: {},
+  async created() {
+    await this.search();
+  },
+  methods: {
+    ...product({ productQuery: 'query' }),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      for (const val of this.productType) {
+        if (val.value == '0') {
+          // 科技需求
+          let res = await this.productQuery({ skip, limit: 6, type: val.value, ...info });
+          if (this.$checkRes(res)) this.$set(this, `fiveList`, res.data);
+        } else if (val.value == '1') {
+          // 技术成果
+          let res = await this.productQuery({ skip, limit: 6, type: val.value, ...info });
+          if (this.$checkRes(res)) this.$set(this, `oneList`, res.data);
+        } else if (val.value == '2') {
+          // 商务服务
+          let res = await this.productQuery({ skip, limit: 5, type: val.value, ...info });
+          if (this.$checkRes(res)) this.$set(this, `sixList`, res.data);
+        }
+      }
+    },
+  },
   computed: {
   computed: {
     ...mapState(['user']),
     ...mapState(['user']),
   },
   },

+ 10 - 3
src/views/market/parts/list.vue

@@ -64,7 +64,7 @@
                 {{ item.name }}
                 {{ item.name }}
               </el-col>
               </el-col>
               <el-col :span="5" class="date">
               <el-col :span="5" class="date">
-                <span>{{ item.create_time || '暂无' }}</span>
+                <span>{{ getDate(item.create_time) || '暂无' }}</span>
               </el-col>
               </el-col>
             </el-col>
             </el-col>
             <el-col :span="24" class="down">
             <el-col :span="24" class="down">
@@ -80,7 +80,7 @@
             </el-col>
             </el-col>
             <el-col :span="10" class="messbute"> 信息属性:{{ item.messattribute }} </el-col>
             <el-col :span="10" class="messbute"> 信息属性:{{ item.messattribute }} </el-col>
             <el-col :span="4" class="date">
             <el-col :span="4" class="date">
-              {{ item.create_time }}
+              {{ getDate(item.create_time) }}
             </el-col>
             </el-col>
             <el-col :span="24" class="info">
             <el-col :span="24" class="info">
               {{ item.informationdesc }}
               {{ item.informationdesc }}
@@ -93,6 +93,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
+var moment = require('moment');
 import { mapState, createNamespacedHelpers } from 'vuex';
 import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
 export default {
   name: 'list',
   name: 'list',
@@ -108,7 +109,13 @@ export default {
     };
     };
   },
   },
   created() {},
   created() {},
-  methods: {},
+  methods: {
+    // 整理时间
+    getDate(date) {
+      let newsDate = moment(date).format('YYYY-MM-DD');
+      if (newsDate) return newsDate;
+    },
+  },
   computed: {
   computed: {
     ...mapState(['user']),
     ...mapState(['user']),
   },
   },