Browse Source

器件收藏跳转bug修改

yangc 7 years ago
parent
commit
482b3ee10c
3 changed files with 28 additions and 4 deletions
  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: {
     computed: {
       compCollectList () {
       compCollectList () {
-        return this.$store.state.product.common.collectList
+        return this.$store.state.product.common.collectListMobile
       },
       },
       fetching () {
       fetching () {
         return this.compCollectList.fetching
         return this.compCollectList.fetching
@@ -77,7 +77,7 @@
     fetch ({ store }) {
     fetch ({ store }) {
       return Promise.all([
       return Promise.all([
         // 获取器件收藏列表
         // 获取器件收藏列表
-        store.dispatch('product/saveStores', { count: 10, page: 1, type: 'component' })
+        store.dispatch('product/getCollectList', { count: 10, page: 1, type: 'component' })
       ])
       ])
     },
     },
     components: {
     components: {
@@ -104,7 +104,7 @@
           })
           })
       },
       },
       reloadList: function () {
       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 () {
       onPullUpAction: function () {
         this.page++
         this.page++
@@ -122,7 +122,7 @@
         this.showPublishBox = true
         this.showPublishBox = true
       },
       },
       goUrl: function (url) {
       goUrl: function (url) {
-        console.log(url)
+//        console.log(url)
         this.$router.push(url)
         this.$router.push(url)
       }
       }
     }
     }

+ 10 - 0
store/product.js

@@ -151,6 +151,16 @@ export const actions = {
         commit('common/GET_COLLECTLIST_FAILURE', err)
         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 = {}) {
   loadSupplierInformation ({ commit }, params = {}) {
     let uuid = params.uuid
     let uuid = params.uuid

+ 14 - 0
store/product/common.js

@@ -10,6 +10,10 @@ export const state = () => ({
   collectList: {
   collectList: {
     fetching: false,
     fetching: false,
     data: []
     data: []
+  },
+  collectListMobile: {
+    fetching: false,
+    data: []
   }
   }
 })
 })
 
 
@@ -43,5 +47,15 @@ export const mutations = {
   GET_COLLECTLIST_SUCCESS (state, result) {
   GET_COLLECTLIST_SUCCESS (state, result) {
     state.collectList.fetching = false
     state.collectList.fetching = false
     state.collectList.data = result
     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
   }
   }
 }
 }