瀏覽代碼

feature: 对首页banner做优先缓存展示处理

332777428@qq.com 4 月之前
父節點
當前提交
3214061ac8

+ 7 - 0
app.js

@@ -20,6 +20,7 @@ App({
     baseUrl: env.prod.baseUrl,
 
     userInfo: null,
+    bannerList: bannerList,
     classifyProducts: "",
     statusBarHeight: 0,
     safeBottomHeight: 0,
@@ -61,6 +62,12 @@ App({
       that.globalData.userInfo = userInfo;
     }
 
+    ///首页banner
+    var bannerList = store.getStore("homeBanner");
+    if (!strings.isEmpty(bannerList)) {
+      that.globalData.bannerList = bannerList;
+    }
+
     ///设备列表
     var classifyProducts = store.getStore("classifyProducts");
     if (!strings.isEmpty(classifyProducts)) {

+ 0 - 1
pages/deviceWake/deviceWake.js

@@ -6,7 +6,6 @@ const {
   deviceWakedetail
 } = require('../../utils/apiUtil.js');
 
-import lexin_devices from '../../utils/lexin/devices.js';
 import lexin_util from '../../utils/lexin/util.js';
 import routePath from '../../utils/routePath.js';
 import routeUtil from '../../utils/routeUtil.js';

+ 9 - 14
pages/pageA/index/index.js

@@ -33,6 +33,7 @@ Page({
   data: {
     navBarHeight: app.globalData.navBarHeight,
     safeBottomHeight: app.globalData.safeBottomHeight,
+    bannerList: app.globalData.bannerList,
     nvabarData: {
       showCapsule: 0, //是否显示左上角图标   1表示显示    0表示不显示
       title: 'OhPlay', //导航栏 中间的标题
@@ -41,13 +42,13 @@ Page({
     ///下午好
     isLogin: false,
     greeting: "",
-    bannerList: [{
-        "pic": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20241028142233669038262.png"
-      },
-      {
-        "pic": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20240823145816541223911.png"
-      }
-    ],
+    // bannerList: [{
+    //     "pic": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20241028142233669038262.png"
+    //   },
+    //   {
+    //     "pic": "https://music-play.oss-cn-shenzhen.aliyuncs.com/device/20240823145816541223911.png"
+    //   }
+    // ],
     autoplay: true,
     interval: 3000, // 切换时间间隔
     duration: 500, // 滑动动画时长
@@ -1195,15 +1196,9 @@ Page({
 
   onBannerLoad() {
     var that = this;
-    var bannerList = wx.getStorageSync("homeBanner") || [];
-    if (that.data.bannerList.length > 0) {
-      that.setData({
-        bannerList: bannerList
-      });
-    }
     getBanner({}).then((res) => {
       that.setData({
-        bannerList: res
+        bannerList: res,
       });
       store.setStore("homeBanner", res);
     });

+ 66 - 0
pages/pageC/pages/repeat/repeat.js

@@ -0,0 +1,66 @@
+// pages/pageC/pages/repeat/repeat.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 3 - 0
pages/pageC/pages/repeat/repeat.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 2 - 0
pages/pageC/pages/repeat/repeat.wxml

@@ -0,0 +1,2 @@
+<!--pages/pageC/pages/repeat/repeat.wxml-->
+<text>pages/pageC/pages/repeat/repeat.wxml</text>

+ 1 - 0
pages/pageC/pages/repeat/repeat.wxss

@@ -0,0 +1 @@
+/* pages/pageC/pages/repeat/repeat.wxss */