邃芒慧影管理端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

117 lines
2.4 KiB

  1. import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
  2. import { getCurrentInstance } from "vue";
  3. export const Layout = () => import("@/layout/index.vue");
  4. // 静态路由
  5. export const constantRoutes: RouteRecordRaw[] = [
  6. // 登录
  7. {
  8. path: "/login",
  9. component: () => import("@/views/login/index.vue"),
  10. meta: { hidden: true },
  11. name: "login",
  12. },
  13. {
  14. path: "/signSucceed",
  15. component: () => import("@/views/signSucceed/index.vue"),
  16. meta: { hidden: true },
  17. },
  18. {
  19. path: "/",
  20. component: Layout,
  21. redirect: "/model",
  22. children: [
  23. {
  24. path: "model",
  25. component: () => import("@/views/mangage/model.vue"),
  26. name: "model",
  27. meta: {
  28. title: "model",
  29. icon: "homepage",
  30. affix: true,
  31. name: "modelMangage.title",
  32. },
  33. },
  34. ],
  35. },
  36. {
  37. path: "/",
  38. component: Layout,
  39. redirect: "/keyCheck",
  40. children: [
  41. {
  42. path: "keyCheck",
  43. component: () => import("@/views/mangage/keyCheck.vue"),
  44. name: "keyCheck",
  45. meta: {
  46. title: "keyCheck",
  47. icon: "homepage",
  48. affix: true,
  49. name: "keyMangage.title",
  50. },
  51. },
  52. ],
  53. },
  54. // 系统设置路由
  55. {
  56. path: "/",
  57. component: Layout,
  58. redirect: "/userList",
  59. children: [
  60. {
  61. path: "userList",
  62. component: () => import("@/views/dict/index.vue"),
  63. name: "userList",
  64. meta: {
  65. title: "userList",
  66. icon: "homepage",
  67. affix: true,
  68. name: "userListMangage.title",
  69. },
  70. },
  71. ],
  72. },
  73. {
  74. path: "/",
  75. component: Layout,
  76. redirect: "/ruleList",
  77. children: [
  78. {
  79. path: "ruleList",
  80. component: () => import("@/views/mangage/ruleList.vue"),
  81. name: "ruleList",
  82. meta: {
  83. title: "ruleList",
  84. icon: "homepage",
  85. affix: true,
  86. name: "ruleListMangage.title",
  87. },
  88. },
  89. ],
  90. },
  91. ];
  92. /**
  93. * 创建路由
  94. */
  95. const router = createRouter({
  96. history: createWebHashHistory(),
  97. routes: constantRoutes as RouteRecordRaw[],
  98. // 刷新时,滚动条位置还原
  99. // 2023-5-23 添加平滑滚动 YWQ
  100. scrollBehavior: () => ({ behavior: "smooth", left: 0, top: 0 }),
  101. });
  102. /**
  103. * 重置路由
  104. */
  105. export function resetRouter() {
  106. router.replace({ path: "/login" });
  107. }
  108. export default router;