Parcourir la source

fix: 兼容黑洞星球显示和不显示

joe il y a 4 ans
Parent
commit
6717703efc
1 fichiers modifiés avec 7 ajouts et 3 suppressions
  1. 7 3
      view/xcx/pages/index/index.js

+ 7 - 3
view/xcx/pages/index/index.js

@@ -338,6 +338,7 @@ Page({
     onTapCategoryTabItem: function (event) {
         let tabIndex = event.detail.index;
         if (tabIndex <= 0 || tabIndex > this.data.prodCates.children.length) {
+            console.log(1)
             this.setData({
                 activeTabIndex: tabIndex
             })
@@ -619,10 +620,12 @@ Page({
         let tabIndex = this.data.activeTabIndex
         if (tabIndex == 0) {
             this.getIndexConfig();
-        } else if (tabIndex == this.data.prodCates.children.length) { // 黑洞星球不处理
+        } else if (tabIndex > this.data.prodCates.children.length) { 
 
         } else {
-            this.get_product_list(tabIndex, true)
+            if (!this.data.prodCates.children[tabIndex - 1].id == CATE_BLACKHOLE_ID) {
+                this.get_product_list(tabIndex, true)
+            }
         }
 
         wx.stopPullDownRefresh();
@@ -638,6 +641,7 @@ Page({
 
     onPageScroll: throttle(function (obj) {
         if (this.data.activeTabIndex <= 0 || this.data.activeTabIndex > this.data.prodCates.children.length) {
+            console.log('impossiable err')
             return
         }
 
@@ -712,7 +716,7 @@ Page({
             this.setData(changingData)
         }
 
-        if (cindex >= 0 && cindex < this.data.prodCates.children.length - 1) {
+        if (cindex >= 0 && cindex < this.data.prodCates.children.length) {
             this.setData({
                 ['prodCates.children[' + cindex + '].scrollPos']: pos
             })