import Vue from 'vue' import Router from 'vue-router' /* Layout */ import Layout from '@/layout' Vue.use(Router) /** * 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 (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: '/passenger', component: Layout, name: 'Passenger', meta: { icon: 'el-icon-pie-chart', authorities: ['bz.passenger.equipment.find'] }, children: [ { path: 'equipment', name: 'PassengerEquipment', component: () => import('@/views/passenger/equipment'), meta: { title: '客流数据采集', authorities: ['bz.passenger.equipment.find'] } }, { path: 'equipment/detail/:id', name: 'PassengerEquipmentDetail', hidden: true, component: () => import('@/views/passenger/equipment/Detail'), meta: { title: '客流数据采集详情' } } ] }, { path: '/category', component: Layout, name: 'CulturalTourism', meta: { title: '文旅资源目录管理', icon: 'el-icon-goods', authorities: ['category.organization.find', 'category.occupation.find', 'category.material.find'] }, children: [ { path: 'organization', name: 'CulturalTourismOrganization', component: () => import('@/views/category/organization'), meta: { title: '机构目录管理', authorities: ['category.organization.find'] } }, { path: 'occupation', name: 'CulturalTourismOccupation', component: () => import('@/views/category/occupation'), meta: { title: '岗位目录管理', authorities: ['category.occupation.find'] } }, { path: 'material', name: 'CulturalTourismMaterial', component: () => import('@/views/category/material'), meta: { title: '物务资源目录管理', authorities: ['category.material.find'] } } ] }, { path: '/place', component: Layout, name: 'place', meta: { title: '文旅场所管理', icon: 'el-icon-receiving', authorities: ['place.category.find', 'place.base.info.find'] }, redirect: '/place/baseInfo', children: [ { path: 'baseInfo', name: 'PlaceBaseInfo', component: () => import('@/views/place/baseInfo'), meta: { title: '文旅场所管理', authorities: ['place.category.find'] } }, { path: 'category', name: 'PlaceCategory', component: () => import('@/views/place/category'), meta: { title: '文旅场所分类管理', authorities: ['place.base.info.find'] } } // { // 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: '景区', authorities: ['bz.base.scenery.find'] } // }, // { // path: 'holidayVillage', // name: 'BzBaseHolidayVillage', // component: () => import('@/views/bz/base/holidayVillage/index'), // meta: { title: '度假村', authorities: ['bz.base.holiday.village.find'] } // }, // { // path: 'hotel', // name: 'BzBaseHotel', // component: () => import('@/views/bz/base/hotel/index'), // meta: { title: '酒店', authorities: ['bz.base.hotel.find'] } // }, // { // path: 'homeStay', // name: 'BzBaseHomeStay', // component: () => import('@/views/bz/base/homeStay/index'), // meta: { title: '民宿', authorities: ['bz.base.home.stay.find'] } // }, // { // path: 'tourist', // name: 'BzBaseTourist', // component: () => import('@/views/bz/base/tourist/index'), // meta: { title: '旅行社', authorities: ['bz.base.tourist.find'] } // } ] }, { path: '/statistics', component: Layout, name: 'Statistics', meta: { title: '数据统计分析', icon: 'el-icon-s-data', authorities: ['statistics.complaint', 'statistics.file.manage', 'statistics.gis.map.base'] }, redirect: '/statistics/index', children: [ { path: 'complaint', name: 'StatisticsComplaint', component: () => import('@/views/statistics/complaint'), meta: { title: '客诉信息管理', authorities: ['statistics.complaint'] } }, { path: 'file', name: 'StatisticsFile', component: () => import('@/views/statistics/file'), meta: { title: '多媒体信息管理', authorities: ['statistics.file.manage'] } }, { path: 'gis', name: 'BzBaseGis', component: () => import('@/views/bz/gis'), meta: { title: 'GIS地图分布', authorities: ['statistics.gis.map.base'] } } ] }, { 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