core.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import type { RouteRecordRaw } from 'vue-router';
  2. import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants';
  3. import { AuthPageLayout, BasicLayout } from '#/layouts';
  4. import { $t } from '#/locales';
  5. import Login from '#/views/_core/authentication/login.vue';
  6. /** 全局404页面 */
  7. const fallbackNotFoundRoute: RouteRecordRaw = {
  8. component: () => import('#/views/_core/fallback/not-found.vue'),
  9. meta: {
  10. hideInBreadcrumb: true,
  11. hideInMenu: true,
  12. hideInTab: true,
  13. title: '404',
  14. },
  15. name: 'FallbackNotFound',
  16. path: '/:path(.*)*',
  17. };
  18. /** 基本路由,这些路由是必须存在的 */
  19. const coreRoutes: RouteRecordRaw[] = [
  20. /**
  21. * 根路由
  22. * 使用基础布局,作为所有页面的父级容器,子级就不必配置BasicLayout。
  23. * 此路由必须存在,且不应修改
  24. */
  25. {
  26. component: BasicLayout,
  27. meta: {
  28. title: 'Root',
  29. },
  30. name: 'Root',
  31. path: '/',
  32. redirect: DEFAULT_HOME_PATH,
  33. children: [],
  34. },
  35. {
  36. component: AuthPageLayout,
  37. meta: {
  38. hideInTab: true,
  39. title: 'Authentication',
  40. },
  41. name: 'Authentication',
  42. path: '/auth',
  43. redirect: LOGIN_PATH,
  44. children: [
  45. {
  46. name: 'Login',
  47. path: 'login',
  48. component: Login,
  49. meta: {
  50. title: $t('page.auth.login'),
  51. },
  52. },
  53. {
  54. name: 'CodeLogin',
  55. path: 'code-login',
  56. component: () => import('#/views/_core/authentication/code-login.vue'),
  57. meta: {
  58. title: $t('page.auth.codeLogin'),
  59. },
  60. },
  61. {
  62. name: 'QrCodeLogin',
  63. path: 'qrcode-login',
  64. component: () =>
  65. import('#/views/_core/authentication/qrcode-login.vue'),
  66. meta: {
  67. title: $t('page.auth.qrcodeLogin'),
  68. },
  69. },
  70. {
  71. name: 'ForgetPassword',
  72. path: 'forget-password',
  73. component: () =>
  74. import('#/views/_core/authentication/forget-password.vue'),
  75. meta: {
  76. title: $t('page.auth.forgetPassword'),
  77. },
  78. },
  79. {
  80. name: 'Register',
  81. path: 'register',
  82. component: () => import('#/views/_core/authentication/register.vue'),
  83. meta: {
  84. title: $t('page.auth.register'),
  85. },
  86. },
  87. ],
  88. },
  89. ];
  90. export { coreRoutes, fallbackNotFoundRoute };