Przeglądaj źródła

feature: banner写死图片展示

Damon 7 miesięcy temu
rodzic
commit
92f9b8c216
1 zmienionych plików z 22 dodań i 13 usunięć
  1. 22 13
      pages/index/index.js

+ 22 - 13
pages/index/index.js

@@ -23,7 +23,16 @@ Page({
     ///下午好
     isLogin: false,
     greeting: "",
-    bannerList: [],
+    bannerList: [{
+        "pic": "https://img0.baidu.com/it/u=3151309647,377730925&fm=253&fmt=auto&app=120&f=JPEG?w=910&h=500"
+      },
+      {
+        "pic": "https://img1.baidu.com/it/u=548664894,321719310&fm=253&fmt=auto&app=120&f=JPEG?w=889&h=500"
+      },
+      {
+        "pic": "https://img2.baidu.com/it/u=1540025982,116580369&fm=253&fmt=auto&app=120&f=JPEG?w=889&h=500"
+      },
+    ],
     autoplay: true,
     interval: 3000, // 切换时间间隔
     duration: 500, // 滑动动画时长
@@ -1088,22 +1097,22 @@ Page({
 
   onBannerLoad() {
     var that = this;
-    var bannerList = wx.getStorageSync("homeBanner") || [];
-    if (that.data.bannerList.length == 0) {
-      that.setData({
-        bannerList: bannerList
-      });
-    }
+    // var bannerList = wx.getStorageSync("homeBanner") || [];
+    // if (that.data.bannerList.length > 0) {
+    //   that.setData({
+    //     bannerList: bannerList
+    //   });
+    // }
   },
 
   onBannerShow() {
     var that = this;
-    getBanner({}).then((res) => {
-      that.setData({
-        bannerList: res
-      });
-      wx.setStorageSync("homeBanner", res);
-    })
+    // getBanner({}).then((res) => {
+    //   that.setData({
+    //     bannerList: res
+    //   });
+    //   wx.setStorageSync("homeBanner", res);
+    // })
   },
 
   ///销毁蓝牙