宝宝来信 tab 角标改圈数字①~⑩,>10 显示 10+;bfcache 返回也重拉未读 (v26100434)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-04 13:55:02 +00:00
parent 2b15f78706
commit 98a948db39
3 changed files with 18 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26100433';
var VER = '26100434';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -769,8 +769,16 @@
一封就圈 1、两封就圈 2」→ 首页卡永远收起,未读数(信 + 回信)直接写进底 tab 的红圈里。 */
hideLetterCard();
const n = (Number(r.unreadLetters) || 0) + (Number(r.unreadReplies) || 0) || Number(r.unread) || 0;
if (badge) badge.textContent = n > 99 ? '99+' : String(n);
if (badge) badge.classList.add('show');
/* 2026-10-04 「宝宝来信(新)」会话转产品:「一封信圈一,两封信圈二」→ 1~10 画成圈数字(①~⑩ 的样子:
白底红圈红字,CSS .t-badge.is-ring 画圈,不用 ① 字符本身 —— 各家字体里大小/粗细不一,叠在 tab 上会糊);
>10 换成实心红胶囊「10+」。读屏读 aria-label。 */
if (badge) {
badge.textContent = n > 10 ? '10+' : String(n);
badge.classList.toggle('is-ring', n <= 10);
badge.classList.toggle('d2', n === 10); // ⑩ 两位数,圈里字缩小
badge.setAttribute('aria-label', n + ' 封未读来信');
badge.classList.add('show');
}
}
/* 2026-10-02 底部导航:「宝宝来信」tab 的信封在有红点时轻轻晃(CSS .has-new)。
红点的 owner 仍是 renderLetterReminder,这里只跟着它的 .show 走,不另立判据。 */
@@ -5239,6 +5247,8 @@
document.addEventListener('visibilitychange', function () {
if (!document.hidden) syncLaixinReminder();
});
/* 从来信页「返回」时浏览器可能直接从往返缓存(bfcache)恢复本页,不一定触发 visibilitychange → 补一个 pageshow */
addEventListener('pageshow', function (e) { if (e.persisted) syncLaixinReminder(); });
/* 「授权完善资料」:H5 → navigateTo → 小程序端独立授权页(pages/annex/auth/index)。
说明:微信 web-view 的 postMessage 非实时送达(只在分享/后退/onHide 等时机