瀏覽代碼

帮助中心、热卖推荐、经销代理

ouxq 8 年之前
父節點
當前提交
bc4ca0c357

+ 21 - 5
components/help/left.vue

@@ -22,7 +22,7 @@
       let value2 = object2[propertyName]
       if (value1 > value2) {
         return 1
-      } else if (value1 < value2) {
+      } else if (value1 > value2) {
         return -1
       } else {
         return 0
@@ -36,13 +36,29 @@
         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) {

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

@@ -52,24 +52,53 @@
   </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 () {
-        return this.lists.data.slice(0, 3)
+        if (this.lists.data) {
+          return this.lists.data.slice(0, 3)
+        }
       },
       list2 () {
-        return this.lists.data.slice(3, 8)
+        if (this.lists.data) {
+          return this.lists.data.slice(3, 8)
+        }
       },
       list3 () {
-        return this.lists.data.slice(8, 11)
+        if (this.lists.data) {
+          return this.lists.data.slice(8, 11)
+        }
       },
       list4 () {
-        return this.lists.data.slice(11, 16)
+        if (this.lists.data) {
+          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>

+ 59 - 49
components/provider/HotCommodity.vue

@@ -12,15 +12,25 @@
   </div>
 </template>
 <script>
-
-export default {
-  name: 'hot-commodity',
-  computed: {
-    hotComponents () {
-      return this.$store.state.provider.storeCms.hotComponents.data
+  export default {
+    name: 'hot-commodity',
+    data () {
+      return {
+        hotComponents: {}
+      }
+    },
+    mounted () {
+      this.$http.get('/api/cms-service/storeCms/inventory')
+        .then(response => {
+          this.hotComponents = response.data
+        })
+    },
+    computed: {
+      // hotComponents () {
+      // return this.$store.state.provider.storeCms.hotComponents.data
+      // }
     }
   }
-}
 </script>
 <style scoped>
   .hot-commodity {
@@ -36,50 +46,50 @@ export default {
   }
 
   .hot-commodity .hot-commodity-box {
-		width: 238px;
-		height: 239px;
-		border-top: 1px solid #D6D3CE;
-		border-left: 1px solid #D6D3CE;
-		overflow: hidden;
-	}
+    width: 238px;
+    height: 239px;
+    border-top: 1px solid #D6D3CE;
+    border-left: 1px solid #D6D3CE;
+    overflow: hidden;
+  }
 
-	.hot-commodity > ul > li {
-		/*float: left;*/
-	}
-	.hot-commodity > ul > li:hover{
-		border: #5078cb 1px solid;
-	}
-	.hot-commodity > ul > li:hover span{
-		color: #5078cb;
-		font-weight: bold;
-	}
-	.hot-commodity > ul > li:hover img{
-		transform: scale(1.1);
-	}
-	.hot-commodity ul {
-		border-bottom: 1px solid #D6D3CE;
-		font-size: 0px;
-	}
+  .hot-commodity > ul > li {
+    /*float: left;*/
+  }
+  .hot-commodity > ul > li:hover{
+    border: #5078cb 1px solid;
+  }
+  .hot-commodity > ul > li:hover span{
+    color: #5078cb;
+    font-weight: bold;
+  }
+  .hot-commodity > ul > li:hover img{
+    transform: scale(1.1);
+  }
+  .hot-commodity ul {
+    border-bottom: 1px solid #D6D3CE;
+    font-size: 0px;
+  }
 
-	.hot-commodity-box img {
-		width: 238px;
-		height: 180px;
-		margin-top: 10px;
-	}
+  .hot-commodity-box img {
+    width: 238px;
+    height: 180px;
+    margin-top: 10px;
+  }
 
-	.hot-commodity-box span {
-		font-size: 14px;
-		font-family: "Microsoft Yahei", "微软雅黑";
-		color: #333434;
-		text-align: center;
-		display: inline-block;
-		width: 100%;
-		height: 30px;
-		line-height: 30px;
-		margin-top: 12px;
-	}
+  .hot-commodity-box span {
+    font-size: 14px;
+    font-family: "Microsoft Yahei", "微软雅黑";
+    color: #333434;
+    text-align: center;
+    display: inline-block;
+    width: 100%;
+    height: 30px;
+    line-height: 30px;
+    margin-top: 12px;
+  }
 
-	.hot-commodity .border-right {
-		border-right: 1px solid #D6D3CE;
-	}
+  .hot-commodity .border-right {
+    border-right: 1px solid #D6D3CE;
+  }
 </style>

+ 28 - 9
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/{$helpDetail.navId}`" 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/${helpTitle.id}`" 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,24 +35,43 @@
   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>

+ 45 - 12
pages/help/helpList/_id.vue

@@ -35,11 +35,12 @@
 </div>
 </template>
 <script>
+  import { left, helpHeader } from '~components/help'
   // 升序
   function compare (propertyName) {
     return function (object1, object2) {
-      var value1 = object1[propertyName]
-      var value2 = object2[propertyName]
+      let value1 = object1[propertyName]
+      let value2 = object2[propertyName]
       if (value1 > value2) {
         return 1
       } else if (value1 < value2) {
@@ -49,27 +50,59 @@
       }
     }
   }
-  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>

+ 16 - 4
pages/help/home.vue

@@ -34,19 +34,31 @@
   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
-      }
+//      helpNav () {
+//        return this.$store.state.help.snapsho.data.sort(compare('detno'))
+//      }
     }
   }
 </script>

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

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