夜间自迭代体检(生产四tab+7子页,截图+console+接口+文案标志采集) 发现三类问题,本轮修复: 1. 信息架构(采纳用户建议):今日页「我的地图」四宫格三项与底部tab 重复(问/练),仅学习中心/工作上报有增量 → 整块从今日页移除, 「学习中心/我的训练概况/工作上报」下沉到「我」页新「常用功能」组 (图标+标题+说明行,与我的积分同列);今日页保留小贴士条, 页面高度显著缩短、不再与tab栏功能重复。 2. 内部编码泄漏:派发 reason 里的调度批次码(AUTO22-20260717 PILOT-04)在今日「今日安排」、练页「最近练过」、学习中心 「昨日错题重练」三处原样示人 → 新增 services/text.ts stripInternalCodes(剥前缀码保留人话,整行为码则回退默认文案), 三处渲染点统一接入。 3. 功能不通:直接访问 /pages/user/exam/index(无id)会请求 /api/aihr/mobile/exams/0 → 服务端500 → load() 增加 id 守卫, 显示「请从学习中心·考试任务进入」且不再发请求。 同时:今日「打字问」描述改为不换行文案(原两行文案窄列截断)。 验证:本地7项断言全过;生产复核 map removed/code clean/ profile entries/exam guard/exams|0 not fired 全 true。 发布备份 h5-before-20260718055449。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
23 lines
891 B
TypeScript
23 lines
891 B
TypeScript
/**
|
|
* Internal dispatch/batch codes (e.g. "AUTO22-20260717 PILOT-04", "SOP-LG-001")
|
|
* come from seeding/request keys and must never surface to employees.
|
|
*/
|
|
const CODE_TOKEN = /^[A-Za-z][A-Za-z0-9]*(?:[-_][A-Za-z0-9]+)+$/;
|
|
|
|
const isCodeToken = (token: string) => CODE_TOKEN.test(token) && /\d/.test(token);
|
|
|
|
/** True when the whole line is just an internal code (used to drop list items). */
|
|
export const isInternalCode = (text = '') => isCodeToken(text.trim());
|
|
|
|
/** Remove leading internal code tokens, keeping the human-readable remainder. */
|
|
export const stripInternalCodes = (text = '') => {
|
|
const value = text.trim();
|
|
if (!value) return '';
|
|
const parts = value.split(/\s+/);
|
|
let index = 0;
|
|
while (index < parts.length && isCodeToken(parts[index])) index += 1;
|
|
if (index === 0) return value;
|
|
const rest = parts.slice(index).join(' ').trim();
|
|
return rest || value;
|
|
};
|