core.ts 2.4 KB

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