From 24b1674ae7753960132473d7b32ec794b174e73f 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: Sat, 20 Dec 2025 11:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=8E=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E8=BF=94=E5=9B=9E=E6=97=B6=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=88=97=E8=A1=A8=E6=9B=B4=E6=96=B0=E4=B8=8D=E5=8F=8A?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/chat/index.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pages/chat/index.js b/pages/chat/index.js index b0f8e12..0a44454 100644 --- a/pages/chat/index.js +++ b/pages/chat/index.js @@ -62,9 +62,22 @@ Page({ }, onShow: function () { - // 只有已登录用户才启动定时器 - if (!this.data.timer && this.isUserLoggedIn()) { - this.startTimer(); + // 只有已登录用户才执行操作 + if (this.isUserLoggedIn()) { + // 从聊天详情页返回时,强制刷新列表,绕过节流限制 + // 保存当前时间戳,用于强制刷新 + const forcedLoadTime = Date.now(); + this.setData({ + lastLoadTime: forcedLoadTime - 3000, // 设置为3秒前,确保能绕过2秒的节流限制 + }, () => { + // 重新加载聊天列表,实现从聊天详情页返回时立即更新 + this.loadChatList(); + }); + + // 启动定时器 + if (!this.data.timer) { + this.startTimer(); + } } },