feat(首页): 宝宝来信不再上首页卡,只在底 tab 显示带数字的红圈 (v26100417)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-04 06:16:44 +00:00
parent 0ddd6348fb
commit f3af6bb839
3 changed files with 12 additions and 20 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:26100416 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
<!-- V:26100417 缓存版本标记:改 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 = '26100416';
var VER = '26100417';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -765,24 +765,11 @@
hideLetterCard();
return;
}
const card = $('#homeLetter'), body = $('#homeBody');
if (!card) return;
const letters = Number(r.unreadLetters) || 0;
const replies = Number(r.unreadReplies) || 0;
/* 两种都有时分开讲,别合成一个含糊的总数(用户不知道「3」是什么东西) */
let desc = (letters && replies) ? '有 ' + letters + ' 封新信、' + replies + ' 条新回信'
: replies ? '宝宝回了你 ' + replies + ' 条话'
: '宝宝给你写了 ' + letters + ' 封信';
const at = r.latestLetterAt ? Date.parse(r.latestLetterAt) : NaN;
if (!isNaN(at)) desc += ' · 最近一封 ' + fmtWhen(at);
$('#lcTitle').textContent = babyWord('来信');
$('#lcDesc').textContent = desc;
$('#lcLink').textContent = '读读' + babyWord('的话');
const num = $('#lcNum'); if (num) { const n = letters + replies; num.textContent = n > 99 ? '99+' : (n || ''); }
card.classList.add('has-new');
card.classList.remove('hide');
if (body) body.classList.remove('no-letter');
const hero = $('.home-hero'); if (hero) hero.classList.remove('no-letter');
/* 2026-10-04 用户:「宝宝来信不在首页卡片上展示了,有来信只在 tab 上给个明显的小提示,
一封就圈 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-02 底部导航:「宝宝来信」tab 的信封在有红点时轻轻晃(CSS .has-new)。

View File

@@ -4472,3 +4472,8 @@ a.skip:focus{left:16px;top:16px}
linear-gradient(180deg,rgba(255,255,255,.95) 0,rgba(255,255,255,.7) 70px,rgba(255,255,255,.5) 160px)!important;
box-shadow:0 -6px 18px rgba(150,60,40,.10),0 12px 30px rgba(190,110,80,.10),0 2px 6px rgba(190,110,80,.04),inset 0 1px 0 #fff!important}
.tool-dock .wm{top:10px}
/* 2026-10-04 宝宝来信不再上首页卡,只在底 tab 提示:红点改成带数字的红圈(1 / 2 / … / 99+) */
.t-badge{min-width:17px;width:auto;height:17px;padding:0 4.5px;box-sizing:border-box;top:2px;left:calc(50% + 6px);
border-radius:999px;border:1.5px solid #fff;color:#fff;font:700 10.5px/14px -apple-system,"PingFang SC",sans-serif;text-align:center;
box-shadow:0 2px 6px rgba(255,59,48,.35)}