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

@@ -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;