mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 登录页面实现
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
|
||||
import type { App } from 'vue';
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
import { constantRoutes, customRoutes } from './routes';
|
||||
import { constantRoutes, customRoutes, RouteNameMap } from './routes';
|
||||
import createRouterGuide from './permission';
|
||||
|
||||
const routes: Array<RouteRecordRaw> = [...customRoutes, ...constantRoutes];
|
||||
@ -19,3 +19,5 @@ export async function setupRouter(app: App) {
|
||||
createRouterGuide(router);
|
||||
await router.isReady();
|
||||
}
|
||||
|
||||
export { RouteNameMap };
|
||||
|
@ -1,11 +1,15 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
import { BasicLayout, BlankLayout, BlankChildLayout } from '@/layouts';
|
||||
import { BasicLayout, BlankLayout } from '@/layouts';
|
||||
import { EnumRoutePaths } from '@/enum';
|
||||
|
||||
type RouteKey = keyof typeof EnumRoutePaths;
|
||||
import type { RoutePathKey, LoginModuleType } from '@/interface';
|
||||
import { getLoginModuleRegExp } from '@/utils';
|
||||
|
||||
/** 路由名称 */
|
||||
export const RouteNameMap = new Map<RouteKey, RouteKey>((Object.keys(EnumRoutePaths) as RouteKey[]).map(v => [v, v]));
|
||||
export const RouteNameMap = new Map<RoutePathKey, RoutePathKey>(
|
||||
(Object.keys(EnumRoutePaths) as RoutePathKey[]).map(v => [v, v])
|
||||
);
|
||||
|
||||
const loginModuleRegExp = getLoginModuleRegExp();
|
||||
|
||||
/**
|
||||
* 固定不变的路由
|
||||
@ -21,8 +25,14 @@ export const constantRoutes: Array<RouteRecordRaw> = [
|
||||
// 登录
|
||||
{
|
||||
name: RouteNameMap.get('login'),
|
||||
path: EnumRoutePaths.login,
|
||||
path: `${EnumRoutePaths.login}/:module(/${loginModuleRegExp}/)?`,
|
||||
component: () => import('@/views/system/login/index.vue'),
|
||||
props: route => {
|
||||
const moduleType: LoginModuleType = (route.params.module as LoginModuleType) || 'pwd-login';
|
||||
return {
|
||||
module: moduleType
|
||||
};
|
||||
},
|
||||
meta: {
|
||||
fullPage: true
|
||||
}
|
||||
@ -70,47 +80,45 @@ export const customRoutes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
name: 'root',
|
||||
path: '/',
|
||||
redirect: { name: RouteNameMap.get('dashboard-analysis') }
|
||||
},
|
||||
{
|
||||
name: 'dashboard',
|
||||
path: '/dashboard',
|
||||
component: BasicLayout,
|
||||
redirect: { name: RouteNameMap.get('dashboard-analysis') },
|
||||
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: 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: RouteNameMap.get('exception-403'),
|
||||
path: EnumRoutePaths['exception-403'],
|
||||
component: () => import('@/views/system/exception/403.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')
|
||||
}
|
||||
]
|
||||
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')
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user