1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321 |
- import { asyncRoutes, constantRoutes } from "@/router";
- import router from "@/router";
- import { getSilder } from "@/api/silder";
- import store from "@/store";
- import { Message } from "element-ui";
- // import { stat } from 'fs'
- // import { removeToken } from '@/utils/auth'
- // import Layout from '@/layout'
- /**
- * 遍历接口菜单添加页面
- * @param asyncRoutes
- * @param getMenu
- */
- function generateAsyncRouter(asyncRoutes, data) {
- if (!data) {
- return [];
- }
- data.forEach(item => {
- item.component = asyncRoutes[item.component];
- if (item.children && item.children.length > 0) {
- generateAsyncRouter(asyncRoutes, item.children);
- }
- });
- return data;
- }
- /**
- * 判断平台端添加首页
- * @param type
- */
- // const type = getters.type
- const state = {
- routes: [],
- addRoutes: [],
- type: "", // 登录的平台类型
- permission: [] // 权限
- };
- const mutations = {
- SET_ROUTES: (state, routes) => {
- state.addRoutes = routes;
- state.routes = constantRoutes.concat(routes);
- },
- SET_PERMISSION: (state, permission) => {
- state.permission = permission;
- }
- };
- function getFirstMenu(routes) {
- // 可能没有权限 提示管理
- if (routes && routes.length > 0) {
- let firstMenu = null;
- routes.forEach(item => {
- if (item.children?.length > 0 && !item.hidden) {
- firstMenu = pathErgodic(item);
- // console.log(firstMenu)
- item.redirect = firstMenu;
- }
- });
- return routes;
- } else {
- Message.error("暂无页面权限,请联系管理员");
- return false;
- }
- }
- function pathErgodic(item) {
- // console.log(item)
- let firstMenu = null;
- item.children.forEach(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 {
- if (!firstMenu && checkPathUrl(i.path)) {
- firstMenu = i.path;
- } else {
- if (!firstMenu && !i.hidden) {
- firstMenu = item.path + "/" + i.path;
- }
- }
- }
- } else {
- if (!firstMenu && checkPathUrl(i.path)) {
- firstMenu = i.path;
- } else {
- if (!firstMenu && !i.hidden) {
- firstMenu = item.path + "/" + i.path;
- }
- }
- }
- });
- return firstMenu;
- }
- // 判断path有没有带/,并且是第一个位置
- function checkPathUrl(path) {
- return path.indexOf("/") === 0 ? true : false;
- }
- // 路由
- // 递归遍历数组
- function recursionRouter(arr) {
- // 这里来了
- if (arr.length > 0) {
- let newArr = [];
- for (let i = 0; i < arr.length; i++) {
- if (arr[i].type == 1) {
- continue;
- }
- let obj = {};
- obj.component = arr[i].component;
- obj.name = arr[i].component;
- // if (item.type != '1' && item.component) {
- // if (!item.path.startsWith('/') && item.component != 'Layout') {
- // obj.names = item.name
- // }
- // }
- arr[i].hid == 0 ? (obj.hidden = false) : (obj.hidden = true);
- // console.log('高亮标签'+arr[i].parentPermission,'普通路径'+arr[i].path)
- obj.path = arr[i].path;
- obj.meta = {
- title: arr[i].name,
- icon: arr[i].icon,
- noCache: arr[i].keepAlive,
- activeMenu: arr[i].parentPermission,
- belongTopMenu: arr[i].belongTopMenu,
- id: arr[i].id
- };
- if (arr[i].sysMenus && arr[i].sysMenus.length > 0) {
- obj.children = recursionRouter(arr[i].sysMenus);
- }
- newArr.push(obj);
- }
- return newArr;
- }
- }
- // 设置 belongTopMenu, 顶部菜单
- function addTopMenu(arr) {
- if (arr.length > 0) {
- let newArr = [];
- for (let i = 0; i < arr.length; i++) {
- if (arr[i].type == 1) {
- continue;
- }
- let obj = arr[i];
- obj.belongTopMenu = obj.path;
- if (arr[i].sysMenus && arr[i].sysMenus.length > 0) {
- obj.sysMenus = setTopMenu(arr[i].sysMenus, obj);
- }
- newArr.push(obj);
- }
- return newArr;
- }
- }
- function setTopMenu(arr, topParentArr) {
- let newArr = [];
- for (let i = 0; i < arr.length; i++) {
- let obj = arr[i];
- obj.belongTopMenu = topParentArr.path;
- if (arr[i].sysMenus && arr[i].sysMenus.length > 0) {
- obj.sysMenus = setTopMenu(arr[i].sysMenus, topParentArr);
- }
- newArr.push(obj);
- }
- return newArr;
- }
- // 权限
- // 递归遍历数组
- let tempArr = [];
- function recursionPermission(arr) {
- arr.map(item => {
- tempArr.push(item.memo);
- if (item.sysMenus && item.sysMenus.length > 0) {
- recursionPermission(item.sysMenus);
- }
- });
- }
- function setDetailRoute(accessedRoutes) {
- // console.log(accessedRoutes)
- accessedRoutes.forEach(route => {
- // console.log(route.path)
- if (route.path == "/main") {
- route.children = route.children.concat([
- {
- name: "日程安排",
- path: "scheduleDetail",
- component: () => import("@/views/main/teamSchedule/scheduleDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "日程安排",
- belongTopMenu: "/main",
- activeMenu: "/workbench",
- id: "xx1"
- }
- },
- {
- name: "未在班级学员",
- path: "notClassStudent",
- component: () => import("@/views/main/notClassStudent"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "未在班级学员",
- belongTopMenu: "/main",
- activeMenu: "/workbench",
- id: "xx2"
- }
- },
- {
- name: "学员请假列表",
- path: "studentLeaveList",
- component: () => import("@/views/main/studentLeaveList"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "学员请假列表",
- belongTopMenu: "/main",
- activeMenu: "/workbench"
- }
- },
- {
- name: "乐团会员列表",
- path: "teamMemberList",
- component: () => import("@/views/studentManager/memberList"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "乐团会员列表",
- belongTopMenu: "/main",
- activeMenu: "/workbench"
- }
- },
- {
- name: "乐团展演列表",
- path: "teamShowList",
- component: () => import("@/views/main/teamShowList"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "乐团展演列表",
- belongTopMenu: "/main",
- activeMenu: "/workbench"
- }
- },
- {
- name: "organDateDetail",
- path: "organDateDetail",
- component: () => import("@/views/main/cloudDate/organDateDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "分部云教练数据详情",
- belongTopMenu: "/main",
- activeMenu: "/workbench"
- }
- },
- {
- name: "organRankDetail",
- path: "organRankDetail",
- component: () => import("@/views/main/cloudDate/organRankDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "分部云教练排行",
- belongTopMenu: "/main",
- activeMenu: "/workbench"
- }
- },
- {
- name: "hasfreeCourse",
- path: "/hasfreeCourse",
- component: () => import("@/views/main/hasfreeCourse"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "排课时长消耗异常",
- belongTopMenu: "/main",
- activeMenu: "/workbench"
- }
- }
- // /hasfreeCourse 排课时长消耗异常
- ]);
- }
- if (route.path == "/business") {
- // import('@/views/resetTeaming/components/strudentPayInfo'),
- route.children = route.children.concat([
- {
- name: "学员缴费详情",
- path: "strudentPayInfo",
- component: () =>
- import("@/views/resetTeaming/components/strudentPayInfo"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "学员缴费详情",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "xx3"
- }
- },
- {
- name: "缴费设置",
- path: "studentPaySet",
- component: () =>
- import("@/views/resetTeaming/components/payInfoDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "缴费设置",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "xx3"
- }
- },
- {
- name: "乐团详情",
- path: "resetTeaming",
- component: () => import("@/views/resetTeaming/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "乐团详情",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "3953"
- }
- },
- {
- name: "乐团档案",
- path: "musicArchices",
- component: () =>
- import("@/views/resetTeaming/components/musicArchices"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "乐团档案",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "xx4"
- }
- },
- //musicArchices
- {
- name: "会员排课列表",
- path: "memberClassList",
- component: () =>
- import("@/views/teamDetail/components/memberClassList"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "会员排课列表",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "xx28"
- }
- },
- {
- name: "相册详情",
- path: "photo-detail",
- component: () => import("@/views/photo-detail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "相册详情",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "xxx28"
- }
- },
- // 相册详情
- {
- name: "全部证书",
- path: "performance",
- component: () => import("@/views/photo-detail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "全部证书",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "xxx28"
- }
- },
- // 全部证书
- {
- name: "新建vip",
- path: "buildVip",
- component: () => import("@/views/buildVip/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "VIP/乐理课申请",
- belongTopMenu: "/business",
- activeMenu: "/vipManager/vipList",
- id: "xx5"
- }
- },
- {
- name: "网管课",
- path: "newPractice",
- component: () => import("@/views/buildVip/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "网管课申请",
- belongTopMenu: "/business",
- activeMenu: "/accompanyManager/accompany",
- id: "xx5"
- }
- },
- {
- name: "vip修改",
- path: "vipReset",
- component: () => import("@/views/vipClass/vipReset"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "VIP/乐理课修改",
- belongTopMenu: "/business",
- activeMenu: "/vipManager/vipList",
- id: "xx6"
- }
- },
- {
- name: "vip详情",
- path: "vipDetail",
- component: () => import("@/views/vipClass/vipDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "vip详情",
- belongTopMenu: "/business",
- activeMenu: "/vipManager/vipList",
- id: "xx7"
- }
- },
- {
- name: "网管课详情",
- path: "accompanys",
- component: () => import("@/views/accompanyManager/accompanys"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "网管课详情",
- belongTopMenu: "/business",
- activeMenu: "/accompanyManager/accompany",
- id: "xx8"
- }
- },
- {
- name: "评价详情",
- path: "evaluateDetail",
- component: () => import("@/views/evaluateManager/evaluateDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "评价详情",
- belongTopMenu: "/business",
- activeMenu: "/commentManager",
- id: "xx9"
- }
- },
- {
- name: "课外训练详情",
- path: "afterSchoolDetail",
- component: () =>
- import("@/views/afterSchoolManager/afterSchoolDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "VIP/乐理课详情",
- belongTopMenu: "/business",
- activeMenu: "/afterSchoolManager",
- id: "xx10"
- }
- },
- {
- name: "学员详情",
- path: "studentDetail",
- component: () => import("@/views/studentManager/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "学员详情",
- belongTopMenu: "/business",
- activeMenu: "/studentManager/studentList",
- id: "4083"
- }
- },
- {
- name: "老师详情",
- path: "teacherDetail",
- component: () => import("@/views/teacherManager/teacherDetail/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "老师详情",
- belongTopMenu: "/business",
- activeMenu: "/teacherManager/teacherList",
- id: "4118"
- }
- },
- {
- name: "老师修改",
- path: "teacherOperation",
- component: () =>
- import("@/views/teacherManager/teacherOperation/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "老师修改",
- belongTopMenu: "/business",
- activeMenu: "/teacherManager/teacherList",
- id: "4174"
- }
- },
- {
- name: "问答详情",
- path: "answer",
- component: () => import("@/views/reaplceMusicPlayer/answerList"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "问答详情",
- belongTopMenu: "/business",
- activeMenu: "/otherManager/reaplceMusicPlayer",
- id: "4293"
- }
- },
- {
- name: "活动详情",
- path: "childrensdayDetail",
- component: () => import("@/views/childrensDay/detail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "活动详情",
- belongTopMenu: "/business",
- activeMenu: "/childrensDay"
- }
- },
- {
- name: "新建直播课",
- path: "createLiveClass",
- component: () => import("@/views/liveClassManager/newLiveClass"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "新建直播课",
- belongTopMenu: "/business",
- activeMenu: "/liveClassManager"
- }
- },
- {
- name: "商品设置",
- path: "liveShopControl",
- component: () => import("@/views/liveClassManager/liveShopControl"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "商品设置",
- belongTopMenu: "/business",
- activeMenu: "/liveClassManager"
- }
- },
- {
- name: "直播课详情",
- path: "liveClassDetail",
- component: () => import("@/views/liveClassManager/liveClassDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "直播课详情",
- belongTopMenu: "/business",
- activeMenu: "/liveClassManager"
- }
- },
- {
- name: "黑名单",
- path: "liveBlackList",
- component: () => import("@/views/liveClassManager/studentBlacklist"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "黑名单",
- belongTopMenu: "/business",
- activeMenu: "/liveClassManager"
- }
- },
- {
- name: "直播学员",
- path: "liveStudentList",
- component: () => import("@/views/liveClassManager/addStudentList"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "直播学员",
- belongTopMenu: "/business",
- activeMenu: "/liveClassManager"
- }
- },
- {
- name: "学员缴费设置",
- path: "studentPaySet",
- component: () =>
- import("@/views/resetTeaming/components/payInfoDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "学员缴费设置",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "xx3"
- }
- },
- {
- name: "乐团详情",
- path: "resetTeaming",
- component: () => import("@/views/resetTeaming/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "乐团详情",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "3953"
- }
- },
- {
- name: "乐团档案",
- path: "musicArchices",
- component: () =>
- import("@/views/resetTeaming/components/musicArchices"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "乐团档案",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "xx4"
- }
- },
- //musicArchices
- {
- name: "会员排课列表",
- path: "memberClassList",
- component: () =>
- import("@/views/teamDetail/components/memberClassList"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "会员排课列表",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "xx28"
- }
- },
- {
- name: "相册详情",
- path: "photo-detail",
- component: () => import("@/views/photo-detail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "相册详情",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "xxx28"
- }
- },
- // 相册详情
- {
- name: "全部证书",
- path: "performance",
- component: () => import("@/views/photo-detail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "全部证书",
- belongTopMenu: "/business",
- activeMenu: "/teamList",
- id: "xxx28"
- }
- },
- // 全部证书
- {
- name: "新建vip",
- path: "buildVip",
- component: () => import("@/views/buildVip/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "VIP/乐理课申请",
- belongTopMenu: "/business",
- activeMenu: "/vipManager/vipList",
- id: "xx5"
- }
- },
- {
- name: "网管课",
- path: "newPractice",
- component: () => import("@/views/buildVip/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "网管课申请",
- belongTopMenu: "/business",
- activeMenu: "/accompanyManager/accompany",
- id: "xx5"
- }
- },
- {
- name: "vip修改",
- path: "vipReset",
- component: () => import("@/views/vipClass/vipReset"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "VIP/乐理课修改",
- belongTopMenu: "/business",
- activeMenu: "/vipManager/vipList",
- id: "xx6"
- }
- },
- {
- name: "vip详情",
- path: "vipDetail",
- component: () => import("@/views/vipClass/vipDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "vip详情",
- belongTopMenu: "/business",
- activeMenu: "/vipManager/vipList",
- id: "xx7"
- }
- },
- {
- name: "网管课详情",
- path: "accompanys",
- component: () => import("@/views/accompanyManager/accompanys"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "网管课详情",
- belongTopMenu: "/business",
- activeMenu: "/accompanyManager/accompany",
- id: "xx8"
- }
- },
- {
- name: "评价详情",
- path: "evaluateDetail",
- component: () => import("@/views/evaluateManager/evaluateDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "评价详情",
- belongTopMenu: "/business",
- activeMenu: "/commentManager",
- id: "xx9"
- }
- },
- {
- name: "课外训练详情",
- path: "afterSchoolDetail",
- component: () =>
- import("@/views/afterSchoolManager/afterSchoolDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "VIP/乐理课详情",
- belongTopMenu: "/business",
- activeMenu: "/afterSchoolManager",
- id: "xx10"
- }
- },
- {
- name: "学员详情",
- path: "studentDetail",
- component: () => import("@/views/studentManager/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "学员详情",
- belongTopMenu: "/business",
- activeMenu: "/studentManager/studentList",
- id: "4083"
- }
- },
- {
- name: "老师详情",
- path: "teacherDetail",
- component: () => import("@/views/teacherManager/teacherDetail/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "老师详情",
- belongTopMenu: "/business",
- activeMenu: "/teacherManager/teacherList",
- id: "4118"
- }
- },
- {
- name: "老师修改",
- path: "teacherOperation",
- component: () =>
- import("@/views/teacherManager/teacherOperation/index"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "老师修改",
- belongTopMenu: "/business",
- activeMenu: "/teacherManager/teacherList",
- id: "4174"
- }
- },
- {
- name: "问答详情",
- path: "answer",
- component: () => import("@/views/reaplceMusicPlayer/answerList"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "问答详情",
- belongTopMenu: "/business",
- activeMenu: "/otherManager/reaplceMusicPlayer",
- id: "4293"
- }
- },
- {
- name: "活动详情",
- path: "childrensdayDetail",
- component: () => import("@/views/childrensDay/detail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "活动详情",
- belongTopMenu: "/business",
- activeMenu: "/childrensDay"
- }
- }
- // /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",
- id: "3513"
- }
- },
- {
- name: "新建活动方案",
- path: "vipNewActive",
- component: () => import("@/views/categroyManager/vipNewActive"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "新建活动方案",
- belongTopMenu: "/operateManager",
- activeMenu: "/vipActiveManager/vipActiveList",
- id: "3558"
- }
- },
- {
- name: "活动资格管理",
- path: "activeSenior",
- component: () => import("@/views/categroyManager/activeSenior"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "活动资格管理",
- belongTopMenu: "/operateManager",
- activeMenu: "/vipActiveManager/vipActiveList",
- id: "4610"
- }
- },
- // activeSenior
- {
- name: "添加阶梯奖励",
- path: "branchActiveOperationAdd",
- component: () =>
- import("@/views/categroyManager/insideSetting/branchActiveOperation"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "添加阶梯奖励",
- belongTopMenu: "/operateManager",
- activeMenu: "/operateManager/branchActiveManager/branchActive",
- id: "3527"
- }
- },
- {
- name: "修改阶梯奖励",
- path: "branchActiveOperation",
- component: () =>
- import("@/views/categroyManager/insideSetting/branchActiveOperation"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "修改阶梯奖励",
- belongTopMenu: "/operateManager",
- activeMenu: "/operateManager/branchActiveManager/branchActive",
- id: "3528"
- }
- },
- {
- name: "添加问卷",
- path: "questionOperations",
- component: () => import("@/views/setQuestions/operation"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "添加问卷",
- belongTopMenu: "/operateManager",
- activeMenu: "/operateManager/setQuestions",
- id: "4286"
- }
- },
- {
- name: "2021memeberActionManager",
- path: "/2021memeberActionManager",
- component: () => import("@/views/2021memeberActionManager"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "2021会员活动",
- belongTopMenu: "/operateManager",
- activeMenu: "/activeMarketing",
- id: "4550"
- }
- },
- {
- name: "memberActiveDetail",
- path: "memberActiveDetail",
- component: () =>
- import("@/views/2021memeberActionManager/memberActiveDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "2021十一活动详情",
- belongTopMenu: "/operateManager",
- activeMenu: "/activeMarketing",
- id: "4551"
- }
- },
- {
- name: "2021double11List",
- path: "/2021double11List",
- component: () =>
- import("@/views/activityScheduling/2021double11List"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "双十一活动",
- belongTopMenu: "/operateManager",
- activeMenu: "/activeMarketing",
- id: "4594"
- }
- },
- {
- name: "2021doubleDetail",
- path: "2021doubleDetail",
- component: () =>
- import("@/views/activityScheduling/2021doubleDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "双十一活动详情",
- belongTopMenu: "/operateManager",
- activeMenu: "/activeMarketing",
- id: "4595"
- }
- },
- {
- name: "新增优惠券",
- path: "couponUpdate",
- component: () => import("@/views/couponManager/couponUpdate"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "新增优惠券",
- belongTopMenu: "/operateManager",
- activeMenu: "/couponManager",
- id: "4553"
- }
- },
- {
- name: "发放优惠券",
- path: "couponGrant",
- component: () => import("@/views/couponManager/couponGrant"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "发放优惠券",
- belongTopMenu: "/operateManager",
- activeMenu: "/couponManager",
- id: "xx19"
- }
- },
- {
- name: "答题详情",
- path: "userAskList",
- component: () => import("@/views/setQuestions/userAskList"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "答题详情",
- belongTopMenu: "/operateManager",
- activeMenu: "/operateManager/setQuestions",
- id: "xx19"
- }
- },
- {
- name: "训练营详情",
- path: "aristCampDetail",
- component: () => import("@/views/littleArtistCamp/aristCampDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "训练营详情",
- belongTopMenu: "/operateManager",
- activeMenu: "/littleArtistCamp",
- id: "xx19"
- }
- },
- {
- name: "群聊详情",
- path: "chatDetail",
- component: () => import("@/views/groupChatManager/chatDetail"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "群聊详情",
- belongTopMenu: "/operateManager",
- activeMenu: "/groupChatManager",
- id: "xx19"
- }
- }
- ]);
- }
- 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",
- id: "4217"
- }
- },
- {
- name: "缴费项目列表",
- path: "payschoolList",
- component: () =>
- import("@/views/branchPayManager/payschoolList"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "缴费项目列表",
- belongTopMenu: "/financialManager",
- activeMenu: "/branchPayManager",
- id: "4217"
- }
- }
- ]);
- }
- 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",
- id: "3596"
- }
- },
- {
- name: "添加&修改内容管理",
- path: "contentOperation",
- component: () => import("@/views/contentManager/contentOperation"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "添加&修改内容管理",
- belongTopMenu: "/contentManager",
- activeMenu: "/contentManager/contentManager",
- id: "xx22"
- }
- }
- ]);
- }
- 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: "/shopList",
- id: "3618"
- }
- },
- {
- name: "添加修改商品",
- path: "shopOperation",
- component: () =>
- import("@/views/businessManager/shopManager/shopOperation"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "添加修改商品",
- belongTopMenu: "/shopManager",
- activeMenu: "/shopList",
- id: "3617"
- }
- }
- ]);
- }
- 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",
- id: "3748"
- }
- },
- {
- name: "添加&查看时间充值活动",
- path: "entryOperation",
- component: () => import("@/views/app/entryOperation"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "添加&查看时间充值活动",
- belongTopMenu: "/systemManager",
- activeMenu: "/sysBasics/entryActivities",
- id: "3773"
- }
- },
- {
- name: "添加&修改系统权限",
- path: "adminOperation",
- component: () =>
- import("@/views/categroyManager/insideSetting/adminOperation"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "添加&修改系统权限",
- belongTopMenu: "/systemManager",
- activeMenu: "/adminManager",
- id: "3993"
- }
- },
- {
- name: "扣费记录",
- path: "chargingRecord",
- component: () => import("@/views/tenantSetting/chargingRecord.vue"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "扣费记录",
- belongTopMenu: "/systemManager",
- activeMenu: "/productService",
- id: "4741"
- }
- }
- // /parameter/adminManager adminOperation
- ]);
- }
- if (route.path == "/platformManager") {
- route.children = route.children.concat([
- {
- name: "添加&修改",
- path: "serviceOperation",
- component: () =>
- import("@/views/platformManager/serviceManager/form"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "添加&修改",
- belongTopMenu: "/platformManager",
- activeMenu: "/serviceManager/serviceList",
- id: "4631"
- }
- },
- {
- name: "添加&修改",
- path: "organOperation",
- component: () => import("@/views/organManager/organOperation"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "添加&修改",
- belongTopMenu: "/platformManager",
- activeMenu: "/organManager/organList",
- id: "4652"
- }
- },
- {
- name: "平台角色设置",
- path: "adminOperation",
- component: () =>
- import("@/views/platformManager/paltformAdmin/paltformOperation"),
- hidden: true,
- meta: {
- noCache: "1",
- title: "平台角色设置",
- belongTopMenu: "/platformManager",
- activeMenu: "/platformAdminManger",
- id: "3993"
- }
- }
- ]);
- }
- });
- return accessedRoutes;
- }
- const actions = {
- generateRoutes({ commit }) {
- return new Promise(resolve => {
- // 获取接口返回的权限菜单
- getSilder().then(async res => {
- if (res.code == 200) {
- let result = addTopMenu(res.data);
- if (res.data?.length < 1) {
- // 一条权限都没有
- //退出 跳到登录页 提示'该账号无任何权限'
- // console.log(store.dispatch)
- await store.dispatch("user/logout");
- localStorage.removeItem("firstMenuUrl");
- // await this.$store.dispatch("permission/removePermission")
- Message.error("该用户无访问权限");
- router.push(`/login`);
- // window.location.reload();
- }
- let newData = recursionRouter(result);
- newData = getFirstMenu(newData);
- recursionPermission(res.data);
- let accessedRoutes;
- // 生成异步路由表
- accessedRoutes = generateAsyncRouter(asyncRoutes, newData);
- accessedRoutes = setDetailRoute(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))
- window.localStorage.removeItem("permission");
- window.localStorage.setItem("permission", tempArr);
- this.dispatch("app/setDotStatus");
- this.dispatch("app/setServiceInfo"); // 获取机构信息,用于续费弹窗和个人信息
- resolve(accessedRoutes);
- }
- });
- });
- },
- removePermission({ commit }) {
- window.localStorage.removeItem("permission");
- commit("SET_PERMISSION", []);
- }
- };
- export default {
- namespaced: true,
- state,
- mutations,
- actions
- };
|