refactor: 优化权限管理与登录流程,修复细节问题

1.  调整仪表盘图标从DeviceOutlined为MonitorOutlined
2.  新增403无权访问页面与路由配置
3.  完善权限存储与路由守卫逻辑
4.  修复用户信息获取与token持久化问题
5.  补充普通管理员权限初始化与补丁脚本
6.  优化后端用户服务与认证控制器逻辑
7.  调整登录表单交互与请求流程
This commit is contained in:
andyesfly committed 2026-05-28 16:25:26 +08:00
1 parent 3d7eb12103
commit 2534723842
9 files changed
+259 -50

No files matched your search

+20 -3
View File
@@ -9,6 +9,12 @@ const routes: RouteRecordRaw[] = [
component: () => import("@/views/login/index.vue"),
meta: { requiresAuth: false, title: "登录" }
},
{
path: "/403",
name: "Forbidden",
component: () => import("@/views/403.vue"),
meta: { requiresAuth: false, title: "无权访问" }
},
{
path: "/",
component: () => import("@/layouts/index.vue"),
@@ -112,9 +118,20 @@ router.beforeEach(async (to, _from, next) => {
if (!permissionStore.userInfo) {
try {
await permissionStore.fetchUserInfo();
const success = await permissionStore.fetchUserInfo();
if (!success) {
next({
path: "/login",
query: { redirect: to.fullPath }
});
return;
}
} catch (error) {
permissionStore.logout();
console.error('获取用户信息失败:', error);
next({
path: "/login",
query: { redirect: to.fullPath }
});
return;
}
}
@@ -129,4 +146,4 @@ router.beforeEach(async (to, _from, next) => {
next();
});
export default router;
export default router;