feat(权限): 实现基于角色的路由权限控制

- 新增路由元信息类型定义 (requiresAuth, roles, title)
- 实现路由守卫中的角色权限校验逻辑
- 新增 403 禁止访问页面
- 提取权限校验函数 checkRoutePermission,提高可测试性
- 修复 JSON.parse 异常处理,增强健壮性
- 优化页面标题动态设置

测试优化:
- 重构 global-setup.ts,支持 JAR 文件启动后端服务
- 优化测试用例等待逻辑,减少硬编码延迟
- 简化 playwright 配置,移除多浏览器支持
- 新增路由权限守卫单元测试

关联需求:权限系统完善
This commit is contained in:
张翔
2026-04-08 15:29:03 +08:00
parent 9b2c8a47a4
commit 7420afa380
23 changed files with 933 additions and 349 deletions
+4 -2
View File
@@ -16,8 +16,8 @@
"test:unit": "vitest --run --coverage",
"test:coverage": "vitest --run --coverage",
"test:e2e": "playwright test",
"test:e2e:smoke": "playwright test smoke/",
"test:e2e:journeys": "playwright test journeys/",
"test:e2e:smoke": "playwright test --project=smoke",
"test:e2e:journeys": "playwright test --project=journeys",
"test:e2e:headed": "playwright test --headed",
"test:e2e:debug": "playwright test --debug",
"test:e2e:perf": "node scripts/measure-e2e-performance.js",
@@ -37,8 +37,10 @@
"@element-plus/icons-vue": "^2.3.2",
"axios": "^1.6.2",
"crypto-js": "^4.2.0",
"date-fns": "^4.1.0",
"dayjs": "^1.11.10",
"element-plus": "^2.13.5",
"jwt-decode": "^4.0.0",
"pinia": "^3.0.4",
"vue": "^3.5.26",
"vue-i18n": "^9.8.0",