| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- 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'/'el-icon-x' 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
- */
- export const asyncRoutes = [
- {
- path: '/bz/base',
- component: Layout,
- name: 'bz',
- meta: {
- title: '业务资源管理',
- icon: 'el-icon-eleme',
- authorities: ['bz.base.venue.find']
- },
- redirect: '/bz/base/venue',
- children: [
- {
- path: 'venue',
- name: 'BzBaseVenue',
- component: () => import('@/views/bz/base/venue/index'),
- meta: { title: '场馆', authorities: ['bz.base.venue.find'] }
- },
- {
- path: 'scenery',
- name: 'BzBaseScenery',
- component: () => import('@/views/bz/base/scenery/index'),
- meta: { title: '景区' }
- },
- {
- path: 'holidayVillage',
- name: 'BzBaseHolidayVillage',
- component: () => import('@/views/bz/base/holidayVillage/index'),
- meta: { title: '度假村' }
- },
- {
- path: 'hotel',
- name: 'BzBaseHotel',
- component: () => import('@/views/bz/base/hotel/index'),
- meta: { title: '酒店' }
- },
- {
- path: 'homeStay',
- name: 'BzBaseHomeStay',
- component: () => import('@/views/bz/base/homeStay/index'),
- meta: { title: '民宿' }
- },
- {
- path: 'tourist',
- name: 'BzBaseTourist',
- component: () => import('@/views/bz/base/tourist/index'),
- meta: { title: '旅行社' }
- }
- ]
- },
- {
- path: '/appKey',
- component: Layout,
- name: 'AppKey',
- meta: { title: '接口', icon: 'el-icon-eleme', authorities: ['app.key.find', 'app.key.request.logs'] },
- redirect: '/appKey/index',
- children: [
- {
- path: 'index',
- name: 'AppKeyIndex',
- component: () => import('@/views/appKey/index'),
- meta: { title: 'AppKey管理', authorities: ['app.key.find'] }
- },
- {
- path: 'requestLogs',
- name: 'AppKeyRequestLogs',
- component: () => import('@/views/appKey/requestLogs'),
- meta: { title: '调用日志', authorities: ['app.key.request.logs'] }
- }
- ]
- },
- {
- path: '/user',
- component: Layout,
- name: 'User',
- meta: {
- title: '用户',
- icon: 'el-icon-user',
- authorities: ['oauth.user.find', 'oauth.role.find', 'oauth.role.find', 'oauth.user.find.operate.log', 'oauth.user.find.login.log']
- },
- children: [
- {
- path: 'info',
- name: 'UserInfo',
- component: () => import('@/views/user/info'),
- meta: { title: '用户管理', authorities: ['oauth.user.find'] }
- },
- {
- path: 'role',
- name: 'UserRole',
- component: () => import('@/views/user/role'),
- meta: { title: '角色管理', authorities: ['oauth.role.find'] }
- },
- {
- path: 'operateLog',
- name: 'UserOperateLog',
- component: () => import('@/views/user/operateLog'),
- meta: { title: '操作日志', authorities: ['oauth.user.find.operate.log'] }
- },
- {
- path: 'loginLog',
- name: 'UserLoginLog',
- component: () => import('@/views/user/loginLog'),
- meta: { title: '登录日志', authorities: ['oauth.user.find.login.log'] }
- }
- ]
- },
- {
- path: '/setting',
- component: Layout,
- name: 'Setting',
- meta: { title: '设置', icon: 'el-icon-setting', authorities: ['system.config.find'] },
- children: [
- {
- path: 'systemConfig',
- name: 'SettingSystemConfig',
- component: () => import('@/views/setting/systemConfig'),
- meta: { title: '系统设置', authorities: ['system.config.find'] }
- }
- ]
- },
- // 404 page must be placed at the end !!!
- { path: '*', redirect: '/404', hidden: true }
- ]
- export const constantRoutes = [
- {
- path: '/login',
- component: () => import('@/views/login/index'),
- hidden: true
- },
- {
- path: '/api/docs',
- component: () => import('@/views/apidocs/index'),
- hidden: true
- },
- {
- path: '/404',
- component: () => import('@/views/404'),
- hidden: true
- },
- {
- path: '/',
- component: Layout,
- redirect: '/dashboard',
- children: [
- {
- path: 'dashboard',
- component: () => import('@/views/dashboard/index'),
- name: 'Dashboard',
- meta: { title: '控制面片', icon: 'dashboard', affix: true }
- }
- ]
- }
- ]
- const createRouter = () => new Router({
- mode: 'hash', // 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
|