fix(扫码登录):调整签到页面
deploy-hxtesting / build-and-deploy (push) Successful in 1m13s

This commit is contained in:
runny committed 2026-11-25 12:34:35 +08:00
1 parent 21abd01593
commit 2483dd933a
5 files changed
+30 -15

No files matched your search

@@ -286,4 +286,5 @@
- **OAuth 降级为预留通道**:`checkin-auth/checkin-session` 后端保留,前端仅在 URL 带 code+state 回跳时消费,主流程不再跳转授权页;可信域名配置就绪后可恢复为免登优先;
- **自动登录开关**:规则项 `employee_checkin_autologin`(默认 1=开;0=只签到不签发会话,前端停留成功页)——工号属半公开信息,存在知悉他人工号者冒签/冒登录的风险,已与需求方确认接受,该开关是回退手段;
- **前端**:`CheckinPage` 匿名主流程(工号输入框 + 输入工号签到按钮);已登录用户(PC 自测/已有会话)仍走登录态接口并预填工号;
- **repo 新增**:`GetMemberByEmployeeNo`(同工号多行取最早建档行,保证稳定映射)。
- **repo 新增**:`GetMemberByEmployeeNo`(同工号多行取最早建档行,保证稳定映射);
- **独立手机端 H5(2026-11-25 三次调整)**:签到页从 `/platform` 子路由迁出为**顶层独立路由** `/m/training/checkin/:token` —— 直接渲染在 App.vue 裸 RouterView,完全脱离平台壳布局(侧栏/桌面样式),扫码免登录直达;二维码指向新路径;旧路径 `/platform/training/checkin/:token` 兼容重定向(携 query,OAuth 回跳参数不丢);移动端满屏居中样式。核实结论:路由守卫/平台布局/App.vue 均无对显式 `requiresAuth:false` 路由的登录拦截,"扫码先登录"系测试环境跑旧构建所致(旧版进页自动签到 → 401 → axios 拦截器跳登录),**验证前必须重新构建部署前后端**。
+21 -10
View File
@@ -56,6 +56,17 @@ const router = createRouter({
component: () => import("../views/auth/Login.vue"),
meta: { requiresAuth: false, requiresInit: false }
},
{
// 学员扫码签到:独立手机端 H5 页(2026-11-25 调整)。顶层路由,直接渲染在
// App.vue 的裸 RouterView —— 完全脱离平台壳布局(侧栏/桌面样式),扫码免
// 登录直达;页面内自行完成工号签到与自动登录。显式 requiresAuth:false +
// requiresInit:false 放行路由守卫(meta 缺省 = undefined 时守卫仍按需
// 登录拦截,必须显式 false)。
path: "/m/training/checkin/:token",
name: "mobileTrainingCheckin",
component: () => import("../views/training/CheckinPage.vue"),
meta: { requiresInit: false, requiresAuth: false }
},
// Embed chat is a separate entry (embed.html + embed-main.ts), not this SPA.
{
path: "/register",
@@ -184,16 +195,16 @@ const router = createRouter({
component: () => import("../views/training/CourseDetail.vue"),
meta: { requiresInit: true, requiresAuth: true }
},
{
// 学员扫码签到落地页(2026-11 企微扫码免登):企微「扫一扫」直接打开,
// 页面内自行完成免登(OAuth 静默授权)/自动登录/倒计时/点击签到,
// 故显式 requiresAuth:false + requiresInit:false 放行路由守卫
// (meta 缺省 = undefined 时守卫仍按需登录拦截,必须显式 false)。
path: "training/checkin/:token",
name: "trainingCheckin",
component: () => import("../views/training/CheckinPage.vue"),
meta: { requiresInit: false, requiresAuth: false }
},
{
// 旧平台内签到路径兼容重定向(2026-11-25 签到页迁移为独立手机端 H5):
// 已投屏/已分发的旧二维码短窗口内仍可扫;携 query 重定向,OAuth 回跳
// 参数(code/state)不丢。
path: "training/checkin/:token",
redirect: (to) => ({
path: `/m/training/checkin/${to.params.token}`,
query: to.query
})
},
{
// 组织架构:租户级共享组织架构(部门 + 员工档案),
// 业务模块(企业培训等)按需引用,部门岗位只维护一份。
+3 -1
View File
@@ -429,8 +429,10 @@ onBeforeUnmount(stopCountdown)
display: flex;
align-items: center;
justify-content: center;
min-height: 60vh;
// 独立手机端 H5 页:顶层路由直接渲染,占满整屏并居中卡片(脱离平台壳布局)。
min-height: 100vh;
padding: var(--app-space-4);
background: var(--td-bg-color-page, #f3f3f3);
}
.checkin-card {
@@ -257,7 +257,7 @@ const buildSignQr = async () => {
signQrUrl.value = ''
return
}
const url = `${window.location.origin}/platform/training/checkin/${token}`
const url = `${window.location.origin}/m/training/checkin/${token}`
try {
signQrUrl.value = await QRCode.toDataURL(url, { width: 320, margin: 1 })
} catch {
+3 -2
View File
@@ -1855,7 +1855,8 @@ func (h *Handler) WecomCheckinAuth(c *gin.Context) {
}
redirectURI := strings.TrimSpace(q.RedirectURI)
if redirectURI == "" {
// 兜底:按请求 Host 还原落地页地址(反代透传 X-Forwarded-Proto)。
// 兜底:按请求 Host 还原落地页地址(独立手机端 H5 路由,反代透传
// X-Forwarded-Proto)。
scheme := "https"
if c.Request.TLS == nil {
if proto := strings.TrimSpace(c.GetHeader("X-Forwarded-Proto")); proto != "" {
@@ -1864,7 +1865,7 @@ func (h *Handler) WecomCheckinAuth(c *gin.Context) {
scheme = "http"
}
}
redirectURI = fmt.Sprintf("%s://%s/platform/training/checkin/%s", scheme, c.Request.Host, q.Token)
redirectURI = fmt.Sprintf("%s://%s/m/training/checkin/%s", scheme, c.Request.Host, q.Token)
}
url, err := h.svc.WecomCheckinAuthURL(c.Request.Context(), q.Token, redirectURI)
if err != nil {