AGENTS.md 硬约定 14:goHome 前先 rememberIdentity(身份存 localStorage 的应用)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -109,10 +109,12 @@ nginx:`root /opt/app` + `Cache-Control: no-cache` + `etag on` —— 缓存靠
|
||||
- 原因:首页地址是后台动态配置的(见第 1 节),写死 `https://mp.yizhezhe.com/mama-box/` 会把用户送回旧首页。
|
||||
`goHome()`(`js/wx-auth.js` ⑦)先拉 `/api/mp/public/home/config` 再跳,自动续接 openid/unionid;1.5s 超时或接口坏 → 回退 `/mama-box/`。
|
||||
- 写法:`if (window.wxAuth && typeof wxAuth.goHome === 'function') { wxAuth.goHome(); return; }`,
|
||||
原来拼身份的写死地址只允许留作 **wxAuth 没加载时的兜底**。`wx-auth.js` 用绝对地址 `https://mp.yizhezhe.com/mama-box/js/wx-auth.js` 引入。
|
||||
原来拼身份的写死地址只允许留作 **wxAuth 没加载时的兜底**。
|
||||
⚠️ `goHome()` 的身份只认 URL + sessionStorage(`identity()`)。应用若把身份从 URL 抹掉、存在 localStorage 等别处,
|
||||
站内跳几次后回首页会带空身份 → 调 `goHome()` 前先 `wxAuth.rememberIdentity(openid, unionid)`(数胎动 2026-10-10 首个这么做)。`wx-auth.js` 用绝对地址 `https://mp.yizhezhe.com/mama-box/js/wx-auth.js` 引入。
|
||||
- 首页带 `return_url` 跳过去的应用(档案 / 婴儿房 / 商城)返回时回 `return_url` 即可(它就是当时的首页地址);**没带 `return_url` 时的兜底也要走 `goHome()`**,别 `history.back()`。
|
||||
- 本仓库自己:首页内部不要用 `goHome()`(那是给别的应用回来用的);`wx-auth.js` 里 `DEFAULT_HOME` 是唯一允许写死首页的地方。
|
||||
- 2026-10-09 普查(48 个目录):主返回写死 `/mama-box/`、已通知各自会话改的有 数胎动 taidong、孕检日历 chanjian-rili、待产清单 daichan-qingdan、
|
||||
- 2026-10-09 普查(48 个目录):主返回写死 `/mama-box/`、已通知各自会话改的有 数胎动 taidong(预览版已改,正式待批)、孕检日历 chanjian-rili(10-10 已上线,复扫通过)、待产清单 daichan-qingdan、
|
||||
体重 yunqi-tizhong、血糖 yunqi-xuetang、数宫缩 gongsuo-pinlv;laixin、laixin/youju、yunqi-nengbuchi、shengao-tizhong 已先调 goHome(写死仅兜底)。
|
||||
新接应用前照此检查:`curl -s https://mp.yizhezhe.com/<slug>/ | grep -n "mama-box/'\|goHome"`。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user