123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- import Vue from 'vue'
- import Router from 'vue-router'
- import Layout from '@/layout'
- Vue.use(Router)
- // 超级管理员
- import systemRouter from './modules/system'
- // 企业管理员
- import aqptRouter from './modules/aqpt'
- // 企业管理员
- import iiotRouter from './modules/iiot'
- export const constantRoutes = [
- {
- path: '/redirect',
- component: Layout,
- hidden: true,
- children: [
- {
- path: '/redirect/:path(.*)',
- component: () => import('@/views/redirect/index')
- }
- ]
- },
- {
- path: '/login',
- component: () => import('@/views/login/index'),
- hidden: true
- },
- {
- path: '/auth-redirect',
- component: () => import('@/views/login/auth-redirect'),
- hidden: true
- },
- {
- path: '/auth-test',
- component: Layout,
- hidden: true,
- children: [
- {
- path: '/test',
- component: () => import('@/views/test')
- }
- ]
- },
- {
- path: '/profile',
- component: Layout,
- redirect: '/profile/index',
- hidden: true,
- children: [
- {
- path: 'index',
- component: () => import('@/views/system/profile/userProfile'),
- name: 'Profile',
- meta: { title: '个人中心', icon: 'user', noCache: true }
- }
- ]
- },
- {
- path: '/404',
- component: Layout,
- hidden: true,
- children: [
- {
- path: '/404',
- component: () => import('@/views/404'),
- meta: { title: '404', icon: 'user', noCache: true }
- }
- ]
- }
- ]
- /**
- * asyncRoutes
- * the routes that need to be dynamically loaded based on user permits
- */
- export const asyncRoutes = [
- ...systemRouter,
- ...aqptRouter,
- ...iiotRouter,
- { path: '*', redirect: '/404', hidden: true }
- ]
- const createRouter = () => new Router({
- // mode: 'history', // require service support
- scrollBehavior: () => ({ y: 0 }),
- routes: constantRoutes
- })
- const router = createRouter()
- export function resetRouter() {
- const newRouter = createRouter()
- router.matcher = newRouter.matcher // reset router
- }
- export default router
|