fix(auth): 企微提醒卡片深链登录后回跳原目标

- 新增 shared/utils/redirect.ts 安全回跳校验(防开放重定向)
- 路由守卫未登录跳转携带 redirect 完整深链,已登录访问登录页优先回跳
- 登录成功统一按 redirect 深链落地,支持企微卡片点击直达精益培训模块
This commit is contained in:
runny committed 2026-09-11 04:09:56 +08:00
1 parent f1beb6fefb
commit 1034435355
15 files changed
+656 -38

No files matched your search

+1
View File
@@ -67,6 +67,7 @@
| 培训配置管理 | 已实现 | `TrainingConfigResource` 增加 `training_level`;管理端按公司级、部门级、班组级卡片独立增删资料;知识库候选仅允许“员工培训”分组内未删除文档的当前版本;员工端按 `safetyStage` 动态展示当前级别资料 |
| 精益培训对象化任务与提醒 | 已实现 | HR 按系统角色或指定用户(并集)发布精益周任务;任务、看板和提醒只处理冻结对象,首次发布与定向催学均复用企微提醒审计幂等去重。学员端“精益管理”按时间树展示全部已发布任务(按任务周期倒序、最新在上),每期任务带状态徽章(进行中/已延期/已完成,由服务端按截止时间与完成记录判定)、任务周期区间与视频缩略图(点击弹窗播放,须播放到结尾才判定观看完成并由服务端持久化,提前关闭或拖拽跳过不计);提交学习感悟前校验:未观看全部已推送视频或感悟字数不达标时拦截并友好提示;任务"已完成"仅在感悟提交后落定。 |
| 精益周任务规则化推送 | 已实现 | 任务周(周一)与截止时间默认按当周计算且**支持修改**(可指定任意自然周与截止时刻,须为周一且截止不早于所选周周一;修改后【发布周任务】/【立即新增任务补推】均作用于所选周任务);培训视频列表分页展示(4 条/页),已推送视频默认勾选、不可取消并带"第X周 MM-DD至MM-DD"周次标签,推过的视频不重复推直至全部推完;【发布周任务】对所选周任务发布并首次自动推首批,【立即新增任务补推】按游标对所选周任务增推;平台排程每周一 09:00(Asia/Shanghai)自动滚动创建当周任务(模板取严格早于当周的最近一期,游标继承进度)并推送下一批,无需人工维护;每批推送成功后立即向受训人员发送企微通知,并对"已延期"(过截止未提交)人员立即发送延期提醒(event_key 幂等防重);学员端任务期号统一采用后端 week_index 口径。规则手册见 [docs/features/training/精益管理周任务规则手册.md](features/training/精益管理周任务规则手册.md) |
| 培训分享入口 | 前端已实现 | 员工培训页培训类型页签行右侧新增分享按钮,仅具备 `training_hr_manage`(培训管理)权限的用户可见;点击弹出分享弹窗,支持复制链接或下载二维码,链接指向 `/chat/<agentId>?training_type=<当前培训类型>` 深链,接收者点击或扫码后在登录页登录,登录成功自动回跳员工培训页并定位到对应培训类型(如“出国规章培训”);文案覆盖 zh-CN/zh-TW/en/th 四语言 |
| 培训主链推荐架构 | 已文档化 | 推荐采用“受控考试主链 + Dify 辅助问答/ChatBI”的混合方案;培训 Agent 对接 Dify 时会额外透传后台账号 `role`,便于区分学员/HR 问答分支,见 [docs/新人入职培训Agent_推荐落地方案.md](新人入职培训Agent_推荐落地方案.md) |
| 培训业务闭环整改清单 | 已文档化 | 见[docs/新人入职培训Agent_闭环整改清单.md](新人入职培训Agent_闭环整改清单.md) |
+331 -3
View File
@@ -20,6 +20,7 @@
"marked": "^17.0.3",
"pdfjs-dist": "^5.6.205",
"pinia": "^3.0.4",
"qrcode": "^1.5.4",
"vue": "^3.5.25",
"vue-i18n": "^11.2.8",
"vue-router": "^4.6.4",
@@ -28,6 +29,7 @@
"devDependencies": {
"@types/node": "^24.10.1",
"@types/pdfjs-dist": "^2.10.377",
"@types/qrcode": "^1.5.6",
"@vitejs/plugin-vue": "^6.0.2",
"@vue/test-utils": "^2.4.11",
"@vue/tsconfig": "^0.8.1",
@@ -1179,6 +1181,16 @@
"pdfjs-dist": "*"
}
},
"node_modules/@types/qrcode": {
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.6.tgz",
"integrity": "sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/raf": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@types/raf/-/raf-3.4.3.tgz",
@@ -1845,6 +1857,15 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
}
},
"node_modules/camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/camelcase-css": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/camelcase-css/-/camelcase-css-2.0.1.tgz",
@@ -1954,6 +1975,87 @@
"node": ">= 6"
}
},
"node_modules/cliui": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
"license": "ISC",
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^6.2.0"
}
},
"node_modules/cliui/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/cliui/node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"license": "MIT",
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/cliui/node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"license": "MIT"
},
"node_modules/cliui/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"license": "MIT",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/cliui/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/cliui/node_modules/wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
"license": "MIT",
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/codepage": {
"version": "1.15.0",
"resolved": "https://registry.npmmirror.com/codepage/-/codepage-1.15.0.tgz",
@@ -1967,7 +2069,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-name": "~1.1.4"
@@ -1980,7 +2081,6 @@
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"license": "MIT"
},
"node_modules/commander": {
@@ -2134,6 +2234,15 @@
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
}
},
"node_modules/decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/decimal.js": {
"version": "10.6.0",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz",
@@ -2157,6 +2266,12 @@
"integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
"license": "Apache-2.0"
},
"node_modules/dijkstrajs": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",
"integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==",
"license": "MIT"
},
"node_modules/dlv": {
"version": "1.1.3",
"resolved": "https://registry.npmmirror.com/dlv/-/dlv-1.1.3.tgz",
@@ -2363,6 +2478,19 @@
"node": ">=8"
}
},
"node_modules/find-up": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
"license": "MIT",
"dependencies": {
"locate-path": "^5.0.0",
"path-exists": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/foreground-child": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
@@ -2426,6 +2554,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"license": "ISC",
"engines": {
"node": "6.* || 8.* || >= 10.*"
}
},
"node_modules/glob": {
"version": "10.5.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz",
@@ -2577,7 +2714,6 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@@ -3021,6 +3157,18 @@
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
"license": "MIT"
},
"node_modules/locate-path": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
"license": "MIT",
"dependencies": {
"p-locate": "^4.1.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/lru-cache": {
"version": "11.5.2",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz",
@@ -3262,6 +3410,42 @@
"node": ">=12.20.0"
}
},
"node_modules/p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
"license": "MIT",
"dependencies": {
"p-try": "^2.0.0"
},
"engines": {
"node": ">=6"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-locate": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
"license": "MIT",
"dependencies": {
"p-limit": "^2.2.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/package-json-from-dist": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
@@ -3318,6 +3502,15 @@
"dev": true,
"license": "MIT"
},
"node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
@@ -3448,6 +3641,15 @@
"node": ">= 6"
}
},
"node_modules/pngjs": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
"integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==",
"license": "MIT",
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/postcss": {
"version": "8.5.21",
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.21.tgz",
@@ -3639,6 +3841,23 @@
"node": ">=6"
}
},
"node_modules/qrcode": {
"version": "1.5.4",
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
"integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",
"license": "MIT",
"dependencies": {
"dijkstrajs": "^1.0.1",
"pngjs": "^5.0.0",
"yargs": "^15.3.1"
},
"bin": {
"qrcode": "bin/qrcode"
},
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz",
@@ -3709,6 +3928,15 @@
"license": "MIT",
"optional": true
},
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/require-from-string": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
@@ -3719,6 +3947,12 @@
"node": ">=0.10.0"
}
},
"node_modules/require-main-filename": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
"license": "ISC"
},
"node_modules/resolve": {
"version": "1.22.12",
"resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.22.12.tgz",
@@ -3849,6 +4083,12 @@
"node": ">=10"
}
},
"node_modules/set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
"license": "ISC"
},
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@@ -4834,6 +5074,12 @@
"node": ">= 8"
}
},
"node_modules/which-module": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
"integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
"license": "ISC"
},
"node_modules/why-is-node-running": {
"version": "2.3.0",
"resolved": "https://registry.npmmirror.com/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
@@ -5005,6 +5251,12 @@
"dev": true,
"license": "MIT"
},
"node_modules/y18n": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
"integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
"license": "ISC"
},
"node_modules/yaml": {
"version": "2.8.2",
"resolved": "https://mirrors.tencent.com/npm/yaml/-/yaml-2.8.2.tgz",
@@ -5019,6 +5271,82 @@
"funding": {
"url": "https://github.com/sponsors/eemeli"
}
},
"node_modules/yargs": {
"version": "15.4.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
"license": "MIT",
"dependencies": {
"cliui": "^6.0.0",
"decamelize": "^1.2.0",
"find-up": "^4.1.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^4.2.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^18.1.2"
},
"engines": {
"node": ">=8"
}
},
"node_modules/yargs-parser": {
"version": "18.1.3",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
"license": "ISC",
"dependencies": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/yargs/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/yargs/node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"license": "MIT"
},
"node_modules/yargs/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"license": "MIT",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/yargs/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
}
}
}
+2
View File
@@ -22,6 +22,7 @@
"marked": "^17.0.3",
"pdfjs-dist": "^5.6.205",
"pinia": "^3.0.4",
"qrcode": "^1.5.4",
"vue": "^3.5.25",
"vue-i18n": "^11.2.8",
"vue-router": "^4.6.4",
@@ -30,6 +31,7 @@
"devDependencies": {
"@types/node": "^24.10.1",
"@types/pdfjs-dist": "^2.10.377",
"@types/qrcode": "^1.5.6",
"@vitejs/plugin-vue": "^6.0.2",
"@vue/test-utils": "^2.4.11",
"@vue/tsconfig": "^0.8.1",
+9 -4
View File
@@ -2,7 +2,8 @@
* app/router/guards.ts
* 全局路由守卫:认证、权限、旧 URL 兼容、document.title。
* 依赖:vue-router、config、auth.store、i18n、adminModulePath、isPublicPath、useMessage、contract-payment 权限常量。
* 逻辑:beforeEach 做登录/管理员/功能权限校验;afterEach 将 meta.title(i18n key 或字面量)解析为浏览器标题。
* 逻辑:beforeEach 做登录/管理员/功能权限校验,未登录跳登录页时携带 redirect 深链参数(登录后原样回跳);
* afterEach 将 meta.title(i18n key 或字面量)解析为浏览器标题。
*/
import type { Router } from 'vue-router';
import { config } from '@/config';
@@ -11,6 +12,7 @@ import { useAuthStore } from '@/features/auth/stores/auth.store';
import { CONTRACT_PAYMENT_ACCESS_PERMISSION } from '@/features/contract-payment/constants';
import { isPublicPath } from '@/shared/constants/routes';
import { useMessage } from '@/shared/composables/useMessage';
import { resolveSafeRedirect } from '@/shared/utils/redirect';
import i18n from '@/i18n';
/**
@@ -57,7 +59,7 @@ function setupChunkLoadRecovery(router: Router): void {
}
/**
注册全局 beforeEach / afterEach:登录、管理员、功能权限与页面标题。
* 注册全局 beforeEach / afterEach:登录、管理员、功能权限与页面标题。
* 核心逻辑:requiresAdmin 仍静默回应用管理;requiresFeaturePermission 会提示后再跳转,避免用户以为入口损坏。
* @param router - 应用根路由实例
*/
@@ -79,12 +81,15 @@ export function setupRouterGuards(router: Router): void {
}
if (to.path === '/login' && auth.isLoggedIn) {
next('/workspace/applications');
// 已登录访问登录页:优先回跳 redirect 深链(如企微卡片点入),避免丢失原目标
const redirect = resolveSafeRedirect(to.query.redirect);
next(redirect || '/workspace/applications');
return;
}
if (!auth.isLoggedIn && !isPublicPath(to.path)) {
next('/login');
// 未登录:携带完整深链(含 query)跳登录页,登录成功后原样回跳,保证企微卡片“点击直达”
next({ path: '/login', query: { redirect: to.fullPath } });
return;
}
@@ -2,10 +2,12 @@
* features/auth/composables/useLogin.ts
* 登录页编排层:组合认证、公告展示与 OAuth 回调,provide 给 LoginView 子组件。
* 依赖:auth.store、linked-nav.store、useLoginAuth、useLoginLanding。
* 逻辑:登录成功后预取关联服务侧栏入口,减少进入 Chat/工作台后的入口闪现。
* 逻辑:登录成功后优先按守卫携带的 redirect 深链回跳(企微提醒卡片“点击直达”场景),
* 无 redirect 时按 SSO continuation 或默认页落地;登录成功前预取关联服务侧栏入口,减少进入 Chat/工作台后的闪现。
*/
import { onMounted, reactive } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import type { RouteLocationRaw } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { config } from '@/config';
import { useTheme } from '@/shared/composables/useTheme';
@@ -16,6 +18,7 @@ import { DEFAULT_POST_LOGIN_AGENT_ID } from '@/features/workspace/types/workspac
import { useWorkspaceLocale } from '@/features/workspace/composables/useWorkspaceLocale';
import { continuationLocation, readSsoContinuation } from '@/features/sso';
import { useLinkedNavStore } from '@/features/sso/stores/linked-nav.store';
import { resolveSafeRedirect } from '@/shared/utils/redirect';
import { useLoginAuth } from './useLoginAuth';
import { useLoginLanding } from './useLoginLanding';
@@ -31,26 +34,34 @@ export function useLogin() {
const deps = { t, locale, msg, router, route, setThemePreference, appliedTheme };
const landing = useLoginLanding();
/**
* 解析本次登录的最终落地页。
* AI 触发时机:密码/OAuth 登录成功后、以及已登录用户访问登录页时调用。
* 核心逻辑:优先取守卫写入的 redirect 深链(如企微精益提醒卡片 /chat/16?training_type=lean_management),
* 保证“点卡片 → 登录 → 直达精益模块”;其次 SSO continuation;最后由调用方按登录方式给默认页。
* redirect 已由 resolveSafeRedirect 做站内路径校验,防开放重定向(如 //evil.com)。
* Returns:站内跳转目标(字符串路径或路由对象);无可回跳目标时返回空串。
*/
const resolvePostLoginLocation = (): RouteLocationRaw | '' => {
const redirect = resolveSafeRedirect(route.query.redirect);
if (redirect) return redirect;
const continuation = readSsoContinuation();
if (continuation) return continuationLocation(continuation);
return '';
};
const completePasswordLogin = async () => {
authStore.syncFromStorage();
void linkedNav.ensureLoaded({ force: true });
const continuation = readSsoContinuation();
if (continuation) {
await router.replace(continuationLocation(continuation));
return;
}
await router.replace(`/chat/${DEFAULT_POST_LOGIN_AGENT_ID}`);
const target = resolvePostLoginLocation();
await router.replace(target || `/chat/${DEFAULT_POST_LOGIN_AGENT_ID}`);
};
const completeOAuthLogin = async () => {
authStore.syncFromStorage();
void linkedNav.ensureLoaded({ force: true });
const continuation = readSsoContinuation();
if (continuation) {
await router.replace(continuationLocation(continuation));
return;
}
await router.replace('/workspace/applications');
const target = resolvePostLoginLocation();
await router.replace(target || '/workspace/applications');
};
const loginAuth = useLoginAuth(deps, { completePasswordLogin, completeOAuthLogin });
@@ -75,8 +86,9 @@ export function useLogin() {
authStore.syncFromStorage();
if (authStore.isLoggedIn) {
const continuation = readSsoContinuation();
await router.replace(continuation ? continuationLocation(continuation) : '/workspace/applications');
// 已登录访问登录页:优先回跳 redirect 深链(如企微卡片点入),避免丢失原目标
const target = resolvePostLoginLocation();
await router.replace(target || '/workspace/applications');
return;
}
@@ -0,0 +1,160 @@
<!--
features/chat/components/TrainingShareModal.vue
用途:员工培训分享弹窗——把"当前培训模块深链 + 二维码"提供给有培训管理权限的 HR/管理员,
供其复制链接或下载二维码后分发给员工(企微/短信/海报等渠道)。
依赖:qrcode(前端生成二维码 dataURL)、copyTextToClipboard(shared/utils/clipboard)、useMessage。
逻辑:由 TrainingWorkspacePanel 以 v-model:open 控制显隐;打开时按 shareUrl 生成二维码;
接收方打开链接 → 登录 → 由面板深链逻辑自动定位到对应培训模块(见 TrainingWorkspacePanel.vue)。
-->
<script setup lang="ts">
import { ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import QRCode from 'qrcode';
import { Copy, Download, Share2, XCircle } from 'lucide-vue-next';
import { copyTextToClipboard } from '@/shared/utils/clipboard';
import { useMessage } from '@/shared/composables/useMessage';
const props = defineProps<{
open: boolean;
/** 分享深链:/chat/<agentId>?training_type=<code>,由调用方拼好完整绝对地址。 */
shareUrl: string;
/** 当前分享的培训模块名称,仅用于弹窗内文案展示。 */
trainingName: string;
}>();
const emit = defineEmits<{
'update:open': [open: boolean];
}>();
const { t } = useI18n();
const msg = useMessage();
const qrDataUrl = ref('');
const qrGenerating = ref(false);
watch(
() => [props.open, props.shareUrl] as const,
async ([open, url]) => {
if (!open || !url) return;
qrGenerating.value = true;
try {
// 纠错级别 H:二维码可能被打印后裁剪/污损,取最高冗余保证扫码成功率。
qrDataUrl.value = await QRCode.toDataURL(url, { width: 240, margin: 2, errorCorrectionLevel: 'H' });
} catch {
qrDataUrl.value = '';
} finally {
qrGenerating.value = false;
}
},
{ immediate: true },
);
const closeModal = () => emit('update:open', false);
/**
* 复制培训深链到剪贴板(兼容企微 WebView 等 clipboard API 受限环境)。
* AI 触发时机:HR 在分享弹窗点击“复制链接”时调用;结果必须用 useMessage 明确反馈成败。
*/
const copyShareLink = async () => {
const ok = await copyTextToClipboard(props.shareUrl);
if (ok) {
msg.success(t('chat.training.share.copied'));
} else {
msg.error(t('chat.training.share.copyFailed'));
}
};
/**
* 把当前二维码下载为 PNG 图片,供 HR 插入海报/群公告等离线场景。
* AI 触发时机:HR 在分享弹窗点击“下载二维码”时调用;二维码未生成完成时禁止下载。
*/
const downloadQrCode = () => {
if (!qrDataUrl.value) return;
const link = document.createElement('a');
link.href = qrDataUrl.value;
link.download = `training-share-qr-${Date.now()}.png`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
</script>
<template>
<Teleport to="body">
<div
v-if="open"
class="fixed inset-0 z-[100] flex items-center justify-center bg-slate-950/80 p-4 backdrop-blur-sm"
@click.self="closeModal"
>
<div class="relative w-full max-w-md overflow-hidden rounded-3xl bg-white shadow-2xl">
<div class="flex items-center justify-between border-b border-default px-6 py-4">
<h3 class="flex items-center gap-2 text-lg font-semibold text-primary">
<Share2 class="h-5 w-5 text-brand-600" />
{{ $t('chat.training.share.title') }}
</h3>
<button
type="button"
class="flex h-8 w-8 items-center justify-center rounded-full bg-surface-soft text-secondary transition hover:bg-surface hover:text-primary"
:aria-label="$t('chat.training.share.close')"
@click="closeModal"
>
<XCircle class="h-5 w-5" />
</button>
</div>
<div class="flex flex-col gap-4 px-6 py-5">
<p class="text-sm leading-6 text-secondary">
{{ $t('chat.training.share.description', { name: trainingName }) }}
</p>
<!-- 培训链接:只读展示 + 一键复制,避免长链接被截断导致复制不全。 -->
<div>
<div class="text-xs font-medium text-secondary">{{ $t('chat.training.share.linkLabel') }}</div>
<div class="mt-1.5 flex items-center gap-2">
<input
type="text"
readonly
:value="shareUrl"
class="input-field h-9 min-w-0 flex-1 truncate text-xs"
@focus="($event.target as HTMLInputElement).select()"
/>
<button
type="button"
class="inline-flex h-9 shrink-0 items-center gap-1.5 rounded-xl bg-brand-600 px-3.5 text-xs font-medium text-white transition hover:bg-brand-700"
@click="copyShareLink"
>
<Copy class="h-4 w-4" />
{{ $t('chat.training.share.copyLink') }}
</button>
</div>
</div>
<!-- 培训二维码:扫码与链接等价,未登录用户扫码后先登录再自动直达对应模块。 -->
<div>
<div class="text-xs font-medium text-secondary">{{ $t('chat.training.share.qrLabel') }}</div>
<div class="mt-1.5 flex items-center gap-4">
<div class="flex h-40 w-40 shrink-0 items-center justify-center rounded-2xl border border-default bg-surface-soft">
<img
v-if="qrDataUrl"
:src="qrDataUrl"
:alt="$t('chat.training.share.qrLabel')"
class="h-36 w-36"
/>
<span v-else class="text-xs text-secondary">{{ qrGenerating ? '...' : '--' }}</span>
</div>
<button
type="button"
class="inline-flex h-9 items-center gap-1.5 rounded-xl border border-default bg-white px-3.5 text-xs font-medium text-secondary transition hover:bg-surface-soft disabled:cursor-not-allowed disabled:opacity-60"
:disabled="!qrDataUrl"
@click="downloadQrCode"
>
<Download class="h-4 w-4" />
{{ $t('chat.training.share.downloadQr') }}
</button>
</div>
</div>
</div>
</div>
</div>
</Teleport>
</template>
@@ -21,6 +21,7 @@ import {
FileText,
PlayCircle,
RefreshCcw,
Share2,
ShieldCheck,
Target,
User,
@@ -30,6 +31,7 @@ import {
} from 'lucide-vue-next';
import { useTrainingWorkspace } from '@/features/chat/composables/useTrainingWorkspace';
import FilePreviewModal from '@/shared/components/FilePreviewModal.vue';
import TrainingShareModal from './TrainingShareModal.vue';
import { useMessage } from '@/shared/composables/useMessage';
import { resolveTrainingExamPdfGuide, type TrainingGuideLike } from '@/features/chat/training/trainingWorkspace.utils';
import { getMyTrainingConfig } from '@/features/chat/api/training.api';
@@ -293,33 +295,52 @@ const openWorkspaceView = (view: typeof workspace.activeView) => {
setWorkspaceExpanded(true, true);
};
// [STEP] 企微提醒卡片深链支持:/chat/<agentId>?training_type=lean_management&weekly_task_id=<id>
// AI 触发时机:员工/HR 从企微“和信AI智能工作台”精益提醒卡片点入时,自动展开精益培训对应页签
// (管理员进管理端看板、学员进学员侧学习页),无需手动点页签,保证卡片“点击直达”体验。
// [STEP] 培训深链支持:/chat/<agentId>?training_type=<培训类型code>
// 来源 1:企微“和信AI智能工作台”精益提醒卡片(training_type=lean_management&weekly_task_id=<id>)
// 来源 2:员工培训分享链接(HR 在分享弹窗复制/生成二维码,员工扫码或点击后进入)
// AI 触发时机:员工/HR 从企微卡片或分享链接点入时,自动展开并定位到对应培训模块,
// 无需手动点页签,保证“点击直达”体验;精益卡片的管理员仍直达管理端精益看板。
const route = useRoute();
const router = useRouter();
let leanJumpConsumed = false;
let trainingDeepLinkConsumed = false;
watch(
() => [workspace.isTrainingAgent, Boolean(props.currentUser), workspace.canManageTrainingWorkspace] as const,
([isTraining, loggedIn]) => {
// 仅在培训 Agent 且登录态就绪后消费一次,避免身份权限异步未加载时误判视图归属
if (!isTraining || !loggedIn || leanJumpConsumed) return;
leanJumpConsumed = true;
if (route.query.training_type !== 'lean_management') return;
if (workspace.canManageTrainingWorkspace) {
if (!isTraining || !loggedIn || trainingDeepLinkConsumed) return;
const targetTrainingType = String(route.query.training_type || '').trim();
if (!targetTrainingType) return;
trainingDeepLinkConsumed = true;
if (targetTrainingType === 'lean_management' && workspace.canManageTrainingWorkspace) {
// 兼容企微精益提醒卡片:管理员直达管理端精益看板,学员进学员侧精益学习页。
workspace.activeView = 'admin';
workspace.hrTrainingTab = 'lean';
} else {
// 分享链接与其余培训类型:统一进员工培训页并定位到目标模块
//(learnerTab 直接赋值即可,loadTrainingTypes 拉取后若类型有效会保留)。
workspace.activeView = 'learner';
workspace.learnerTab = 'lean_management';
workspace.learnerTab = targetTrainingType;
}
setWorkspaceExpanded(true, true);
// 消费后清理深链参数,避免刷新或分享链接时重复自动展开
// 消费后清理深链参数,避免刷新或二次分享时重复自动展开
void router.replace({ query: { ...route.query, training_type: undefined, weekly_task_id: undefined } });
},
{ immediate: true },
);
/**
* 组装当前培训模块的分享深链(绝对地址),供分享弹窗展示链接与生成二维码。
* AI 触发时机:有培训管理权限的用户点击“分享”时使用;必须带上 training_type 参数,
* 接收方登录后会自动定位到当前正在查看的培训模块。
*/
const shareModalOpen = ref(false);
const trainingShareUrl = computed(() => {
const agentId = workspace.currentTrainingAgentId;
if (!agentId) return '';
return `${window.location.origin}/chat/${agentId}?training_type=${encodeURIComponent(workspace.learnerTab)}`;
});
const trainingShareName = computed(() => workspace.resolveTrainingTypeName(workspace.learnerTab));
/**
* 收起培训工作区并回到纯聊天页面。
* AI 触发时机:点击“收起工作区”时,必须立即恢复聊天消息区与输入栏,而不是仅折叠局部内容。
@@ -811,7 +832,7 @@ const currentSafetyStageText = computed(() => {
<div v-if="!isCompactMode && workspace.activeView === 'learner'" :class="learnerWorkspaceGridClass">
<!-- 已发布培训类型由后端配置动态提供。 -->
<div class="col-span-full mb-1">
<div class="col-span-full mb-1 flex flex-wrap items-center justify-between gap-2">
<div class="inline-flex flex-wrap rounded-xl border border-default bg-surface-soft p-1">
<button
v-for="trainingType in workspace.trainingTypes"
@@ -826,6 +847,16 @@ const currentSafetyStageText = computed(() => {
{{ trainingType.name }}
</button>
</div>
<!-- [STEP 1] 分享入口:仅培训管理权限可见,分享当前培训类型深链 -->
<button
v-if="workspace.canManageTrainingWorkspace"
type="button"
class="inline-flex flex-shrink-0 items-center gap-1.5 rounded-full bg-brand-600 px-4 py-2 text-sm font-semibold text-white shadow-md transition-all hover:bg-brand-700 hover:shadow-lg active:scale-95"
@click="shareModalOpen = true"
>
<Share2 class="h-4 w-4" />
{{ $t('chat.training.share.button') }}
</button>
</div>
<div v-if="workspace.trainingConfigLoading" class="col-span-full rounded-2xl border border-default bg-white px-6 py-16 text-center text-secondary">
@@ -1906,6 +1937,13 @@ const currentSafetyStageText = computed(() => {
:required-duration="workspace.currentViewingMaterialRequiredDuration"
@update:modelValue="handlePreviewClose"
/>
<!-- 员工培训分享弹窗:复制链接 / 下载二维码,接收方登录后自动定位到对应培训模块。 -->
<TrainingShareModal
v-model:open="shareModalOpen"
:share-url="trainingShareUrl"
:training-name="trainingShareName"
/>
<div v-if="reportModalVisible" class="fixed inset-0 z-[100] flex items-center justify-center bg-slate-950/80 p-4 backdrop-blur-sm" @click.self="closeReport">
<div class="relative w-full max-w-4xl max-h-[90vh] flex flex-col overflow-hidden rounded-3xl bg-white shadow-2xl">
@@ -25,7 +25,9 @@ const msg = useMessage();
const downloading = ref(false);
const downloadingAnnotated = ref(false);
const latestReview = ref<ContractReviewRow | null>(null);
let refreshTimer: ReturnType<typeof window.setTimeout> | undefined;
// 浏览器端 window.setTimeout 返回 number;勿用 ReturnType<typeof window.setTimeout>,
// 其在 @types/node 与 DOM lib 混用时会解析为 NodeJS.Timeout 导致 TS2322。
let refreshTimer: number | undefined;
let refreshing = false;
let disposed = false;
@@ -446,9 +446,11 @@ export function useShippingOrderReview(options: {
const workflowProgressPolling = ref(false);
let contextConversationId = '';
let contextItemNo = '';
let progressPollTimer: ReturnType<typeof window.setInterval> | null = null;
let stpCreatePollTimer: ReturnType<typeof window.setInterval> | null = null;
let reparseCaseRefreshTimer: ReturnType<typeof window.setInterval> | null = null;
// 浏览器端 window.setInterval 返回 number;勿用 ReturnType<typeof window.setInterval>,
// 其在 @types/node 与 DOM lib 混用时会解析为 NodeJS.Timeout 导致 TS2322。
let progressPollTimer: number | null = null;
let stpCreatePollTimer: number | null = null;
let reparseCaseRefreshTimer: number | null = null;
/**
* 应用后端返回的完整 Case 快照。
@@ -65,7 +65,9 @@ export function useShippingProcessingWorkItem(
const projection = ref<ShippingProcessingProjection | null>(null);
const loading = ref(false);
const error = ref<string | null>(null);
let timer: ReturnType<typeof window.setTimeout> | null = null;
// 浏览器端 window.setTimeout 返回 number;勿用 ReturnType<typeof window.setTimeout>,
// 其在 @types/node 与 DOM lib 混用时会解析为 NodeJS.Timeout 导致 TS2322。
let timer: number | null = null;
let generation = 0;
let stopped = false;
let refreshInFlight: { no: string; promise: Promise<void> } | null = null;
+12
View File
@@ -997,6 +997,18 @@
"collapseWorkspace": "Collapse Workspace",
"viewExamPdf": "View Exam PDF"
},
"share": {
"button": "Share",
"title": "Share Training",
"description": "Copy the link or download the QR code to share with employees. After signing in, they will land directly on the \"{name}\" training module.",
"linkLabel": "Training link",
"qrLabel": "Training QR code",
"copyLink": "Copy link",
"copied": "Link copied",
"copyFailed": "Copy failed. Please copy manually",
"downloadQr": "Download QR code",
"close": "Close"
},
"steps": {
"video": "Watch Video",
"summary": "Review Key Points",
+12
View File
@@ -997,6 +997,18 @@
"collapseWorkspace": "ย่อพื้นที่ทำงาน",
"viewExamPdf": "ดู PDF ข้อสอบ"
},
"share": {
"button": "แชร์",
"title": "แชร์การอบรม",
"description": "คัดลอกลิงก์หรือดาวน์โหลดคิวอาร์โค้ดเพื่อแชร์ให้พนักงาน เมื่อเข้าสู่ระบบแล้วจะไปยังโมดูลการอบรม \"{name}\" โดยอัตโนมัติ",
"linkLabel": "ลิงก์การอบรม",
"qrLabel": "คิวอาร์โค้ดการอบรม",
"copyLink": "คัดลอกลิงก์",
"copied": "คัดลอกลิงก์แล้ว",
"copyFailed": "คัดลอกไม่สำเร็จ โปรดคัดลอกด้วยตนเอง",
"downloadQr": "ดาวน์โหลดคิวอาร์โค้ด",
"close": "ปิด"
},
"steps": {
"video": "ดูวิดีโอ",
"summary": "ทบทวนความรู้",
+12
View File
@@ -1031,6 +1031,18 @@
"collapseWorkspace": "收起工作区",
"viewExamPdf": "查看试题 PDF"
},
"share": {
"button": "分享",
"title": "分享培训",
"description": "复制链接或下载二维码发给员工,对方登录后自动进入「{name}」培训模块。",
"linkLabel": "培训链接",
"qrLabel": "培训二维码",
"copyLink": "复制链接",
"copied": "链接已复制",
"copyFailed": "复制失败,请手动复制",
"downloadQr": "下载二维码",
"close": "关闭"
},
"steps": {
"video": "观看视频",
"summary": "复盘知识点",
+12
View File
@@ -997,6 +997,18 @@
"collapseWorkspace": "收起工作區",
"viewExamPdf": "查看試題 PDF"
},
"share": {
"button": "分享",
"title": "分享培訓",
"description": "複製連結或下載二維碼發給員工,對方登入後自動進入「{name}」培訓模組。",
"linkLabel": "培訓連結",
"qrLabel": "培訓二維碼",
"copyLink": "複製連結",
"copied": "連結已複製",
"copyFailed": "複製失敗,請手動複製",
"downloadQr": "下載二維碼",
"close": "關閉"
},
"steps": {
"video": "觀看影片",
"summary": "複盤知識點",
+18
View File
@@ -0,0 +1,18 @@
/**
* shared/utils/redirect.ts
* 登录回跳目标解析:企微提醒卡片等深链场景下,登录页按 redirect 参数原样回跳。
* 依赖:无。被 app/router/guards.ts(守卫放行/跳转)与 features/auth(登录成功后回跳)共用。
*/
/**
* 校验并解析登录后回跳目标(企微提醒卡片等深链场景)。
* AI 触发时机:路由守卫拦截未登录访问时,以及密码/OAuth 登录成功后决定跳转目标时调用。
* 核心逻辑:仅接受站内相对路径(以 / 开头且不以 // 开头),拒绝外链与协议相对地址,防开放重定向。
* @param raw - 待校验的 redirect 参数(可能为 string | string[] | undefined)
* @returns 安全的站内路径;不合法时返回 null
*/
export function resolveSafeRedirect(raw: unknown): string | null {
const value = Array.isArray(raw) ? String(raw[0] ?? '') : String(raw ?? '');
if (!value.startsWith('/') || value.startsWith('//')) return null;
return value;
}