Browse Source

请求多次处理

yangc 7 years ago
parent
commit
cfe96582f2
4 changed files with 13 additions and 13 deletions
  1. 2 2
      components/home/floor/FloorList.vue
  2. 9 8
      nuxt.config.js
  3. 1 0
      pages/index.vue
  4. 1 3
      store/index.js

+ 2 - 2
components/home/floor/FloorList.vue

@@ -151,7 +151,7 @@
         lists[3].items = this.floorsF4
         lists[4].items = this.floorsF5
         lists.slice().forEach(function(value) {
-          let lengs = value.items.length
+          let lengs = value.items ? value.items.length : 0
           for (let j = 0; j < lengs; j++) {
             value.items[j].backGroundColor = value.items[j].metadatas.contExp_select
             value.items[j].body = value.items[j].metadatas.contExp_remark
@@ -174,7 +174,7 @@
         lists[0].items = this.expandF1
         lists[1].items = this.expandF2
         lists.slice().forEach(function(value) {
-          let lengs = value.items.length
+          let lengs = value.items ? value.items.length : 0
           for (let j = 0; j < lengs; j++) {
             value.items[j].backGroundColor = value.items[j].metadatas.contExp_select
             value.items[j].body = value.items[j].metadatas.contExp_remark

+ 9 - 8
nuxt.config.js

@@ -17,7 +17,7 @@ const ssoUrl = process.env.ssoUrl || (isProdMode ? 'https://sso.ubtob.com/' : 'h
 
 module.exports = {
   router: {
-    middleware: 'check-auth',
+    // middleware: 'check-auth',
     scrollBehavior: function (to, from, savedPosition) {
       return { x: 0, y: 0 }
     }
@@ -72,8 +72,8 @@ module.exports = {
     },
     vendor: [
       'axios',
-      'swiper',
-      'element-ui'
+      'swiper'
+      // 'element-ui'
     ],
     babel: {
       presets: ['es2015', 'stage-2'],
@@ -103,17 +103,18 @@ module.exports = {
     uasUrl
   },
   plugins: [
-    {
-      src: '~plugins/axios.js'
-    },
+    // {
+    //   src: '~plugins/axios.js',
+    //   ssr: false
+    // },
     {
       src: '~plugins/vue-filter.js'
     }, {
       src: '~plugins/mixin.js'
-    }, {
+    }, /* {
       src: '~plugins/swiper.js',
       ssr: false
-    }, {
+    }, */ {
       src: '~plugins/vue-loading.js',
       ssr: false
     }, {

+ 1 - 0
pages/index.vue

@@ -59,6 +59,7 @@
         store.dispatch('supplier/loadVendorAll', {page: 1, size: 20}),
         store.dispatch('loadAllCount', {_status: 'actived', usedFor: 'mall_home_banner'}),
         store.dispatch('loadInquirySheet'),
+        store.dispatch('loadProductCounts', { _status: 'actived' }),
 //        store.dispatch('loadInquirySheetLast', {year: nowYear, month: LastMonth}),
         store.dispatch('provider/findSimilarStoreList', {page: 1, count: 10, type: 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT', keyword: ''}),
         store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 50, enUU: store.state.option.user.data.enterprise ? store.state.option.user.data.enterprise.uu : null}),

+ 1 - 3
store/index.js

@@ -60,10 +60,8 @@ export const actions = {
     return Promise.all([
       // 全局数据
       store.dispatch('loadUserInfo'),
-      store.dispatch('loadProductCounts', { _status: 'actived' }),
       store.dispatch('loadHotSearchDevice'),
-      store.dispatch('loadHotSearchBrand'),
-      store.dispatch('loadNewFloors')
+      store.dispatch('loadHotSearchBrand')
     ])
   },
   // 获取用户信息