fix: 退出登录后在受保护页面跳转到配方查询页面 #14

Merged
fam merged 1 commits from fix/logout-redirect-protected-pages into main 2026-04-09 18:56:32 +00:00
Collaborator

关联 Issue #13

修改内容

router/index.js:为需要登录才能访问的路由添加 meta: { requiresAuth: true } 标记:

  • /manage 配方管理
  • /inventory 库存
  • /projects 商业核算
  • /mydiary 我的
  • /audit 操作日志
  • /bugs 问题追踪
  • /users 用户管理

UserMenu.vuehandleLogout() 改为根据当前路由判断:

if (router.currentRoute.value.meta.requiresAuth) {
  router.push("/")  // 受保护页面 → 跳回配方查询
} else {
  window.location.reload()  // 公开页面 → 原地刷新
}
关联 Issue #13 ## 修改内容 **`router/index.js`**:为需要登录才能访问的路由添加 `meta: { requiresAuth: true }` 标记: - `/manage` 配方管理 - `/inventory` 库存 - `/projects` 商业核算 - `/mydiary` 我的 - `/audit` 操作日志 - `/bugs` 问题追踪 - `/users` 用户管理 **`UserMenu.vue`**:`handleLogout()` 改为根据当前路由判断: ```js if (router.currentRoute.value.meta.requiresAuth) { router.push("/") // 受保护页面 → 跳回配方查询 } else { window.location.reload() // 公开页面 → 原地刷新 } ```
Owner

🚀 Preview: https://pr-14.oil.oci.euphon.net

DB is a copy of production.

🚀 **Preview**: https://pr-14.oil.oci.euphon.net DB is a copy of production.
yoyo added 1 commit 2026-04-09 18:49:07 +00:00
fix: 退出登录后在受保护页面跳转到配方查询页面
Some checks failed
PR Preview / test (pull_request) Has been skipped
Deploy Production / test (push) Successful in 5s
Test / unit-test (push) Successful in 5s
PR Preview / teardown-preview (pull_request) Successful in 14s
PR Preview / deploy-preview (pull_request) Has been skipped
Test / build-check (push) Successful in 4s
Deploy Production / deploy (push) Successful in 5s
Test / e2e-test (push) Failing after 1m14s
b764ff7ea3
在 router/index.js 中为需要登录才能访问的路由(manage、inventory、
projects、mydiary、audit、bugs、users)添加 meta.requiresAuth 标记。

在 UserMenu.vue 的 handleLogout() 中检查当前路由是否需要登录,
如果是则 router.push('/') 跳回配方查询页,否则原地 reload。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
yoyo force-pushed fix/logout-redirect-protected-pages from 603e81853d to b764ff7ea3 2026-04-09 18:49:07 +00:00 Compare
Owner

🚀 Preview: https://pr-14.oil.oci.euphon.net

DB is a copy of production.

🚀 **Preview**: https://pr-14.oil.oci.euphon.net DB is a copy of production.
fam merged commit b764ff7ea3 into main 2026-04-09 18:56:32 +00:00
Owner

🗑️ Preview torn down.

🗑️ Preview torn down.
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hera/oil-formula-calculator#14