From e72feb9326c15647ab521d182db15175108d22cc Mon Sep 17 00:00:00 2001 From: Karlcarlo Date: Tue, 8 Sep 2026 00:21:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=94=A8=E6=88=B7=E7=A9=BA=E6=80=81:?= =?UTF-8?q?=20pregnancy=20=E6=9C=AA=E5=BB=BA=E6=A1=A3=E8=BF=94=E5=9B=9E=20?= =?UTF-8?q?empty(=E4=B8=8D=E5=86=8D=E9=BB=98=E8=AE=A4=E4=BB=8A=E5=A4=A9+3?= =?UTF-8?q?=E4=B8=AA=E6=9C=88);=20=E6=A0=B7=E4=BE=8B=E4=BF=A1=E5=8F=AA?= =?UTF-8?q?=E5=AF=B9=E5=B7=B2=E5=AE=8C=E5=96=84=E8=B5=84=E6=96=99=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=92=AD=E7=A7=8D;=20=E5=89=8D=E7=AB=AF=20pregEmpty?= =?UTF-8?q?=20=E5=BC=95=E5=AF=BC=E5=8D=A0=E4=BD=8D=20(v26090710)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 10 +++++----- js/app.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 8269961..4e4b358 100644 --- a/index.html +++ b/index.html @@ -6,8 +6,8 @@ 妈妈盒子 · 孕育陪伴 - - + + @@ -1758,8 +1758,8 @@ 加载失败/离线时 window.wx 为 undefined,goMall() 会降级为 toast 提示, 不影响应用其余功能。 --> - - -
v26090709
+ + +
v26090710
diff --git a/js/app.js b/js/app.js index 4a5deb2..2a5e0f0 100644 --- a/js/app.js +++ b/js/app.js @@ -1740,6 +1740,46 @@ /* 把 state 里的孕期信息刷到「我的」孕期卡 + 首页头部 + 档案页顶部 */ function syncPregnancy() { + /* ---- 新用户空态:未完善资料(无预产期)→ 全部显示引导占位,不读演示数据 ---- + me 页已有两条引导(授权卡 + 孕期信息必填卡);这里把首页/档案页的 + 孕周数字换成引导文案,避免新用户看到"孕 27 周"这类假数据。 */ + if (state.pregEmpty) { + const nm = state.babyName || '宝宝'; + /* ① 我的 · 孕期卡 → 引导 */ + $('#pcTitle').textContent = '待完善孕期信息'; + $('#pcSub').textContent = '填好预产期,开启孕期陪伴'; + $('#pcBar').style.setProperty('--p', '0%'); + const rg = $('#pcRing'); + if (rg) { + const C = 2 * Math.PI * parseFloat(rg.getAttribute('r')); + rg.setAttribute('stroke-dasharray', '0 ' + C.toFixed(2)); + } + $$('.pc-stage span').forEach((s) => { + s.textContent = s.textContent.split(' · ')[0]; + s.classList.remove('cur'); + }); + /* ② 首页 hero → 占位 */ + $('#heroWeek').textContent = '--'; + $('#heroPlus').textContent = ''; + $('#heroDays').textContent = '--'; + $('#heroWho').textContent = nm; + setRing($('#heroRing'), 0); + /* ③ 档案页 → 占位 */ + $('#arTitleName').textContent = nm; + $('#arLine1').textContent = '完善孕期信息后开启'; + $('#arDays').textContent = '--'; + $('#arLine2').textContent = '先去「我的资料」填预产期'; + $('#arPct').textContent = '0%'; + setArBar(0); + $('#genWeekTag').textContent = '--'; + /* ④ 信件/称呼:新用户无信(后端不播种),列表走 letterEmpty 空提示 */ + $('#replyTo').textContent = nm; + syncBabyWords(); + pushLatestToHome(); + renderLetters(); + renderLetterDetail(curLetter()); + return; + } const week = state.week, day = state.day, name = state.babyName; const days = week * 7 + day; // 一起生活了多少天 const weekTxt = '孕 ' + week + ' 周' + (day ? ' +' + day + ' 天' : ''); @@ -4033,9 +4073,16 @@ if (!p.userName) { var _ai2 = $('#meAvatarImg'); if (_ai2) _ai2.removeAttribute('src'); } } if (pg && pg.code === 200 && pg.result) { - state.week = pg.result.week; - state.day = pg.result.day; - if (pg.result.due) { const d = parseDay(pg.result.due); if (d) state.due = d; } + /* 新用户空态(未完善资料):后端不再给默认孕周 → 显示引导占位, + 不读任何演示数据(详见 syncPregnancy 的 pregEmpty 分支) */ + if (pg.result.empty || pg.result.week == null) { + state.pregEmpty = true; + } else { + state.pregEmpty = false; + state.week = pg.result.week; + state.day = pg.result.day; + if (pg.result.due) { const d = parseDay(pg.result.due); if (d) state.due = d; } + } } // 统一回刷依赖这些 state 的展示 syncPregnancy();