From a3ab225520d23b20995efecfac48e9302b6a247f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Fri, 26 Dec 2025 17:13:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E8=BF=94=E5=9B=9E=E6=97=B6=E7=9A=84=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 避免onShow每次都重新加载商品数据 - 添加needRefresh标志控制是否需要刷新 - 在onHide/onUnload时标记需要刷新 - 返回首页时仅在需要时才刷新列表 --- pages/index/index.js | 16 +++++++++++++++- pages/index/index.wxml | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index c07bc87..0900e0d 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -44,6 +44,9 @@ Page({ previewImageUrls: [], previewImageIndex: 0, showImagePreview: false, + + // 页面刷新标志 + needRefresh: false, }, // 跳转到聊天页面 @@ -189,7 +192,18 @@ Page({ app.updateCurrentTab('index'); app.globalData.showTabBar = true; this.checkAndRestoreLoginStatus() - this.refreshGoodsList() + if (this.data.needRefresh) { + this.setData({ needRefresh: false }) + this.refreshGoodsList() + } + }, + + onHide: function () { + this.setData({ needRefresh: true }) + }, + + onUnload: function () { + this.setData({ needRefresh: true }) }, onPullDownRefresh: function() { diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 2a1f895..49a02f5 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -218,7 +218,7 @@ {{item.negotiateStatus}} - 已售{{item.sales || item.reservedCount || 0}}件 + 已有{{item.reservedCount || 0}}人收藏 {{item.region || ''}} @@ -276,7 +276,7 @@ {{item.negotiateStatus}} - 已售{{item.sales || item.reservedCount || 0}}件 + 已有{{item.reservedCount || 0}}人收藏 {{item.region || ''}} From 5d0b0899d7743b3d53356b69785e893eb7bc0024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Fri, 26 Dec 2025 17:14:51 +0800 Subject: [PATCH 2/3] =?UTF-8?q?perf:=20=E7=A7=BB=E9=99=A4=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=88=B7=E6=96=B0=EF=BC=8C=E4=BB=85=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - onShow不再自动刷新商品列表 - 移除onHide/onUnload中的刷新标记逻辑 - 保留onPullDownRefresh下拉刷新功能 --- pages/index/index.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index 0900e0d..8079a53 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -44,9 +44,6 @@ Page({ previewImageUrls: [], previewImageIndex: 0, showImagePreview: false, - - // 页面刷新标志 - needRefresh: false, }, // 跳转到聊天页面 @@ -192,18 +189,6 @@ Page({ app.updateCurrentTab('index'); app.globalData.showTabBar = true; this.checkAndRestoreLoginStatus() - if (this.data.needRefresh) { - this.setData({ needRefresh: false }) - this.refreshGoodsList() - } - }, - - onHide: function () { - this.setData({ needRefresh: true }) - }, - - onUnload: function () { - this.setData({ needRefresh: true }) }, onPullDownRefresh: function() { From 7ac7d265421e000562542dc554478f6bb08d8f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Fri, 26 Dec 2025 17:17:51 +0800 Subject: [PATCH 3/3] =?UTF-8?q?style:=20=E6=9B=B4=E6=96=B0=E6=94=B6?= =?UTF-8?q?=E8=97=8F=E6=98=BE=E7=A4=BA=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.wxml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 49a02f5..ca75ef3 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -213,7 +213,6 @@ {{item.name}} {{item.specification || '无'}} | {{item.yolk}} - {{item.supplyStatus || ''}} {{item.sourceType || ''}} {{item.negotiateStatus}} @@ -265,13 +264,11 @@ data-item="{{item}}" data-index="0" > - 预售 {{item.name}} {{item.specification || '无'}} | {{item.yolk}} - {{item.supplyStatus || ''}} {{item.sourceType || ''}} {{item.negotiateStatus}}