diff --git a/index.html b/index.html index c661173..a49a778 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ 兜爸心选 · 孕育陪伴 - + diff --git a/js/app.js b/js/app.js index e997fa6..4a6f31e 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,7 @@ (function () { 'use strict'; /* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */ - var VER = '26092008'; + var VER = '26092009'; const $ = (s, c) => (c || document).querySelector(s); const $$ = (s, c) => Array.from((c || document).querySelectorAll(s)); @@ -738,11 +738,18 @@ ? '还没填预产期,孕周先锁着 —— 选好上面的预产期就会自动算出来。' : '已按预产期自动算出,觉得不准可以自己微调。'; } - /* 缓存戳重载:URL 已有 query 时必须用 & 拼接 —— 直接拼 '?t=' 会把 - 第二个 ? 吃进已有参数值里(?openid=abc001?t=123 → openid 变脏)。 */ + /* 缓存戳重载:只换查询串(?t=…),两处都不能丢: + ① URL 已有 query 时必须用 & 拼接 —— 直接拼 '?t=' 会把第二个 ? 吃进已有参数值里 + (?openid=abc001?t=123 → openid 变脏); + ② **hash 必须原样拼回去** —— openid/unionid 只活在 hash 里(宿主注入的形态是 + …/mama-box/#openid=…&unionid=…),丢掉 hash 再重载 = 把身份一起丢了 → + applyRemoteProfile 走访客分支:误报「未获取到微信身份」、孕周清空、 + 昵称/头像也拉不到(后端其实都保留着)。 + 调用它的两个场景都要求身份还在:① 退出授权登录(只翻授权状态,资料保留) + ② 新用户首次完善资料(重载后要按服务端孕周显示)。 */ function bustReload() { const b = location.href.split('#')[0]; - location.replace(b + (b.indexOf('?') >= 0 ? '&' : '?') + 't=' + Date.now()); + location.replace(b + (b.indexOf('?') >= 0 ? '&' : '?') + 't=' + Date.now() + location.hash); } /* state.due / week / day 在 fetch 返回前是内置默认 —— 不能在脚本加载时