元气智驾官网后台前端页面
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.
 
 
 
 

257 lines
6.5 KiB

  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '@/layout'
  6. /**
  7. * Note: sub-menu only appear when route children.length >= 1
  8. * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
  9. *
  10. * hidden: true if set true, item will not show in the sidebar(default is false)
  11. * alwaysShow: true if set true, will always show the root menu
  12. * if not set alwaysShow, when item has more than one children route,
  13. * it will becomes nested mode, otherwise not show the root menu
  14. * redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
  15. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  16. * meta : {
  17. roles: ['admin','editor'] control the page roles (you can set multiple roles)
  18. title: 'title' the name show in sidebar and breadcrumb (recommend set)
  19. icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
  20. breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
  21. activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
  22. }
  23. */
  24. /**
  25. * constantRoutes
  26. * a base page that does not have permission requirements
  27. * all roles can be accessed
  28. */
  29. export const constantRoutes = [
  30. {
  31. path: '/login',
  32. component: () => import('@/views/login/index'),
  33. hidden: true
  34. },
  35. {
  36. path: '/404',
  37. component: () => import('@/views/404'),
  38. hidden: true
  39. },
  40. {
  41. path: '/',
  42. component: Layout,
  43. redirect: '/home',
  44. children: [{
  45. path: 'home',
  46. name: 'home',
  47. component: () => import('@/views/home/index'),
  48. meta: { title: 'Home', icon: 'dashboard' }
  49. }]
  50. },
  51. {
  52. path: '/homePage',
  53. component: Layout,
  54. alwaysShow: true,
  55. redirect: '/homePage/carousel',
  56. name: 'homePage',
  57. meta: {
  58. title: '首页',
  59. icon: 'nested'
  60. },
  61. children: [
  62. {
  63. path: 'carousel',
  64. component: () => import('@/views/homePage/carousel'),
  65. meta: { title: '轮播' }
  66. },
  67. {
  68. path: 'carHot',
  69. component: () => import('@/views/homePage/carHot'),
  70. meta: { title: '汽车资讯热门' }
  71. },
  72. {
  73. path: 'banner1',
  74. component: () => import('@/views/homePage/banner1'),
  75. meta: { title: '广告位1' }
  76. },
  77. {
  78. path: 'yyzHot',
  79. component: () => import('@/views/homePage/yyzHot'),
  80. meta: { title: '元宇宙日爆热门' }
  81. },
  82. {
  83. path: 'banner2',
  84. component: () => import('@/views/homePage/banner2'),
  85. meta: { title: '广告位2' }
  86. },
  87. {
  88. path: 'link',
  89. component: () => import('@/views/homePage/link'),
  90. meta: { title: '外链' }
  91. }
  92. ]
  93. },
  94. {
  95. path: '/car',
  96. component: Layout,
  97. alwaysShow: true,
  98. redirect: '/car/carousel',
  99. name: 'car',
  100. meta: {
  101. title: '汽车资讯',
  102. icon: 'nested'
  103. },
  104. children: [
  105. {
  106. path: 'carousel',
  107. component: () => import('@/views/car/carousel'),
  108. meta: { title: '轮播' }
  109. },
  110. {
  111. path: 'news',
  112. component: () => import('@/views/car/news'),
  113. meta: { title: '热点新闻配置' }
  114. },
  115. {
  116. path: 'banner1',
  117. component: () => import('@/views/car/banner1'),
  118. meta: { title: '广告位1' }
  119. },
  120. {
  121. path: 'video',
  122. component: () => import('@/views/car/video'),
  123. meta: { title: '视频轮播' }
  124. },
  125. {
  126. path: 'banner2',
  127. component: () => import('@/views/car/banner2'),
  128. meta: { title: '广告位2' }
  129. }
  130. ]
  131. },
  132. {
  133. path: '/yyzrb',
  134. component: Layout,
  135. alwaysShow: true,
  136. redirect: '/yyzrb/carousel',
  137. name: 'yyzrb',
  138. meta: {
  139. title: '元宇宙日爆',
  140. icon: 'nested'
  141. },
  142. children: [
  143. {
  144. path: 'carousel',
  145. component: () => import('@/views/yyzrb/carousel'),
  146. meta: { title: '轮播' }
  147. },
  148. {
  149. path: 'news',
  150. component: () => import('@/views/yyzrb/news'),
  151. meta: { title: '热点新闻配置' }
  152. },
  153. {
  154. path: 'banner1',
  155. component: () => import('@/views/yyzrb/banner1'),
  156. meta: { title: '广告位1' }
  157. },
  158. {
  159. path: 'banner2',
  160. component: () => import('@/views/yyzrb/banner2'),
  161. meta: { title: '广告位2' }
  162. }
  163. ]
  164. },
  165. {
  166. path: '/aigc',
  167. component: Layout,
  168. alwaysShow: true,
  169. redirect: '/aigc/carousel',
  170. name: 'aigc',
  171. meta: {
  172. title: 'AIGC',
  173. icon: 'nested'
  174. },
  175. children: [
  176. {
  177. path: 'carousel',
  178. component: () => import('@/views/aigc/carousel'),
  179. meta: { title: '轮播' }
  180. },
  181. {
  182. path: 'numberImg',
  183. component: () => import('@/views/aigc/numberImg'),
  184. meta: { title: '数字人形象' }
  185. },
  186. {
  187. path: 'banner1',
  188. component: () => import('@/views/aigc/banner1'),
  189. meta: { title: '广告位1' }
  190. },
  191. {
  192. path: 'numberLive',
  193. component: () => import('@/views/aigc/numberLive'),
  194. meta: { title: '数字人直播' }
  195. },
  196. {
  197. path: 'banner2',
  198. component: () => import('@/views/aigc/banner2'),
  199. meta: { title: '广告位2' }
  200. },
  201. {
  202. path: 'video',
  203. component: () => import('@/views/aigc/video'),
  204. meta: { title: '数字人视频' }
  205. }
  206. ]
  207. },
  208. {
  209. path: '/about',
  210. component: Layout,
  211. alwaysShow: true,
  212. redirect: '/about/company',
  213. name: 'about',
  214. meta: {
  215. title: '关于我们',
  216. icon: 'nested'
  217. },
  218. children: [
  219. {
  220. path: 'company',
  221. component: () => import('@/views/about/company'),
  222. meta: { title: '公司介绍' }
  223. },
  224. {
  225. path: 'member',
  226. component: () => import('@/views/about/member'),
  227. meta: { title: '成员介绍' }
  228. }
  229. ]
  230. }
  231. // 404 page must be placed at the end !!!
  232. // { path: '*', redirect: '/404', hidden: true }
  233. ]
  234. const createRouter = () => new Router({
  235. base: '/',
  236. mode: 'history', // require service support
  237. scrollBehavior: () => ({ y: 0 }),
  238. routes: constantRoutes
  239. })
  240. const router = createRouter()
  241. // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
  242. export function resetRouter() {
  243. const newRouter = createRouter()
  244. router.matcher = newRouter.matcher // reset router
  245. }
  246. export default router