index.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. import VueRouter from 'vue-router'
  2. import Vue from 'vue'
  3. // 懒加载引入页面组件,es6语法
  4. // ********************************************************************************************************************
  5. // 应用主页
  6. const Home = () => import('views/home/Index')
  7. const TimelineIndex = () => import('views/home/Timeline')
  8. const StatusPage = () => import('views/home/Status')
  9. const VideoIndex = () => import('views/home/Video')
  10. const ShortVideoIndex = () => import('views/home/ShortVideo')
  11. const VideoPage = () => import('views/home/VideoPage')
  12. const VideoList = () => import('views/home/VideoList')
  13. const LivePage = () => import('views/home/LivePage')
  14. const AudioIndex = () => import('views/home/Audio')
  15. const AudioPage = () => import('views/home/AudioPage')
  16. const ImageIndex = () => import('views/home/Image')
  17. const ImagePage = () => import('views/home/ImagePage')
  18. const ArticleIndex = () => import('views/home/Article')
  19. const ArticlePage = () => import('views/home/ArticlePage')
  20. const MessageStream = () => import('views/home/MessageStream1')
  21. const Search = () => import('views/home/Search')
  22. const DiscoverIndex = () => import('views/home/Discover')
  23. const BdMap = () => import('views/home/BdMap')
  24. const AMap = () => import('views/home/AMap')
  25. const Vip = () => import('views/vip/Vip')
  26. // ********************************************************************************************************************
  27. // 用户前台主页
  28. const UserHome = () => import('views/user/Home')
  29. const UserVideo = () => import('views/user/Home')
  30. const UserImage = () => import('views/user/Home')
  31. const UserAudio = () => import('views/user/Home')
  32. const UserArticle = () => import('views/user/Home')
  33. const UserRelation = () => import('views/user/UserRelation')
  34. // ********************************************************************************************************************
  35. // 用户后台主页
  36. const My = () => import('views/my/My')
  37. const MyProfile = () => import('views/my/MyProfile')
  38. const MyVip = () => import('views/my/MyVip')
  39. // 收藏夹
  40. const FavlistVideo = () => import('views/my/FavlistVideo')
  41. const FavlistImage = () => import('views/my/FavlistImage')
  42. // 浏览记录
  43. const HistoryIndex = () => import('views/my/History')
  44. // 消息
  45. const MessageIndex = () => import('views/my/Message')
  46. // 发布稿件
  47. const PostPublishVideo = () => import('components/upload/PublishVideo')
  48. const PostPublishAudio = () => import('components/upload/PublishAudio')
  49. const PostPublishAlbum = () => import('components/upload/PublishImage')
  50. const PostPublishArticle = () => import('components/upload/PublishArticle')
  51. const PostPublishFile = () => import('components/upload/PublishFile')
  52. // 稿件列表
  53. const UserPostVideo = () => import('views/post/VideoPost')
  54. const PostEditVideo = () => import('components/upload/EditVideo')
  55. const UserPostAudio = () => import('views/post/AudioPost')
  56. const PostEditAudio = () => import('components/upload/EditAudio')
  57. const UserPostImage = () => import('views/post/ImagePost')
  58. const PostEditAlbum = () => import('components/upload/EditImage')
  59. const UserPostArticle = () => import('views/post/ArticlePost')
  60. const PostEditArticle = () => import('components/upload/EditArticle')
  61. const PostPublish = () => import('views/post/PostPublish')
  62. const PostList = () => import('views/post/PostList')
  63. const PostAnalysis = () => import('views/post/PostAnalysis')
  64. // 使用安装路由插件
  65. Vue.use(VueRouter)
  66. const routes = [
  67. {
  68. path: '/my',
  69. name: 'My',
  70. component: My,
  71. meta: { needAuth: true }
  72. },
  73. {
  74. path: '/my/account',
  75. name: 'MyAccount',
  76. component: My,
  77. meta: { needAuth: true },
  78. children: [
  79. {
  80. path: '/my/account/profile',
  81. name: '个人资料',
  82. component: MyProfile,
  83. meta: { needAuth: true }
  84. },
  85. {
  86. path: '/my/account/vip',
  87. name: '小会员',
  88. component: MyVip,
  89. meta: { needAuth: true }
  90. }
  91. ]
  92. },
  93. {
  94. path: '/my/post/publish',
  95. name: 'MyPostPublish',
  96. component: My,
  97. meta: { needAuth: true },
  98. children: [
  99. {
  100. path: '/my/post/publish/video',
  101. name: '发布视频',
  102. component: PostPublishVideo,
  103. meta: { needAuth: true }
  104. },
  105. {
  106. path: '/my/post/publish/audio',
  107. name: '发布音频',
  108. component: PostPublishAudio,
  109. meta: { needAuth: true }
  110. },
  111. {
  112. path: '/my/post/publish/image',
  113. name: '发布相册',
  114. component: PostPublishAlbum,
  115. meta: { needAuth: true }
  116. },
  117. {
  118. path: '/my/post/publish/article',
  119. name: '发布文章',
  120. component: PostPublishArticle,
  121. meta: { needAuth: true }
  122. },
  123. {
  124. path: '/my/post/publish/file',
  125. name: '发布文件',
  126. component: PostPublishFile,
  127. meta: { needAuth: true }
  128. }
  129. ]
  130. },
  131. {
  132. path: '/my/post/list',
  133. name: 'MyPostList',
  134. component: My,
  135. meta: { needAuth: true },
  136. children: [
  137. {
  138. path: '/my/post/list/video',
  139. name: '视频稿件',
  140. component: UserPostVideo,
  141. meta: { needAuth: true }
  142. },
  143. {
  144. path: '/my/post/list/audio',
  145. name: '音频稿件',
  146. component: UserPostAudio,
  147. meta: { needAuth: true }
  148. },
  149. {
  150. path: '/my/post/list/image',
  151. name: '相册稿件',
  152. component: UserPostImage,
  153. meta: { needAuth: true }
  154. },
  155. {
  156. path: '/my/post/list/article',
  157. name: '文章稿件',
  158. component: UserPostArticle,
  159. meta: { needAuth: true }
  160. }
  161. ]
  162. },
  163. {
  164. path: '/my/favlist',
  165. name: 'MyFavlist',
  166. component: My,
  167. meta: { needAuth: true },
  168. children: [
  169. {
  170. path: '/my/favlist/video',
  171. name: '视频收藏',
  172. component: FavlistVideo,
  173. meta: { needAuth: true }
  174. },
  175. {
  176. path: '/my/favlist/image',
  177. name: '相册收藏',
  178. component: FavlistImage,
  179. meta: { needAuth: true }
  180. }
  181. ]
  182. },
  183. {
  184. path: '/my/visit',
  185. name: 'MyVisit',
  186. component: My,
  187. meta: { needAuth: true },
  188. children: [
  189. {
  190. path: '/my/visit',
  191. name: '浏览记录',
  192. component: HistoryIndex,
  193. meta: { needAuth: true }
  194. }
  195. ]
  196. },
  197. {
  198. path: '/my/message',
  199. name: 'MyMessage',
  200. component: My,
  201. meta: { needAuth: true },
  202. children: [
  203. {
  204. path: '/my/message/send',
  205. name: '发出的消息',
  206. component: MessageIndex,
  207. meta: { needAuth: true }
  208. },
  209. {
  210. path: '/my/message/receive',
  211. name: '收到的消息',
  212. component: MessageIndex,
  213. meta: { needAuth: true }
  214. },
  215. {
  216. path: '/my/message/private',
  217. name: '私信',
  218. component: MessageIndex,
  219. meta: { needAuth: true }
  220. }
  221. ]
  222. },
  223. {
  224. path: '/timeline',
  225. name: 'TimelineIndex',
  226. component: TimelineIndex,
  227. meta: { needAuth: true }
  228. },
  229. {
  230. path: '/live/:id',
  231. name: 'LivePage',
  232. component: LivePage,
  233. meta: { needAuth: true }
  234. },
  235. {
  236. path: '/my/post/edit/video/:videoId',
  237. name: 'PostEditVideo',
  238. component: PostEditVideo,
  239. meta: { needAuth: true }
  240. },
  241. {
  242. path: '/',
  243. name: 'index',
  244. component: Home,
  245. meta: { needAuth: false }
  246. },
  247. {
  248. path: '/video',
  249. name: 'VideoIndex',
  250. component: VideoIndex,
  251. meta: { needAuth: false }
  252. },
  253. {
  254. path: '/shortvideo',
  255. name: 'ShortVideoIndex',
  256. component: ShortVideoIndex,
  257. meta: { needAuth: false }
  258. },
  259. {
  260. path: '/video/:id',
  261. name: 'VideoPage',
  262. component: VideoPage,
  263. meta: { needAuth: false }
  264. },
  265. {
  266. path: '/vidlist/:id',
  267. name: 'VideoList',
  268. component: VideoList,
  269. meta: { needAuth: false }
  270. },
  271. {
  272. path: '/audio',
  273. name: 'AudioIndex',
  274. component: AudioIndex,
  275. meta: { needAuth: false }
  276. },
  277. {
  278. path: '/audio/:audioId',
  279. name: 'AudioPage',
  280. component: AudioPage,
  281. meta: { needAuth: false }
  282. },
  283. {
  284. path: '/image',
  285. name: 'ImageIndex',
  286. component: ImageIndex,
  287. meta: { needAuth: false }
  288. },
  289. {
  290. path: '/image/album/:albumId',
  291. name: 'ImagePage',
  292. component: ImagePage,
  293. meta: { needAuth: false }
  294. },
  295. {
  296. path: '/article',
  297. name: 'ArticleIndex',
  298. component: ArticleIndex,
  299. meta: { needAuth: false }
  300. },
  301. {
  302. path: '/stream',
  303. name: 'MessageStream',
  304. component: MessageStream,
  305. meta: { needAuth: false }
  306. },
  307. {
  308. path: '/article/:articleId',
  309. name: 'ArticlePage',
  310. component: ArticlePage,
  311. meta: { needAuth: false }
  312. },
  313. {
  314. path: '/discover',
  315. name: 'DiscoverIndex',
  316. component: DiscoverIndex,
  317. meta: { needAuth: false }
  318. },
  319. {
  320. path: '/search',
  321. name: 'search',
  322. component: Search,
  323. meta: { needAuth: false }
  324. },
  325. {
  326. path: '/user/:id',
  327. name: 'UserHome',
  328. component: UserHome,
  329. meta: { needAuth: false }
  330. },
  331. {
  332. path: '/user/:id/video',
  333. name: 'UserVideo',
  334. component: UserVideo,
  335. meta: { needAuth: false }
  336. },
  337. {
  338. path: '/user/:id/image',
  339. name: 'UserImage',
  340. component: UserImage,
  341. meta: { needAuth: false }
  342. },
  343. {
  344. path: '/user/:id/audio',
  345. name: 'UserAudio',
  346. component: UserAudio,
  347. meta: { needAuth: false }
  348. },
  349. {
  350. path: '/user/:id/article',
  351. name: 'UserArticle',
  352. component: UserArticle,
  353. meta: { needAuth: false }
  354. },
  355. {
  356. path: '/user/:id/following',
  357. name: 'UserRelation',
  358. component: UserRelation,
  359. meta: { needAuth: false }
  360. },
  361. {
  362. path: '/user/:id/follower',
  363. name: 'UserRelation',
  364. component: UserRelation,
  365. meta: { needAuth: false }
  366. },
  367. {
  368. path: '/map',
  369. name: 'AMap',
  370. component: AMap,
  371. meta: { needAuth: false }
  372. },
  373. {
  374. path: '/bdmap',
  375. name: 'BdMap',
  376. component: BdMap,
  377. meta: { needAuth: false }
  378. },
  379. {
  380. path: '/amap',
  381. name: 'AMap',
  382. component: AMap,
  383. meta: { needAuth: false }
  384. },
  385. {
  386. path: '/vip',
  387. name: 'Vip',
  388. component: Vip,
  389. meta: { needAuth: false }
  390. },
  391. {
  392. path: '/login',
  393. name: 'Login',
  394. component: () => import('@/views/login.vue'),
  395. meta: { needAuth: false }
  396. },
  397. {
  398. path: '*',
  399. name: '404',
  400. component: () => import('@/views/404.vue'),
  401. meta: { needAuth: false }
  402. }
  403. ]
  404. // 创建路由对象
  405. const router = new VueRouter({
  406. mode: 'history',
  407. routes,
  408. scrollBehavior(to, from, savedPosition) {
  409. return { x: 0, y: 0 }
  410. }
  411. })
  412. // 导出router
  413. export default router