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 (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 constantRoutes = [{ path: '/login', component: () => import('@/views/login/index'), hidden: true }, { path: '/404', component: () => import('@/views/404'), hidden: true }, { path: '/externalInfo', component: () => import('@/views/externalInfo/externalInfo'), hidden: true }, { path: '/', component: Layout, redirect: '/dashboard', children: [{ path: 'dashboard', name: '首页', component: () => import('@/views/dashboard/index'), meta: { title: '首页', icon: 'dashboard' } }] }, { path: '/promotelinks', component: () => import('@/views/promotelinks/promotelinks'), hidden: true }, { path: '/user', component: Layout, redirect: '/user', name: '用户管理', meta: { title: '用户管理', icon: 'el-icon-s-help' }, children: [{ path: 'map', name: 'Table', component: () => import('@/views/user/index'), meta: { title: '所有用户', icon: 'table' } }, { path: 'managerTable', name: 'manager', component: () => import('@/views/user/managerTable'), meta: { title: '客户经理', icon: 'table' } }, // { // path: 'manager', // name: 'manager', // component: () => import('@/views/user/manager'), // meta: { // title: '客户经理下级', // icon: 'table' // } // }, // { // path: 'commissioner', // name: 'manager', // component: () => import('@/views/user/commissioner'), // meta: { // title: '推广专员下级', // icon: 'table' // } // } ] }, // appointment { path: '/appointment', component: Layout, redirect: '/appointment', children: [{ path: 'appointment', name: '预约管理', component: () => import('@/views/appointment/appointment'), meta: { title: '预约管理', icon: 'el-icon-s-help' } }] }, // { // path: '/appointByUserId', // component: Layout, // redirect: '/appointByUserId', // children: [{ // path: 'appointByUserId', // name: '查询预约', // component: () => import('@/views/appointByUserId/appointByUserId'), // meta: { // title: '查询预约', // icon: 'el-icon-s-help', // } // }] // }, { path: '/AdminManage', component: Layout, redirect: '/AdminManage', meta:{ permissions:['admin']// }, children: [{ path: 'AdminManage', name: '管理员管理', component: () => import('@/views/AdminManage/AdminManage'), meta: { title: '管理员管理', icon: 'el-icon-s-help', // hidden:true } }] }, // 推广链接 // { // path: '/promotelinks', // component: Layout, // redirect: '/promotelinks', // children: [{ // path: 'promotelinks', // name: '推广链接', // component: () => import('@/views/promotelinks/promotelinks'), // meta: { // title: '推广链接', // icon: 'el-icon-s-help' // } // }] // }, // 提现管理 { path: '/moneys', component: Layout, redirect: '/moneys', children: [{ path: 'moneys', name: '提现管理', component: () => import('@/views/moneys/moneys'), meta: { title: '提现管理', icon: 'el-icon-s-help' } }] }, // 分成管理 { path: '/proportion', component: Layout, redirect: 'proportion', children: [{ path: 'proportion', name: '分成管理', component: () => import('@/views/proportion/proportion'), meta: { title: '分成管理', icon: 'el-icon-s-help' } }] }, // 外部数据 // { // path: '/externalInfo', // component: Layout, // redirect: '/externalInfo', // children: [{ // path: 'externalInfo', // name: '外部数据', // component: () => import('@/views/externalInfo/externalInfo'), // meta: { // title: '外部数据', // icon: 'el-icon-s-help' // } // }] // }, // { // path: '/comment', // component: Layout, // redirect: '/comment', // children: [{ // path: 'comment', // name: '评价管理', // component: () => import('@/views/comment/comment'), // meta: { // title: '评价管理', // icon: 'el-icon-s-help' // } // }] // }, // record { path: '/record', component: Layout, redirect: '/record', children: [{ path: 'record', name: '领取记录11', component: () => import('@/views/record/record'), meta: { title: '领取产品记录', icon: 'el-icon-s-help' } }] }, // 合伙人 { path: '/partner', component: Layout, redirect: '/partner', children: [{ path: 'partner', name: '合伙人管理', component: () => import('@/views/partner/partner'), meta: { title: '合伙人管理', icon: 'el-icon-s-help' } }] }, // deposit // { // path: '/deposit', // component: Layout, // redirect: '/deposit', // children: [{ // path: 'deposit', // name: '提现管理', // component: () => import('@/views/deposit/deposit'), // meta: { // title: '提现管理', // icon: 'deposit' // } // }] // }, // // promotion // { // path: '/promotion', // component: Layout, // redirect: '/promotion', // children: [{ // path: 'promotion', // name: '推广管理', // component: () => import('@/views/promotion/promotion'), // meta: { // title: '推广管理', // icon: 'promotion' // } // }] // }, { path: '/system', component: Layout, redirect: '/system', name: '系统设置', meta: { title: '系统设置', icon: 'el-icon-s-help' }, children: [{ path: 'map', name: 'Table', component: () => import('@/views/system/map'), meta: { title: '服务范围设置', icon: 'table' } }, { path: 'calendar', name: 'calendar', component: () => import('@/views/system/calendar'), meta: { title: '可预约时间设置', icon: 'table' } }, { path: 'updpassword', name: 'updpassword', component: () => import('@/views/system/updpassword'), meta: { title: '密码修改', icon: 'table' } }, { path: 'robot', name: 'robot', component: () => import('@/views/system/robot'), meta: { title: '滚屏设置', icon: 'table' } }, { path: 'deduct', name: 'deduct', component: () => import('@/views/system/deduct'), meta: { title: '提成计算', icon: 'table' } }, // { // path: 'introduce', // name: 'introduce', // component: () => import('@/views/system/introduce'), // meta: { // title: '介绍设置', // icon: 'table' // } // }, // rulesstr // { // path: 'rulesstr', // name: 'rulesstr', // component: () => import('@/views/system/rulesstr'), // meta: { // title: '补贴规则设置', // icon: 'table' // } // }, { path: 'missionNum', name: 'missionNum', component: () => import('@/views/system/missionNum'), meta: { title: '任务单量设置', icon: 'table' } }, // meal { path: 'meal', name: 'meal', component: () => import('@/views/system/meal'), meta: { title: '首页广告设置', icon: 'table' } }, // subscribe // { // path: 'subscribe', // name: 'subscribe', // component: () => import('@/views/system/subscribe'), // meta: { // title: '预约谈目', // icon: 'table' // } // }, ] }, // 404 page must be placed at the end !!! { path: '*', redirect: '/404', hidden: true } ] 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