index.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
  2. export const Layout = () => import("@/layout/index.vue");
  3. // 静态路由
  4. export const constantRoutes: RouteRecordRaw[] = [
  5. {
  6. path: "/redirect",
  7. component: Layout,
  8. meta: { hidden: true },
  9. children: [
  10. {
  11. path: "/redirect/:path(.*)",
  12. component: () => import("@/views/redirect/index.vue"),
  13. },
  14. ],
  15. },
  16. {
  17. path: "/login",
  18. component: () => import("@/views/login/index.vue"),
  19. meta: { hidden: true },
  20. },
  21. {
  22. path: "/",
  23. name: "/",
  24. component: Layout,
  25. redirect: "/process",
  26. children: [
  27. {
  28. path: "process",
  29. component: () => import("@/views/process/main.vue"),
  30. name: "process",
  31. meta: {
  32. title: "process",
  33. icon: "homepage",
  34. },
  35. },
  36. {
  37. path: "pro-steps",
  38. component: () => import("@/views/pro-steps/index.vue"),
  39. name: "pro-steps",
  40. meta: {
  41. title: "pro-steps",
  42. icon: "homepage",
  43. back: true,
  44. },
  45. children: [
  46. {
  47. path: "dianjian",
  48. component: () =>
  49. import("@/views/pro-steps/components/dianjian.vue"),
  50. name: "dianjian",
  51. meta: {
  52. back: true,
  53. },
  54. },
  55. {
  56. path: "duomeiticaiji",
  57. component: () =>
  58. import("@/views/pro-steps/components/duomeiticaiji.vue"),
  59. name: "duomeiticaiji",
  60. meta: {
  61. back: true,
  62. },
  63. },
  64. {
  65. path: "esop",
  66. component: () => import("@/views/pro-steps/components/ESOP.vue"),
  67. name: "esop",
  68. meta: {
  69. back: true,
  70. },
  71. },
  72. {
  73. path: "jingu",
  74. component: () => import("@/views/pro-steps/components/jingu.vue"),
  75. name: "jingu",
  76. meta: {
  77. back: true,
  78. },
  79. },
  80. {
  81. path: "mingpaibangding",
  82. component: () =>
  83. import("@/views/pro-steps/components/mingpaibangding.vue"),
  84. name: "mingpaibangding",
  85. meta: {
  86. back: true,
  87. },
  88. },
  89. {
  90. path: "Jiluxiang",
  91. component: () =>
  92. import("@/views/pro-steps/components/Jiluxiang.vue"),
  93. name: "Jiluxiang",
  94. meta: {
  95. back: true,
  96. keepAlive: true,
  97. },
  98. },
  99. {
  100. path: "shebeijilu",
  101. component: () =>
  102. import("@/views/pro-steps/components/shebeijilu.vue"),
  103. name: "shebeijilu",
  104. meta: {
  105. back: true,
  106. },
  107. },
  108. {
  109. path: "tiaoshipipei",
  110. component: () =>
  111. import("@/views/pro-steps/components/tiaoshipipei.vue"),
  112. name: "tiaoshipipei",
  113. meta: {
  114. back: true,
  115. },
  116. },
  117. {
  118. path: "wuliaocaiji",
  119. component: () =>
  120. import("@/views/pro-steps/components/wuliaocaiji.vue"),
  121. name: "wuliaocaiji",
  122. meta: {
  123. back: true,
  124. keepAlive: true,
  125. },
  126. },
  127. ],
  128. },
  129. ],
  130. },
  131. {
  132. path: "/:pathMatch(.*)*", // 必备
  133. component: () => import("@/views/error-page/404.vue"),
  134. },
  135. ];
  136. /**
  137. * 创建路由
  138. */
  139. const router = createRouter({
  140. history: createWebHashHistory(),
  141. routes: constantRoutes,
  142. // 刷新时,滚动条位置还原
  143. scrollBehavior: () => ({ left: 0, top: 0 }),
  144. });
  145. /**
  146. * 重置路由
  147. */
  148. export function resetRouter() {
  149. router.replace({ path: "/login" });
  150. }
  151. export default router;