Browse Source

首页和新闻页请求方式调整

yangc 7 years ago
parent
commit
4541178439

+ 2 - 1
components/common/image-upload/imageUpload.vue

@@ -35,7 +35,8 @@
     }
   }
 </script>
-<style>
+<style scoped>
+  @import "~element-ui/lib/theme-default/index.css";
   input[type="file"] {
     display: none;
   }

+ 2 - 0
components/common/page/pageComponent.vue

@@ -44,6 +44,8 @@
 </script>
 
 <style>
+  @import "~font-awesome/css/font-awesome.css";
+  @import "~element-ui/lib/theme-default/index.css";
   a {
     color: #2d8cf0;
     background: 0 0;

+ 4 - 4
components/default/RightBar.vue

@@ -72,7 +72,6 @@
   </div>
 </template>
 <script>
-  import axios from '~/plugins/axios'
   import { scrollTo } from '~utils/scroll'
   import MessageBoard from '~components/messageBoard/MessageBoard.vue'
   export default {
@@ -185,14 +184,14 @@
           // 获得窗口的水平位置
           let iLeft = (window.screen.availWidth - 10 - 1030) / 2
           let newTab = window.open('', '即时对话框', 'height=600, width=1030, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
-          axios.get('/basic/enterprise/' + this.enterprise.uu + '/info')
+          this.$http.get('/basic/enterprise/' + this.enterprise.uu + '/info')
             .then(response => {
               let obj = {}
               obj.enUU = response.data.uu
               obj.enterprise = {enUU: response.data.uu, name: response.data.enName}
               obj.type = 'LIST'
               obj.userPhone = this.user.data.userTel
-              axios.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
+              this.$http.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
                 .then(response => {
                   if (response.data.success) {
                     newTab.location.href = 'http://im.ubtob.com/chat/visit?gid=' + response.data.content
@@ -205,7 +204,7 @@
       },
       getChatCount: function () {
         if (this.user.logged) {
-          axios.get('http://im.ubtob.com/api/chat/message', {params: {enUU: this.enterprise.uu, operate: 'count_unread', phone: this.user.data.userTel}})
+          this.$http.get('http://im.ubtob.com/api/chat/message', {params: {enUU: this.enterprise.uu, operate: 'count_unread', phone: this.user.data.userTel}})
             .then(response => {
               this.chatCount = response.data.count
             })
@@ -215,6 +214,7 @@
   }
 </script>
 <style lang="scss" scoped>
+  @import "~element-ui/lib/theme-default/index.css";
   /*查看*/
   #image-box .x-floating-wrap {
     position: fixed;

+ 2 - 1
components/help/left.vue

@@ -53,7 +53,8 @@
     }
   }
 </script>
-<style>
+<style scoped>
+  @import "~element-ui/lib/theme-default/index.css";
    .el-tree{
     border: none;
      min-height: 300px;

+ 14 - 5
components/home/Carousel.vue

@@ -40,15 +40,24 @@
             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: {
-      banners () {
-        return this.$store.state.carousel.banners
-      },
+//      banner () {
+//       // return this.$store.state.carousel.banners
+//      },
       activeColor () {
-        return this.banners.data.length ? this.banners.data[this.activeSlide].metadata['background-color'] : null
+        if (this.banners.data) {
+          return this.banners.data.length ? this.banners.data[this.activeSlide].metadata['background-color'] : null
+        }
       }
     }
   }

+ 14 - 5
components/home/KindCategory.vue

@@ -49,7 +49,8 @@
     name: 'kind-category',
     data () {
       return {
-        activeKindId: 0
+        activeKindId: 0,
+        kinds: {}
       }
     },
     methods: {
@@ -65,13 +66,21 @@
         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个根类目
-        return this.kinds.data.slice(0, 13)
+        if (this.kinds.data) {
+          return this.kinds.data.slice(0, 13)
+        }
       }
     }
   }

+ 20 - 5
components/home/News.vue

@@ -27,15 +27,30 @@
 <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 () {
-        return this.news.data.slice(0, 3)
+        if (this.news.data) {
+          return this.news.data.content.slice(0, 3)
+        }
       },
       news5 () {
-        return this.news.data.slice(0, 5)
+        if (this.news.data) {
+          return this.news.data.content.slice(0, 5)
+        }
       }
     }
   }

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

@@ -9,18 +9,28 @@
 <script>
   import Floor from './Floor.vue'
   import FloorBar from './FloorBar.vue'
-
   export default {
     name: 'floor-list',
     components: {
       Floor,
       FloorBar
     },
-    computed: {
-      floors () {
-        return this.$store.state.floor.list
+    data () {
+      return {
+        floors: {}
       }
+    },
+    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>

+ 18 - 4
components/news/Detail.vue

@@ -12,14 +12,28 @@
     </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 () {
-        return this.new.data
+        if (this.new.data) {
+          return this.new.data
+        }
       }
     },
     filters: {

+ 18 - 4
components/news/Left.vue

@@ -27,12 +27,26 @@
 </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 () {
-        return this.new.data
+     //   console.log(this.new.data)
+        if (this.new.data) {
+          return this.new.data.content
+        }
       }
     },
     filters: {

+ 21 - 7
components/news/Right.vue

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

+ 2 - 1
components/product/CategoryNav.vue

@@ -30,7 +30,8 @@
   }
 </script>
 
-<style>
+<style scoped>
+  @import "~element-ui/lib/theme-default/breadcrumb.css";
   /* breadcrumbs */
   .breadcrumbs {
     margin-top: 20px;

+ 5 - 4
components/product/ComponentGoods.vue

@@ -24,12 +24,12 @@
       <tr v-for="compGoods in componentGoods.content">
         <td>
           <!--store/{{compGoods.storeId}}#/batchInfo/{{compGoods.batchCode}}-->
-          <a v-if="compGoods.batchCode" href="#">
+          <nuxt-link v-if="compGoods.batchCode" :to="`/product/component/${compGoods.uuid}`">
             <img :src="compGoods.img || '/images/all/default.png'"/>
-          </a>
+          </nuxt-link>
           <img v-if="!compGoods.batchCode" :src="compGoods.img || '/images/all/default.png'"/>
           <!--store/{{compGoods.storeId}}#/home-->
-          <a href="#" class="contact" :title="compGoods.storeName">{{compGoods.storeName}}</a>
+          <nuxt-link :to="'/store/' + compGoods.storeId" class="contact" :title="compGoods.storeName">{{compGoods.storeName}}</nuxt-link>
         </td>
         <td class="brand-code">
           <div class="brand"><nuxt-link :to="`/product/brand/${compGoods.brand.uuid}/`" title="compGoods.brand.nameEn">{{compGoods.brand.nameEn}}</nuxt-link></div>
@@ -173,7 +173,8 @@
   }
 </script>
 
-<style>
+<style scoped>
+  @import "~element-ui/lib/theme-default/index.css";
   .product-list{
     width: 1190px;
     margin-bottom: 20px;

+ 1 - 0
components/product/brand/BrandComponent.vue

@@ -98,6 +98,7 @@
   }
 </script>
 <style scoped>
+  @import "~element-ui/lib/theme-default/index.css";
   .component-list {
     float: left;
     margin-left: 20px;

+ 1 - 0
components/product/brand/CategoriesList.vue

@@ -114,6 +114,7 @@
   }
 </script>
 <style scoped>
+  @import "~element-ui/lib/theme-default/index.css";
   /*  产品分类调整*/
   .el-tree {
     border: none;

+ 1 - 0
components/product/component/ComponentDetail.vue

@@ -132,6 +132,7 @@
   }
 </script>
 <style scoped>
+  @import "~element-ui/lib/theme-default/index.css";
   .header-text {
     text-align: center;
     font-size: 20px;

+ 2 - 1
components/provider/Suppliers.vue

@@ -108,7 +108,8 @@ export default {
   }
 }
 </script>
-<style>
+<style scoped>
+  @import "~element-ui/lib/theme-default/index.css";
   .el-pagination .el-pager li.active{
     background-color: #5078cb;
     border-color: #337ab7;

+ 12 - 1
components/store/BaseInfo.vue

@@ -81,9 +81,20 @@ 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

+ 11 - 1
components/store/CommodityList.vue

@@ -135,6 +135,7 @@ function getAllLeafIds (kind) {
     return ids.join('-')
   }
 }
+// import axios from '~plugins/axios'
 import Buy from '~components/common/buyOrCar/buyComponent.vue'
 export default {
   name: 'commodity-list',
@@ -155,11 +156,19 @@ export default {
       searchCode: '',
       parentKindId: 0,
       ids: null
+    //  commodities: {}
     }
   },
+//  mounted () {
+//    axios.get('/api/commodity/commodities', { params: { storeid: this.$route.params.uuid, origin: 'store', page: 1, count: 6 } })
+//      .then(response => {
+//        this.commodities = response.data
+//      })
+//  },
   computed: {
     commodities () {
       return this.$store.state.shop.storeInfo.storeCommodity.data
+     // return this.commodity.data
     }
   },
   methods: {
@@ -204,7 +213,8 @@ export default {
   }
 }
 </script>
-<style>
+<style scoped>
+  @import "~element-ui/lib/theme-default/index.css";
 /*  产品分类调整*/
   .category-content .el-tree{
     border: none;

+ 1 - 1
components/store/ComponentInfo.vue

@@ -4,7 +4,7 @@
       <div class="head">
         <span class="tab">产品参数<b class="tip">(仅供参考,以实际产品为准)</b></span>
       </div>
-      <ul class="list-unstyled list-inline" v-if="component.properties">
+      <ul class="list-unstyled list-inline" style="margin-left: 0px;" v-if="component.properties">
         <li v-for="property in component.properties" v-if="property.value">
           <div class="property-name">
             <span v-text="property.property.labelCn"></span>:

+ 16 - 0
components/store/RecommendProduct.vue

@@ -35,6 +35,22 @@
     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

+ 6 - 1
components/store/common/StoreHeader.vue

@@ -67,13 +67,13 @@
 </template>
 <script>
 import SearchBox from '~components/main/Search.vue'
-
 export default {
   name: 'store-header',
   data () {
     return {
       isOpen: false,
       dialogVisible: false
+   //   storeInfo: {}
     }
   },
   components: {
@@ -95,6 +95,10 @@ export default {
     this.$nextTick(() => {
       this.loadFocusList()
     })
+//    axios.get('/api/store-service/stores', this.$route.params)
+//      .then(response => {
+//        this.storeInfo = response.data
+//      })
   },
   methods: {
     loadFocusList () {
@@ -125,6 +129,7 @@ export default {
 }
 </script>
 <style scoped>
+  @import "~element-ui/lib/theme-default/index.css";
   body{
 		font-family: "Microsoft Yahei", "微软雅黑";
 	}

+ 21 - 11
nuxt.config.js

@@ -2,6 +2,7 @@ const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
 const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://www.usoftmall.com/' : 'http://192.168.253.60:9090/platform-b2c/')
 const webpack = require('webpack')
+const ExtractTextPlugin = require('extract-text-webpack-plugin')
 
 module.exports = {
   router: {
@@ -44,6 +45,18 @@ module.exports = {
         test: /\.js$/,
         loader: 'babel-loader'
       })
+      config.module.rules.push({
+        test: /\.css$/,
+        loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
+      })
+      config.module.rules.push({
+        test: /\.scss$/,
+        loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
+      })
+      config.module.rules.push({
+        test: /\.less$/,
+        loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
+      })
       if (isClient) {
         config.module.rules.push({
           enforce: 'pre',
@@ -72,18 +85,15 @@ module.exports = {
       })
     ]
   },
-  css: [ {
-    src: 'bootstrap/dist/css/bootstrap.css'
-  }, {
+  css: [ {src: 'bootstrap/dist/css/bootstrap.min.css'},
+    /* {
     src: 'font-awesome/css/font-awesome.css'
-  }, {
-    src: '~assets/scss/app.scss',
-    lang: 'scss'
-  }, {
-    src: 'swiper/dist/css/swiper.css'
-  }, {
-    src: 'element-ui/lib/theme-default/index.css'
-  }],
+  }, */{src: '~assets/scss/app.scss', lang: 'scss'}/* , {
+      src: 'swiper/dist/css/swiper.css'
+    } */ /*, {
+      src: 'element-ui/lib/theme-default/index.css'
+    } */
+  ],
   dev: !isProdMode,
   env: {
     baseUrl

+ 3 - 1
package.json

@@ -44,7 +44,9 @@
     "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"
+    "sass-loader": "^6.0.6",
+    "webpack": "^3.2.0"
   }
 }

+ 8 - 4
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,3 +38,7 @@
     }
   }
 </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 v-on:childEvent="listenChild"></right>
+    <right></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>

+ 0 - 1
pages/product/original.vue

@@ -18,5 +18,4 @@
   }
 </script>
 <style  scoped>
-
 </style>

+ 1 - 1
pages/provider/home.vue

@@ -29,7 +29,7 @@ export default{
   }
 }
 </script>
-<style>
+<style scoped>
   .container{
     padding:0;
   }

+ 2 - 0
pages/search/_keyword.vue

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

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

@@ -5,7 +5,6 @@
   </div>
 </template>
 <script>
-import axios from '~plugins/axios'
 import { CommodityList, RecommendProduct } from '~components/store'
 
 export default {
@@ -23,7 +22,7 @@ export default {
     ])
   },
   async asyncData ({ params }) {
-    let { data } = await axios.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
+    let { data } = await this.$http.get('/api/commodity/components/kinds', { params: { StoreUuid: params.uuid } })
     return { kinds: data }
   },
   components: {
@@ -32,7 +31,7 @@ export default {
   }
 }
 </script>
-<style>
+<style scoped>
   #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
+//   }
+// }

+ 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
+//   }
+// }

+ 39 - 39
store/product/kind.js

@@ -1,8 +1,8 @@
 export const state = () => ({
-  kinds: {
-    fetching: false,
-    data: []
-  },
+  // kinds: {
+  //   fetching: false,
+  //   data: []
+  // },
   kindsParentWithBother: {
     fetching: false,
     data: []
@@ -22,41 +22,41 @@ export const state = () => ({
 })
 
 export const mutations = {
-  REQUEST_KIND (state, action) {
-    if (!action.id) {
-      state.kinds.fetching = true
-    } else {
-      const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
-      if (kind) {
-        kind.fetching = true
-      }
-    }
-  },
-  GET_KIND_FAILURE (state, action) {
-    if (!action.id) {
-      state.kinds.fetching = false
-    } else {
-      const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
-      if (kind) {
-        kind.fetching = false
-      }
-    }
-  },
-  GET_KIND_SUCCESS (state, action) {
-    if (!action.id) {
-      state.kinds.fetching = false
-      action.result.forEach(kind => {
-        kind.fetching = false
-      })
-      state.kinds.data = action.result
-    } else {
-      const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
-      if (kind) {
-        kind.fetching = false
-        kind.children = action.result
-      }
-    }
-  },
+  // REQUEST_KIND (state, action) {
+  //   if (!action.id) {
+  //     state.kinds.fetching = true
+  //   } else {
+  //     const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
+  //     if (kind) {
+  //       kind.fetching = true
+  //     }
+  //   }
+  // },
+  // GET_KIND_FAILURE (state, action) {
+  //   if (!action.id) {
+  //     state.kinds.fetching = false
+  //   } else {
+  //     const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
+  //     if (kind) {
+  //       kind.fetching = false
+  //     }
+  //   }
+  // },
+  // GET_KIND_SUCCESS (state, action) {
+  //   if (!action.id) {
+  //     state.kinds.fetching = false
+  //     action.result.forEach(kind => {
+  //       kind.fetching = false
+  //     })
+  //     state.kinds.data = action.result
+  //   } else {
+  //     const kind = state.kinds.data.find(kind => Object.is(kind.id, action.id))
+  //     if (kind) {
+  //       kind.fetching = false
+  //       kind.children = action.result
+  //     }
+  //   }
+  // },
   REQUEST_KINDPARENTSWITHBOTHERS (state) {
     state.kindsParentWithBother.fetching = true
   },