Browse Source

还原之前的请求方式

hangb 7 years ago
parent
commit
514fffdcf4
51 changed files with 547 additions and 979 deletions
  1. 4 20
      components/help/left.vue
  2. 5 14
      components/home/Carousel.vue
  3. 5 14
      components/home/KindCategory.vue
  4. 5 20
      components/home/News.vue
  5. 3 14
      components/home/floor/FloorList.vue
  6. 4 18
      components/news/Detail.vue
  7. 4 18
      components/news/Left.vue
  8. 7 21
      components/news/Right.vue
  9. 3 29
      components/product/BrandList.vue
  10. 4 14
      components/product/Recommends.vue
  11. 7 36
      components/product/original/OriginalDetail.vue
  12. 5 12
      components/provider/Carousel.vue
  13. 4 14
      components/provider/ExcellentSuppliers.vue
  14. 7 33
      components/provider/NewStore.vue
  15. 4 18
      components/provider/RecommendOriginal.vue
  16. 3 4
      components/provider/RecommendStore.vue
  17. 4 48
      components/provider/SalesRank.vue
  18. 8 38
      components/provider/Suppliers.vue
  19. 1 12
      components/store/BaseInfo.vue
  20. 9 20
      components/store/CommodityList.vue
  21. 0 16
      components/store/RecommendProduct.vue
  22. 0 5
      components/store/common/StoreHeader.vue
  23. 4 16
      components/store/common/StoreTitle.vue
  24. 1 3
      package.json
  25. 9 28
      pages/help/helpDetail/_id.vue
  26. 10 43
      pages/help/helpList/_id.vue
  27. 4 16
      pages/help/home.vue
  28. 4 8
      pages/index.vue
  29. 6 6
      pages/news/_id.vue
  30. 19 19
      pages/news/index.vue
  31. 1 1
      pages/product/brand/brandList.vue
  32. 2 2
      pages/product/brand/brandList/_initial.vue
  33. 7 8
      pages/provider/factories.vue
  34. 7 12
      pages/provider/home.vue
  35. 2 2
      pages/provider/list.vue
  36. 0 2
      pages/search/_keyword.vue
  37. 1 2
      pages/store/_uuid/_batchCode.vue
  38. 1 1
      pages/store/_uuid/description.vue
  39. 4 3
      pages/store/_uuid/index.vue
  40. 18 18
      store/floor.js
  41. 65 65
      store/index.js
  42. 33 33
      store/news.js
  43. 36 36
      store/newsData.js
  44. 20 20
      store/newsData/detailNews.js
  45. 19 19
      store/newsData/hotNews.js
  46. 19 19
      store/newsData/newsPage.js
  47. 28 28
      store/product/brand.js
  48. 29 29
      store/provider.js
  49. 70 70
      store/provider/storeCms.js
  50. 18 18
      store/provider/stores.js
  51. 14 14
      store/shop/storeInfo.js

+ 4 - 20
components/help/left.vue

@@ -36,29 +36,13 @@
         defaultProps: {
           children: 'children',
           label: 'item'
-        },
-        getFlag: true,
-        helps: {}
+        }
       }
     },
-    mounted () {
-      this.$http.get('/api/help-service/helps', {params: { parentId: 0 }})
-        .then(response => {
-          console.log(response.data)
-          this.helps = response.data.sort(compare('detno'))
-         // let help = this.helps
-
-          for (let i; i < this.helps.length; i++) {
-            this.helps[i] = this.helps[i].children.sort(compare('detno'))
-          }
-          console.log(this.helps)
-        })
-      this.getFlag = false
-    },
     computed: {
-//      helps () {
-//        return this.$store.state.help.snapsho.data.sort(compare('detno'))
-//      }
+      helps () {
+        return this.$store.state.help.snapsho.data.sort(compare('detno'))
+      }
     },
     methods: {
       openList (data) {

+ 5 - 14
components/home/Carousel.vue

@@ -40,24 +40,15 @@
             document.querySelector('.carousel').style.backgroundColor =
               this.banners.data[swiper.activeIndex].metadata['background-color']
           }
-        },
-        banners: {}
+        }
       }
     },
-    mounted () {
-      this.$http.get('/api/carousel/home%20page%20banner')
-        .then(response => {
-          this.banners = response
-        })
-    },
     computed: {
-//      banner () {
-//       // return this.$store.state.carousel.banners
-//      },
+      banners () {
+        return this.$store.state.carousel.banners
+      },
       activeColor () {
-        if (this.banners.data) {
-          return this.banners.data.length ? this.banners.data[this.activeSlide].metadata['background-color'] : null
-        }
+        return this.banners.data.length ? this.banners.data[this.activeSlide].metadata['background-color'] : null
       }
     }
   }

+ 5 - 14
components/home/KindCategory.vue

@@ -49,8 +49,7 @@
     name: 'kind-category',
     data () {
       return {
-        activeKindId: 0,
-        kinds: {}
+        activeKindId: 0
       }
     },
     methods: {
@@ -66,21 +65,13 @@
         this.activeKindId = null
       }
     },
-    mounted () {
-      this.$http.get(`/api/product/kind/0/children_all`)
-        .then(response => {
-          this.kinds = response
-        })
-    },
     computed: {
-//      kinds () {
-//        return this.$store.state.product.kind.kinds
-//      },
+      kinds () {
+        return this.$store.state.product.kind.kinds
+      },
       kindsToShow () {
         // 只显示前13个根类目
-        if (this.kinds.data) {
-          return this.kinds.data.slice(0, 13)
-        }
+        return this.kinds.data.slice(0, 13)
       }
     }
   }

+ 5 - 20
components/home/News.vue

@@ -27,30 +27,15 @@
 <script>
   export default {
     name: 'news',
-    data () {
-      return {
-        news: {}
-      }
-    },
-    mounted () {
-      this.$http.get('/api/news/created', {params: { page: 1, pageSize: 10 }})
-        .then(response => {
-          this.news = response
-        })
-    },
     computed: {
-//      news () {
-//        return this.$store.state.news.snapshot
-//      },
+      news () {
+        return this.$store.state.news.snapshot
+      },
       news3 () {
-        if (this.news.data) {
-          return this.news.data.content.slice(0, 3)
-        }
+        return this.news.data.slice(0, 3)
       },
       news5 () {
-        if (this.news.data) {
-          return this.news.data.content.slice(0, 5)
-        }
+        return this.news.data.slice(0, 5)
       }
     }
   }

+ 3 - 14
components/home/floor/FloorList.vue

@@ -15,22 +15,11 @@
       Floor,
       FloorBar
     },
-    data () {
-      return {
-        floors: {}
+    computed: {
+      floors () {
+        return this.$store.state.floor.list
       }
-    },
-    mounted () {
-      this.$http.get('/api/floors/home')
-        .then(response => {
-          this.floors = response
-        })
     }
-//    computed: {
-//      floors () {
-//        return this.$store.state.floor.list
-//      }
-//    }
   }
 </script>
 <style lang="scss" scoped>

+ 4 - 18
components/news/Detail.vue

@@ -12,28 +12,14 @@
     </div>
 </template>
 <script>
- // import axios from '~plugins/axios'
   export default {
     name: 'Detail',
-    data () {
-      return {
-        new: {}
-      }
-    },
-    mounted () {
-      this.$http.get(`/api/news/${this.$route.params.id}`)
-        .then(response => {
-          this.new = response
-        })
-    },
     computed: {
-//      new () {
-//        return this.$store.state.newsData.detailNews.detailNews
-//      },
+      new () {
+        return this.$store.state.newsData.detailNews.detailNews
+      },
       item () {
-        if (this.new.data) {
-          return this.new.data
-        }
+        return this.new.data
       }
     },
     filters: {

+ 4 - 18
components/news/Left.vue

@@ -27,26 +27,12 @@
 </template>
 <script>
   export default {
-    data () {
-      return {
-        new: {}
-      }
-    },
-    mounted () {
-      this.$http.get('/api/news/viewCount')
-        .then(response => {
-          this.new = response
-        })
-    },
     computed: {
-//      new () {
-//        return this.$store.state.newsData.hotNews.hotNews
-//      },
+      new () {
+        return this.$store.state.newsData.hotNews.hotNews
+      },
       news_show () {
-     //   console.log(this.new.data)
-        if (this.new.data) {
-          return this.new.data.content
-        }
+        return this.new.data
       }
     },
     filters: {

+ 7 - 21
components/news/Right.vue

@@ -31,29 +31,21 @@
     data () {
       return {
         pageSize: 10,
-        nowPage: 1,
-        new: {}
+        nowPage: 1
       }
     },
     components: {
       Page
     },
-    mounted () {
-      this.loadPageNews()
-    },
     computed: {
-//      new () {
-//        return this.$store.state.newsData.newsPage.allNews
-//      },
+      new () {
+        return this.$store.state.newsData.newsPage.allNews
+      },
       news_show () {
-        if (this.new.data) {
-          return this.new.data.content
-        }
+        return this.new.data.content
       },
       totalCount () {
-        if (this.new.data) {
-          return this.new.data.count
-        }
+        return this.new.data.count
       }
     },
     filters: {
@@ -71,13 +63,7 @@
     methods: {
       listenPage: function (changedPage) {
         this.nowPage = changedPage
-        this.loadPageNews()
-      },
-      loadPageNews: function () {
-        this.$http.get('/api/news/created', {params: { page: this.nowPage, pageSize: this.pageSize }})
-          .then(response => {
-            this.new = response
-          })
+        this.$emit('childEvent', this.nowPage)
       }
     }
   }

+ 3 - 29
components/product/BrandList.vue

@@ -28,36 +28,10 @@
 <script>
   export default {
     name: 'brandList',
-    props: ['key'],
-    data () {
-      return {
-        brandList: {},
-        keyword: this.$route.params.initial,
-        flag: true
-      }
-    },
-    mounted () {
-      let keyword = this.keyword
-      this.$http.get(`/api/product/brand/initial/${keyword}`)
-        .then(response => {
-          this.brandList = response.data
-        })
-      this.flag = false
-    },
-    updated () {
-      if (this.flag) {
-        let keyword = this.keyword
-        this.$http.get(`/api/product/brand/initial/${keyword}`)
-          .then(response => {
-            this.brandList = response.data
-          })
-        this.flag = false
-      }
-    },
     computed: {
-//      brandList () {
-//        return this.$store.state.product.brand.brandList.data
-//      }
+      brandList () {
+        return this.$store.state.product.brand.brandList.data
+      }
     }
   }
 </script>

+ 4 - 14
components/product/Recommends.vue

@@ -26,21 +26,11 @@
 <script>
   export default {
     name: 'recommends',
-    data () {
-      return {
-        hotBrands: {}
-      }
-    },
-    mounted () {
-      this.$http.get(`/api/product/brand/hot/5`)
-        .then(response => {
-          this.hotBrands = response.data
-        })
-    },
+
     computed: {
-//      hotBrands () {
-//        return this.$store.state.product.brand.recommends.data
-//      }
+      hotBrands () {
+        return this.$store.state.product.brand.recommends.data
+      }
     }
   }
 </script>

+ 7 - 36
components/product/original/OriginalDetail.vue

@@ -52,53 +52,24 @@
   </div>
 </template>
 <script>
-  import axios from '~plugins/axios'
   export default {
     name: 'OriginalDetail',
-    data () {
-      return {
-        lists: {}
-      }
-    },
-    mounted () {
-      axios.get('/api/commodity/latest', {params: { length: 17 }})
-        .then(response => {
-          this.lists = response
-        })
-    },
     computed: {
-//      lists () {
-//        return this.$store.state.original.hot
-//      },
+      lists () {
+        return this.$store.state.original.hot
+      },
       list1 () {
-        if (this.lists.data) {
-          return this.lists.data.slice(0, 3)
-        }
+        return this.lists.data.slice(0, 3)
       },
       list2 () {
-        if (this.lists.data) {
-          return this.lists.data.slice(3, 8)
-        }
+        return this.lists.data.slice(3, 8)
       },
       list3 () {
-        if (this.lists.data) {
-          return this.lists.data.slice(8, 11)
-        }
+        return this.lists.data.slice(8, 11)
       },
       list4 () {
-        if (this.lists.data) {
-          return this.lists.data.slice(11, 16)
-        }
+        return this.lists.data.slice(11, 16)
       }
-//      list2 () {
-//        return this.lists.data.slice(3, 8)
-//      },
-//      list3 () {
-//        return this.lists.data.slice(8, 11)
-//      },
-//      list4 () {
-//        return this.lists.data.slice(11, 16)
-//      }
     }
   }
 </script>

+ 5 - 12
components/provider/Carousel.vue

@@ -29,21 +29,14 @@
           paginationElement: 'li',
           prevButton: '.swiper-button-prev',
           nextButton: '.swiper-button-next'
-        },
-        banners: []
+        }
       }
     },
-    mounted () {
-      this.$http.get('/api/carousel/home%20page%20banner')
-      .then(response => {
-        this.banners = response.data
-      })
+    computed: {
+      banners () {
+        return this.$store.state.carousel.banners.data
+      }
     }
-//    computed: {
-//      banners () {
-//        return this.$store.state.carousel.banners.data
-//      }
-//    }
   }
 </script>
 <style lang="scss" scoped>

+ 4 - 14
components/provider/ExcellentSuppliers.vue

@@ -22,24 +22,14 @@
   </div>
 </template>
 <script>
+
 export default {
-  data () {
-    return {
-      stores: {}
-    }
-  },
   name: 'excellent-suppliers',
   props: ['isShowMore'],
-  mounted () {
-    this.$http.get('/api/cms-service/storeIn/5')
-      .then(response => {
-        this.stores = response.data
-      })
-  },
   computed: {
-//    stores () {
-//      return this.$store.state.provider.storeCms.recommendStore.data
-//    }
+    stores () {
+      return this.$store.state.provider.storeCms.recommendStore.data
+    }
   }
 }
 </script>

+ 7 - 33
components/provider/NewStore.vue

@@ -38,42 +38,16 @@
   </div>
 </template>
 <script>
+
 export default {
-  props: ['types'],
-  data () {
-    return {
-      stores: {},
-      storeCount: {},
-      params: {
-        filter: 'newStore'
-      }
-    }
-  },
   name: 'new-store',
-  mounted () {
-    console.log(this.types)
-    this.$http.get('/api/store-service/stores', {
-      params: {filter: this.params.filter, types: this.types}
-    }).then(response => {
-      this.stores = response.data.content || response.data
-      this.$http.get('/api/store-service/stores/type/count', {
-        params: {
-          types: this.types
-        }
-      }).then(response => {
-        if (response.data.data) {
-          this.storeCount = response.data.data
-        }
-      })
-    })
-  },
   computed: {
-//    stores () {
-//      return this.$store.state.provider.storeCms.newStores.data ? this.$store.state.provider.storeCms.newStores.data.content : []
-//    },
-//    storeCount () {
-//      return this.$store.state.provider.storeCms.storeCount.data
-//    }
+    stores () {
+      return this.$store.state.provider.storeCms.newStores.data ? this.$store.state.provider.storeCms.newStores.data.content : []
+    },
+    storeCount () {
+      return this.$store.state.provider.storeCms.storeCount.data
+    }
   }
 }
 </script>

+ 4 - 18
components/provider/RecommendOriginal.vue

@@ -23,27 +23,13 @@
   </div>
 </template>
 <script>
+
 export default {
   name: 'recommend-original',
-  data () {
-    return {
-      stores: {},
-      params: {
-        type: 'ORIGINAL_FACTORY'
-      }
-    }
-  },
-  mounted () {
-    this.$http.get('/api/store-cms/contents/store/5', {
-      params: this.params
-    }).then(response => {
-      this.stores = response.data
-    })
-  },
   computed: {
-//    stores () {
-//      return this.$store.state.provider.storeCms.recommendStore.data
-//    }
+    stores () {
+      return this.$store.state.provider.storeCms.recommendStore.data
+    }
   }
 }
 </script>

+ 3 - 4
components/provider/RecommendStore.vue

@@ -1,13 +1,13 @@
 <template>
   <div class="container marketing">
     <div class="sales-rank">
-      <sales-rank :isOriginal="isOriginal"/>
+      <sales-rank />
     </div>
     <div class="carousel">
       <carousel />
     </div>
     <div class="new-store">
-      <new-store :types="types"/>
+      <new-store />
     </div>
   </div>
 </template>
@@ -22,8 +22,7 @@ export default {
     SalesRank,
     NewStore,
     Carousel
-  },
-  props: ['isOriginal', 'types']
+  }
 }
 </script>
 <style lang="scss" scoped>

+ 4 - 48
components/provider/SalesRank.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="sale-module" v-if="x >0">
+  <div class="sale-module">
     <div class="title">
       <img src="/images/store/home/hot.png" />
       <span>销售排行榜</span>
@@ -22,54 +22,10 @@
 <script>
 export default {
   name: 'sales-rank',
-  data () {
-    return {
-      stores: {},
-      params: {
-        filter: 'topBySales'
-      },
-      x: 1
-    }
-  },
-  props: ['isOriginal'],
-  methods: {
-    countStoreOrderCount (store) {
-      return this.$http.get('/api/provider/order/storeid/' + store.uuid + '/count')
-        .then(response => {
-          store.orderCount = response.data.orderCount
-        })
-    }
-  },
-  mounted () {
-    let _self = this
-    this.$http.get('/api/store-service/stores', {
-      params: {filter: this.params.filter, isOriginal: this.isOriginal}
-    }).then(response => {
-      this.stores = response.data || []
-//      let orderCounts = []
-      for (let i = 0; i < this.stores.length; i++) {
-      //  orderCounts.push(_self.countStoreOrderCount(this.stores[i]))
-        this.$http.get('/api/provider/order/storeid/' + _self.stores[i].uuid + '/count')
-          .then(response => {
-            _self.stores[i].orderCount = response.data.orderCount
-            _self.x++
-          })
-      }
-//    // 合并请求,获取店铺的交易量数据
-//      return Promise.all(orderCounts)
-//        .then(result => {
-//          if (result) {
-//            for (let i = 0; i < result.length; i++) {
-//              this.stores[i].orderCount = result[i].data ? result[i].data.orderCount : 0
-//            }
-//          }
-//        })
-    })
-  },
   computed: {
-//    stores () {
-//      return this.$store.state.provider.storeCms.salesStores.data
-//    }
+    stores () {
+      return this.$store.state.provider.storeCms.salesStores.data
+    }
   }
 }
 </script>

+ 8 - 38
components/provider/Suppliers.vue

@@ -66,50 +66,20 @@ export default {
         page: 1,
         count: 10,
         keyword: '',
-        op: 'pageByType',
-        types: this.types,
-        sorting: {'createTime': 'DESC'}
-      },
-      stores: {},
-      params: {
-        op: 'pageByType',
-        page: 1,
-        count: 10,
         types: this.types
-      },
-      flag: true
-    }
-  },
-  mounted () {
-    this.$http.get('/api/store-service/stores', {params: this.params})
-      .then(response => {
-        this.stores = response.data
-      })
-    this.flag = false
-  },
-  updated () {
-    if (this.flag) {
-      this.$http.get('/api/store-service/stores', {params: this.params})
-        .then(response => {
-          this.stores = response.data
-        })
-      this.flag = false
+      }
     }
   },
   computed: {
-//    stores () {
-//      return this.$store.state.provider.stores.storeList.data
-//    }
+    stores () {
+      return this.$store.state.provider.stores.storeList.data
+    }
   },
   methods: {
     search () {
       this.pageParams.page = 1
       this.pageParams.keyword = this.keyword === '' ? null : this.keyword
-//      this.$store.dispatch('provider/findStoreList', this.pageParams)
-      this.$http.get('/api/store-service/stores', {params: this.pageParams})
-        .then(response => {
-          this.stores = response.data
-        })
+      this.$store.dispatch('provider/findStoreList', this.pageParams)
     },
     showLittleDescription (description) {
       if (!description || description === '') {
@@ -121,10 +91,10 @@ export default {
       pageParams.op = 'pageByType'
 
       try {
-        let { data } = await this.$http.get('/api/store-service/stores', { params: this.pageParams })
-        this.stores = data
+        let { data } = await this.$http.get('/api/store-service/stores', { params: pageParams })
+        this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', data)
       } catch (err) {
-//        this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
+        this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
       }
     },
     handleCurrentChange (page) {

+ 1 - 12
components/store/BaseInfo.vue

@@ -81,20 +81,9 @@ function isPdf (path) {
     return false
   }
 }
-// import axios from '~plugins/axios'
+
 export default {
   name: 'base-info',
-//  data () {
-//    return {
-//      storeInfo: {}
-//    }
-//  },
-//  mounted () {
-//    axios.get('/api/store-service/stores', {params: {StoreUuid: this.$route.params.uuid}})
-//      .then(response => {
-//        this.storeInfo = response.data
-//      })
-//  },
   computed: {
     storeInfo () {
       return this.$store.state.shop.storeInfo.store.data

+ 9 - 20
components/store/CommodityList.vue

@@ -154,27 +154,13 @@ export default {
       },
       searchCode: '',
       parentKindId: 0,
-      ids: null,
-      commodities: {},
-      params: {
-        storeid: this.$route.params.uuid,
-        origin: 'store',
-        code: '',
-        page: 1,
-        count: 6
-      }
+      ids: null
     }
   },
-  mounted () {
-    this.$http.get('/api/commodity/commodities', { params: this.params })
-      .then(response => {
-        this.commodities = response.data
-      })
-  },
   computed: {
-//    commodities () {
-//      return this.$store.state.shop.storeInfo.storeCommodity.data
-//    }
+    commodities () {
+      return this.$store.state.shop.storeInfo.storeCommodity.data
+    }
   },
   methods: {
     handlerCurrentNode (data, node) {
@@ -203,15 +189,18 @@ export default {
 
       try {
         let { data } = await this.$http.get('/api/commodity/commodities', { params })
-        this.commodities = data
+        this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_SUCCESS', data)
       } catch (err) {
-//        this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_FAILURE', err)
+        this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_FAILURE', err)
       }
     },
     handleCurrentChange (page) {
       this.pageParams.page = page
       this.pageCommodity(this.pageParams, this.ids, this.searchCode)
     }
+//    goBack () {
+//      this.$router.back(-1)
+//    }
   }
 }
 </script>

+ 0 - 16
components/store/RecommendProduct.vue

@@ -34,22 +34,6 @@
     components: {
       Buy
     },
-//    data () {
-//      return {
-//        commodities: {},
-//        storeInfo: {}
-//      }
-//    },
-//    mounted () {
-//      axios.get('/api/store/recommend/products', {params: {StoreUuid: this.$route.params.uuid}})
-//        .then(response => {
-//          this.commodities = response.data ? JSON.parse(response.data) : []
-//        })
-//      axios.get('/api/store-service/stores', {params: {StoreUuid: this.$route.params.uuid}})
-//        .then(response => {
-//          this.storeInfo = response.data
-//        })
-//    },
     computed: {
       commodities () {
         return this.$store.state.shop.recommend.products.data

+ 0 - 5
components/store/common/StoreHeader.vue

@@ -73,7 +73,6 @@ export default {
     return {
       isOpen: false,
       dialogVisible: false
-   //   storeInfo: {}
     }
   },
   components: {
@@ -95,10 +94,6 @@ export default {
     this.$nextTick(() => {
       this.loadFocusList()
     })
-//    axios.get('/api/store-service/stores', this.$route.params)
-//      .then(response => {
-//        this.storeInfo = response.data
-//      })
   },
   methods: {
     loadFocusList () {

+ 4 - 16
components/store/common/StoreTitle.vue

@@ -16,25 +16,13 @@
   </div>
 </template>
 <script>
-import axios from '~plugins/axios'
+
 export default {
   name: 'store-title',
-  data () {
-    return {
-      storeInfo: {},
-      params: this.$route.params
-    }
-  },
-  mounted () {
-    axios.get('/api/store-service/stores', { params: this.params })
-      .then(response => {
-        this.storeInfo = response.data
-      })
-  },
   computed: {
-//    storeInfo () {
-//      return this.$store.state.shop.storeInfo.store.data
-//    }
+    storeInfo () {
+      return this.$store.state.shop.storeInfo.store.data
+    }
   }
 }
 </script>

+ 1 - 3
package.json

@@ -44,9 +44,7 @@
     "eslint-plugin-html": "^2.0.0",
     "eslint-plugin-promise": "^3.4.1",
     "eslint-plugin-standard": "^2.0.1",
-    "extract-text-webpack-plugin": "^3.0.0",
     "node-sass": "^4.5.3",
-    "sass-loader": "^6.0.6",
-    "webpack": "^3.2.0"
+    "sass-loader": "^6.0.6"
   }
 }

+ 9 - 28
pages/help/helpDetail/_id.vue

@@ -17,7 +17,7 @@
                 <span>{{helpTitle.item}}</span><i class="fa fa-close"></i></nuxt-link>
                 <i class="dot fa fa-angle-right"></i>
               </span>
-              <nuxt-link :to="`/help/helpList/${helpTitle.id}`" class="box" style="font-size: 14px"><span v-text="helpDetail.title"></span><i class="fa fa-close"></i></nuxt-link>
+              <nuxt-link :to="`/help/helpList/{$helpDetail.navId}`" class="box" style="font-size: 14px"><span v-text="helpDetail.title"></span><i class="fa fa-close"></i></nuxt-link>
             </div>
             <!--文章详情-->
             <div class="help-center-details" style="color: #000">
@@ -35,43 +35,24 @@
   import { left, helpHeader } from '~components/help'
   export default {
     name: 'help',
-    data () {
-      return {
-        helpDetail: {},
-        helpTitle: {}
-      }
-    },
     components: {
       left,
       helpHeader
     },
-    mounted () {
-      let id = this.$route.params.id
-      this.$http.get(`/api/help-service/issues/${id}`)
-        .then(response => {
-          this.helpDetail = response.data
-          let ids = response.data.navId
-          this.$http.get(`/api/help-service/${ids}`)
-            .then(response => {
-              this.helpTitle = response.data
-              console.log(this.helpTitle)
-            })
-        })
-    },
     fetch ({ store, route }) {
       return Promise.all([
-//        store.dispatch('loadHelpSnapsho', { parentId: 0 }),
-//        store.dispatch('loadHelpDetail', route.params)
+        store.dispatch('loadHelpSnapsho', { parentId: 0 }),
+        store.dispatch('loadHelpDetail', route.params)
         // store.dispatch('loadHelpTitle', route)
       ])
     },
     computed: {
-//      helpTitle () {
-//        return this.$store.state.help.title.data
-//      }
-//      helpDetail () {
-//        return this.$store.state.help.detail.data
-//      }
+      helpTitle () {
+        return this.$store.state.help.title.data
+      },
+      helpDetail () {
+        return this.$store.state.help.detail.data
+      }
     }
   }
 </script>

+ 10 - 43
pages/help/helpList/_id.vue

@@ -35,7 +35,6 @@
 </div>
 </template>
 <script>
-  import { left, helpHeader } from '~components/help'
   // 升序
   function compare (propertyName) {
     return function (object1, object2) {
@@ -50,59 +49,27 @@
       }
     }
   }
+  import { left, helpHeader } from '~components/help'
   export default {
     name: 'help',
-    data () {
-      return {
-        helpList: {},
-        getFlag: true,
-        helpTitle: {}
-      }
-    },
     components: {
       left,
       helpHeader
     },
-    mounted () {
-      this.$http.get('/api/help-service/issues', {params: { navId: this.$route.params.id }})
-        .then(response => {
-          this.helpList = response.data.sort(compare('detno'))
-        })
-      this.getFlag = false
-      let id = this.$route.params.id
-      this.$http.get(`/api/help-service/${id}`)
-        .then(response => {
-          this.helpTitle = response.data
-        })
-    },
-    updated () {
-      if (this.getFlag) {
-        this.$http.get('/api/help-service/issues', {params: { navId: this.$route.params.id }})
-          .then(response => {
-            this.helpList = response.data.sort(compare('detno'))
-          })
-        this.getFlag = false
-        let id = this.$route.params.id
-        this.$http.get(`/api/help-service/${id}`)
-          .then(response => {
-            this.helpTitle = response.data
-          })
-      }
-    },
     fetch ({ store, route }) {
       return Promise.all([
-//        store.dispatch('loadHelpSnapsho', { parentId: 0 }),
-//        store.dispatch('loadHelpList', { navId: route.params.id }),
-//        store.dispatch('loadHelpTitle', route.params)
+        store.dispatch('loadHelpSnapsho', { parentId: 0 }),
+        store.dispatch('loadHelpList', { navId: route.params.id }),
+        store.dispatch('loadHelpTitle', route.params)
       ])
     },
     computed: {
-//      helpTitle () {
-//        return this.$store.state.help.title.data
-//      }
-//      helpList () {
-//        return this.$store.state.help.helplist.data.sort(compare('detno'))
-//      }
+      helpTitle () {
+        return this.$store.state.help.title.data
+      },
+      helpList () {
+        return this.$store.state.help.helplist.data.sort(compare('detno'))
+      }
     }
   }
 </script>

+ 4 - 16
pages/help/home.vue

@@ -34,31 +34,19 @@
   import { left, helpHeader } from '~components/help'
   export default {
     name: 'help',
-    data () {
-      return {
-        helpNav: {},
-        getFlag: false
-      }
-    },
     components: {
       left,
       helpHeader
     },
-    mounted () {
-      this.$http.get('/api/help-service/helps', {params: { parentId: 0 }})
-        .then(response => {
-          this.helpNav = response.data
-        })
-    },
     fetch ({ store }) {
       return Promise.all([
-//        store.dispatch('loadHelpSnapsho', { parentId: 0 })
+        store.dispatch('loadHelpSnapsho', { parentId: 0 })
       ])
     },
     computed: {
-//      helpNav () {
-//        return this.$store.state.help.snapsho.data.sort(compare('detno'))
-//      }
+      helpNav () {
+        return this.$store.state.help.snapsho.data
+      }
     }
   }
 </script>

+ 4 - 8
pages/index.vue

@@ -17,10 +17,10 @@
     layout: 'main',
     fetch ({ store }) {
       return Promise.all([
-     //   store.dispatch('loadFloors')
-    //    store.dispatch('loadBanners'),
-    //    store.dispatch('loadProductKinds', { id: 0 }),
-    //    store.dispatch('loadNewsSnapshot', { page: 1, pageSize: 10 })
+        store.dispatch('loadFloors'),
+        store.dispatch('loadBanners'),
+        store.dispatch('loadProductKinds', { id: 0 }),
+        store.dispatch('loadNewsSnapshot', { page: 1, pageSize: 10 })
       ])
     },
     components: {
@@ -38,7 +38,3 @@
     }
   }
 </script>
-
-<style scoped>
-  @import "~swiper/dist/css/swiper.css";
-</style>

+ 6 - 6
pages/news/_id.vue

@@ -11,12 +11,12 @@
   import NuxtLink from '../../.nuxt/components/nuxt-link'
   export default {
     layout: 'main',
-//    fetch ({store, route}) {
-//      return Promise.all([
-//        store.dispatch('newsData/loadHotNews'),
-//        store.dispatch('newsData/loadDetailNews', {id: route.params.id})
-//      ])
-//    },
+    fetch ({store, route}) {
+      return Promise.all([
+        store.dispatch('newsData/loadHotNews'),
+        store.dispatch('newsData/loadDetailNews', {id: route.params.id})
+      ])
+    },
     components: {
       NuxtLink,
       Left,

+ 19 - 19
pages/news/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="container news-container">
     <left></left>
-    <right></right>
+    <right v-on:childEvent="listenChild"></right>
   </div>
 </template>
 
@@ -9,28 +9,28 @@
   import { Left, Right } from '~components/news'
   export default {
     layout: 'main',
-//    data () {
-//      return {
-//        pageSize: 10,
-//        nowPage: 1
-//      }
-//    },
-//    fetch ({ store }) {
-//      return Promise.all([
-//        store.dispatch('newsData/loadAllNews', { page: this.nowPage, pageSize: this.pageSize }),
-//        store.dispatch('newsData/loadHotNews')
-//      ])
-//    },
+    data () {
+      return {
+        pageSize: 10,
+        nowPage: 1
+      }
+    },
+    fetch ({ store }) {
+      return Promise.all([
+        store.dispatch('newsData/loadAllNews', { page: this.nowPage, pageSize: this.pageSize }),
+        store.dispatch('newsData/loadHotNews')
+      ])
+    },
     components: {
       Left,
       Right
+    },
+    methods: {
+      listenChild: function (nPage) {
+        this.nowPage = nPage
+        this.$store.dispatch('newsData/loadAllNews', { page: this.nowPage, pageSize: this.pageSize })
+      }
     }
-//    methods: {
-//      listenChild: function (nPage) {
-//        this.nowPage = nPage
-//        this.$store.dispatch('newsData/loadAllNews', { page: this.nowPage, pageSize: this.pageSize })
-//      }
-//    }
 
   }
 </script>

+ 1 - 1
pages/product/brand/brandList.vue

@@ -48,7 +48,7 @@
     layout: 'main',
     fetch ({store}) {
       return Promise.all([
-//        store.dispatch('product/loadRecommends')
+        store.dispatch('product/loadRecommends')
       ])
     },
     components: {

+ 2 - 2
pages/product/brand/brandList/_initial.vue

@@ -1,5 +1,5 @@
 <template>
-  <brand-list :key="this.$route.params.initial"></brand-list>
+  <brand-list></brand-list>
 </template>
 
 <script>
@@ -9,7 +9,7 @@
     name: 'brandListDetail',
     fetch ({store, route}) {
       return Promise.all([
-//        store.dispatch('product/loadBrands', {'keyword': route.params.initial})
+        store.dispatch('product/loadBrands', {'keyword': route.params.initial})
       ])
     },
     components: {

+ 7 - 8
pages/provider/factories.vue

@@ -2,7 +2,7 @@
   <!-- 组件模板只能包含一个根元素,除非使用v-if 和 v-if-else -->
   <div>
     <!-- 轮播及店铺推荐 -->
-    <recommend-store :isOriginal="true" :types="types"/>
+    <recommend-store/>
 
     <recommend-original/>
 
@@ -16,11 +16,11 @@ export default {
   layout: 'main',
   fetch ({ store }) {
     return Promise.all([
-//      store.dispatch('loadBanners'),
-//      store.dispatch('provider/loadSalesStore', { isOriginal: true }),
-//      store.dispatch('provider/loadNewStores', { types: 'ORIGINAL_FACTORY' }),
-//      store.dispatch('provider/loadRecommendOriginal'),
-//      store.dispatch('provider/findStoreList', { page: 1, count: 10, types: 'ORIGINAL_FACTORY' })
+      store.dispatch('loadBanners'),
+      store.dispatch('provider/loadSalesStore', { isOriginal: true }),
+      store.dispatch('provider/loadNewStores', { types: 'ORIGINAL_FACTORY' }),
+      store.dispatch('provider/loadRecommendOriginal'),
+      store.dispatch('provider/findStoreList', { page: 1, count: 10, types: 'ORIGINAL_FACTORY' })
     ])
   },
   components: {
@@ -30,8 +30,7 @@ export default {
   },
   data () {
     return {
-      msg: 'hello vue',
-      types: 'ORIGINAL_FACTORY'
+      msg: 'hello vue'
     }
   }
 }

+ 7 - 12
pages/provider/home.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <!-- 轮播及店铺推荐 -->
-    <recommend-store :isOriginal="false" :types="types"/>
+    <recommend-store/>
 
     <excellent-suppliers :isShowMore="true"/>
 
@@ -13,18 +13,13 @@ import { RecommendStore, ExcellentSuppliers, HotCommodity } from '~components/pr
 
 export default{
   layout: 'main',
-  data () {
-    return {
-      types: 'AGENCY-DISTRIBUTION'
-    }
-  },
   fetch ({ store }) {
     return Promise.all([
-//      store.dispatch('loadBanners'),
-//      store.dispatch('provider/loadSalesStore', { isOriginal: false })
-//      store.dispatch('provider/loadNewStores', { types: 'AGENCY-DISTRIBUTION' }),
-//      store.dispatch('provider/loadRecommendStores')
-//      store.dispatch('provider/loadHotComponents')
+      store.dispatch('loadBanners'),
+      store.dispatch('provider/loadSalesStore', { isOriginal: false }),
+      store.dispatch('provider/loadNewStores', { types: 'AGENCY-DISTRIBUTION' }),
+      store.dispatch('provider/loadRecommendStores'),
+      store.dispatch('provider/loadHotComponents')
     ])
   },
   components: {
@@ -34,7 +29,7 @@ export default{
   }
 }
 </script>
-<style scoped>
+<style>
   .container{
     padding:0;
   }

+ 2 - 2
pages/provider/list.vue

@@ -12,8 +12,8 @@ export default {
   layout: 'main',
   fetch ({ store }) {
     return Promise.all([
-//      store.dispatch('provider/loadRecommendStores'),
-//      store.dispatch('provider/findStoreList', { page: 1, count: 10, types: 'AGENCY-DISTRIBUTION' })
+      store.dispatch('provider/loadRecommendStores'),
+      store.dispatch('provider/findStoreList', { page: 1, count: 10, types: 'AGENCY-DISTRIBUTION' })
     ])
   },
   components: {

+ 0 - 2
pages/search/_keyword.vue

@@ -178,5 +178,3 @@
   }
 </script>
 
-<style scoped>
-</style>

+ 1 - 2
pages/store/_uuid/_batchCode.vue

@@ -11,7 +11,7 @@ export default {
   layout: 'shop',
   fetch ({ store, route }) {
     return Promise.all([
-//      store.dispatch('shop/findStoreInfoFromUuid', route.params),
+      store.dispatch('shop/findStoreInfoFromUuid', route.params),
       store.dispatch('shop/findCommodityOnBatchInfo', route.params)
     ])
   },
@@ -26,6 +26,5 @@ export default {
 		width: 1190px;
 		padding-left: 0px;
 		padding-right: 0px;
-		font-family: "Microsoft Yahei", "微软雅黑";
 	}
 </style>

+ 1 - 1
pages/store/_uuid/description.vue

@@ -10,7 +10,7 @@ export default {
   layout: 'shop',
   fetch ({ store, route }) {
     return Promise.all([
-//      store.dispatch('shop/findStoreInfoFromUuid', route.params)
+      store.dispatch('shop/findStoreInfoFromUuid', route.params)
     ])
   },
   components: {

+ 4 - 3
pages/store/_uuid/index.vue

@@ -5,6 +5,7 @@
   </div>
 </template>
 <script>
+import axios from '~plugins/axios'
 import { CommodityList, RecommendProduct } from '~components/store'
 
 export default {
@@ -16,13 +17,13 @@ export default {
   },
   fetch ({ store, params }) {
     return Promise.all([
-//      store.dispatch('shop/findStoreInfoFromUuid', params),
+      store.dispatch('shop/findStoreInfoFromUuid', params),
       store.dispatch('shop/findRecommendProducts', params),
       store.dispatch('shop/pageCommoditiesOfStore', params.uuid, { page: 1, count: 6 })
     ])
   },
   async asyncData ({ params }) {
-    let { data } = await this.$http.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
+    let { data } = await axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
     return { kinds: data }
   },
   components: {
@@ -31,7 +32,7 @@ export default {
   }
 }
 </script>
-<style scoped>
+<style>
   #nav_fragment .el-dialog__wrapper .el-dialog--tiny{
     width: 320px !important;
   }

+ 18 - 18
store/floor.js

@@ -1,18 +1,18 @@
-// export const state = () => ({
-//   list: {
-//     fetching: false,
-//     data: []
-//   }
-// })
-// export const mutations = {
-//   REQUEST_LIST (state) {
-//     state.list.fetching = true
-//   },
-//   GET_LIST_FAILURE (state) {
-//     state.list.fetching = false
-//   },
-//   GET_LIST_SUCCESS (state, result) {
-//     state.list.fetching = false
-//     state.list.data = result
-//   }
-// }
+export const state = () => ({
+  list: {
+    fetching: false,
+    data: []
+  }
+})
+export const mutations = {
+  REQUEST_LIST (state) {
+    state.list.fetching = true
+  },
+  GET_LIST_FAILURE (state) {
+    state.list.fetching = false
+  },
+  GET_LIST_SUCCESS (state, result) {
+    state.list.fetching = false
+    state.list.data = result
+  }
+}

+ 65 - 65
store/index.js

@@ -72,15 +72,15 @@ export const actions = {
       })
   },
   // 获取轮播配置
-  // loadBanners ({ commit }) {
-  //   commit('carousel/REQUEST_BANNER')
-  //   return axios.get('/api/carousel/home%20page%20banner')
-  //     .then(response => {
-  //       commit('carousel/GET_BANNER_SUCCESS', response.data)
-  //     }, err => {
-  //       commit('carousel/GET_BANNER_FAILURE', err)
-  //     })
-  // },
+  loadBanners ({ commit }) {
+    commit('carousel/REQUEST_BANNER')
+    return axios.get('/api/carousel/home%20page%20banner')
+      .then(response => {
+        commit('carousel/GET_BANNER_SUCCESS', response.data)
+      }, err => {
+        commit('carousel/GET_BANNER_FAILURE', err)
+      })
+  },
   // 获取子器件类目
   loadProductKinds ({ commit }, params = {}) {
     let id = params.id
@@ -137,15 +137,15 @@ export const actions = {
     commit('search/RESET_KEYWORDS')
   },
   // 热卖推荐页面
-  // loadProductHot ({commit}, params = {}) {
-  //   commit('original/REQUEST_HOT')
-  //   return axios.get('/api/commodity/latest', {params})
-  //     .then(response => {
-  //       commit('original/GET_HOT_SUCCESS', response.data)
-  //     }, err => {
-  //       commit('original/GET_HOT_FAILURE', err)
-  //     })
-  // },
+  loadProductHot ({commit}, params = {}) {
+    commit('original/REQUEST_HOT')
+    return axios.get('/api/commodity/latest', {params})
+      .then(response => {
+        commit('original/GET_HOT_SUCCESS', response.data)
+      }, err => {
+        commit('original/GET_HOT_FAILURE', err)
+      })
+  },
   // 器件详情页面
   // 获得器件详情信息
   loadComponentDetail ({commit}, params = {}) {
@@ -296,55 +296,55 @@ export const actions = {
       }, err => {
         commit('messageBoardInformation/GET_INFORMATION_FAILURE', err)
       })
-  }
+  },
   // 获取帮助中心信息
-  // loadHelpSnapsho ({ commit }, params = {}) {
-  //   commit('help/REQUEST_SNAPSHO')
-  //   return axios.get('/api/help-service/helps', {params})
-  //     .then(response => {
-  //       commit('help/GET_SNAPSHO_SUCCESS', response.data)
-  //     }, err => {
-  //       commit('help/GET_SNAPSHO_FAILURE', err)
-  //     })
-  // },
+  loadHelpSnapsho ({ commit }, params = {}) {
+    commit('help/REQUEST_SNAPSHO')
+    return axios.get('/api/help-service/helps', {params})
+      .then(response => {
+        commit('help/GET_SNAPSHO_SUCCESS', response.data)
+      }, err => {
+        commit('help/GET_SNAPSHO_FAILURE', err)
+      })
+  },
   // 获取帮助中心二级菜单
-  // loadHelpList ({ commit }, params = {}) {
-  //   commit('help/REQUEST_HELPLIST')
-  //   return axios.get('/api/help-service/issues', {params})
-  //     .then(response => {
-  //       commit('help/GET_HELPLIST_SUCCESS', response.data)
-  //     }, err => {
-  //       commit('help/GET_HELPLIST_FAILURE', err)
-  //     })
-  // },
+  loadHelpList ({ commit }, params = {}) {
+    commit('help/REQUEST_HELPLIST')
+    return axios.get('/api/help-service/issues', {params})
+      .then(response => {
+        commit('help/GET_HELPLIST_SUCCESS', response.data)
+      }, err => {
+        commit('help/GET_HELPLIST_FAILURE', err)
+      })
+  },
   // 获取帮助中心名称
-  // loadHelpTitle ({ commit }, params = {}) {
-  //   let id = params.id
-  //   commit('help/REQUEST_TITLE')
-  //   return axios.get(`/api/help-service/${id}`, {params})
-  //     .then(response => {
-  //       commit('help/GET_TITLE_SUCCESS', response.data)
-  //     }, err => {
-  //       commit('help/GET_TITLE_FAILURE', err)
-  //     })
-  // },
+  loadHelpTitle ({ commit }, params = {}) {
+    let id = params.id
+    commit('help/REQUEST_TITLE')
+    return axios.get(`/api/help-service/${id}`, {params})
+      .then(response => {
+        commit('help/GET_TITLE_SUCCESS', response.data)
+      }, err => {
+        commit('help/GET_TITLE_FAILURE', err)
+      })
+  },
   // 获取详情
-  // loadHelpDetail ({ commit }, params = {}) {
-  //   let id = params.id
-  //   commit('help/REQUEST_DETAIL')
-  //   return axios.get(`/api/help-service/issues/${id}`, {params})
-  //     .then(response => {
-  //       commit('help/GET_DETAIL_SUCCESS', response.data)
-  //       let id = response.data.navId
-  //       commit('help/REQUEST_TITLE')
-  //       return axios.get(`/api/help-service/${id}`)
-  //         .then(response => {
-  //           commit('help/GET_TITLE_SUCCESS', response.data)
-  //         }, err => {
-  //           commit('help/GET_TITLE_FAILURE', err)
-  //         })
-  //     }, err => {
-  //       commit('help/GET_DETAIL_FAILURE', err)
-  //     })
-  // }
+  loadHelpDetail ({ commit }, params = {}) {
+    let id = params.id
+    commit('help/REQUEST_DETAIL')
+    return axios.get(`/api/help-service/issues/${id}`, {params})
+      .then(response => {
+        commit('help/GET_DETAIL_SUCCESS', response.data)
+        let id = response.data.navId
+        commit('help/REQUEST_TITLE')
+        return axios.get(`/api/help-service/${id}`)
+          .then(response => {
+            commit('help/GET_TITLE_SUCCESS', response.data)
+          }, err => {
+            commit('help/GET_TITLE_FAILURE', err)
+          })
+      }, err => {
+        commit('help/GET_DETAIL_FAILURE', err)
+      })
+  }
 }

+ 33 - 33
store/news.js

@@ -1,33 +1,33 @@
-// export const state = () => ({
-//   snapshot: {
-//     fetching: false,
-//     data: []
-//   },
-//   detail: {
-//     fetching: false,
-//     data: []
-//   }
-// })
-//
-// export const mutations = {
-//   REQUEST_SNAPSHOT (state) {
-//     state.snapshot.fetching = true
-//   },
-//   GET_SNAPSHOT_FAILURE (state) {
-//     state.snapshot.fetching = false
-//   },
-//   GET_SNAPSHOT_SUCCESS (state, result) {
-//     state.snapshot.fetching = false
-//     state.snapshot.data = result.content
-//   },
-//   REQUEST_DETAIL (state) {
-//     state.detail.fetching = true
-//   },
-//   GET_DETAIL_FAILURE (state) {
-//     state.detail.fetching = false
-//   },
-//   GET_DETAIL_SUCCESS (state, result) {
-//     state.detail.fetching = false
-//     state.detail.data = result
-//   }
-// }
+export const state = () => ({
+  snapshot: {
+    fetching: false,
+    data: []
+  },
+  detail: {
+    fetching: false,
+    data: []
+  }
+})
+
+export const mutations = {
+  REQUEST_SNAPSHOT (state) {
+    state.snapshot.fetching = true
+  },
+  GET_SNAPSHOT_FAILURE (state) {
+    state.snapshot.fetching = false
+  },
+  GET_SNAPSHOT_SUCCESS (state, result) {
+    state.snapshot.fetching = false
+    state.snapshot.data = result.content
+  },
+  REQUEST_DETAIL (state) {
+    state.detail.fetching = true
+  },
+  GET_DETAIL_FAILURE (state) {
+    state.detail.fetching = false
+  },
+  GET_DETAIL_SUCCESS (state, result) {
+    state.detail.fetching = false
+    state.detail.data = result
+  }
+}

+ 36 - 36
store/newsData.js

@@ -1,36 +1,36 @@
-// import axios from '~plugins/axios'
-//
-// export const actions = {
-// // 获取快讯页新闻
-//   loadAllNews ({ commit }, params = {}) {
-//     commit('newsPage/REQUEST_ALLNEWS')
-//     return axios.get('/api/news/created', {params})
-//       .then(response => {
-//         commit('newsPage/GET_ALLNEWS_SUCCESS', response.data)
-//       }, err => {
-//         commit('newsPage/GET_ALLNEWS_FAILURE', err)
-//       })
-//   },
-//   // 获取详细新闻
-//   loadDetailNews ({ commit }, params = {}) {
-//     let id = params.id
-//     commit('detailNews/REQUEST_DETAILNEWS', params)
-//     return axios.get(`/api/news/${id}`)
-//       .then(response => {
-//         commit('detailNews/GET_DETAILNEWS_SUCCESS', response.data)
-//       }, err => {
-//         commit('detailNews/GET_DETAILNEWS_FAILURE', err)
-//       })
-//   },
-//   // 获取热点新闻
-//   loadHotNews ({ commit }, params = {}) {
-//     commit('hotNews/REQUEST_HOTNEWS')
-//     return axios.get('/api/news/viewCount', {params})
-//       .then(response => {
-//         commit('hotNews/GET_HOTNEWS_SUCCESS', response.data)
-//       }, err => {
-//         commit('hotNews/GET_HOTNEWS_FAILURE', err)
-//       })
-//   }
-// }
-//
+import axios from '~plugins/axios'
+
+export const actions = {
+// 获取快讯页新闻
+  loadAllNews ({ commit }, params = {}) {
+    commit('newsPage/REQUEST_ALLNEWS')
+    return axios.get('/api/news/created', {params})
+      .then(response => {
+        commit('newsPage/GET_ALLNEWS_SUCCESS', response.data)
+      }, err => {
+        commit('newsPage/GET_ALLNEWS_FAILURE', err)
+      })
+  },
+  // 获取详细新闻
+  loadDetailNews ({ commit }, params = {}) {
+    let id = params.id
+    commit('detailNews/REQUEST_DETAILNEWS', params)
+    return axios.get(`/api/news/${id}`)
+      .then(response => {
+        commit('detailNews/GET_DETAILNEWS_SUCCESS', response.data)
+      }, err => {
+        commit('detailNews/GET_DETAILNEWS_FAILURE', err)
+      })
+  },
+  // 获取热点新闻
+  loadHotNews ({ commit }, params = {}) {
+    commit('hotNews/REQUEST_HOTNEWS')
+    return axios.get('/api/news/viewCount', {params})
+      .then(response => {
+        commit('hotNews/GET_HOTNEWS_SUCCESS', response.data)
+      }, err => {
+        commit('hotNews/GET_HOTNEWS_FAILURE', err)
+      })
+  }
+}
+

+ 20 - 20
store/newsData/detailNews.js

@@ -1,20 +1,20 @@
-// export const state = () => ({
-//   detailNews: {
-//     fetching: false,
-//     data: []
-//   }
-// })
-//
-// export const mutations = {
-//   REQUEST_DETAILNEWS (state) {
-//     state.detailNews.fetching = true
-//   },
-//   GET_DETAILNEWS_FAILURE (state) {
-//     state.detailNews.fetching = false
-//   },
-//   GET_DETAILNEWS_SUCCESS (state, result) {
-//     state.detailNews.fetching = false
-//     state.detailNews.data = result
-//   }
-// }
-//
+export const state = () => ({
+  detailNews: {
+    fetching: false,
+    data: []
+  }
+})
+
+export const mutations = {
+  REQUEST_DETAILNEWS (state) {
+    state.detailNews.fetching = true
+  },
+  GET_DETAILNEWS_FAILURE (state) {
+    state.detailNews.fetching = false
+  },
+  GET_DETAILNEWS_SUCCESS (state, result) {
+    state.detailNews.fetching = false
+    state.detailNews.data = result
+  }
+}
+

+ 19 - 19
store/newsData/hotNews.js

@@ -1,19 +1,19 @@
-// export const state = () => ({
-//   hotNews: {
-//     fetching: false,
-//     data: []
-//   }
-// })
-//
-// export const mutations = {
-//   REQUEST_HOTNEWS (state) {
-//     state.hotNews.fetching = true
-//   },
-//   GET_HOTNEWS_FAILURE (state) {
-//     state.hotNews.fetching = false
-//   },
-//   GET_HOTNEWS_SUCCESS (state, result) {
-//     state.hotNews.fetching = false
-//     state.hotNews.data = result.content
-//   }
-// }
+export const state = () => ({
+  hotNews: {
+    fetching: false,
+    data: []
+  }
+})
+
+export const mutations = {
+  REQUEST_HOTNEWS (state) {
+    state.hotNews.fetching = true
+  },
+  GET_HOTNEWS_FAILURE (state) {
+    state.hotNews.fetching = false
+  },
+  GET_HOTNEWS_SUCCESS (state, result) {
+    state.hotNews.fetching = false
+    state.hotNews.data = result.content
+  }
+}

+ 19 - 19
store/newsData/newsPage.js

@@ -1,19 +1,19 @@
-// export const state = () => ({
-//   allNews: {
-//     fetching: false,
-//     data: []
-//   }
-// })
-//
-// export const mutations = {
-//   REQUEST_ALLNEWS (state) {
-//     state.allNews.fetching = true
-//   },
-//   GET_ALLNEWS_FAILURE (state) {
-//     state.allNews.fetching = false
-//   },
-//   GET_ALLNEWS_SUCCESS (state, result) {
-//     state.allNews.fetching = false
-//     state.allNews.data = result
-//   }
-// }
+export const state = () => ({
+  allNews: {
+    fetching: false,
+    data: []
+  }
+})
+
+export const mutations = {
+  REQUEST_ALLNEWS (state) {
+    state.allNews.fetching = true
+  },
+  GET_ALLNEWS_FAILURE (state) {
+    state.allNews.fetching = false
+  },
+  GET_ALLNEWS_SUCCESS (state, result) {
+    state.allNews.fetching = false
+    state.allNews.data = result
+  }
+}

+ 28 - 28
store/product/brand.js

@@ -1,33 +1,33 @@
 export const state = () => ({
-  // recommends: {
-  //   fetching: false,
-  //   data: []
-  // },
-  // brandList: {
-  //   fetching: false,
-  //   data: []
-  // }
+  recommends: {
+    fetching: false,
+    data: []
+  },
+  brandList: {
+    fetching: false,
+    data: []
+  }
 })
 
 export const mutations = {
-  // REQUEST_RECOMMENDS (state) {
-  //   state.recommends.fetching = true
-  // },
-  // GET_RECOMMENDS_SUCCESS (state, result) {
-  //   state.recommends.fetching = false
-  //   state.recommends.data = result
-  // },
-  // GET_RECOMMENDS_FAILURE (state) {
-  //   state.recommends.fetching = false
-  // },
-  // REQUEST_BRANDS (state) {
-  //   state.brandList.fetching = true
-  // },
-  // GET_BRANDS_SUCCESS (state, result) {
-  //   state.brandList.fetching = false
-  //   state.brandList.data = result
-  // },
-  // GET_BRANDS_FAILURE (state) {
-  //   state.brandList.fetching = false
-  // }
+  REQUEST_RECOMMENDS (state) {
+    state.recommends.fetching = true
+  },
+  GET_RECOMMENDS_SUCCESS (state, result) {
+    state.recommends.fetching = false
+    state.recommends.data = result
+  },
+  GET_RECOMMENDS_FAILURE (state) {
+    state.recommends.fetching = false
+  },
+  REQUEST_BRANDS (state) {
+    state.brandList.fetching = true
+  },
+  GET_BRANDS_SUCCESS (state, result) {
+    state.brandList.fetching = false
+    state.brandList.data = result
+  },
+  GET_BRANDS_FAILURE (state) {
+    state.brandList.fetching = false
+  }
 }

+ 29 - 29
store/provider.js

@@ -75,34 +75,34 @@ export const actions = {
     }, err => {
       commit('storeCms/GET_RECOMMEND_STORE_FAILURE', err)
     })
-  }
+  },
   // 获取优秀商家信息
-  // loadRecommendStores ({ commit }) {
-  //   commit('storeCms/REQUEST_RECOMMEND_STORE')
-  //   return axios.get('/api/cms-service/storeIn/5')
-  //     .then(response => {
-  //       commit('storeCms/GET_RECOMMEND_STORE_SUCCESS', response.data)
-  //     }, err => {
-  //       commit('storeCms/GET_RECOMMEND_STORE_FAILURE', err)
-  //     })
-  // },
-  // loadHotComponents ({ commit }) {
-  //   commit('storeCms/REQUEST_HOT_COMPONENTS')
-  //   return axios.get('/api/cms-service/storeCms/inventory')
-  //     .then(response => {
-  //       commit('storeCms/GET_HOT_COMPONENTS_SUCCESS', response.data)
-  //     }, err => {
-  //       commit('storeCms/GET_HOT_COMPONENTS_FAILURE', err)
-  //     })
-  // },
-  // findStoreList ({ commit }, params = {}) {
-  //   params.op = 'pageByType'
-  //   commit('stores/REQUEST_STORE_LIST')
-  //   return axios.get('/api/store-service/stores', { params })
-  //     .then(response => {
-  //       commit('stores/GET_STORE_LIST_SUCCESS', response.data)
-  //     }, err => {
-  //       commit('stores/GET_STORE_LIST_FAILURE', err)
-  //     })
-  // }
+  loadRecommendStores ({ commit }) {
+    commit('storeCms/REQUEST_RECOMMEND_STORE')
+    return axios.get('/api/cms-service/storeIn/5')
+      .then(response => {
+        commit('storeCms/GET_RECOMMEND_STORE_SUCCESS', response.data)
+      }, err => {
+        commit('storeCms/GET_RECOMMEND_STORE_FAILURE', err)
+      })
+  },
+  loadHotComponents ({ commit }) {
+    commit('storeCms/REQUEST_HOT_COMPONENTS')
+    return axios.get('/api/cms-service/storeCms/inventory')
+      .then(response => {
+        commit('storeCms/GET_HOT_COMPONENTS_SUCCESS', response.data)
+      }, err => {
+        commit('storeCms/GET_HOT_COMPONENTS_FAILURE', err)
+      })
+  },
+  findStoreList ({ commit }, params = {}) {
+    params.op = 'pageByType'
+    commit('stores/REQUEST_STORE_LIST')
+    return axios.get('/api/store-service/stores', { params })
+      .then(response => {
+        commit('stores/GET_STORE_LIST_SUCCESS', response.data)
+      }, err => {
+        commit('stores/GET_STORE_LIST_FAILURE', err)
+      })
+  }
 }

+ 70 - 70
store/provider/storeCms.js

@@ -1,75 +1,75 @@
 export const state = () => ({
-  // salesStores: {
-  //   fetching: false,
-  //   data: []
-  // }
-  // newStores: {
-  //   fetching: false,
-  //   data: []
-  // },
-  // storeCount: {
-  //   fetching: false,
-  //   data: 0
-  // }
-  // recommendStore: {
-  //   fetching: false,
-  //   data: []
-  // },
-  // hotComponents: {
-  //   fetching: false,
-  //   data: []
-  // }
+  salesStores: {
+    fetching: false,
+    data: []
+  },
+  newStores: {
+    fetching: false,
+    data: []
+  },
+  storeCount: {
+    fetching: false,
+    data: 0
+  },
+  recommendStore: {
+    fetching: false,
+    data: []
+  },
+  hotComponents: {
+    fetching: false,
+    data: []
+  }
 })
 
 export const mutations = {
-//   REQUEST_SALES (state) {
-//     state.salesStores.fetching = true
-//   },
-//   GET_SALES_FAILURE (state) {
-//     state.salesStores.fetching = false
-//   },
-//   GET_SALES_SUCCESS (state, result) {
-//     state.salesStores.fetching = false
-//     state.salesStores.data = result
-//   }
-  // REQUEST_NEW_STORES (state) {
-  //   state.newStores.fetching = true
-  // },
-  // GET_NEW_STORES_FAILURE (state) {
-  //   state.newStores.fetching = false
-  // },
-  // GET_NEW_STORES_SUCCESS (state, result) {
-  //   state.newStores.fetching = false
-  //   state.newStores.data = result
-  // },
-  // REQUEST_STORE_COUNT (state) {
-  //   state.storeCount.fetching = true
-  // },
-  // GET_STORE_COUNT_FAILURE (state) {
-  //   state.storeCount.fetching = false
-  // },
-  // GET_STORE_COUNT_SUCCESS (state, result) {
-  //   state.storeCount.fetching = false
-  //   state.storeCount.data = result
-  // }
-  // REQUEST_RECOMMEND_STORE (state) {
-  //   state.recommendStore.fetching = true
-  // },
-  // GET_RECOMMEND_STORE_FAILURE (state) {
-  //   state.recommendStore.fetching = false
-  // },
-  // GET_RECOMMEND_STORE_SUCCESS (state, result) {
-  //   state.recommendStore.fetching = false
-  //   state.recommendStore.data = result
-  // },
-  // REQUEST_HOT_COMPONENTS (state) {
-  //   state.hotComponents.fetching = true
-  // },
-  // GET_HOT_COMPONENTS_FAILURE (state) {
-  //   state.hotComponents.fetching = false
-  // },
-  // GET_HOT_COMPONENTS_SUCCESS (state, result) {
-  //   state.hotComponents.fetching = false
-  //   state.hotComponents.data = result
-  // }
+  REQUEST_SALES (state) {
+    state.salesStores.fetching = true
+  },
+  GET_SALES_FAILURE (state) {
+    state.salesStores.fetching = false
+  },
+  GET_SALES_SUCCESS (state, result) {
+    state.salesStores.fetching = false
+    state.salesStores.data = result
+  },
+  REQUEST_NEW_STORES (state) {
+    state.newStores.fetching = true
+  },
+  GET_NEW_STORES_FAILURE (state) {
+    state.newStores.fetching = false
+  },
+  GET_NEW_STORES_SUCCESS (state, result) {
+    state.newStores.fetching = false
+    state.newStores.data = result
+  },
+  REQUEST_STORE_COUNT (state) {
+    state.storeCount.fetching = true
+  },
+  GET_STORE_COUNT_FAILURE (state) {
+    state.storeCount.fetching = false
+  },
+  GET_STORE_COUNT_SUCCESS (state, result) {
+    state.storeCount.fetching = false
+    state.storeCount.data = result
+  },
+  REQUEST_RECOMMEND_STORE (state) {
+    state.recommendStore.fetching = true
+  },
+  GET_RECOMMEND_STORE_FAILURE (state) {
+    state.recommendStore.fetching = false
+  },
+  GET_RECOMMEND_STORE_SUCCESS (state, result) {
+    state.recommendStore.fetching = false
+    state.recommendStore.data = result
+  },
+  REQUEST_HOT_COMPONENTS (state) {
+    state.hotComponents.fetching = true
+  },
+  GET_HOT_COMPONENTS_FAILURE (state) {
+    state.hotComponents.fetching = false
+  },
+  GET_HOT_COMPONENTS_SUCCESS (state, result) {
+    state.hotComponents.fetching = false
+    state.hotComponents.data = result
+  }
 }

+ 18 - 18
store/provider/stores.js

@@ -1,19 +1,19 @@
-// export const state = () => ({
-//   storeList: {
-//     fetching: false,
-//     data: {}
-//   }
-// })
+export const state = () => ({
+  storeList: {
+    fetching: false,
+    data: {}
+  }
+})
 
-// export const mutations = {
-//   REQUEST_STORE_LIST (state) {
-//     state.storeList.fetching = true
-//   },
-//   GET_STORE_LIST_FAILURE (state) {
-//     state.storeList.fetching = false
-//   },
-//   GET_STORE_LIST_SUCCESS (state, result = {}) {
-//     state.storeList.fetching = false
-//     state.storeList.data = result
-//   }
-// }
+export const mutations = {
+  REQUEST_STORE_LIST (state) {
+    state.storeList.fetching = true
+  },
+  GET_STORE_LIST_FAILURE (state) {
+    state.storeList.fetching = false
+  },
+  GET_STORE_LIST_SUCCESS (state, result = {}) {
+    state.storeList.fetching = false
+    state.storeList.data = result
+  }
+}

+ 14 - 14
store/shop/storeInfo.js

@@ -14,10 +14,10 @@ export const state = () => ({
     fetching: false,
     data: {}
   },
-  // storeCommodity: {
-  //   fetching: false,
-  //   data: {}
-  // },
+  storeCommodity: {
+    fetching: false,
+    data: {}
+  },
   saveHistory: {
     fetching: false,
     data: {}
@@ -63,16 +63,16 @@ export const mutations = {
     state.component.fetching = false
     state.component.data = result
   },
-  // REQUEST_STORE_COMMODITY (state) {
-  //   state.storeCommodity.fetching = true
-  // },
-  // GET_STORE_COMMODITY_FAILURE (state) {
-  //   state.storeCommodity.fetching = false
-  // },
-  // GET_STORE_COMMODITY_SUCCESS (state, result = {}) {
-  //   state.storeCommodity.fetching = false
-  //   state.storeCommodity.data = result
-  // },
+  REQUEST_STORE_COMMODITY (state) {
+    state.storeCommodity.fetching = true
+  },
+  GET_STORE_COMMODITY_FAILURE (state) {
+    state.storeCommodity.fetching = false
+  },
+  GET_STORE_COMMODITY_SUCCESS (state, result = {}) {
+    state.storeCommodity.fetching = false
+    state.storeCommodity.data = result
+  },
   REQUEST_SAVEHISOTRY (state) {
     state.saveHistory.fetching = true
   },