diff --git a/index.html b/index.html index 30f97ef..4659ab6 100644 --- a/index.html +++ b/index.html @@ -6,8 +6,8 @@ 妈妈盒子 · 孕育陪伴 - - + + @@ -1758,8 +1758,8 @@ 加载失败/离线时 window.wx 为 undefined,goMall() 会降级为 toast 提示, 不影响应用其余功能。 --> - - -
v26090711
+ + +
v26090712
diff --git a/js/app.js b/js/app.js index cf1e2f6..4efdeb7 100644 --- a/js/app.js +++ b/js/app.js @@ -4035,11 +4035,14 @@ 打回白板。同样静默失败,不打断用户。 ⚠️ 竞态:fetch 异步,回来时 init() 已跑完,这里只需回刷那些读 state 的展示。 */ function hashParam(name) { + /* 同时读 hash 和 query:浏览器直访(?openid=x)只有 query; + 小程序 web-view 的授权回传在 hash(微信 webview 丢 query 不丢 hash)。 + ⚠️ 先在原始串上匹配、再对捕获值 decode —— 先 decode 整串会把 + %26 之类的编码提前还原成 &,破坏参数切分。 */ try { - const h = decodeURIComponent(location.hash.slice(1)); - /* openid 是首个参数时前面没有 &/#(如 "#openid=x"),[&#] 是"或",作可省处理 */ + const h = (location.hash.slice(1) || '') + '&' + (location.search.slice(1) || ''); const m = h.match(new RegExp('(?:^|[&#])' + name + '=([^&#]*)')); - return m ? m[1] : ''; + return m ? decodeURIComponent(m[1]) : ''; } catch (e) { return ''; } } let _profileApplied = false;