index.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. import Vue from "vue";
  2. import Router from "vue-router";
  3. import { PAGE_PATH } from "../config";
  4. Vue.use(Router);
  5. const router = new Router({
  6. mode: "hash",
  7. scrollBehavior: () => ({ x: 0, y: 0 }),
  8. routes: [
  9. { path: "/", redirect: PAGE_PATH.user },
  10. //用户
  11. {
  12. path: PAGE_PATH.layout,
  13. redirect: PAGE_PATH.user,
  14. component: () => import("../views/Layout/index.vue"),
  15. children: [
  16. {
  17. path: PAGE_PATH.user,
  18. component: () => import("../views/User/index.vue"),
  19. },
  20. ],
  21. },
  22. //角色
  23. {
  24. path: PAGE_PATH.layout,
  25. component: () => import("../views/Layout/index.vue"),
  26. children: [
  27. {
  28. path: PAGE_PATH.role,
  29. component: () => import("../views/Role/index.vue"),
  30. },
  31. ],
  32. },
  33. //菜单
  34. {
  35. path: PAGE_PATH.layout,
  36. component: () => import("../views/Layout/index.vue"),
  37. children: [
  38. {
  39. path: PAGE_PATH.menu,
  40. component: () => import("../views/Menu/index.vue"),
  41. },
  42. ],
  43. },
  44. //部门
  45. {
  46. path: PAGE_PATH.layout,
  47. component: () => import("../views/Layout/index.vue"),
  48. children: [
  49. {
  50. path: PAGE_PATH.department,
  51. component: () => import("../views/Department/index.vue"),
  52. },
  53. ],
  54. },
  55. //岗位
  56. {
  57. path: PAGE_PATH.layout,
  58. component: () => import("../views/Layout/index.vue"),
  59. children: [
  60. {
  61. path: PAGE_PATH.station,
  62. component: () => import("../views/Station/index.vue"),
  63. },
  64. ],
  65. },
  66. //字典
  67. {
  68. path: PAGE_PATH.layout,
  69. component: () => import("../views/Layout/index.vue"),
  70. children: [
  71. {
  72. path: PAGE_PATH.dict,
  73. component: () => import("../views/Dict/index.vue"),
  74. },
  75. ],
  76. },
  77. //参数
  78. {
  79. path: PAGE_PATH.layout,
  80. component: () => import("../views/Layout/index.vue"),
  81. children: [
  82. {
  83. path: PAGE_PATH.parameter,
  84. component: () => import("../views/Parameter/index.vue"),
  85. },
  86. ],
  87. },
  88. //日志
  89. {
  90. path: PAGE_PATH.layout,
  91. redirect: PAGE_PATH.updateDaily,
  92. component: () => import("../views/Layout/index.vue"),
  93. children: [
  94. {
  95. path: PAGE_PATH.updateDaily,
  96. component: () => import("../views/Daily/UpdateDaily/index.vue"),
  97. },
  98. {
  99. path: PAGE_PATH.handleDaily,
  100. component: () => import("../views/Daily/HandleDaily/index.vue"),
  101. },
  102. {
  103. path: PAGE_PATH.loginDaily,
  104. component: () => import("../views/Daily/LoginDaily/index.vue"),
  105. },
  106. ],
  107. },
  108. //编码
  109. {
  110. path: PAGE_PATH.layout,
  111. component: () => import("../views/Layout/index.vue"),
  112. children: [
  113. {
  114. path: PAGE_PATH.codeRules,
  115. component: () => import("../views/CodeRules/index.vue"),
  116. },
  117. ],
  118. },
  119. // {
  120. // path: PAGE_PATH.layout,
  121. // component: () => import("../views/Layout/index.vue"),
  122. // redirect: PAGE_PATH.user,
  123. // children: [
  124. // {
  125. // path: PAGE_PATH.user,
  126. // // component: () => import("../views/User/index.vue"),
  127. // },
  128. // {
  129. // path: PAGE_PATH.authority,
  130. // // component: () => import("../views/Authority/index.vue"),
  131. // }
  132. // ],
  133. // },
  134. ],
  135. });
  136. // router.beforeEach((to, from, next) => {
  137. // NProgress.start()
  138. // if(to.fullPath !== '/login' && !auth()){
  139. // router.replace({ path: '/login'})
  140. // return next()
  141. // }
  142. // next()
  143. // })
  144. // router.beforeEach((to, from, next) => {
  145. // NProgress.start();
  146. // if (to.fullPath !== "/login" && !auth()) {
  147. // next("/login");
  148. // } else {
  149. // next();
  150. // }
  151. // });
  152. // router.afterEach(() => {
  153. // NProgress.done();
  154. // });
  155. export default router;