mama-box: real 小程序授权入口 — box_app /mp/public/mama-box/profile/auth (code→手机号, 昵称, 头像落库); H5 我的页加『授权完善资料』(postMessage)
This commit is contained in:
@@ -765,6 +765,15 @@
|
||||
</div>
|
||||
|
||||
<div class="page-body no-top">
|
||||
<!-- 授权完善资料:H5 → postMessage → 宿主小程序弹原生授权面板(手机号/昵称/头像) → box_app /profile/auth 落库 -->
|
||||
<div class="list-card" style="margin-top:12px">
|
||||
<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>
|
||||
<span class="li-v">获取手机号 / 昵称 / 头像</span>
|
||||
<i class="chev">›</i>
|
||||
</button>
|
||||
</div>
|
||||
<!-- ⚠️ 这两处的 data-modal 从 modalPreg 改成了 modalProfile:
|
||||
「编辑孕期信息」那张弹窗已整个并进「我的资料」(见文件末尾那段说明)。
|
||||
小名 / 性别 / 预产期现在只有一处能改,改完照样 syncPregnancy() 回刷这张卡。 -->
|
||||
|
||||
@@ -4131,6 +4131,15 @@
|
||||
b.addEventListener('click', goMall);
|
||||
});
|
||||
|
||||
/* 「授权完善资料」:H5 → 宿主小程序弹原生授权面板(手机号/昵称/头像)
|
||||
宿主授权后写 box_app /profile/auth,并更新 web-view src 带结果回传。 */
|
||||
var meAuth = $('#meAuthCard');
|
||||
if (meAuth) meAuth.addEventListener('click', function () {
|
||||
if (!(window.wx && window.wx.miniProgram)) { toast('请在微信小程序中打开'); return; }
|
||||
window.wx.miniProgram.postMessage({ data: { action: 'requestProfile' } });
|
||||
toast('请在弹出的小程序面板授权');
|
||||
});
|
||||
|
||||
/* 从商城/后台切回小程序首页时,webview 会再次可见 —— 把 H5 重置回「首页」屏。
|
||||
⚠️ 若不处理:切到商城再点「首页」tab,仍是同一个 webview 实例,
|
||||
SPA 还停留在切走前的屏(如「我的」),与"回到首页"的预期不符。
|
||||
|
||||
Reference in New Issue
Block a user