index.js 14 KB

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