From 95a25ad3c3eb12fed194a20738aefaa96d8a9125 Mon Sep 17 00:00:00 2001 From: Karlcarlo Date: Mon, 7 Sep 2026 17:53:24 +0800 Subject: [PATCH] =?UTF-8?q?mama-box:=20real=20=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E5=85=A5=E5=8F=A3=20=E2=80=94=20box=5Fapp=20?= =?UTF-8?q?/mp/public/mama-box/profile/auth=20(code=E2=86=92=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E5=8F=B7,=20=E6=98=B5=E7=A7=B0,=20=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E8=90=BD=E5=BA=93);=20H5=20=E6=88=91=E7=9A=84=E9=A1=B5?= =?UTF-8?q?=E5=8A=A0=E3=80=8E=E6=8E=88=E6=9D=83=E5=AE=8C=E5=96=84=E8=B5=84?= =?UTF-8?q?=E6=96=99=E3=80=8F(postMessage)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 9 +++++++++ js/app.js | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/index.html b/index.html index 540eaa2..a60c82d 100644 --- a/index.html +++ b/index.html @@ -765,6 +765,15 @@
+ +
+ +
diff --git a/js/app.js b/js/app.js index 48ce534..fdfde06 100644 --- a/js/app.js +++ b/js/app.js @@ -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 还停留在切走前的屏(如「我的」),与"回到首页"的预期不符。