宝宝来信 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

@@ -7,7 +7,7 @@
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>兜爸心选 · 孕育陪伴</title>
<!-- V:26100433 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
<!-- V:26100434 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
<link rel="stylesheet" href="mama-box.css">
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<!-- 共享助手:授权/跳商城/位置上报(分享卡片同步,见 docs/h5-auth-standard.md 第四节) -->

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 等时机

View File

@@ -4633,3 +4633,7 @@ a.skip:focus{left:16px;top:16px}
.hero-zod.el-earth{--zg:linear-gradient(135deg,rgba(205,178,131,.28),rgba(167,138,90,.28) 55%,rgba(133,112,72,.30))}
.hero-zod.el-air {--zg:linear-gradient(135deg,rgba(159,189,240,.28),rgba(135,150,224,.28) 55%,rgba(115,120,204,.30))}
.hero-zod.el-water{--zg:linear-gradient(135deg,rgba(93,192,211,.28),rgba(58,144,194,.28) 55%,rgba(46,106,164,.30))}
/* 来信角标:1~10 画成圈数字(白底红圈红字 = ①~⑩ 的样子;js renderLetterReminder 加 .is-ring),>10 保持实心红胶囊「10+」 */
.t-badge.is-ring{width:17px;min-width:0;padding:0;background:#fff;border:1.5px solid #FF3B30;color:#FF3B30;
font:800 10.5px/14px -apple-system,"PingFang SC",sans-serif;box-shadow:0 0 0 1.5px #fff,0 2px 6px rgba(255,59,48,.30)}
.t-badge.is-ring.d2{font-size:8.5px;letter-spacing:-.4px}