|
@@ -9,7 +9,7 @@ import { getSilder } from '@/api/silder'
|
|
|
* @param asyncRoutes
|
|
|
* @param getMenu
|
|
|
*/
|
|
|
-function generateAsyncRouter (asyncRoutes, data) {
|
|
|
+function generateAsyncRouter(asyncRoutes, data) {
|
|
|
if (!data) {
|
|
|
return []
|
|
|
}
|
|
@@ -49,7 +49,7 @@ const mutations = {
|
|
|
function getFirstMenu(routes) {
|
|
|
let firstMenu = null
|
|
|
routes.forEach(item => {
|
|
|
- if(item.children?.length > 0 && !item.hidden) {
|
|
|
+ if (item.children?.length > 0 && !item.hidden) {
|
|
|
firstMenu = pathErgodic(item)
|
|
|
item.redirect = firstMenu
|
|
|
}
|
|
@@ -58,15 +58,27 @@ function getFirstMenu(routes) {
|
|
|
}
|
|
|
|
|
|
function pathErgodic(item) {
|
|
|
+ // console.log(item)
|
|
|
let firstMenu = null
|
|
|
item.children.forEach(i => {
|
|
|
- if(!firstMenu && i.children?.length > 0) {
|
|
|
- firstMenu = pathErgodic(i)
|
|
|
+ if (!firstMenu && i.children?.length > 0&&!i.hidden) {
|
|
|
+ let isChildrenList = false;
|
|
|
+ i.children.forEach(ii=>{
|
|
|
+ if(!ii.hidden){
|
|
|
+ isChildrenList = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(isChildrenList){
|
|
|
+ firstMenu = pathErgodic(i)
|
|
|
+ }else{
|
|
|
+ firstMenu = i.path
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
- if(!firstMenu && checkPathUrl(i.path)) {
|
|
|
+ if (!firstMenu && checkPathUrl(i.path)) {
|
|
|
firstMenu = i.path
|
|
|
} else {
|
|
|
- if(!firstMenu && !i.hidden) {
|
|
|
+ if (!firstMenu && !i.hidden) {
|
|
|
firstMenu = item.path + '/' + i.path
|
|
|
}
|
|
|
}
|
|
@@ -81,7 +93,8 @@ function checkPathUrl(path) {
|
|
|
// 路由
|
|
|
|
|
|
// 递归遍历数组
|
|
|
-function recursionRouter (arr) {
|
|
|
+function recursionRouter(arr) {
|
|
|
+ // 这里来了
|
|
|
if (arr.length > 0) {
|
|
|
let newArr = [];
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -112,7 +125,7 @@ function recursionRouter (arr) {
|
|
|
|
|
|
// 设置 belongTopMenu, 顶部菜单
|
|
|
function addTopMenu(arr) {
|
|
|
- if(arr.length > 0) {
|
|
|
+ if (arr.length > 0) {
|
|
|
let newArr = [];
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
if (arr[i].type == 1) {
|
|
@@ -148,7 +161,7 @@ function setTopMenu(arr, topParentArr) {
|
|
|
// 权限
|
|
|
// 递归遍历数组
|
|
|
let tempArr = []
|
|
|
-function recursionPermission (arr) {
|
|
|
+function recursionPermission(arr) {
|
|
|
arr.map(item => {
|
|
|
tempArr.push(item.memo)
|
|
|
if (item.sysMenus && item.sysMenus.length > 0) {
|
|
@@ -156,11 +169,11 @@ function recursionPermission (arr) {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-function setDetailRoute(accessedRoutes){
|
|
|
- accessedRoutes.forEach(route=>{
|
|
|
+function setDetailRoute(accessedRoutes) {
|
|
|
+ accessedRoutes.forEach(route => {
|
|
|
console.log(route.path)
|
|
|
- if(route.path == '/main'){
|
|
|
- route.children= route.children.concat( [
|
|
|
+ if (route.path == '/main') {
|
|
|
+ route.children = route.children.concat([
|
|
|
{
|
|
|
name: '日程安排',
|
|
|
path: 'scheduleDetail',
|
|
@@ -170,7 +183,7 @@ function setDetailRoute(accessedRoutes){
|
|
|
noCache: '1',
|
|
|
title: '日程安排',
|
|
|
belongTopMenu: "/main",
|
|
|
- activeMenu:'/main/main'
|
|
|
+ activeMenu: '/main/main'
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -182,15 +195,15 @@ function setDetailRoute(accessedRoutes){
|
|
|
noCache: '1',
|
|
|
title: '未在班级学员',
|
|
|
belongTopMenu: "/main",
|
|
|
- activeMenu:'/main/main'
|
|
|
+ activeMenu: '/main/main'
|
|
|
}
|
|
|
},
|
|
|
//
|
|
|
])
|
|
|
}
|
|
|
- if(route.path == '/business'){
|
|
|
+ if (route.path == '/business') {
|
|
|
// import('@/views/resetTeaming/components/strudentPayInfo'),
|
|
|
- route.children= route.children.concat( [
|
|
|
+ route.children = route.children.concat([
|
|
|
{
|
|
|
name: '学员缴费详情',
|
|
|
path: 'strudentPayInfo',
|
|
@@ -200,7 +213,7 @@ function setDetailRoute(accessedRoutes){
|
|
|
noCache: '1',
|
|
|
title: '学员缴费详情',
|
|
|
belongTopMenu: "/business",
|
|
|
- activeMenu:'/teamList'
|
|
|
+ activeMenu: '/teamList'
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -212,32 +225,332 @@ function setDetailRoute(accessedRoutes){
|
|
|
noCache: '1',
|
|
|
title: '乐团详情',
|
|
|
belongTopMenu: "/business",
|
|
|
- activeMenu:'/teamList'
|
|
|
+ activeMenu: '/teamList'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '新建vip',
|
|
|
+ path: 'buildVip',
|
|
|
+ component: () => import('@/views/buildVip/index'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: 'VIP/乐理课申请',
|
|
|
+ belongTopMenu: "/business",
|
|
|
+ activeMenu: '/vipManager/vipList'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'vip修改',
|
|
|
+ path: 'vipReset',
|
|
|
+ component: () => import('@/views/vipClass/vipReset'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: 'VIP/乐理课修改',
|
|
|
+ belongTopMenu: "/business",
|
|
|
+ activeMenu: '/vipManager/vipList'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'vip详情',
|
|
|
+ path: 'vipDetail',
|
|
|
+ component: () => import('@/views/vipClass/vipDetail'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: 'vip详情',
|
|
|
+ belongTopMenu: "/business",
|
|
|
+ activeMenu: '/vipManager/vipList'
|
|
|
}
|
|
|
},
|
|
|
+ {
|
|
|
+ name: '网管课详情',
|
|
|
+ path: 'accompanys',
|
|
|
+ component: () => import('@/views/accompanyManager/accompanys'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '网管课详情',
|
|
|
+ belongTopMenu: "/business",
|
|
|
+ activeMenu: '/vipManager/vipList'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '评价详情',
|
|
|
+ path: 'evaluateDetail',
|
|
|
+ component: () => import('@/views/evaluateManager/evaluateDetail'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '评价详情',
|
|
|
+ belongTopMenu: "/business",
|
|
|
+ activeMenu: '/commentManager'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '课外训练详情',
|
|
|
+ path: 'afterSchoolDetail',
|
|
|
+ component: () => import('@/views/afterSchoolManager/afterSchoolDetail'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: 'VIP/乐理课详情',
|
|
|
+ belongTopMenu: "/business",
|
|
|
+ activeMenu: '/afterSchoolManager'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '学员详情',
|
|
|
+ path: 'studentDetail',
|
|
|
+ component: () => import('@/views/studentManager/index'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '学员详情',
|
|
|
+ belongTopMenu: "/business",
|
|
|
+ activeMenu: '/studentManager/studentList'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '老师详情',
|
|
|
+ path: 'teacherDetail',
|
|
|
+ component: () => import('@/views/teacherManager/teacherDetail/index'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '老师详情',
|
|
|
+ belongTopMenu: "/business",
|
|
|
+ activeMenu: '/teacherManager/teacherList'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '老师修改',
|
|
|
+ path: 'teacherOperation',
|
|
|
+ component: () => import('@/views/teacherManager/teacherOperation/index'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '老师修改',
|
|
|
+ belongTopMenu: "/business",
|
|
|
+ activeMenu: '/teacherManager/teacherList'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '问答详情',
|
|
|
+ path: 'answer',
|
|
|
+ component: () => import('@/views/reaplceMusicPlayer/answerList'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '问答详情',
|
|
|
+ belongTopMenu: "/business",
|
|
|
+ activeMenu: '/otherManager/reaplceMusicPlayer'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // /otherManager/reaplceMusicPlayer /reaplceMusicPlayer/answer
|
|
|
|
|
|
])
|
|
|
}
|
|
|
+ if (route.path == '/operateManager') {
|
|
|
+ route.children = route.children.concat([
|
|
|
+ {
|
|
|
+ name: '服务指标(详情)',
|
|
|
+ path: 'serverIndexDetail',
|
|
|
+ component: () => import('@/views/operateManager/serverIndexDetail'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '服务指标(详情)',
|
|
|
+ belongTopMenu: "/operateManager",
|
|
|
+ activeMenu: '/serverIndexManager/serverIndexList'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '新建活动方案',
|
|
|
+ path: 'vipNewActive',
|
|
|
+ component: () => import('@/views/categroyManager/vipNewActive'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '新建活动方案',
|
|
|
+ belongTopMenu: "/operateManager",
|
|
|
+ activeMenu: '/vipActiveManager/vipActiveList'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '添加分部活动',
|
|
|
+ path: 'branchActiveOperationAdd',
|
|
|
+ component: () => import('@/views/categroyManager/insideSetting/branchActiveOperation'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '添加分部活动',
|
|
|
+ belongTopMenu: "/operateManager",
|
|
|
+ activeMenu: '/branchActiveManager/branchActive'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '修改分部活动',
|
|
|
+ path: 'branchActiveOperation',
|
|
|
+ component: () => import('@/views/categroyManager/insideSetting/branchActiveOperation'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '修改分部活动',
|
|
|
+ belongTopMenu: "/operateManager",
|
|
|
+ activeMenu: '/branchActiveManager/branchActive'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '添加问卷',
|
|
|
+ path: 'questionOperations',
|
|
|
+ component: () => import('@/views/setQuestions/operation'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '添加问卷',
|
|
|
+ belongTopMenu: "/operateManager",
|
|
|
+ activeMenu: '/operateManager/setQuestions'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // /operateManager/setQuestions /questionOperation operateManager
|
|
|
+ ])
|
|
|
+ }
|
|
|
+ if (route.path == '/financialManager') {
|
|
|
+ route.children = route.children.concat([
|
|
|
+ {
|
|
|
+ name: '经营报表详情',
|
|
|
+ path: 'businessStatementDetail',
|
|
|
+ component: () => import('@/views/businessManager/orderManager/businessStatementDetail'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '经营报表详情',
|
|
|
+ belongTopMenu: "/financialManager",
|
|
|
+ activeMenu: '/businessStatement'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ])
|
|
|
+ }
|
|
|
+ if (route.path == '/contentManager') {
|
|
|
+ route.children = route.children.concat([
|
|
|
+ {
|
|
|
+ name: '经营报表详情',
|
|
|
+ path: 'helpCategory',
|
|
|
+ component: () => import('@/views/helpCenter/helpCategory'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '经营报表详情',
|
|
|
+ belongTopMenu: "/contentManager",
|
|
|
+ activeMenu: '/contentManager/helpContent'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '添加&修改内容管理',
|
|
|
+ path: 'contentOperation',
|
|
|
+ component: () => import('@/views/contentManager/contentOperation'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '添加&修改内容管理',
|
|
|
+ belongTopMenu: "/contentManager",
|
|
|
+ activeMenu: '/contentManager/contentManager'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ])
|
|
|
+ }
|
|
|
+ if (route.path == '/shopManager') {
|
|
|
+ route.children = route.children.concat([
|
|
|
+ {
|
|
|
+ name: '进货清单',
|
|
|
+ path: 'purchaseLlist',
|
|
|
+ component: () => import('@/views/businessManager/shopManager/purchase-llist'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '进货清单',
|
|
|
+ belongTopMenu: "/shopManager",
|
|
|
+ activeMenu: '/shopManager'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '添加修改商品',
|
|
|
+ path: 'shopOperation',
|
|
|
+ component: () => import('@/views/businessManager/shopManager/shopOperation'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '添加修改商品',
|
|
|
+ belongTopMenu: "/shopManager",
|
|
|
+ activeMenu: '/shopManager'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ])
|
|
|
+ }
|
|
|
+ if(route.path == '/systemManager'){
|
|
|
+ route.children = route.children.concat([
|
|
|
+ {
|
|
|
+ name: '创建&修改汇付账号',
|
|
|
+ path: 'adapayOperation',
|
|
|
+ component: () => import('@/views/adapayAccount/form'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '创建&修改汇付账号',
|
|
|
+ belongTopMenu: "/systemManager",
|
|
|
+ activeMenu: '/sysBasics/adapayManager'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '添加&查看时间充值活动',
|
|
|
+ path: 'entryOperation',
|
|
|
+ component: () => import('@/views/app/entryOperation'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '添加&查看时间充值活动',
|
|
|
+ belongTopMenu: "/systemManager",
|
|
|
+ activeMenu: '/sysBasics/entryActivities'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '添加&修改系统权限',
|
|
|
+ path: 'adminOperation',
|
|
|
+ component: () => import('@/views/categroyManager/insideSetting/adminOperation'),
|
|
|
+ hidden: true,
|
|
|
+ meta: {
|
|
|
+ noCache: '1',
|
|
|
+ title: '添加&修改系统权限',
|
|
|
+ belongTopMenu: "/systemManager",
|
|
|
+ activeMenu: '/parameter/adminManager'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // /parameter/adminManager adminOperation
|
|
|
+ ])
|
|
|
+ }
|
|
|
})
|
|
|
return accessedRoutes
|
|
|
}
|
|
|
const actions = {
|
|
|
- generateRoutes ({ commit }) {
|
|
|
+ generateRoutes({ commit }) {
|
|
|
return new Promise(resolve => {
|
|
|
// 获取接口返回的权限菜单
|
|
|
getSilder().then(res => {
|
|
|
if (res.code == 200) {
|
|
|
let result = addTopMenu(res.data)
|
|
|
let newData = recursionRouter(result);
|
|
|
+
|
|
|
newData = getFirstMenu(newData)
|
|
|
- // console.log((newData))
|
|
|
+
|
|
|
recursionPermission(res.data)
|
|
|
let accessedRoutes
|
|
|
|
|
|
// 生成异步路由表
|
|
|
accessedRoutes = generateAsyncRouter(asyncRoutes, newData)
|
|
|
accessedRoutes = setDetailRoute(accessedRoutes)
|
|
|
- console.log('生成出来的异步路由',accessedRoutes)
|
|
|
+ console.log('生成出来的异步路由', accessedRoutes)
|
|
|
// var result = accessedRoutes.concat({ path: '*', redirect: '/404', hidden: true })
|
|
|
commit('SET_ROUTES', accessedRoutes)
|
|
|
// commit('SET_PERMISSION', recursionPermission(res.data).flat(Infinity))
|
|
@@ -249,7 +562,7 @@ const actions = {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- removePermission ({ commit }) {
|
|
|
+ removePermission({ commit }) {
|
|
|
window.localStorage.removeItem('permission')
|
|
|
commit('SET_PERMISSION', [])
|
|
|
|