diff --git a/index.html b/index.html index f21f19f..6af0508 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ 兜爸心选 · 孕育陪伴 - + diff --git a/js/app.js b/js/app.js index 387345d..c5bcde5 100644 --- a/js/app.js +++ b/js/app.js @@ -3,7 +3,7 @@ (function () { 'use strict'; /* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */ - var VER = '26092201'; + var VER = '26092202'; const $ = (s, c) => (c || document).querySelector(s); const $$ = (s, c) => Array.from((c || document).querySelectorAll(s)); @@ -191,9 +191,13 @@ if (sessionStorage.getItem(RESUME_DONE_KEY)) return; // 同一 web-view 会话只尝试一次 const oid = hashParam('openid'); if (!oid) return; // 无身份不跳(宿主拿不到 openid 时也不会加载本页) - /* 先置闸门再请求:GET 失败/超时也不在本次会话里重试 —— - 宁可少恢复一次,也不要「用户切回首页 tab 时被突然跳走」。 */ + /* 先置闸门再请求/再判 norestore: + · #norestore=1 = 小程序首页壳**已经自己决策过**了(它直接把用户送进了目标应用, + 本页只是它留在身后的「返回落点」)—— 这里既不跳,也要用闸门占住, + 免得后续宿主 ?t= 重载(不带该标记)时又跳一次,把返回落点也换成目标应用。 + · 浏览器直访 / 首页壳取数失败后回落加载本页时,没有该标记 → 照旧自行恢复(兜底)。 */ sessionStorage.setItem(RESUME_DONE_KEY, '1'); + if (hashParam('norestore')) return; fetch(LAST_APP_API + '?openid=' + encodeURIComponent(oid)) .then(r => (r.ok ? r.json() : null)) .then(d => {