2024-07-31 21:22:43 +08:00
|
|
|
|
import type { RouteRecordRaw } from 'vue-router';
|
|
|
|
|
|
2024-10-24 22:43:49 +08:00
|
|
|
|
import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants';
|
2024-07-31 21:22:43 +08:00
|
|
|
|
|
|
|
|
|
import { $t } from '#/locales';
|
|
|
|
|
|
2025-04-09 01:05:20 +08:00
|
|
|
|
const BasicLayout = () => import('#/layouts/basic.vue');
|
|
|
|
|
const AuthPageLayout = () => import('#/layouts/auth.vue');
|
2024-07-31 21:22:43 +08:00
|
|
|
|
/** 全局404页面 */
|
|
|
|
|
const fallbackNotFoundRoute: RouteRecordRaw = {
|
|
|
|
|
component: () => import('#/views/_core/fallback/not-found.vue'),
|
|
|
|
|
meta: {
|
|
|
|
|
hideInBreadcrumb: true,
|
|
|
|
|
hideInMenu: true,
|
|
|
|
|
hideInTab: true,
|
|
|
|
|
title: '404',
|
|
|
|
|
},
|
|
|
|
|
name: 'FallbackNotFound',
|
|
|
|
|
path: '/:path(.*)*',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 基本路由,这些路由是必须存在的 */
|
|
|
|
|
const coreRoutes: RouteRecordRaw[] = [
|
2025-01-14 12:12:08 +08:00
|
|
|
|
/**
|
|
|
|
|
* 根路由
|
|
|
|
|
* 使用基础布局,作为所有页面的父级容器,子级就不必配置BasicLayout。
|
|
|
|
|
* 此路由必须存在,且不应修改
|
|
|
|
|
*/
|
2024-07-31 21:22:43 +08:00
|
|
|
|
{
|
2025-01-14 12:12:08 +08:00
|
|
|
|
component: BasicLayout,
|
2024-07-31 21:22:43 +08:00
|
|
|
|
meta: {
|
2025-01-14 17:51:39 +08:00
|
|
|
|
hideInBreadcrumb: true,
|
2024-07-31 21:22:43 +08:00
|
|
|
|
title: 'Root',
|
|
|
|
|
},
|
|
|
|
|
name: 'Root',
|
|
|
|
|
path: '/',
|
|
|
|
|
redirect: DEFAULT_HOME_PATH,
|
2025-01-14 12:12:08 +08:00
|
|
|
|
children: [],
|
2024-07-31 21:22:43 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
component: AuthPageLayout,
|
|
|
|
|
meta: {
|
2024-10-13 18:33:43 +08:00
|
|
|
|
hideInTab: true,
|
2024-07-31 21:22:43 +08:00
|
|
|
|
title: 'Authentication',
|
|
|
|
|
},
|
|
|
|
|
name: 'Authentication',
|
|
|
|
|
path: '/auth',
|
2024-10-24 22:43:49 +08:00
|
|
|
|
redirect: LOGIN_PATH,
|
2024-07-31 21:22:43 +08:00
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
name: 'Login',
|
|
|
|
|
path: 'login',
|
2025-04-09 01:05:20 +08:00
|
|
|
|
component: () => import('#/views/_core/authentication/login.vue'),
|
2024-07-31 21:22:43 +08:00
|
|
|
|
meta: {
|
2024-10-19 14:28:21 +08:00
|
|
|
|
title: $t('page.auth.login'),
|
2024-07-31 21:22:43 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'CodeLogin',
|
|
|
|
|
path: 'code-login',
|
|
|
|
|
component: () => import('#/views/_core/authentication/code-login.vue'),
|
|
|
|
|
meta: {
|
2024-10-19 14:28:21 +08:00
|
|
|
|
title: $t('page.auth.codeLogin'),
|
2024-07-31 21:22:43 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'QrCodeLogin',
|
|
|
|
|
path: 'qrcode-login',
|
|
|
|
|
component: () =>
|
|
|
|
|
import('#/views/_core/authentication/qrcode-login.vue'),
|
|
|
|
|
meta: {
|
2024-10-19 14:28:21 +08:00
|
|
|
|
title: $t('page.auth.qrcodeLogin'),
|
2024-07-31 21:22:43 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'ForgetPassword',
|
|
|
|
|
path: 'forget-password',
|
|
|
|
|
component: () =>
|
|
|
|
|
import('#/views/_core/authentication/forget-password.vue'),
|
|
|
|
|
meta: {
|
2024-10-19 14:28:21 +08:00
|
|
|
|
title: $t('page.auth.forgetPassword'),
|
2024-07-31 21:22:43 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Register',
|
|
|
|
|
path: 'register',
|
|
|
|
|
component: () => import('#/views/_core/authentication/register.vue'),
|
|
|
|
|
meta: {
|
2024-10-19 14:28:21 +08:00
|
|
|
|
title: $t('page.auth.register'),
|
2024-07-31 21:22:43 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export { coreRoutes, fallbackNotFoundRoute };
|