196 lines
5.1 KiB
JavaScript
196 lines
5.1 KiB
JavaScript
|
|
import Vue from 'vue'
|
|||
|
|
import Router from 'vue-router'
|
|||
|
|
|
|||
|
|
Vue.use(Router)
|
|||
|
|
|
|||
|
|
/* Layout */
|
|||
|
|
import Layout from '@/layout'
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Note: sub-menu only appear when route children.length >= 1
|
|||
|
|
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
|
|||
|
|
*
|
|||
|
|
* hidden: true if set true, item will not show in the sidebar(default is false)
|
|||
|
|
* alwaysShow: true if set true, will always show the root menu
|
|||
|
|
* if not set alwaysShow, when item has more than one children route,
|
|||
|
|
* it will becomes nested mode, otherwise not show the root menu
|
|||
|
|
* redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
|
|||
|
|
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
|||
|
|
* meta : {
|
|||
|
|
roles: ['admin','editor'] control the page roles (you can set multiple roles)
|
|||
|
|
title: 'title' the name show in sidebar and breadcrumb (recommend set)
|
|||
|
|
icon: 'svg-name' the icon show in the sidebar
|
|||
|
|
breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
|
|||
|
|
activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
|
|||
|
|
}
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* constantRoutes
|
|||
|
|
* a base page that does not have permission requirements
|
|||
|
|
* all roles can be accessed
|
|||
|
|
* 游客权限标识:guest
|
|||
|
|
*/
|
|||
|
|
export const constantRoutes = [
|
|||
|
|
{
|
|||
|
|
path: '/login',
|
|||
|
|
component: () => import('@/views/login/index'),
|
|||
|
|
// component: () => import('@/views/Maintain'),
|
|||
|
|
hidden: true,
|
|||
|
|
meta: {
|
|||
|
|
roles: ['guest'],
|
|||
|
|
title: '登录'
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'Maintain',
|
|||
|
|
path: '/maintain',
|
|||
|
|
component: () => import('@/views/Maintain'),
|
|||
|
|
hidden: true,
|
|||
|
|
meta: { title: '系统维护', icon: 'home', roles: ['guest'] }
|
|||
|
|
},
|
|||
|
|
// {
|
|||
|
|
// path: '/404',
|
|||
|
|
// component: () => import('@/views/404'),
|
|||
|
|
// hidden: true,
|
|||
|
|
// meta: {
|
|||
|
|
// roles: ['guest'],
|
|||
|
|
// title: '找不到对应的页面'
|
|||
|
|
// }
|
|||
|
|
// },
|
|||
|
|
{
|
|||
|
|
path: '/',
|
|||
|
|
redirect: '/menuIndex',
|
|||
|
|
hidden: true
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'redirect',
|
|||
|
|
path: '/redirect',
|
|||
|
|
component: () => import('@/views/workbench/redirect'),
|
|||
|
|
hidden: true,
|
|||
|
|
meta: { title: '空白页', icon: 'home' }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/iframe',
|
|||
|
|
name: 'iframe',
|
|||
|
|
component: Layout,
|
|||
|
|
redirect: '/iframe/index',
|
|||
|
|
hidden: true,
|
|||
|
|
children: [
|
|||
|
|
{
|
|||
|
|
path: '/index',
|
|||
|
|
name: 'index',
|
|||
|
|
component: () => import('@/views/iframe/index'),
|
|||
|
|
// hidden: true,
|
|||
|
|
meta: { title: '嵌套', icon: 'home' }
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/refresh',
|
|||
|
|
name: 'refresh',
|
|||
|
|
component: () => import('@/views/refresh/index'),
|
|||
|
|
hidden: true,
|
|||
|
|
meta: { title: '用于同路由刷新', icon: 'home' }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/menuIndex',
|
|||
|
|
component: Layout,
|
|||
|
|
redirect: '/menuIndex/index',
|
|||
|
|
meta: { title: '待办事项', icon: 'form' },
|
|||
|
|
children: [
|
|||
|
|
{
|
|||
|
|
path: '/menuIndex/index',
|
|||
|
|
name: 'menuIndex',
|
|||
|
|
component: () => import('@/views/regulatoryPlatForm/index'),
|
|||
|
|
meta: { title: '待办总览' }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/toDoList',
|
|||
|
|
name: 'toDoList',
|
|||
|
|
component: () => import('@/views/regulatoryPlatForm/toDoList'),
|
|||
|
|
meta: { title: '我的待办' }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/finishTodoList',
|
|||
|
|
name: 'finishTodoList',
|
|||
|
|
component: () => import('@/views/regulatoryPlatForm/finishTodoList'),
|
|||
|
|
meta: { title: '我的已办' }
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/versionLog',
|
|||
|
|
component: () => import('@/views/youfool/AppVersionLog'),
|
|||
|
|
hidden: true
|
|||
|
|
}
|
|||
|
|
// {
|
|||
|
|
// path: '*',
|
|||
|
|
// redirect: '/menuIndex/index'
|
|||
|
|
// }
|
|||
|
|
// {
|
|||
|
|
// path: '/',
|
|||
|
|
// component: Layout,
|
|||
|
|
// redirect: '/dict',
|
|||
|
|
// children: [{
|
|||
|
|
// path: '/druid',
|
|||
|
|
// name: 'Druid',
|
|||
|
|
// component: () => import('@/views/druid/index'),
|
|||
|
|
// meta: { title: '数据源监控', icon: 'druid' }
|
|||
|
|
// }]
|
|||
|
|
// }
|
|||
|
|
// 404 page must be placed at the end !!!
|
|||
|
|
|
|||
|
|
]
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* asyncRoutes
|
|||
|
|
* the routes that need to be dynamically loaded based on user roles
|
|||
|
|
*/
|
|||
|
|
export const asyncRoutes = [
|
|||
|
|
// {
|
|||
|
|
// path: '/role',
|
|||
|
|
// component: Layout,
|
|||
|
|
// meta: {
|
|||
|
|
// title: '权限拦截',
|
|||
|
|
// icon: 'user'
|
|||
|
|
// },
|
|||
|
|
// children: [
|
|||
|
|
// {
|
|||
|
|
// path: 'admin-role',
|
|||
|
|
// name: 'AdminRole',
|
|||
|
|
// component: () => import('@/views/role/AdminRole'),
|
|||
|
|
// meta: {
|
|||
|
|
// title: 'admin角色',
|
|||
|
|
// roles: ['admin']
|
|||
|
|
// }
|
|||
|
|
// },
|
|||
|
|
// {
|
|||
|
|
// path: 'editor-role',
|
|||
|
|
// name: 'EditorRole',
|
|||
|
|
// component: () => import('@/views/role/EditorRole'),
|
|||
|
|
// meta: {
|
|||
|
|
// title: 'editor角色',
|
|||
|
|
// roles: ['editor']
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// ]
|
|||
|
|
// }
|
|||
|
|
]
|
|||
|
|
|
|||
|
|
const createRouter = () => new Router({
|
|||
|
|
// mode: 'history', // require service support
|
|||
|
|
scrollBehavior: () => ({ y: 0 }),
|
|||
|
|
routes: constantRoutes
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
const router = createRouter()
|
|||
|
|
|
|||
|
|
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
|
|||
|
|
export function resetRouter() {
|
|||
|
|
const newRouter = createRouter()
|
|||
|
|
router.matcher = newRouter.matcher // reset router
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export default router
|