core.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. hideInBreadcrumb: true,
  29. title: 'Root',
  30. },
  31. name: 'Root',
  32. path: '/',
  33. redirect: DEFAULT_HOME_PATH,
  34. children: [],
  35. },
  36. {
  37. component: AuthPageLayout,
  38. meta: {
  39. hideInTab: true,
  40. title: 'Authentication',
  41. },
  42. name: 'Authentication',
  43. path: '/auth',
  44. redirect: LOGIN_PATH,
  45. children: [
  46. {
  47. name: 'Login',
  48. path: 'login',
  49. component: Login,
  50. meta: {
  51. title: $t('page.auth.login'),
  52. },
  53. },
  54. {
  55. name: 'CodeLogin',
  56. path: 'code-login',
  57. component: () => import('#/views/_core/authentication/code-login.vue'),
  58. meta: {
  59. title: $t('page.auth.codeLogin'),
  60. },
  61. },
  62. {
  63. name: 'QrCodeLogin',
  64. path: 'qrcode-login',
  65. component: () =>
  66. import('#/views/_core/authentication/qrcode-login.vue'),
  67. meta: {
  68. title: $t('page.auth.qrcodeLogin'),
  69. },
  70. },
  71. {
  72. name: 'ForgetPassword',
  73. path: 'forget-password',
  74. component: () =>
  75. import('#/views/_core/authentication/forget-password.vue'),
  76. meta: {
  77. title: $t('page.auth.forgetPassword'),
  78. },
  79. },
  80. {
  81. name: 'Register',
  82. path: 'register',
  83. component: () => import('#/views/_core/authentication/register.vue'),
  84. meta: {
  85. title: $t('page.auth.register'),
  86. },
  87. },
  88. ],
  89. },
  90. ];
  91. export { coreRoutes, fallbackNotFoundRoute };