From 0f0af3533d817c3565b1d28744e775e81518741e Mon Sep 17 00:00:00 2001 From: Karlcarlo Date: Sun, 20 Sep 2026 02:32:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A6=96=E9=A1=B5):=20=E6=9D=A5=E4=BF=A1?= =?UTF-8?q?=E5=8D=A1=E4=B8=8D=E5=86=8D=E7=9C=8B=20mama-box=20=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=BB=BA=E6=A1=A3=EF=BC=8C=E4=B8=8E=E7=BA=A2=E7=82=B9?= =?UTF-8?q?=E5=88=A4=E6=8D=AE=E5=AF=B9=E9=BD=90=EF=BC=88v26092005=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 生产实测发现的漏子:某 openid 在 laixin 有 1 封未读(红点亮),但 mama-box 档案未建档(pregnancy empty → state.pregEmpty=true),而 applyLaixinReminder 里带了这个条件 → 卡不显示。于是又出现「红点说有新信、卡里没有」—— 只是这次方向相反:是我自己加的判据把两处口径写歪了。 改法:卡只看 laixin 的未读数(与红点同一套判据),不再看 pregEmpty。 「档案未建档」和「宝宝来信里有没有信」本来就是两件事 —— 用户能从 laixin 收到信,未必在 mama-box 填过预产期。注释里写死了「别再加回来」。 验证:新增本地 mock 场景「laixin 未读=2 + pregnancy empty」→ 卡正常显示 (「小汤圆来信 / 有 1 封新信、1 条新回信 · 最近一封 今天 9:00」)且红点同亮; 访客(无 openid)仍收起。 --- index.html | 2 +- js/app.js | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index eb98fa5..ff904e2 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ 兜爸心选 · 孕育陪伴 - + diff --git a/js/app.js b/js/app.js index 0da44b4..5ca0624 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,7 @@ (function () { 'use strict'; /* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */ - var VER = '26092004'; + var VER = '26092005'; const $ = (s, c) => (c || document).querySelector(s); const $$ = (s, c) => Array.from((c || document).querySelectorAll(s)); @@ -1336,10 +1336,14 @@ function applyLaixinReminder(r) { const card = $('#homeLetter'), body = $('#homeBody'); if (!card) return; - /* 访客态(没身份)、后端说他没建档、上游降级、未读为 0 —— 一律收起。 - ⚠️ 与底 tab 角标同一套判据,两处别各写一份。 */ - const has = r && r.ok !== false && Number(r.unread) > 0; - if (!has || !hashParam('openid') || state.pregEmpty) { hideLetterCard(); return; } + /* 上游降级(ok:false)或未读为 0 —— 收起。 + ⚠️ 与底 tab 红点**同一套判据**,两处别各写一份(写歪一处就会出现 + 「红点亮了、卡没出来」这种自相矛盾的屏)。 + ⚠️⚠️ 这里**故意不看 state.pregEmpty**:那是「兜爸心选档案未建档」, + 与「宝宝来信里有没有信」是两件事。加过一版,结果生产上实测出 + 「红点有 1 封未读、卡不显示」—— 用户能从 laixin 收到信, + 却未必在 mama-box 填过预产期。别再加回来。 */ + if (!r || r.ok === false || !(Number(r.unread) > 0)) { hideLetterCard(); return; } const letters = Number(r.unreadLetters) || 0; const replies = Number(r.unreadReplies) || 0; /* 两种都有时分开讲,别合成一个含糊的总数(用户不知道「3」是什么东西) */