index.js 12 KB

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