index.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. import VueRouter from 'vue-router'
  2. import Vue from 'vue'
  3. // 懒加载引入页面组件,es6语法
  4. const Home = () => import('views/home/Index')
  5. const TimelineIndex = () => import('views/home/Timeline')
  6. const StatusPage = () => import('views/home/Status')
  7. const VideoIndex = () => import('views/home/Video')
  8. const VideoPage = () => import('views/home/VideoPage')
  9. const LivePage = () => import('views/home/LivePage')
  10. const AudioIndex = () => import('views/home/Audio')
  11. const AudioPage = () => import('views/home/AudioPage')
  12. const ImageIndex = () => import('views/home/Image')
  13. const ImagePage = () => import('views/home/ImagePage')
  14. const ArticleIndex = () => import('views/home/Article')
  15. const ArticlePage = () => import('views/home/ArticlePage')
  16. const Search = () => import('views/home/Search')
  17. const UserHome = () => import('views/user/Home')
  18. const UserVideo = () => import('views/user/Home')
  19. const UserImage = () => import('views/user/Home')
  20. const UserAudio = () => import('views/user/Home')
  21. const UserArticle = () => import('views/user/Home')
  22. const UserRelation = () => import('views/user/UserRelation')
  23. const CollectionIndex = () => import('views/user/Collection')
  24. const HistoryIndex = () => import('views/user/History')
  25. const PostPublish = () => import('views/post/PostPublish')
  26. const PostPublishVideo = () => import('views/post/PostPublish')
  27. const PostEditVideo = () => import('components/upload/EditVideo')
  28. const PostPublishAudio = () => import('views/post/PostPublish')
  29. const PostEditAudio = () => import('components/upload/EditAudio')
  30. const PostPublishAlbum = () => import('views/post/PostPublish')
  31. const PostEditAlbum = () => import('components/upload/EditImage')
  32. const PostPublishArticle = () => import('views/post/PostPublish')
  33. const PostList = () => import('views/post/PostList')
  34. const UserPostVideo = () => import('views/post/PostList')
  35. const UserPostAudio = () => import('views/post/PostList')
  36. const UserPostImage = () => import('views/post/PostList')
  37. const UserPostArticle = () => import('views/post/PostList')
  38. const PostAnalysis = () => import('views/post/PostAnalysis')
  39. const MessageIndex = () => import('views/message/Message')
  40. const DiscoverIndex = () => import('views/home/Discover')
  41. const BdMap = () => import('views/home/BdMap')
  42. const AMap = () => import('views/home/AMap')
  43. const Vip = () => import('views/vip/Vip')
  44. const Admin = () => import('views/admin/AdminUser')
  45. const AdminUser = () => import('views/admin/AdminUser')
  46. const AdminPost = () => import('views/admin/AdminPost')
  47. const AdminPostVideo = () => import('views/admin/AdminPost')
  48. const AdminPostAudio = () => import('views/admin/AdminPost')
  49. const AdminPostImage = () => import('views/admin/AdminPost')
  50. const AdminPostArticle = () => import('views/admin/AdminPost')
  51. const AdminEditVideo = () => import('components/admin/AdminEditVideo')
  52. // 使用安装路由插件
  53. Vue.use(VueRouter)
  54. const routes = [
  55. {
  56. path: '/sso',
  57. name: 'sso',
  58. redirect: '/sso/login',
  59. component: () => import('@/views/sso/layout'),
  60. children: [
  61. {
  62. path: '/sso/login',
  63. meta: {
  64. title: '验证码登录',
  65. needLogin: false,
  66. },
  67. component: () => import('@/views/sso/login'),
  68. },
  69. {
  70. path: '/sso/login1',
  71. meta: {
  72. title: '密码登录',
  73. needLogin: false,
  74. },
  75. component: () => import('@/views/sso/login1'),
  76. },
  77. {
  78. path: '/sso/register',
  79. meta: {
  80. title: '账号注册?',
  81. needLogin: false,
  82. },
  83. component: () => import('@/views/sso/register'),
  84. },
  85. {
  86. path: '/sso/forget',
  87. meta: {
  88. title: '找回密码?',
  89. needLogin: false,
  90. },
  91. component: () => import('@/views/sso/forget'),
  92. },
  93. ],
  94. },
  95. {
  96. path: '/',
  97. name: 'index',
  98. component: Home
  99. },
  100. {
  101. path: '/status',
  102. name: 'TimelineIndex',
  103. component: TimelineIndex
  104. },
  105. {
  106. path: '/status/:statusId',
  107. name: 'StatusPage',
  108. component: StatusPage
  109. },
  110. {
  111. path: '/video',
  112. name: 'VideoIndex',
  113. component: VideoIndex
  114. },
  115. {
  116. path: '/video/:id',
  117. name: 'VideoPage',
  118. component: VideoPage
  119. },
  120. {
  121. path: '/live/:id',
  122. name: 'LivePage',
  123. component: LivePage
  124. },
  125. {
  126. path: '/audio',
  127. name: 'AudioIndex',
  128. component: AudioIndex
  129. },
  130. {
  131. path: '/audio/:audioId',
  132. name: 'AudioPage',
  133. component: AudioPage
  134. },
  135. {
  136. path: '/image',
  137. name: 'ImageIndex',
  138. component: ImageIndex
  139. },
  140. {
  141. path: '/image/album/:albumId',
  142. name: 'ImagePage',
  143. component: ImagePage
  144. },
  145. {
  146. path: '/article',
  147. name: 'ArticleIndex',
  148. component: ArticleIndex
  149. },
  150. {
  151. path: '/article/:articleId',
  152. name: 'ArticlePage',
  153. component: ArticlePage
  154. },
  155. {
  156. path: '/discover',
  157. name: 'DiscoverIndex',
  158. component: DiscoverIndex
  159. },
  160. {
  161. path: '/search',
  162. name: 'search',
  163. component: Search
  164. },
  165. {
  166. path: '/user/:id',
  167. name: 'UserHome',
  168. component: UserHome
  169. },
  170. {
  171. path: '/user/:id/video',
  172. name: 'UserVideo',
  173. component: UserVideo
  174. },
  175. {
  176. path: '/user/:id/image',
  177. name: 'UserImage',
  178. component: UserImage
  179. },
  180. {
  181. path: '/user/:id/audio',
  182. name: 'UserAudio',
  183. component: UserAudio
  184. },
  185. {
  186. path: '/user/:id/article',
  187. name: 'UserArticle',
  188. component: UserArticle
  189. },
  190. {
  191. path: '/user/:id/following',
  192. name: 'UserRelation',
  193. component: UserRelation
  194. },
  195. {
  196. path: '/user/:id/follower',
  197. name: 'UserRelation',
  198. component: UserRelation
  199. },
  200. {
  201. path: '/u/collection',
  202. name: 'CollectionIndex',
  203. component: CollectionIndex
  204. },
  205. {
  206. path: '/u/myfavlist',
  207. name: 'CollectionIndex',
  208. component: CollectionIndex
  209. },
  210. {
  211. path: '/u/favlist',
  212. name: 'CollectionIndex',
  213. component: CollectionIndex
  214. },
  215. {
  216. path: '/u/history',
  217. name: 'HistoryIndex',
  218. component: HistoryIndex
  219. },
  220. {
  221. path: '/post/publish',
  222. name: 'PostPublish',
  223. component: PostPublish
  224. },
  225. {
  226. path: '/post/publish/video',
  227. name: 'PostPublishVideo',
  228. component: PostPublishVideo
  229. },
  230. {
  231. path: '/post/edit/video/:videoId',
  232. name: 'PostEditVideo',
  233. component: PostEditVideo
  234. },
  235. {
  236. path: '/post/publish/audio',
  237. name: 'PostPublishAudio',
  238. component: PostPublishAudio
  239. },
  240. {
  241. path: '/post/edit/audio/:audioId',
  242. name: 'PostEditAudio',
  243. component: PostEditAudio
  244. },
  245. {
  246. path: '/post/publish/image',
  247. name: 'PostPublishAlbum',
  248. component: PostPublishAlbum
  249. },
  250. {
  251. path: '/post/edit/album/:albumId',
  252. name: 'PostEditAlbum',
  253. component: PostEditAlbum
  254. },
  255. {
  256. path: '/post/publish/article',
  257. name: 'PostPublishArticle',
  258. component: PostPublishArticle
  259. },
  260. {
  261. path: '/post/list',
  262. name: 'PostList',
  263. component: PostList
  264. },
  265. {
  266. path: '/post/video',
  267. name: 'UserPostVideo',
  268. component: UserPostVideo
  269. },
  270. {
  271. path: '/post/audio',
  272. name: 'UserPostAudio',
  273. component: UserPostAudio
  274. },
  275. {
  276. path: '/post/image',
  277. name: 'UserPostImage',
  278. component: UserPostImage
  279. },
  280. {
  281. path: '/post/article',
  282. name: 'UserPostArticle',
  283. component: UserPostArticle
  284. },
  285. {
  286. path: '/post/analysis',
  287. name: 'PostAnalysis',
  288. component: PostAnalysis
  289. },
  290. {
  291. path: '/message',
  292. name: 'MessageIndex',
  293. component: MessageIndex
  294. },
  295. {
  296. path: '/map',
  297. name: 'AMap',
  298. component: AMap
  299. },
  300. {
  301. path: '/bdmap',
  302. name: 'BdMap',
  303. component: BdMap
  304. },
  305. {
  306. path: '/amap',
  307. name: 'AMap',
  308. component: AMap
  309. },
  310. {
  311. path: '/vip',
  312. name: 'Vip',
  313. component: Vip
  314. },
  315. {
  316. path: '/admin',
  317. name: 'Admin',
  318. component: Admin
  319. },
  320. {
  321. path: '/admin/user',
  322. name: 'AdminUser',
  323. component: AdminUser
  324. },
  325. {
  326. path: '/admin/post',
  327. name: 'AdminPost',
  328. component: AdminPost
  329. },
  330. {
  331. path: '/admin/post/video',
  332. name: 'AdminPostVideo',
  333. component: AdminPostVideo
  334. },
  335. {
  336. path: '/admin/post/image',
  337. name: 'AdminPostImage',
  338. component: AdminPostImage
  339. },
  340. {
  341. path: '/admin/post/audio',
  342. name: 'AdminPostAudio',
  343. component: AdminPostAudio
  344. },
  345. {
  346. path: '/admin/post/article',
  347. name: 'AdminPostArticle',
  348. component: AdminPostArticle
  349. },
  350. {
  351. path: '/admin/edit/video/:videoId',
  352. name: 'AdminEditVideo',
  353. component: AdminEditVideo
  354. },
  355. {
  356. path: '*',
  357. name: '404',
  358. component: () => import('@/views/404.vue'),
  359. meta: {
  360. title: '404'
  361. }
  362. }
  363. ]
  364. // 创建路由对象
  365. const router = new VueRouter({
  366. mode: 'history',
  367. routes
  368. })
  369. // 导出router
  370. export default router