mama-box: real 小程序授权入口 — box_app /mp/public/mama-box/profile/auth (code→手机号, 昵称, 头像落库); H5 我的页加『授权完善资料』(postMessage)
This commit is contained in:
@@ -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