index.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
  2. import type { RouteRecordRaw } from 'vue-router'
  3. import Layout from '@/layout/index.vue'
  4. // 示例路由配置
  5. const routes: Array<RouteRecordRaw> = [
  6. {
  7. path: '/',
  8. name: '',
  9. component: () => import('../views/login/login.vue')
  10. },
  11. {
  12. path: '/login',
  13. name: 'Login',
  14. component: () => import('../views/login/login.vue')
  15. },
  16. {
  17. path: '/main',
  18. name: 'main',
  19. component: Layout,
  20. children: [
  21. {
  22. path: 'school',
  23. name: 'school',
  24. component: () => import('@/views/school/index.vue')
  25. },
  26. {
  27. path: 'teacherList',
  28. name: 'teacherList',
  29. component: () => import('@/views/school/teacherList.vue')
  30. },
  31. {
  32. path: 'manager',
  33. name: 'manager',
  34. component: () => import('@/views/manager/index.vue')
  35. },
  36. {
  37. path: 'examination',
  38. name: 'examination',
  39. component: () => import('@/views/examination/index.vue')
  40. },
  41. {
  42. path: 'userSearch', //用户查询
  43. name: 'userSearch',
  44. component: () => import('@/views/userSearch/index.vue')
  45. },
  46. {
  47. path: 'logMonitor', //日志监控
  48. name: 'logMonitor',
  49. component: () => import('@/views/logMonitor/index.vue')
  50. },
  51. {
  52. path: 'logMonitorDetail', //日志监控详情
  53. name: 'logMonitorDetail',
  54. component: () => import('@/views/logMonitor/LogMonitorDetail.vue')
  55. },
  56. {
  57. path: 'performanceMonitor', //业务监控
  58. name: 'performanceMonitor',
  59. component: () => import('@/views/performanceMonitor/index.vue')
  60. },
  61. ]
  62. },
  63. {
  64. path: '/:pathMatch(.*)*', // 捕获所有未匹配路径
  65. name: 'NotFound',
  66. component: () => import('../views/login/login.vue') // 未匹配到路由跳转到登录页面
  67. }
  68. ]
  69. const router = createRouter({
  70. history: createWebHashHistory(),
  71. routes
  72. })
  73. export default router