refactor(路由与用户管理): 优化路由处理和用户登出逻辑
- 修改用户登出时的重定向逻辑,确保用户显式返回登录页,避免保留重定向参数 - 引入默认动态路由子项,简化路由配置 - 更新后端路由初始化逻辑,确保动态路由的正确处理 - 增强代码可读性,修复部分代码风格问题
This commit is contained in:
@@ -21,6 +21,39 @@ import { RouteRecordRaw } from 'vue-router';
|
||||
* @description 各字段请查看 `/@/views/system/menu/component/addMenu.vue 下的 ruleForm`
|
||||
* @returns 返回路由菜单数据
|
||||
*/
|
||||
export const defaultDynamicRouteChildren: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: '/home',
|
||||
name: 'home',
|
||||
component: () => import('/@/views/home/index.vue'),
|
||||
meta: {
|
||||
title: 'message.router.home',
|
||||
isLink: '',
|
||||
isHide: true,
|
||||
isKeepAlive: true,
|
||||
isAffix: true,
|
||||
isIframe: false,
|
||||
roles: ['admin', 'common'],
|
||||
icon: 'iconfont icon-shouye',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/personal',
|
||||
name: 'personals',
|
||||
component: () => import('/@/views/system/personal/index.vue'),
|
||||
meta: {
|
||||
title: '个人中心',
|
||||
isLink: '',
|
||||
isHide: true,
|
||||
isKeepAlive: true,
|
||||
isAffix: false,
|
||||
isIframe: false,
|
||||
roles: ['admin'],
|
||||
icon: 'iconfont icon-diannao',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const dynamicRoutes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
path: '/',
|
||||
@@ -30,38 +63,7 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
|
||||
meta: {
|
||||
isKeepAlive: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '/home',
|
||||
name: 'home',
|
||||
component: () => import('/@/views/home/index.vue'),
|
||||
meta: {
|
||||
title: 'message.router.home',
|
||||
isLink: '',
|
||||
isHide: true,
|
||||
isKeepAlive: true,
|
||||
isAffix: true,
|
||||
isIframe: false,
|
||||
roles: ['admin', 'common'],
|
||||
icon: 'iconfont icon-shouye',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/personal',
|
||||
name: 'personals',
|
||||
component: () => import('/@/views/system/personal/index.vue'),
|
||||
meta: {
|
||||
title: '个人中心',
|
||||
isLink: '',
|
||||
isHide: true,
|
||||
isKeepAlive: true,
|
||||
isAffix: false,
|
||||
isIframe: false,
|
||||
roles: ['admin'],
|
||||
icon: 'iconfont icon-diannao',
|
||||
},
|
||||
},
|
||||
],
|
||||
children: [...defaultDynamicRouteChildren],
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user