| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- import VueRouter from 'vue-router'
- import Vue from 'vue'
- import MyRouter from './my'
- import AdminRouter from './admin'
- import UserRouter from './user'
- import MallRouter from './mall'
- import DiskRouter from './disk'
- import PostRouter from './post'
- import CamRouter from './cam'
- // 懒加载引入页面组件,es6语法
- // ********************************************************************************************************************
- const Login = () => import('views/Login')
- const Register = () => import('views/Register')
- const Forgot = () => import('views/Forgot')
- const Index = () => import('views/Index')
- const Home = () => import('views/home/Home')
- 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 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')
- // ********************************************************************************************************************
- // 使用安装路由插件
- Vue.use(VueRouter)
- const routes = [
- MyRouter,
- AdminRouter,
- UserRouter,
- MallRouter,
- DiskRouter,
- PostRouter,
- CamRouter,
- {
- path: '/login',
- name: 'Login',
- component: Login,
- meta: { needAuth: false }
- },
- {
- path: '/register',
- name: 'Register',
- component: Register,
- meta: { needAuth: false }
- },
- {
- path: '/forgot',
- name: 'Forgot',
- component: Forgot,
- meta: { needAuth: false }
- },
- {
- path: '*',
- name: '404',
- component: () => import('@/views/404.vue'),
- meta: { needAuth: false }
- },
- {
- path: '/',
- name: 'Index',
- component: Index,
- meta: { needAuth: true },
- children: [
- {
- path: '',
- name: 'Home',
- component: Home,
- meta: { needAuth: false }
- },
- {
- path: '/timeline',
- name: 'TimelineIndex',
- component: TimelineIndex,
- meta: { needAuth: true }
- },
- {
- path: '/stream',
- name: 'MessageStream',
- component: MessageStream,
- meta: { needAuth: false }
- },
- {
- path: '/discover',
- name: 'DiscoverIndex',
- component: DiscoverIndex,
- meta: { needAuth: false }
- },
- {
- path: '/search',
- name: 'search',
- component: Search,
- 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: '/shortvideo',
- name: 'ShortVideoIndex',
- component: ShortVideoIndex,
- meta: { needAuth: false }
- },
- {
- path: '/video',
- name: 'VideoIndex',
- component: VideoIndex,
- 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: '/article/:articleId',
- name: 'ArticlePage',
- component: ArticlePage,
- meta: { needAuth: false }
- }
- ]
- }
- ]
- // 创建路由对象
- const router = new VueRouter({
- mode: 'history',
- routes,
- scrollBehavior(to, from, savedPosition) {
- return { x: 0, y: 0 }
- }
- })
- // 导出router
- export default router
|