邃芒慧影、口播(PC) https://neuver.metavatar.cc/
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

169 行
3.5 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. {
  20. path: "/",
  21. component: Layout,
  22. redirect: "/createVideo",
  23. children: [
  24. {
  25. path: "createVideo",
  26. component: () => import("@/views/createVideo/index.vue"),
  27. name: "createVideo",
  28. meta: {
  29. title: "createVideo",
  30. icon: "homepage",
  31. affix: true,
  32. name: "createVideo.title",
  33. },
  34. },
  35. ],
  36. },
  37. // 视频列表
  38. {
  39. path: "/",
  40. component: Layout,
  41. redirect: "/myCreating",
  42. children: [
  43. {
  44. path: "myCreating",
  45. component: () => import("@/views/myCreating/index.vue"),
  46. name: "myCreating",
  47. meta: {
  48. title: "myCreating",
  49. icon: "homepage",
  50. affix: true,
  51. name: "myCreating.title",
  52. },
  53. },
  54. ],
  55. }, // 定制分身
  56. {
  57. path: "/",
  58. component: Layout,
  59. redirect: "/userModel",
  60. children: [
  61. {
  62. path: "userModel",
  63. component: () => import("@/views/userModel/index.vue"),
  64. name: "userModel",
  65. meta: {
  66. title: "userModel",
  67. icon: "homepage",
  68. affix: true,
  69. name: "userModel.title",
  70. },
  71. },
  72. ],
  73. }, // 定制声纹
  74. {
  75. path: "/",
  76. component: Layout,
  77. redirect: "/voiceModel",
  78. children: [
  79. {
  80. path: "voiceModel",
  81. component: () => import("@/views/voiceModel/index.vue"),
  82. name: "voiceModel",
  83. meta: {
  84. title: "voiceModel",
  85. icon: "homepage",
  86. affix: true,
  87. name: "voiceModel.title",
  88. },
  89. },
  90. ],
  91. }, {
  92. path: "/",
  93. component: Layout,
  94. redirect: "/myStore",
  95. children: [
  96. {
  97. path: "myStore",
  98. component: () => import("@/views/myStore/index.vue"),
  99. name: "myStore",
  100. meta: {
  101. title: "myStore",
  102. icon: "homepage",
  103. affix: true,
  104. name: "myStore.title",
  105. },
  106. },
  107. ],
  108. }, {
  109. path: "/",
  110. component: Layout,
  111. redirect: "/myAPI",
  112. children: [
  113. {
  114. path: "myAPI",
  115. component: () => import("@/views/myAPI/index.vue"),
  116. name: "myAPI",
  117. meta: {
  118. title: "myAPI",
  119. icon: "homepage",
  120. affix: true,
  121. name: "API.title",
  122. },
  123. },
  124. ],
  125. },
  126. {
  127. path: "/",
  128. component: Layout,
  129. redirect: "/moveImg",
  130. children: [
  131. {
  132. path: "moveImg",
  133. component: () => import("@/views/moveImg/index.vue"),
  134. name: "moveImg",
  135. meta: {
  136. title: "moveImg",
  137. icon: "homepage",
  138. affix: true,
  139. name: "moveImg.title",
  140. },
  141. },
  142. ],
  143. },
  144. ];
  145. /**
  146. * 创建路由
  147. */
  148. const router = createRouter({
  149. history: createWebHashHistory(),
  150. routes: constantRoutes as RouteRecordRaw[],
  151. // 刷新时,滚动条位置还原
  152. // 2023-5-23 添加平滑滚动 YWQ
  153. scrollBehavior: () => ({ behavior: "smooth", left: 0, top: 0 }),
  154. });
  155. /**
  156. * 重置路由
  157. */
  158. export function resetRouter() {
  159. router.replace({ path: "/login" });
  160. }
  161. export default router;