| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479 |
- import VueRouter from 'vue-router'
- import Vue from 'vue'
- import MallRouter from './mall'
- import DiskRouter from './disk'
- import AdminRouter from './admin'
- // 懒加载引入页面组件,es6语法
- // ********************************************************************************************************************
- const Index = () => import('views/Index')
- const Home = () => import('views/home/Index')
- const TimelineIndex = () => import('views/home/Timeline')
- const VideoIndex = () => import('views/home/Video')
- const ShortVideoIndex = () => import('views/home/ShortVideo')
- const VideoPage = () => import('views/home/VideoPage')
- const VideoList = () => import('views/home/VideoList')
- const LivePage = () => import('views/cam/LivePage')
- const RecordPage = () => import('views/cam/RecordPage')
- const AudioIndex = () => import('views/home/Audio')
- const AudioPage = () => import('views/home/AudioPage')
- const ImageIndex = () => import('views/home/Image')
- const ImagePage = () => import('views/home/ImagePage')
- const ArticleIndex = () => import('views/home/Article')
- const ArticlePage = () => import('views/home/ArticlePage')
- const MessageStream = () => import('views/home/MessageStream2')
- const Search = () => import('views/home/Search')
- const DiscoverIndex = () => import('views/home/Discover')
- const BdMap = () => import('views/home/BdMap')
- const AMap = () => import('views/home/AMap')
- // ********************************************************************************************************************
- // 用户前台主页
- const UserHome = () => import('views/user/Home')
- const UserVideo = () => import('views/user/Home')
- const UserImage = () => import('views/user/Home')
- const UserAudio = () => import('views/user/Home')
- const UserArticle = () => import('views/user/Home')
- const UserRelation = () => import('views/user/UserRelation')
- // ********************************************************************************************************************
- // 用户后台主页
- const My = () => import('views/my/My')
- const MyProfile = () => import('views/my/MyProfile')
- const MyContact = () => import('views/my/MyContact')
- const MyRealname = () => import('views/my/MyRealname')
- const MessageIndex = () => import('views/my/Message')
- const MyVip = () => import('views/my/MyVip')
- const MyWallet = () => import('views/my/MyWallet')
- const FavlistVideo = () => import('views/my/FavlistVideo')
- const FavlistImage = () => import('views/my/FavlistImage')
- const HistoryIndex = () => import('views/my/History')
- const CamList = () => import('views/cam/CamList')
- // 发布稿件
- const PostPublishVideo = () => import('components/upload/PublishVideo')
- const PostPublishAudio = () => import('components/upload/PublishAudio')
- const PostPublishAlbum = () => import('components/upload/PublishImage')
- const PostPublishArticle = () => import('components/upload/PublishArticle')
- const PostPublishFile = () => import('components/upload/PublishFile')
- // 稿件列表
- const UserPostVideo = () => import('views/post/VideoPost')
- const PostEditVideo = () => import('components/upload/EditVideo')
- const UserPostAudio = () => import('views/post/AudioPost')
- const PostEditAudio = () => import('components/upload/EditAudio')
- const UserPostImage = () => import('views/post/ImagePost')
- const PostEditImage = () => import('components/upload/EditImage')
- const UserPostArticle = () => import('views/post/ArticlePost')
- const PostEditArticle = () => import('components/upload/EditArticle')
- // ********************************************************************************************************************
- // 使用安装路由插件
- Vue.use(VueRouter)
- const routes = [
- MallRouter,
- DiskRouter,
- AdminRouter,
- {
- path: '/my',
- name: 'My',
- component: My,
- meta: { needAuth: true },
- children: [
- {
- path: '',
- name: '个人资料',
- component: MyProfile,
- meta: { needAuth: true }
- },
- {
- path: '/my/account/contact',
- name: '联系人',
- component: MyContact,
- meta: { needAuth: true }
- },
- {
- path: '/my/account/realname',
- name: '实名认证',
- component: MyRealname,
- meta: { needAuth: true }
- },
- {
- path: '/my/account/vip',
- name: '小会员',
- component: MyVip,
- meta: { needAuth: true }
- },
- {
- path: '/my/account/wallet',
- name: '钱包',
- component: MyWallet,
- meta: { needAuth: true }
- }
- ]
- },
- {
- path: '/my/post/publish',
- name: 'MyPostPublish',
- component: My,
- meta: { needAuth: true },
- children: [
- {
- path: '/my/post/publish/video',
- name: '发布视频',
- component: PostPublishVideo,
- meta: { needAuth: true }
- },
- {
- path: '/my/post/publish/audio',
- name: '发布音频',
- component: PostPublishAudio,
- meta: { needAuth: true }
- },
- {
- path: '/my/post/publish/image',
- name: '发布相册',
- component: PostPublishAlbum,
- meta: { needAuth: true }
- },
- {
- path: '/my/post/publish/article',
- name: '发布文章',
- component: PostPublishArticle,
- meta: { needAuth: true }
- },
- {
- path: '/my/post/publish/file',
- name: '发布文件',
- component: PostPublishFile,
- meta: { needAuth: true }
- }
- ]
- },
- {
- path: '/my/post/list',
- name: 'MyPostList',
- component: My,
- meta: { needAuth: true },
- children: [
- {
- path: '/my/post/list/video',
- name: '视频稿件',
- component: UserPostVideo,
- meta: { needAuth: true }
- },
- {
- path: '/my/post/list/audio',
- name: '音频稿件',
- component: UserPostAudio,
- meta: { needAuth: true }
- },
- {
- path: '/my/post/list/image',
- name: '相册稿件',
- component: UserPostImage,
- meta: { needAuth: true }
- },
- {
- path: '/my/post/list/article',
- name: '文章稿件',
- component: UserPostArticle,
- meta: { needAuth: true }
- }
- ]
- },
- {
- path: '/my/favlist',
- name: 'MyFavlist',
- component: My,
- meta: { needAuth: true },
- children: [
- {
- path: '/my/favlist/video',
- name: '视频收藏',
- component: FavlistVideo,
- meta: { needAuth: true }
- },
- {
- path: '/my/favlist/image',
- name: '相册收藏',
- component: FavlistImage,
- meta: { needAuth: true }
- }
- ]
- },
- {
- path: '/my/visit',
- name: 'MyVisit',
- component: My,
- meta: { needAuth: true },
- children: [
- {
- path: '/my/visit',
- name: '浏览记录',
- component: HistoryIndex,
- meta: { needAuth: true }
- }
- ]
- },
- {
- path: '/my/message',
- name: 'MyMessage',
- component: My,
- meta: { needAuth: true },
- children: [
- {
- path: '/my/message/receive',
- name: '收到的消息',
- component: MessageIndex,
- meta: { needAuth: true }
- }
- ]
- },
- {
- path: '/my/cam',
- name: 'MyCam',
- component: My,
- meta: { needAuth: true },
- children: [
- {
- path: '/my/cam/list',
- name: '摄像头列表',
- component: CamList,
- meta: { needAuth: true }
- },
- {
- path: '/my/cam/live/:camId',
- name: 'LivePage',
- component: LivePage,
- meta: { needAuth: true }
- },
- {
- path: '/my/cam/record/:camId',
- name: 'RecordPage',
- component: RecordPage,
- meta: { needAuth: true }
- }
- ]
- },
- // ********************************************************************************************************************
- {
- path: '/timeline',
- name: 'TimelineIndex',
- component: TimelineIndex,
- meta: { needAuth: true }
- },
- {
- path: '/my/post/edit/video/:videoId',
- name: 'PostEditVideo',
- component: PostEditVideo,
- meta: { needAuth: true }
- },
- {
- path: '/my/post/edit/audio/:audioId',
- name: 'PostEditAudio',
- component: PostEditAudio,
- meta: { needAuth: true }
- },
- {
- path: '/my/post/edit/album/:albumId',
- name: 'PostEditImage',
- component: PostEditImage,
- meta: { needAuth: true }
- },
- {
- path: '/my/post/edit/article/:articleId',
- name: 'PostEditArticle',
- component: PostEditArticle,
- meta: { needAuth: true }
- },
- {
- path: '/',
- name: 'Index',
- component: Index,
- meta: { needAuth: true },
- children: [
- {
- path: '',
- name: 'Home',
- component: Home,
- meta: { needAuth: false }
- },
- {
- path: '/video',
- name: 'VideoIndex',
- component: VideoIndex,
- meta: { needAuth: false }
- },
- {
- path: '/shortvideo',
- name: 'ShortVideoIndex',
- component: ShortVideoIndex,
- meta: { needAuth: false }
- },
- {
- path: '/video/:id',
- name: 'VideoPage',
- component: VideoPage,
- meta: { needAuth: false }
- },
- {
- path: '/vidlist/:id',
- name: 'VideoList',
- component: VideoList,
- meta: { needAuth: false }
- },
- {
- path: '/audio',
- name: 'AudioIndex',
- component: AudioIndex,
- meta: { needAuth: false }
- },
- {
- path: '/audio/:audioId',
- name: 'AudioPage',
- component: AudioPage,
- meta: { needAuth: false }
- },
- {
- path: '/image',
- name: 'ImageIndex',
- component: ImageIndex,
- meta: { needAuth: false }
- },
- {
- path: '/image/album/:albumId',
- name: 'ImagePage',
- component: ImagePage,
- meta: { needAuth: false }
- },
- {
- path: '/article',
- name: 'ArticleIndex',
- component: ArticleIndex,
- meta: { needAuth: false }
- },
- {
- path: '/stream',
- name: 'MessageStream',
- component: MessageStream,
- meta: { needAuth: false }
- },
- {
- path: '/article/:articleId',
- name: 'ArticlePage',
- component: ArticlePage,
- meta: { needAuth: false }
- },
- {
- path: '/discover',
- name: 'DiscoverIndex',
- component: DiscoverIndex,
- meta: { needAuth: false }
- },
- {
- path: '/search',
- name: 'search',
- component: Search,
- meta: { needAuth: false }
- },
- {
- path: '/user/:id',
- name: 'UserHome',
- component: UserHome,
- meta: { needAuth: false }
- },
- {
- path: '/user/:id/video',
- name: 'UserVideo',
- component: UserVideo,
- meta: { needAuth: false }
- },
- {
- path: '/user/:id/image',
- name: 'UserImage',
- component: UserImage,
- meta: { needAuth: false }
- },
- {
- path: '/user/:id/audio',
- name: 'UserAudio',
- component: UserAudio,
- meta: { needAuth: false }
- },
- {
- path: '/user/:id/article',
- name: 'UserArticle',
- component: UserArticle,
- meta: { needAuth: false }
- },
- {
- path: '/user/:id/following',
- name: 'UserRelation',
- component: UserRelation,
- meta: { needAuth: false }
- },
- {
- path: '/user/:id/follower',
- name: 'UserRelation',
- component: UserRelation,
- meta: { needAuth: false }
- },
- {
- path: '/map',
- name: 'AMap',
- component: AMap,
- meta: { needAuth: false }
- },
- {
- path: '/bdmap',
- name: 'BdMap',
- component: BdMap,
- meta: { needAuth: false }
- },
- {
- path: '/amap',
- name: 'AMap',
- component: AMap,
- meta: { needAuth: false }
- }
- ]
- },
- {
- path: '/login',
- name: 'Login',
- component: () => import('@/views/login.vue'),
- meta: { needAuth: false }
- },
- {
- path: '/register',
- name: 'Register',
- component: () => import('@/views/register.vue'),
- meta: { needAuth: false }
- },
- {
- path: '/forgot',
- name: 'Forgot',
- component: () => import('@/views/forgot.vue'),
- meta: { needAuth: false }
- },
- {
- path: '*',
- name: '404',
- component: () => import('@/views/404.vue'),
- meta: { needAuth: false }
- }
- ]
- // 创建路由对象
- const router = new VueRouter({
- mode: 'history',
- routes,
- scrollBehavior(to, from, savedPosition) {
- return { x: 0, y: 0 }
- }
- })
- // 导出router
- export default router
|