发货方式优化及消息功能优化

This commit is contained in:
Dev
2026-10-08 20:34:08 +08:00
parent f21b010ced
commit 7e3e999b74
23 changed files with 371 additions and 455 deletions
+1 -16
View File
@@ -25,12 +25,10 @@ App({
});
},
});
//启动未读消息轮询(tabbar红点)
this.startUnreadPolling();
},
onShow: function () {
updateManager();
//从后台切回前台,立即刷新未读红点
//从后台切回前台时刷新一次未读红点(不使用定时轮询,避免请求堆积导致页面卡死)
this.refreshUnread();
},
onHide: function () {},
@@ -38,19 +36,6 @@ App({
unread: 0, //未读消息数(tabbar红点共享缓存)
},
/**
* 未读消息轮询:小程序前台每10s刷新一次底部tabbar红点
* (切后台后JS执行会被系统挂起,定时器自然暂停,回前台由onShow立即补一次)
*/
startUnreadPolling: function () {
if (this.unreadTimer) {
return;
}
this.unreadTimer = setInterval(() => {
this.refreshUnread();
}, 10000);
},
/**
* 刷新当前 tab 页 tabbar 实例的红点(非tab页无tabbar实例,自动跳过)
*/