瀏覽代碼

器件收藏跳转bug修改

yangc 7 年之前
父節點
當前提交
482b3ee10c
共有 3 個文件被更改,包括 28 次插入4 次删除
  1. 4 4
      pages/mobile/center/user/collect/component.vue
  2. 10 0
      store/product.js
  3. 14 0
      store/product/common.js

+ 4 - 4
pages/mobile/center/user/collect/component.vue

@@ -65,7 +65,7 @@
     },
     computed: {
       compCollectList () {
-        return this.$store.state.product.common.collectList
+        return this.$store.state.product.common.collectListMobile
       },
       fetching () {
         return this.compCollectList.fetching
@@ -77,7 +77,7 @@
     fetch ({ store }) {
       return Promise.all([
         // 获取器件收藏列表
-        store.dispatch('product/saveStores', { count: 10, page: 1, type: 'component' })
+        store.dispatch('product/getCollectList', { count: 10, page: 1, type: 'component' })
       ])
     },
     components: {
@@ -104,7 +104,7 @@
           })
       },
       reloadList: function () {
-        this.$store.dispatch('product/saveStores', { page: this.page, count: this.count, type: 'component' })
+        this.$store.dispatch('product/getCollectList', { page: this.page, count: this.count, type: 'component' })
       },
       onPullUpAction: function () {
         this.page++
@@ -122,7 +122,7 @@
         this.showPublishBox = true
       },
       goUrl: function (url) {
-        console.log(url)
+//        console.log(url)
         this.$router.push(url)
       }
     }

+ 10 - 0
store/product.js

@@ -151,6 +151,16 @@ export const actions = {
         commit('common/GET_COLLECTLIST_FAILURE', err)
       })
   },
+  // 保存一列收藏记录, 此方法仅限于在登陆界面使用
+  getCollectList ({ commit }, params = {}) {
+    commit('common/REQUEST_COLLECT_LIST')
+    return axios.get(`/trade/collection/list`, { params })
+      .then(response => {
+        commit('common/GET_COLLECT_LIST_SUCCESS', response.data)
+      }, err => {
+        commit('common/GET_COLLECT_LIST_FAILURE', err)
+      })
+  },
   // 供应商维护
   loadSupplierInformation ({ commit }, params = {}) {
     let uuid = params.uuid

+ 14 - 0
store/product/common.js

@@ -10,6 +10,10 @@ export const state = () => ({
   collectList: {
     fetching: false,
     data: []
+  },
+  collectListMobile: {
+    fetching: false,
+    data: []
   }
 })
 
@@ -43,5 +47,15 @@ export const mutations = {
   GET_COLLECTLIST_SUCCESS (state, result) {
     state.collectList.fetching = false
     state.collectList.data = result
+  },
+  REQUEST_COLLECT_LIST (state) {
+    state.collectListMobile.fetching = true
+  },
+  GET_COLLECT_LIST_FAILURE (state) {
+    state.collectListMobile.fetching = false
+  },
+  GET_COLLECT_LIST_SUCCESS (state, result) {
+    state.collectListMobile.fetching = false
+    state.collectListMobile.data = result
   }
 }