diff --git a/index.html b/index.html
index dd89794..0fdddda 100644
--- a/index.html
+++ b/index.html
@@ -765,7 +765,7 @@
-
+
+
+
+
+
+
diff --git a/js/app.js b/js/app.js
index 47c3fec..544c27c 100644
--- a/js/app.js
+++ b/js/app.js
@@ -4141,13 +4141,40 @@
b.addEventListener('click', goMall);
});
- /* 「授权完善资料」:H5 → 宿主小程序弹原生授权面板(手机号/昵称/头像)
- 宿主授权后写 box_app /profile/auth,并更新 web-view src 带结果回传。 */
+ /* 「授权完善资料」:H5 → navigateTo → 小程序端独立授权页(pages/annex/auth/index)。
+ 说明:微信 web-view 的 postMessage 非实时送达(只在分享/后退/onHide 等时机
+ 才派发 bindmessage),点按钮时端上收不到 → 改用 wx.miniProgram.navigateTo
+ 实时跳转到授权页,避开该限制。 */
+ function goAuth() {
+ haptic();
+ if (window.wx && window.wx.miniProgram) {
+ window.wx.miniProgram.navigateTo({ url: '/pages/annex/auth/index' });
+ } else {
+ toast('请在微信小程序中打开');
+ }
+ }
var meAuth = $('#meAuthCard');
- if (meAuth) meAuth.addEventListener('click', function () {
+ if (meAuth) meAuth.addEventListener('click', goAuth);
+
+ /* 「退出登录」:清除本机身份(openid/unionid/资料展示) → 重新加载页面回到未登录态。
+ 入口跳到授权页,便于直接测试授权流程。 */
+ var meLogout = $('#meLogoutCard');
+ if (meLogout) meLogout.addEventListener('click', function () {
+ haptic();
if (!(window.wx && window.wx.miniProgram)) { toast('请在微信小程序中打开'); return; }
- window.wx.miniProgram.postMessage({ data: { action: 'requestProfile' } });
- toast('请在弹出的小程序面板授权');
+ try { if (location.hash) location.hash = ''; } catch (e) {}
+ // 清除本地读取到的 openid/unionid,回到未登录态
+ try {
+ var base = location.href.split('#')[0];
+ // 保留 query 里的结构与版本戳,仅去掉身份参数
+ var q = (location.search || '').replace(/([?&])openid=[^&]*(&|$)/g, '$1')
+ .replace(/([?&])unionid=[^&]*(&|$)/g, '$1').replace(/\?&$/, '?').replace(/&$/, '');
+ var url = base + (q && q !== '?' ? q : '') ;
+ // 重新加载当前 H5(去掉身份)→ applyRemoteProfile 因无 openid 跳过,页面回到未登录占位
+ location.replace(url + '?t=' + Date.now());
+ } catch (e) {
+ toast('已清除身份');
+ }
});
/* 从商城/后台切回小程序首页时,webview 会再次可见 —— 把 H5 重置回「首页」屏。
diff --git a/mama-box.css b/mama-box.css
index 2cf6174..e338fee 100644
--- a/mama-box.css
+++ b/mama-box.css
@@ -1900,6 +1900,7 @@ a.skip:focus{left:16px;top:16px}
.li-ico.p{background:#EFE9FA;color:#7B5FD4}
.li-ico.o{background:#FBEDE3;color:#DE7443}
.li-ico.b{background:#E6EFF8;color:#4478BC}
+.li-ico.r{background:#FBE9E7;color:#C33A2E}
.li-t{font-size:16.5px;font-weight:700}
.li-v{margin-left:auto;font-size:13px;color:var(--brand);font-weight:600}
.li .chev{margin-left:auto}