Sfoglia il codice sorgente

feature: 首页Banner缓存处理

332777428@qq.com 4 mesi fa
parent
commit
2dd9a1e867
1 ha cambiato i file con 8 aggiunte e 13 eliminazioni
  1. 8 13
      pages/index/index.js

+ 8 - 13
pages/index/index.js

@@ -89,7 +89,7 @@ Page({
     // }],
     _willConnectBle: null,
     _hasShowModal: null,
-    _clickOtherDevice:false,
+    _clickOtherDevice: false,
     // deviceList: [{
     //   "connectType": 3,
     //   "devName": "猫王小王子OTR-X",
@@ -1183,23 +1183,18 @@ Page({
 
   onBannerLoad() {
     var that = this;
-    // var bannerList = wx.getStorageSync("homeBanner") || [];
-    // if (that.data.bannerList.length > 0) {
-    //   that.setData({
-    //     bannerList: bannerList
-    //   });
-    // }
-  },
-
-  onBannerShow() {
-    var that = this;
+    var bannerList = wx.getStorageSync("homeBanner") || [];
+    if (that.data.bannerList.length > 0) {
+      that.setData({
+        bannerList: bannerList
+      });
+    }
     getBanner({}).then((res) => {
-      console.log("banner:", res)
       that.setData({
         bannerList: res
       });
       store.setStore("homeBanner", res);
-    })
+    });
   },
 
   stopIntervalId1: function () {