mama-box: 匿名→授权→完善身份体系 — box_app /profile 返回 isAuthorized;H5 我的页状态化(未授权占位+授权入口, 已授权隐藏入口)

This commit is contained in:
2026-09-07 18:18:04 +08:00
parent 62724c2e58
commit 44f21eff91
2 changed files with 7 additions and 4 deletions

View File

@@ -744,7 +744,7 @@
</i>
</div>
<div class="me-info">
<div class="me-name" id="meName">小满妈妈</div>
<div class="me-name" id="meName">未登录</div>
<!-- ⚠️ 这里先后住过两样东西,两样都已经删了,别再往回搬:
① 最早是「孕 24 周 +3 天 · 预产期 12月22日」,由 syncPregnancy() 刷。
删它是因为**重复**:往下滚一屏就是孕期卡,孕周、预产期、
@@ -766,7 +766,7 @@
<div class="page-body no-top">
<!-- 授权完善资料:H5 → postMessage → 宿主小程序弹原生授权面板(手机号/昵称/头像) → box_app /profile/auth 落库 -->
<div class="list-card" style="margin-top:12px">
<div class="list-card" style="margin-top:12px" id="meAuthBox">
<button class="li ripple" id="meAuthCard">
<span class="li-ico o"><svg viewBox="0 0 24 24" width="19" height="19" aria-hidden="true"><rect x="5" y="10.5" width="14" height="9.5" rx="2.5" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M8.5 10.5V8a3.5 3.5 0 0 1 7 0v2.5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 15v2" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg></span>
<span class="li-t">授权完善资料</span>

View File

@@ -3985,13 +3985,16 @@
if (p.userName) state.userName = p.userName;
if (p.babySex && p.babySex !== 'unknown') state.babySex = p.babySex;
if (p.dueDate) { const d = parseDay(p.dueDate); if (d) state.due = d; }
/* 授权/同步后即时刷「我的」页的昵称与头像(此前只在保存时写,异步拉取不回刷) */
if (p.userName) { var _n = $('#meName'); if (_n) _n.textContent = state.userName; }
/* 状态化「我的」页:未授权→占位+显示授权入口;已授权→资料+隐藏授权入口;已建档(B→C)由孕期信息卡引导 */
var _auth = !!(p.userName || p.avatar || p.phone);
var _n = $('#meName'); if (_n) _n.textContent = p.userName || '未登录';
if (p.avatar) {
var _ai = $('#meAvatarImg'), _aw = $('#meAvatar');
if (_ai) _ai.src = p.avatar;
if (_aw) _aw.classList.add('has-img');
}
var _box = $('#meAuthBox'); if (_box) _box.style.display = _auth ? 'none' : '';
if (!p.userName) { var _ai2 = $('#meAvatarImg'); if (_ai2) _ai2.removeAttribute('src'); }
}
if (pg && pg.code === 200 && pg.result) {
state.week = pg.result.week;