import VueRouter from 'vue-router' import Vue from 'vue' // 懒加载引入页面组件,es6语法 const Home = () => import('views/home/Index') const TimelineIndex = () => import('views/home/Timeline') const StatusPage = () => import('views/home/Status') const VideoIndex = () => import('views/home/Video') const VideoPage = () => import('views/home/VideoPage') const LivePage = () => import('views/home/LivePage') 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 Search = () => import('views/home/Search') 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 CollectionIndex = () => import('views/user/Collection') const HistoryIndex = () => import('views/user/History') const PostPublish = () => import('views/post/PostPublish') const PostPublishVideo = () => import('views/post/PostPublish') const PostEditVideo = () => import('components/upload/EditVideo') const PostPublishAudio = () => import('views/post/PostPublish') const PostEditAudio = () => import('components/upload/EditAudio') const PostPublishAlbum = () => import('views/post/PostPublish') const PostEditAlbum = () => import('components/upload/EditImage') const PostPublishArticle = () => import('views/post/PostPublish') const PostList = () => import('views/post/PostList') const UserPostVideo = () => import('views/post/PostList') const UserPostAudio = () => import('views/post/PostList') const UserPostImage = () => import('views/post/PostList') const UserPostArticle = () => import('views/post/PostList') const PostAnalysis = () => import('views/post/PostAnalysis') const MessageIndex = () => import('views/message/Message') const DiscoverIndex = () => import('views/home/Discover') const BdMap = () => import('views/home/BdMap') const AMap = () => import('views/home/AMap') const Vip = () => import('views/vip/Vip') const Admin = () => import('views/admin/AdminUser') const AdminUser = () => import('views/admin/AdminUser') const AdminPost = () => import('views/admin/AdminPost') const AdminPostVideo = () => import('views/admin/AdminPost') const AdminPostAudio = () => import('views/admin/AdminPost') const AdminPostImage = () => import('views/admin/AdminPost') const AdminPostArticle = () => import('views/admin/AdminPost') const AdminEditVideo = () => import('components/admin/AdminEditVideo') // 使用安装路由插件 Vue.use(VueRouter) const routes = [ { path: '/sso', name: 'sso', redirect: '/sso/login', component: () => import('@/views/sso/layout'), children: [ { path: '/sso/login', meta: { title: '验证码登录', needLogin: false, }, component: () => import('@/views/sso/login'), }, { path: '/sso/login1', meta: { title: '密码登录', needLogin: false, }, component: () => import('@/views/sso/login1'), }, { path: '/sso/register', meta: { title: '账号注册?', needLogin: false, }, component: () => import('@/views/sso/register'), }, { path: '/sso/forget', meta: { title: '找回密码?', needLogin: false, }, component: () => import('@/views/sso/forget'), }, ], }, { path: '/', name: 'index', component: Home }, { path: '/status', name: 'TimelineIndex', component: TimelineIndex }, { path: '/status/:statusId', name: 'StatusPage', component: StatusPage }, { path: '/video', name: 'VideoIndex', component: VideoIndex }, { path: '/video/:id', name: 'VideoPage', component: VideoPage }, { path: '/live/:id', name: 'LivePage', component: LivePage }, { path: '/audio', name: 'AudioIndex', component: AudioIndex }, { path: '/audio/:audioId', name: 'AudioPage', component: AudioPage }, { path: '/image', name: 'ImageIndex', component: ImageIndex }, { path: '/image/album/:albumId', name: 'ImagePage', component: ImagePage }, { path: '/article', name: 'ArticleIndex', component: ArticleIndex }, { path: '/article/:articleId', name: 'ArticlePage', component: ArticlePage }, { path: '/discover', name: 'DiscoverIndex', component: DiscoverIndex }, { path: '/search', name: 'search', component: Search }, { path: '/user/:id', name: 'UserHome', component: UserHome }, { path: '/user/:id/video', name: 'UserVideo', component: UserVideo }, { path: '/user/:id/image', name: 'UserImage', component: UserImage }, { path: '/user/:id/audio', name: 'UserAudio', component: UserAudio }, { path: '/user/:id/article', name: 'UserArticle', component: UserArticle }, { path: '/user/:id/following', name: 'UserRelation', component: UserRelation }, { path: '/user/:id/follower', name: 'UserRelation', component: UserRelation }, { path: '/u/collection', name: 'CollectionIndex', component: CollectionIndex }, { path: '/u/myfavlist', name: 'CollectionIndex', component: CollectionIndex }, { path: '/u/favlist', name: 'CollectionIndex', component: CollectionIndex }, { path: '/u/history', name: 'HistoryIndex', component: HistoryIndex }, { path: '/post/publish', name: 'PostPublish', component: PostPublish }, { path: '/post/publish/video', name: 'PostPublishVideo', component: PostPublishVideo }, { path: '/post/edit/video/:videoId', name: 'PostEditVideo', component: PostEditVideo }, { path: '/post/publish/audio', name: 'PostPublishAudio', component: PostPublishAudio }, { path: '/post/edit/audio/:audioId', name: 'PostEditAudio', component: PostEditAudio }, { path: '/post/publish/image', name: 'PostPublishAlbum', component: PostPublishAlbum }, { path: '/post/edit/album/:albumId', name: 'PostEditAlbum', component: PostEditAlbum }, { path: '/post/publish/article', name: 'PostPublishArticle', component: PostPublishArticle }, { path: '/post/list', name: 'PostList', component: PostList }, { path: '/post/video', name: 'UserPostVideo', component: UserPostVideo }, { path: '/post/audio', name: 'UserPostAudio', component: UserPostAudio }, { path: '/post/image', name: 'UserPostImage', component: UserPostImage }, { path: '/post/article', name: 'UserPostArticle', component: UserPostArticle }, { path: '/post/analysis', name: 'PostAnalysis', component: PostAnalysis }, { path: '/message', name: 'MessageIndex', component: MessageIndex }, { path: '/map', name: 'AMap', component: AMap }, { path: '/bdmap', name: 'BdMap', component: BdMap }, { path: '/amap', name: 'AMap', component: AMap }, { path: '/vip', name: 'Vip', component: Vip }, { path: '/admin', name: 'Admin', component: Admin }, { path: '/admin/user', name: 'AdminUser', component: AdminUser }, { path: '/admin/post', name: 'AdminPost', component: AdminPost }, { path: '/admin/post/video', name: 'AdminPostVideo', component: AdminPostVideo }, { path: '/admin/post/image', name: 'AdminPostImage', component: AdminPostImage }, { path: '/admin/post/audio', name: 'AdminPostAudio', component: AdminPostAudio }, { path: '/admin/post/article', name: 'AdminPostArticle', component: AdminPostArticle }, { path: '/admin/edit/video/:videoId', name: 'AdminEditVideo', component: AdminEditVideo }, { path: '*', name: '404', component: () => import('@/views/404.vue'), meta: { title: '404' } } ] // 创建路由对象 const router = new VueRouter({ mode: 'history', routes }) // 导出router export default router