index.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import type { AppRouteRecordRaw, AppRouteModule } from '/@/router/types';
  2. import { PAGE_NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '/@/router/routes/basic';
  3. import { mainOutRoutes } from './mainOut';
  4. import { PageEnum } from '/@/enums/pageEnum';
  5. import { t } from '/@/hooks/web/useI18n';
  6. import { LAYOUT } from '/@/router/constant';
  7. const modules = import.meta.globEager('./modules/**/*.ts');
  8. const routeModuleList: AppRouteModule[] = [];
  9. Object.keys(modules).forEach((key) => {
  10. const mod = modules[key].default || {};
  11. const modList = Array.isArray(mod) ? [...mod] : [mod];
  12. routeModuleList.push(...modList);
  13. });
  14. export const asyncRoutes = [PAGE_NOT_FOUND_ROUTE, ...routeModuleList];
  15. export const RootRoute: AppRouteRecordRaw = {
  16. path: '/',
  17. name: 'Root',
  18. redirect: PageEnum.BASE_HOME,
  19. meta: {
  20. title: 'Root',
  21. },
  22. };
  23. export const LoginRoute: AppRouteRecordRaw = {
  24. path: '/login',
  25. name: 'Login',
  26. component: () => import('/@/views/sys/login/Login.vue'),
  27. meta: {
  28. title: t('routes.basic.login'),
  29. },
  30. };
  31. export const WelcomeRoute: AppRouteRecordRaw = {
  32. path: '/welcome',
  33. name: 'Welcome',
  34. component: LAYOUT,
  35. redirect: '/welcome/index',
  36. // component: () => import('/@/views/welcome/index.vue'),
  37. meta: {
  38. title: t('routes.basic.welcome'),
  39. },
  40. children: [
  41. {
  42. path: 'index',
  43. name: 'welcome',
  44. component: () => import('/@/views/welcome/index.vue'),
  45. meta: {
  46. title: t('routes.basic.welcomeLogin'),
  47. hideMenu: true,
  48. },
  49. },
  50. {
  51. path: 'analysis',
  52. name: 'analysis',
  53. component: () => import('/@/views/dashboard/analysis/index.vue'),
  54. meta: {
  55. title: t('routes.dashboard.analysis'),
  56. hideMenu: true,
  57. },
  58. },
  59. ],
  60. };
  61. // Basic routing without permission
  62. export const basicRoutes = [
  63. LoginRoute,
  64. WelcomeRoute,
  65. RootRoute,
  66. ...mainOutRoutes,
  67. REDIRECT_ROUTE,
  68. PAGE_NOT_FOUND_ROUTE,
  69. ];