ruoyi-plus-soybean/src/router/routes.ts

118 lines
3.2 KiB
TypeScript
Raw Normal View History

2021-08-17 14:59:59 +08:00
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout, BlankLayout, BlankChildLayout } from '@/layouts';
2021-09-09 12:00:18 +08:00
import { EnumRoutePaths } from '@/enum';
type RouteKey = keyof typeof EnumRoutePaths;
/** 路由名称 */
export const RouteNameMap = new Map<RouteKey, RouteKey>((Object.keys(EnumRoutePaths) as RouteKey[]).map(v => [v, v]));
/**
*
* @description !
*/
export const constantRoutes: Array<RouteRecordRaw> = [
{
name: 'system',
path: '/system',
component: BlankLayout,
redirect: { name: 'not-found' },
children: [
// 登录
{
name: RouteNameMap.get('login'),
path: EnumRoutePaths.login,
component: () => import('@/views/system/login/index.vue'),
meta: {
fullPage: true
}
2021-09-09 12:00:18 +08:00
},
// 404
{
name: RouteNameMap.get('not-found'),
path: EnumRoutePaths['not-found'],
component: () => import('@/views/system/exception/404.vue'),
meta: {
fullPage: true
}
2021-09-09 12:00:18 +08:00
},
// 403
{
name: RouteNameMap.get('no-permission'),
path: EnumRoutePaths['no-permission'],
component: () => import('@/views/system/exception/403.vue'),
meta: {
fullPage: true
}
2021-09-09 12:00:18 +08:00
},
// 500
{
name: RouteNameMap.get('service-error'),
path: EnumRoutePaths['service-error'],
component: () => import('@/views/system/exception/500.vue'),
meta: {
fullPage: true
}
2021-09-09 12:00:18 +08:00
}
]
},
// 匹配无效的路径重定向404
{
path: '/:pathMatch(.*)*',
redirect: { name: 'not-found' }
}
];
2021-08-17 14:59:59 +08:00
/**
*
*/
export const customRoutes: Array<RouteRecordRaw> = [
{
name: 'root',
path: '/',
redirect: { name: RouteNameMap.get('dashboard-analysis') },
2021-08-18 12:02:59 +08:00
component: BasicLayout,
children: [
{
name: 'dashboard',
path: '/dashboard',
component: BlankChildLayout,
children: [
{
name: RouteNameMap.get('dashboard-analysis'),
path: EnumRoutePaths['dashboard-analysis'],
component: () => import('@/views/dashboard/analysis/index.vue')
},
{
name: RouteNameMap.get('dashboard-workbench'),
path: EnumRoutePaths['dashboard-workbench'],
component: () => import('@/views/dashboard/workbench/index.vue')
}
]
},
{
name: 'exception',
path: '/exception',
component: BlankChildLayout,
children: [
{
name: RouteNameMap.get('exception-403'),
path: EnumRoutePaths['exception-403'],
component: () => import('@/views/system/exception/403.vue')
},
{
name: RouteNameMap.get('exception-404'),
path: EnumRoutePaths['exception-404'],
component: () => import('@/views/system/exception/404.vue')
},
{
name: RouteNameMap.get('exception-500'),
path: EnumRoutePaths['exception-500'],
component: () => import('@/views/system/exception/500.vue')
}
]
2021-08-18 12:02:59 +08:00
}
]
2021-08-17 14:59:59 +08:00
}
];