constant.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import type { AppRouteRecordRaw } from '/@/router/types';
  2. import ParentLayout from '/@/layouts/page/ParentView.vue';
  3. import { t } from '/@/hooks/web/useI18n';
  4. export const REDIRECT_NAME = 'Redirect';
  5. export const EXCEPTION_COMPONENT = () => import('../views/sys/exception/Exception.vue');
  6. /**
  7. * @description: default layout
  8. */
  9. export const LAYOUT = () => import('/@/layouts/default/index.vue');
  10. /**
  11. * @description: page-layout
  12. */
  13. export const getParentLayout = (name: string) => {
  14. return () =>
  15. new Promise((resolve) => {
  16. resolve({
  17. ...ParentLayout,
  18. name,
  19. });
  20. });
  21. };
  22. // 404 on a page
  23. export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = {
  24. path: '/:path(.*)*',
  25. name: 'ErrorPage',
  26. component: LAYOUT,
  27. meta: {
  28. title: 'ErrorPage',
  29. hideBreadcrumb: true,
  30. },
  31. children: [
  32. {
  33. path: '/:path(.*)*',
  34. name: 'ErrorPage',
  35. component: EXCEPTION_COMPONENT,
  36. meta: {
  37. title: 'ErrorPage',
  38. hideBreadcrumb: true,
  39. },
  40. },
  41. ],
  42. };
  43. export const REDIRECT_ROUTE: AppRouteRecordRaw = {
  44. path: '/redirect',
  45. name: REDIRECT_NAME,
  46. component: LAYOUT,
  47. meta: {
  48. title: REDIRECT_NAME,
  49. hideBreadcrumb: true,
  50. },
  51. children: [
  52. {
  53. path: '/redirect/:path(.*)',
  54. name: REDIRECT_NAME,
  55. component: () => import('/@/views/sys/redirect/index.vue'),
  56. meta: {
  57. title: REDIRECT_NAME,
  58. hideBreadcrumb: true,
  59. },
  60. },
  61. ],
  62. };
  63. export const ERROR_LOG_ROUTE: AppRouteRecordRaw = {
  64. path: '/error-log',
  65. name: 'errorLog',
  66. component: LAYOUT,
  67. meta: {
  68. title: 'ErrorLog',
  69. hideBreadcrumb: true,
  70. },
  71. children: [
  72. {
  73. path: 'list',
  74. name: 'errorLogList',
  75. component: () => import('/@/views/sys/error-log/index.vue'),
  76. meta: {
  77. title: t('routes.basic.errorLogList'),
  78. hideBreadcrumb: true,
  79. },
  80. },
  81. ],
  82. };