邃芒慧影管理端
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.
 
 
 
 

304 lines
6.8 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. path: "/",
  8. redirect: "/login",
  9. },
  10. // 登录
  11. {
  12. path: "/login",
  13. component: () => import("@/views/login/index.vue"),
  14. meta: { hidden: true },
  15. name: "login",
  16. },
  17. {
  18. path: "/signSucceed",
  19. component: () => import("@/views/signSucceed/index.vue"),
  20. meta: { hidden: true },
  21. },
  22. {
  23. path: "/",
  24. component: Layout,
  25. redirect: "/model",
  26. children: [
  27. {
  28. path: "model",
  29. component: () => import("@/views/mangage/model.vue"),
  30. name: "model",
  31. meta: {
  32. title: "model",
  33. icon: "homepage",
  34. affix: true,
  35. name: "modelMangage.title",
  36. },
  37. },
  38. ],
  39. },
  40. {
  41. path: "/",
  42. component: Layout,
  43. redirect: "/keyList",
  44. children: [
  45. {
  46. path: "keyList",
  47. component: () => import("@/views/keys/keyList.vue"),
  48. name: "keyList",
  49. meta: {
  50. title: "keyList",
  51. icon: "homepage",
  52. affix: true,
  53. name: "keyMangage.list",
  54. },
  55. },
  56. ],
  57. },
  58. {
  59. path: "/",
  60. component: Layout,
  61. redirect: "/keyCheck",
  62. children: [
  63. {
  64. path: "keyCheck",
  65. component: () => import("@/views/keys/keyCheck.vue"),
  66. name: "keyCheck",
  67. meta: {
  68. title: "keyCheck",
  69. icon: "homepage",
  70. affix: true,
  71. name: "keyMangage.title",
  72. },
  73. },
  74. ],
  75. },
  76. {
  77. path: "/",
  78. component: Layout,
  79. redirect: "/businessList",
  80. children: [
  81. {
  82. path: "businessList",
  83. component: () => import("@/views/business/businessList.vue"),
  84. name: "businessList",
  85. meta: {
  86. title: "businessList",
  87. icon: "homepage",
  88. affix: true,
  89. name: "keyMangage.list",
  90. },
  91. },
  92. ],
  93. },
  94. {
  95. path: "/",
  96. component: Layout,
  97. redirect: "/businessCheck",
  98. children: [
  99. {
  100. path: "businessCheck",
  101. component: () => import("@/views/apiManage/businessCheck.vue"),
  102. name: "businessCheck",
  103. meta: {
  104. title: "businessCheck",
  105. icon: "homepage",
  106. affix: true,
  107. name: "keyMangage.title",
  108. },
  109. },
  110. ],
  111. },
  112. // 系统设置路由
  113. {
  114. path: "/",
  115. component: Layout,
  116. redirect: "/userList",
  117. children: [
  118. {
  119. path: "userList",
  120. component: () => import("@/views/dict/index.vue"),
  121. name: "userList",
  122. meta: {
  123. title: "userList",
  124. icon: "homepage",
  125. affix: true,
  126. name: "userListMangage.title",
  127. },
  128. },
  129. ],
  130. },
  131. {
  132. path: "/",
  133. component: Layout,
  134. redirect: "/ruleList",
  135. children: [
  136. {
  137. path: "ruleList",
  138. component: () => import("@/views/mangage/ruleList.vue"),
  139. name: "ruleList",
  140. meta: {
  141. title: "ruleList",
  142. icon: "homepage",
  143. affix: true,
  144. name: "ruleListMangage.title",
  145. },
  146. },
  147. ],
  148. },
  149. {
  150. path: "/",
  151. component: Layout,
  152. redirect: "/home",
  153. children: [
  154. {
  155. path: "/home",
  156. component: () => import("@/views/home/index.vue"),
  157. name: "home",
  158. meta: {
  159. title: "home",
  160. icon: "home",
  161. affix: true,
  162. name: "ruleListMangage.title",
  163. },
  164. },
  165. {
  166. path: "/apiManage",
  167. component: () => import("@/views/apiManage/index.vue"),
  168. name: "apiManage",
  169. meta: {
  170. title: "apiManage",
  171. icon: "homepage",
  172. affix: true,
  173. name: "ruleListMangage.title",
  174. },
  175. },
  176. {
  177. path: "/privatization",
  178. component: () => import("@/views/privatization/index.vue"),
  179. name: "privatization",
  180. meta: {
  181. title: "privatization",
  182. icon: "homepage",
  183. affix: true,
  184. name: "ruleListMangage.title",
  185. },
  186. },
  187. {
  188. path: "/template",
  189. component: () => import("@/views/template/index.vue"),
  190. name: "template",
  191. meta: {
  192. title: "template",
  193. icon: "homepage",
  194. affix: true,
  195. name: "ruleListMangage.title",
  196. },
  197. },
  198. {
  199. path: "/secretKey",
  200. component: () => import("@/views/secretKey/index.vue"),
  201. name: "secretKey",
  202. meta: {
  203. title: "secretKey",
  204. icon: "homepage",
  205. affix: true,
  206. name: "ruleListMangage.title",
  207. },
  208. },
  209. {
  210. path: "/video",
  211. component: () => import("@/views/video/index.vue"),
  212. name: "video",
  213. meta: {
  214. title: "video",
  215. icon: "homepage",
  216. affix: true,
  217. name: "ruleListMangage.title",
  218. },
  219. },
  220. {
  221. path: "/userManage",
  222. component: () => import("@/views/userManage/userList.vue"),
  223. name: "userManage",
  224. meta: {
  225. title: "userManage",
  226. icon: "homepage",
  227. affix: true,
  228. name: "ruleListMangage.title",
  229. },
  230. },
  231. {
  232. path: "/userMouldList",
  233. component: () => import("@/views/userManage/userMouldList.vue"),
  234. name: "userMouldList",
  235. meta: {
  236. title: "userMouldList",
  237. icon: "homepage",
  238. affix: true,
  239. name: "ruleListMangage.title",
  240. },
  241. },
  242. {
  243. path: "/userVoiceList",
  244. component: () => import("@/views/userManage/userVoiceList.vue"),
  245. name: "userVoiceList",
  246. meta: {
  247. title: "userVoiceList",
  248. icon: "homepage",
  249. affix: true,
  250. name: "ruleListMangage.title",
  251. },
  252. },
  253. {
  254. path: "/rechargeList",
  255. component: () => import("@/views/userManage/rechargeList.vue"),
  256. name: "rechargeList",
  257. meta: {
  258. title: "rechargeList",
  259. icon: "homepage",
  260. affix: true,
  261. name: "ruleListMangage.title",
  262. },
  263. },
  264. {
  265. path: "/videoList",
  266. component: () => import("@/views/userManage/videoList.vue"),
  267. name: "videoList",
  268. meta: {
  269. title: "videoList",
  270. icon: "homepage",
  271. affix: true,
  272. name: "ruleListMangage.title",
  273. },
  274. },
  275. ],
  276. }
  277. ];
  278. /**
  279. * 创建路由
  280. */
  281. const router = createRouter({
  282. history: createWebHashHistory(),
  283. routes: constantRoutes as RouteRecordRaw[],
  284. // 刷新时,滚动条位置还原
  285. // 2023-5-23 添加平滑滚动 YWQ
  286. scrollBehavior: () => ({ behavior: "smooth", left: 0, top: 0 }),
  287. });
  288. /**
  289. * 重置路由
  290. */
  291. export function resetRouter() {
  292. router.replace({ path: "/login" });
  293. }
  294. export default router;