permission.js 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429
  1. import { asyncRoutes, constantRoutes } from "@/router";
  2. import router from "@/router";
  3. import { getSilder } from "@/api/silder";
  4. import store from "@/store";
  5. import { Message } from "element-ui";
  6. import { removeToken } from "@/utils/auth";
  7. // import { stat } from 'fs'
  8. // import { removeToken } from '@/utils/auth'
  9. // import Layout from '@/layout'
  10. /**
  11. * 遍历接口菜单添加页面
  12. * @param asyncRoutes
  13. * @param getMenu
  14. */
  15. function generateAsyncRouter(asyncRoutes, data) {
  16. if (!data) {
  17. return [];
  18. }
  19. data.forEach(item => {
  20. item.component = asyncRoutes[item.component];
  21. if (item.children && item.children.length > 0) {
  22. generateAsyncRouter(asyncRoutes, item.children);
  23. }
  24. });
  25. return data;
  26. }
  27. /**
  28. * 判断平台端添加首页
  29. * @param type
  30. */
  31. // const type = getters.type
  32. const state = {
  33. routes: [],
  34. addRoutes: [],
  35. type: "", // 登录的平台类型
  36. permission: [] // 权限
  37. };
  38. const mutations = {
  39. SET_ROUTES: (state, routes) => {
  40. state.addRoutes = routes;
  41. state.routes = constantRoutes.concat(routes);
  42. },
  43. SET_PERMISSION: (state, permission) => {
  44. state.permission = permission;
  45. }
  46. };
  47. function getFirstMenu(routes) {
  48. // 可能没有权限 提示管理
  49. if (routes && routes.length > 0) {
  50. let firstMenu = null;
  51. routes.forEach(item => {
  52. if (item.children?.length > 0 && !item.hidden) {
  53. firstMenu = pathErgodic(item);
  54. // console.log(firstMenu)
  55. item.redirect = firstMenu;
  56. }
  57. });
  58. return routes;
  59. } else {
  60. Message.error("暂无页面权限,请联系管理员");
  61. return false;
  62. }
  63. }
  64. function pathErgodic(item) {
  65. // console.log(item)
  66. let firstMenu = null;
  67. item.children.forEach(i => {
  68. if (!firstMenu && i.children?.length > 0 && !i.hidden) {
  69. let isChildrenList = false;
  70. i.children.forEach(ii => {
  71. if (!ii.hidden) {
  72. isChildrenList = true;
  73. }
  74. });
  75. if (isChildrenList) {
  76. firstMenu = pathErgodic(i);
  77. } else {
  78. if (!firstMenu && checkPathUrl(i.path)) {
  79. firstMenu = i.path;
  80. } else {
  81. if (!firstMenu && !i.hidden) {
  82. firstMenu = item.path + "/" + i.path;
  83. }
  84. }
  85. }
  86. } else {
  87. if (!firstMenu && checkPathUrl(i.path)) {
  88. firstMenu = i.path;
  89. } else {
  90. if (!firstMenu && !i.hidden) {
  91. firstMenu = item.path + "/" + i.path;
  92. }
  93. }
  94. }
  95. });
  96. return firstMenu;
  97. }
  98. // 判断path有没有带/,并且是第一个位置
  99. function checkPathUrl(path) {
  100. return path.indexOf("/") === 0 ? true : false;
  101. }
  102. // 路由
  103. // 递归遍历数组
  104. function recursionRouter(arr) {
  105. // 这里来了
  106. if (arr && arr.length > 0) {
  107. let newArr = [];
  108. for (let i = 0; i < arr.length; i++) {
  109. if (arr[i].type == 1) {
  110. continue;
  111. }
  112. let obj = {};
  113. obj.component = arr[i].component;
  114. obj.name = arr[i].component;
  115. // if (item.type != '1' && item.component) {
  116. // if (!item.path.startsWith('/') && item.component != 'Layout') {
  117. // obj.names = item.name
  118. // }
  119. // }
  120. arr[i].hid == 0 ? (obj.hidden = false) : (obj.hidden = true);
  121. // console.log('高亮标签'+arr[i].parentPermission,'普通路径'+arr[i].path)
  122. obj.path = arr[i].path;
  123. obj.meta = {
  124. title: arr[i].name,
  125. icon: arr[i].icon,
  126. noCache: arr[i].keepAlive,
  127. activeMenu: arr[i].parentPermission,
  128. belongTopMenu: arr[i].belongTopMenu,
  129. id: arr[i].id
  130. };
  131. if (arr[i].sysMenus && arr[i].sysMenus.length > 0) {
  132. obj.children = recursionRouter(arr[i].sysMenus);
  133. }
  134. newArr.push(obj);
  135. }
  136. return newArr;
  137. } else {
  138. return [];
  139. }
  140. }
  141. // 设置 belongTopMenu, 顶部菜单
  142. function addTopMenu(arr) {
  143. if (arr.length > 0) {
  144. let newArr = [];
  145. for (let i = 0; i < arr.length; i++) {
  146. if (arr[i].type == 1) {
  147. continue;
  148. }
  149. let obj = arr[i];
  150. obj.belongTopMenu = obj.path;
  151. if (arr[i].sysMenus && arr[i].sysMenus.length > 0) {
  152. obj.sysMenus = setTopMenu(arr[i].sysMenus, obj);
  153. }
  154. newArr.push(obj);
  155. }
  156. return newArr;
  157. }
  158. }
  159. function setTopMenu(arr, topParentArr) {
  160. let newArr = [];
  161. for (let i = 0; i < arr.length; i++) {
  162. let obj = arr[i];
  163. obj.belongTopMenu = topParentArr.path;
  164. if (arr[i].sysMenus && arr[i].sysMenus.length > 0) {
  165. obj.sysMenus = setTopMenu(arr[i].sysMenus, topParentArr);
  166. }
  167. newArr.push(obj);
  168. }
  169. return newArr;
  170. }
  171. // 权限
  172. // 递归遍历数组
  173. let tempArr = [];
  174. function recursionPermission(arr) {
  175. arr.map(item => {
  176. tempArr.push(item.memo);
  177. if (item.sysMenus && item.sysMenus.length > 0) {
  178. recursionPermission(item.sysMenus);
  179. }
  180. });
  181. }
  182. function setDetailRoute(accessedRoutes) {
  183. // console.log(accessedRoutes)
  184. accessedRoutes.forEach(route => {
  185. // console.log(route.path)
  186. if (route.path == "/main") {
  187. route.children = route.children.concat([
  188. {
  189. name: "日程安排",
  190. path: "scheduleDetail",
  191. component: () => import("@/views/main/teamSchedule/scheduleDetail"),
  192. hidden: true,
  193. meta: {
  194. noCache: "1",
  195. title: "日程安排",
  196. belongTopMenu: "/main",
  197. activeMenu: "/workbench",
  198. id: "xx1"
  199. }
  200. },
  201. {
  202. name: "未在班级学员",
  203. path: "notClassStudent",
  204. component: () => import("@/views/main/notClassStudent"),
  205. hidden: true,
  206. meta: {
  207. noCache: "1",
  208. title: "未在班级学员",
  209. belongTopMenu: "/main",
  210. activeMenu: "/workbench",
  211. id: "xx2"
  212. }
  213. },
  214. {
  215. name: "学员请假列表",
  216. path: "studentLeaveList",
  217. component: () => import("@/views/main/studentLeaveList"),
  218. hidden: true,
  219. meta: {
  220. noCache: "1",
  221. title: "学员请假列表",
  222. belongTopMenu: "/main",
  223. activeMenu: "/workbench"
  224. }
  225. },
  226. {
  227. name: "乐团会员列表",
  228. path: "teamMemberList",
  229. component: () => import("@/views/studentManager/memberList"),
  230. hidden: true,
  231. meta: {
  232. noCache: "1",
  233. title: "乐团会员列表",
  234. belongTopMenu: "/main",
  235. activeMenu: "/workbench"
  236. }
  237. },
  238. {
  239. name: "乐团展演列表",
  240. path: "teamShowList",
  241. component: () => import("@/views/main/teamShowList"),
  242. hidden: true,
  243. meta: {
  244. noCache: "1",
  245. title: "乐团展演列表",
  246. belongTopMenu: "/main",
  247. activeMenu: "/workbench"
  248. }
  249. },
  250. {
  251. name: "organDateDetail",
  252. path: "organDateDetail",
  253. component: () => import("@/views/main/cloudDate/organDateDetail"),
  254. hidden: true,
  255. meta: {
  256. noCache: "1",
  257. title: "分部云练习数据详情",
  258. belongTopMenu: "/main",
  259. activeMenu: "/workbench"
  260. }
  261. },
  262. {
  263. name: "organRankDetail",
  264. path: "organRankDetail",
  265. component: () => import("@/views/main/cloudDate/organRankDetail"),
  266. hidden: true,
  267. meta: {
  268. noCache: "1",
  269. title: "分部云练习排行",
  270. belongTopMenu: "/main",
  271. activeMenu: "/workbench"
  272. }
  273. },
  274. {
  275. name: "hasfreeCourse",
  276. path: "/hasfreeCourse",
  277. component: () => import("@/views/main/hasfreeCourse"),
  278. hidden: true,
  279. meta: {
  280. noCache: "1",
  281. title: "排课时长消耗异常",
  282. belongTopMenu: "/main",
  283. activeMenu: "/workbench"
  284. }
  285. },
  286. {
  287. name: "exerciseDurationDetail",
  288. path: "/exerciseDurationDetail",
  289. component: () =>
  290. import("@/views/main/cloudDate/exerciseDurationDetail.vue"),
  291. hidden: true,
  292. meta: {
  293. noCache: "1",
  294. title: "练习时长详情",
  295. belongTopMenu: "/main",
  296. activeMenu: "/workbench"
  297. }
  298. },
  299. {
  300. name: "coursewareDurationDetail",
  301. path: "/coursewareDurationDetail",
  302. component: () =>
  303. import("@/views/main/coursewareDate/exerciseDurationDetail.vue"),
  304. hidden: true,
  305. meta: {
  306. noCache: "1",
  307. title: "观看时长详情",
  308. belongTopMenu: "/main",
  309. activeMenu: "/workbench"
  310. }
  311. }
  312. // /hasfreeCourse 排课时长消耗异常
  313. ]);
  314. }
  315. if (route.path == "/business") {
  316. // import('@/views/resetTeaming/components/strudentPayInfo'),
  317. route.children = route.children.concat([
  318. {
  319. name: "学员缴费详情",
  320. path: "strudentPayInfo",
  321. component: () =>
  322. import("@/views/resetTeaming/components/strudentPayInfo"),
  323. hidden: true,
  324. meta: {
  325. noCache: "1",
  326. title: "学员缴费详情",
  327. belongTopMenu: "/business",
  328. activeMenu: "/teamList",
  329. id: "xx3"
  330. }
  331. },
  332. {
  333. name: "缴费设置",
  334. path: "studentPaySet",
  335. component: () =>
  336. import("@/views/resetTeaming/components/payInfoDetail"),
  337. hidden: true,
  338. meta: {
  339. noCache: "1",
  340. title: "缴费设置",
  341. belongTopMenu: "/business",
  342. activeMenu: "/teamList",
  343. id: "xx3"
  344. }
  345. },
  346. {
  347. name: "缴费设置",
  348. path: "goodsPaySet",
  349. component: () =>
  350. import("@/views/resetTeaming/components/goodsPayInfo"),
  351. hidden: true,
  352. meta: {
  353. noCache: "1",
  354. title: "缴费设置",
  355. belongTopMenu: "/business",
  356. activeMenu: "/teamList",
  357. id: "xx3"
  358. }
  359. },
  360. {
  361. name: "商品采购设置",
  362. path: "goodsPaySet2",
  363. component: () =>
  364. import("@/views/resetTeaming/components/goodsPayInfo"),
  365. hidden: true,
  366. meta: {
  367. noCache: "1",
  368. title: "商品采购设置",
  369. belongTopMenu: "/financialManager",
  370. activeMenu: "/payschoolList",
  371. id: "xx3"
  372. }
  373. },
  374. {
  375. name: "乐团详情",
  376. path: "resetTeaming",
  377. component: () => import("@/views/resetTeaming/index"),
  378. hidden: true,
  379. meta: {
  380. noCache: "1",
  381. title: "乐团详情",
  382. belongTopMenu: "/business",
  383. activeMenu: "/teamList",
  384. id: "3953"
  385. }
  386. },
  387. {
  388. name: "乐团档案",
  389. path: "musicArchices",
  390. component: () =>
  391. import("@/views/resetTeaming/components/musicArchices"),
  392. hidden: true,
  393. meta: {
  394. noCache: "1",
  395. title: "乐团档案",
  396. belongTopMenu: "/business",
  397. activeMenu: "/teamList",
  398. id: "xx4"
  399. }
  400. },
  401. //musicArchices
  402. {
  403. name: "会员排课列表",
  404. path: "memberClassList",
  405. component: () =>
  406. import("@/views/teamDetail/components/memberClassList"),
  407. hidden: true,
  408. meta: {
  409. noCache: "1",
  410. title: "会员排课列表",
  411. belongTopMenu: "/business",
  412. activeMenu: "/teamList",
  413. id: "xx28"
  414. }
  415. },
  416. {
  417. name: "相册详情",
  418. path: "photo-detail",
  419. component: () => import("@/views/photo-detail"),
  420. hidden: true,
  421. meta: {
  422. noCache: "1",
  423. title: "相册详情",
  424. belongTopMenu: "/business",
  425. activeMenu: "/teamList",
  426. id: "xxx28"
  427. }
  428. },
  429. // 相册详情
  430. {
  431. name: "全部证书",
  432. path: "performance",
  433. component: () => import("@/views/photo-detail"),
  434. hidden: true,
  435. meta: {
  436. noCache: "1",
  437. title: "全部证书",
  438. belongTopMenu: "/business",
  439. activeMenu: "/teamList",
  440. id: "xxx28"
  441. }
  442. },
  443. // 全部证书
  444. {
  445. name: "新建vip",
  446. path: "buildVip",
  447. component: () => import("@/views/buildVip/index"),
  448. hidden: true,
  449. meta: {
  450. noCache: "1",
  451. title: "VIP/小组课申请",
  452. belongTopMenu: "/business",
  453. activeMenu: "/vipManager/vipList",
  454. id: "xx5"
  455. }
  456. },
  457. {
  458. name: "网管课",
  459. path: "newPractice",
  460. component: () => import("@/views/buildVip/index"),
  461. hidden: true,
  462. meta: {
  463. noCache: "1",
  464. title: "网管课申请",
  465. belongTopMenu: "/business",
  466. activeMenu: "/accompanyManager/accompany",
  467. id: "xx5"
  468. }
  469. },
  470. {
  471. name: "vip修改",
  472. path: "vipReset",
  473. component: () => import("@/views/vipClass/vipReset"),
  474. hidden: true,
  475. meta: {
  476. noCache: "1",
  477. title: "VIP/小组课修改",
  478. belongTopMenu: "/business",
  479. activeMenu: "/vipManager/vipList",
  480. id: "xx6"
  481. }
  482. },
  483. {
  484. name: "vip详情",
  485. path: "vipDetail",
  486. component: () => import("@/views/vipClass/vipDetail"),
  487. hidden: true,
  488. meta: {
  489. noCache: "1",
  490. title: "vip详情",
  491. belongTopMenu: "/business",
  492. activeMenu: "/vipManager/vipList",
  493. id: "xx7"
  494. }
  495. },
  496. {
  497. name: "网管课详情",
  498. path: "accompanys",
  499. component: () => import("@/views/accompanyManager/accompanys"),
  500. hidden: true,
  501. meta: {
  502. noCache: "1",
  503. title: "网管课详情",
  504. belongTopMenu: "/business",
  505. activeMenu: "/accompanyManager/accompany",
  506. id: "xx8"
  507. }
  508. },
  509. {
  510. name: "评价详情",
  511. path: "evaluateDetail",
  512. component: () => import("@/views/evaluateManager/evaluateDetail"),
  513. hidden: true,
  514. meta: {
  515. noCache: "1",
  516. title: "评价详情",
  517. belongTopMenu: "/business",
  518. activeMenu: "/commentManager",
  519. id: "xx9"
  520. }
  521. },
  522. {
  523. name: "课外训练详情",
  524. path: "afterSchoolDetail",
  525. component: () =>
  526. import("@/views/afterSchoolManager/afterSchoolDetail"),
  527. hidden: true,
  528. meta: {
  529. noCache: "1",
  530. title: "训练详情",
  531. belongTopMenu: "/business",
  532. activeMenu: "/afterSchoolManager",
  533. id: "xx10"
  534. }
  535. },
  536. {
  537. name: "课外训练详情",
  538. path: "afterSchoolDetailold",
  539. component: () =>
  540. import("@/views/afterSchoolManager/oldafterScDetail"),
  541. hidden: true,
  542. meta: {
  543. noCache: "1",
  544. title: "训练详情",
  545. belongTopMenu: "/business",
  546. activeMenu: "/afterSchoolManager",
  547. id: "xx10"
  548. }
  549. },
  550. {
  551. name: "学员详情",
  552. path: "studentDetail",
  553. component: () => import("@/views/studentManager/index"),
  554. hidden: true,
  555. meta: {
  556. noCache: "1",
  557. title: "学员详情",
  558. belongTopMenu: "/business",
  559. activeMenu: "/studentManager/studentList",
  560. id: "4083"
  561. }
  562. },
  563. {
  564. name: "老师详情",
  565. path: "teacherDetail",
  566. component: () => import("@/views/teacherManager/teacherDetail/index"),
  567. hidden: true,
  568. meta: {
  569. noCache: "1",
  570. title: "老师详情",
  571. belongTopMenu: "/business",
  572. activeMenu: "/teacherManager/teacherList",
  573. id: "4118"
  574. }
  575. },
  576. {
  577. name: "老师修改",
  578. path: "teacherOperation",
  579. component: () =>
  580. import("@/views/teacherManager/teacherOperation/index"),
  581. hidden: true,
  582. meta: {
  583. noCache: "1",
  584. title: "老师修改",
  585. belongTopMenu: "/business",
  586. activeMenu: "/teacherManager/teacherList",
  587. id: "4174"
  588. }
  589. },
  590. {
  591. name: "问答详情",
  592. path: "answer",
  593. component: () => import("@/views/reaplceMusicPlayer/answerList"),
  594. hidden: true,
  595. meta: {
  596. noCache: "1",
  597. title: "问答详情",
  598. belongTopMenu: "/business",
  599. activeMenu: "/otherManager/reaplceMusicPlayer",
  600. id: "4293"
  601. }
  602. },
  603. {
  604. name: "活动详情",
  605. path: "childrensdayDetail",
  606. component: () => import("@/views/childrensDay/detail"),
  607. hidden: true,
  608. meta: {
  609. noCache: "1",
  610. title: "活动详情",
  611. belongTopMenu: "/business",
  612. activeMenu: "/childrensDay"
  613. }
  614. },
  615. {
  616. name: "新建直播课",
  617. path: "createLiveClass",
  618. component: () => import("@/views/liveClassManager/newLiveClass"),
  619. hidden: true,
  620. meta: {
  621. noCache: "1",
  622. title: "新建直播课",
  623. belongTopMenu: "/business",
  624. activeMenu: "/liveClassManager"
  625. }
  626. },
  627. {
  628. name: "新建直播课",
  629. path: "createLiveCourse",
  630. component: () => import("@/views/liveClassManager/createLiveClass"),
  631. hidden: true,
  632. meta: {
  633. noCache: "1",
  634. title: "新建直播课",
  635. belongTopMenu: "/business",
  636. activeMenu: "/liveClassManager"
  637. }
  638. },
  639. {
  640. name: "直播课详情",
  641. path: "liveCourseDetail",
  642. component: () => import("@/views/liveClassManager/liveClassTwo"),
  643. hidden: true,
  644. meta: {
  645. noCache: "1",
  646. title: "直播课详情",
  647. belongTopMenu: "/business",
  648. activeMenu: "/liveClassManager"
  649. }
  650. },
  651. {
  652. name: "商品设置",
  653. path: "liveShopControl",
  654. component: () => import("@/views/liveClassManager/liveShopControl"),
  655. hidden: true,
  656. meta: {
  657. noCache: "1",
  658. title: "商品设置",
  659. belongTopMenu: "/business",
  660. activeMenu: "/liveClassManager"
  661. }
  662. },
  663. {
  664. name: "直播课详情",
  665. path: "liveClassDetail",
  666. component: () => import("@/views/liveClassManager/liveClassDetail"),
  667. hidden: true,
  668. meta: {
  669. noCache: "1",
  670. title: "直播课详情",
  671. belongTopMenu: "/business",
  672. activeMenu: "/liveClassManager"
  673. }
  674. },
  675. {
  676. name: "黑名单",
  677. path: "liveBlackList",
  678. component: () => import("@/views/liveClassManager/studentBlacklist"),
  679. hidden: true,
  680. meta: {
  681. noCache: "1",
  682. title: "黑名单",
  683. belongTopMenu: "/business",
  684. activeMenu: "/liveClassManager"
  685. }
  686. },
  687. {
  688. name: "直播学员",
  689. path: "liveStudentList",
  690. component: () => import("@/views/liveClassManager/addStudentList"),
  691. hidden: true,
  692. meta: {
  693. noCache: "1",
  694. title: "直播学员",
  695. belongTopMenu: "/business",
  696. activeMenu: "/liveClassManager"
  697. }
  698. },
  699. {
  700. name: "直播分享学员",
  701. path: "liveShareStudentList",
  702. component: () =>
  703. import("@/views/liveClassManager/liveClassTwo/components/addShareStudentList"),
  704. hidden: true,
  705. meta: {
  706. noCache: "1",
  707. title: "直播分享学员",
  708. belongTopMenu: "/business",
  709. activeMenu: "/liveClassManager"
  710. }
  711. },
  712. {
  713. name: "学员缴费设置",
  714. path: "studentPaySet",
  715. component: () =>
  716. import("@/views/resetTeaming/components/payInfoDetail"),
  717. hidden: true,
  718. meta: {
  719. noCache: "1",
  720. title: "学员缴费设置",
  721. belongTopMenu: "/business",
  722. activeMenu: "/teamList",
  723. id: "xx3"
  724. }
  725. },
  726. {
  727. name: "乐团详情",
  728. path: "resetTeaming",
  729. component: () => import("@/views/resetTeaming/index"),
  730. hidden: true,
  731. meta: {
  732. noCache: "1",
  733. title: "乐团详情",
  734. belongTopMenu: "/business",
  735. activeMenu: "/teamList",
  736. id: "3953"
  737. }
  738. },
  739. {
  740. name: "乐团档案",
  741. path: "musicArchices",
  742. component: () =>
  743. import("@/views/resetTeaming/components/musicArchices"),
  744. hidden: true,
  745. meta: {
  746. noCache: "1",
  747. title: "乐团档案",
  748. belongTopMenu: "/business",
  749. activeMenu: "/teamList",
  750. id: "xx4"
  751. }
  752. },
  753. //musicArchices
  754. {
  755. name: "会员排课列表",
  756. path: "memberClassList",
  757. component: () =>
  758. import("@/views/teamDetail/components/memberClassList"),
  759. hidden: true,
  760. meta: {
  761. noCache: "1",
  762. title: "会员排课列表",
  763. belongTopMenu: "/business",
  764. activeMenu: "/teamList",
  765. id: "xx28"
  766. }
  767. },
  768. {
  769. name: "相册详情",
  770. path: "photo-detail",
  771. component: () => import("@/views/photo-detail"),
  772. hidden: true,
  773. meta: {
  774. noCache: "1",
  775. title: "相册详情",
  776. belongTopMenu: "/business",
  777. activeMenu: "/teamList",
  778. id: "xxx28"
  779. }
  780. },
  781. // 相册详情
  782. {
  783. name: "全部证书",
  784. path: "performance",
  785. component: () => import("@/views/photo-detail"),
  786. hidden: true,
  787. meta: {
  788. noCache: "1",
  789. title: "全部证书",
  790. belongTopMenu: "/business",
  791. activeMenu: "/teamList",
  792. id: "xxx28"
  793. }
  794. },
  795. // 全部证书
  796. {
  797. name: "新建vip",
  798. path: "buildVip",
  799. component: () => import("@/views/buildVip/index"),
  800. hidden: true,
  801. meta: {
  802. noCache: "1",
  803. title: "VIP/小组课申请",
  804. belongTopMenu: "/business",
  805. activeMenu: "/vipManager/vipList",
  806. id: "xx5"
  807. }
  808. },
  809. {
  810. name: "网管课",
  811. path: "newPractice",
  812. component: () => import("@/views/buildVip/index"),
  813. hidden: true,
  814. meta: {
  815. noCache: "1",
  816. title: "网管课申请",
  817. belongTopMenu: "/business",
  818. activeMenu: "/accompanyManager/accompany",
  819. id: "xx5"
  820. }
  821. },
  822. {
  823. name: "vip修改",
  824. path: "vipReset",
  825. component: () => import("@/views/vipClass/vipReset"),
  826. hidden: true,
  827. meta: {
  828. noCache: "1",
  829. title: "VIP/小组课修改",
  830. belongTopMenu: "/business",
  831. activeMenu: "/vipManager/vipList",
  832. id: "xx6"
  833. }
  834. },
  835. {
  836. name: "vip详情",
  837. path: "vipDetail",
  838. component: () => import("@/views/vipClass/vipDetail"),
  839. hidden: true,
  840. meta: {
  841. noCache: "1",
  842. title: "vip详情",
  843. belongTopMenu: "/business",
  844. activeMenu: "/vipManager/vipList",
  845. id: "xx7"
  846. }
  847. },
  848. {
  849. name: "网管课详情",
  850. path: "accompanys",
  851. component: () => import("@/views/accompanyManager/accompanys"),
  852. hidden: true,
  853. meta: {
  854. noCache: "1",
  855. title: "网管课详情",
  856. belongTopMenu: "/business",
  857. activeMenu: "/accompanyManager/accompany",
  858. id: "xx8"
  859. }
  860. },
  861. {
  862. name: "评价详情",
  863. path: "evaluateDetail",
  864. component: () => import("@/views/evaluateManager/evaluateDetail"),
  865. hidden: true,
  866. meta: {
  867. noCache: "1",
  868. title: "评价详情",
  869. belongTopMenu: "/business",
  870. activeMenu: "/commentManager",
  871. id: "xx9"
  872. }
  873. },
  874. {
  875. name: "课外训练详情",
  876. path: "afterSchoolDetail",
  877. component: () =>
  878. import("@/views/afterSchoolManager/afterSchoolDetail"),
  879. hidden: true,
  880. meta: {
  881. noCache: "1",
  882. title: "VIP/小组课详情",
  883. belongTopMenu: "/business",
  884. activeMenu: "/afterSchoolManager",
  885. id: "xx10"
  886. }
  887. },
  888. {
  889. name: "学员详情",
  890. path: "studentDetail",
  891. component: () => import("@/views/studentManager/index"),
  892. hidden: true,
  893. meta: {
  894. noCache: "1",
  895. title: "学员详情",
  896. belongTopMenu: "/business",
  897. activeMenu: "/studentManager/studentList",
  898. id: "4083"
  899. }
  900. },
  901. {
  902. name: "老师详情",
  903. path: "teacherDetail",
  904. component: () => import("@/views/teacherManager/teacherDetail/index"),
  905. hidden: true,
  906. meta: {
  907. noCache: "1",
  908. title: "老师详情",
  909. belongTopMenu: "/business",
  910. activeMenu: "/teacherManager/teacherList",
  911. id: "4118"
  912. }
  913. },
  914. {
  915. name: "老师修改",
  916. path: "teacherOperation",
  917. component: () =>
  918. import("@/views/teacherManager/teacherOperation/index"),
  919. hidden: true,
  920. meta: {
  921. noCache: "1",
  922. title: "老师修改",
  923. belongTopMenu: "/business",
  924. activeMenu: "/teacherManager/teacherList",
  925. id: "4174"
  926. }
  927. },
  928. {
  929. name: "问答详情",
  930. path: "answer",
  931. component: () => import("@/views/reaplceMusicPlayer/answerList"),
  932. hidden: true,
  933. meta: {
  934. noCache: "1",
  935. title: "问答详情",
  936. belongTopMenu: "/business",
  937. activeMenu: "/otherManager/reaplceMusicPlayer",
  938. id: "4293"
  939. }
  940. },
  941. {
  942. name: "活动详情",
  943. path: "childrensdayDetail",
  944. component: () => import("@/views/childrensDay/detail"),
  945. hidden: true,
  946. meta: {
  947. noCache: "1",
  948. title: "活动详情",
  949. belongTopMenu: "/business",
  950. activeMenu: "/childrensDay"
  951. }
  952. }
  953. // /otherManager/reaplceMusicPlayer /reaplceMusicPlayer/answer
  954. ]);
  955. }
  956. if (route.path == "/operateManager") {
  957. route.children = route.children.concat([
  958. {
  959. name: "服务指标(详情)",
  960. path: "serverIndexDetail",
  961. component: () => import("@/views/operateManager/serverIndexDetail"),
  962. hidden: true,
  963. meta: {
  964. noCache: "1",
  965. title: "服务指标(详情)",
  966. belongTopMenu: "/operateManager",
  967. activeMenu: "/serverIndexManager/serverIndexList",
  968. id: "3513"
  969. }
  970. },
  971. {
  972. name: "新建活动方案",
  973. path: "vipNewActive",
  974. component: () => import("@/views/categroyManager/vipNewActive"),
  975. hidden: true,
  976. meta: {
  977. noCache: "1",
  978. title: "新建活动方案",
  979. belongTopMenu: "/operateManager",
  980. activeMenu: "/vipActiveManager/vipActiveList",
  981. id: "3558"
  982. }
  983. },
  984. {
  985. name: "活动资格管理",
  986. path: "activeSenior",
  987. component: () => import("@/views/categroyManager/activeSenior"),
  988. hidden: true,
  989. meta: {
  990. noCache: "1",
  991. title: "活动资格管理",
  992. belongTopMenu: "/operateManager",
  993. activeMenu: "/vipActiveManager/vipActiveList",
  994. id: "4610"
  995. }
  996. },
  997. // activeSenior
  998. {
  999. name: "添加阶梯奖励",
  1000. path: "branchActiveOperationAdd",
  1001. component: () =>
  1002. import("@/views/categroyManager/insideSetting/branchActiveOperation"),
  1003. hidden: true,
  1004. meta: {
  1005. noCache: "1",
  1006. title: "添加阶梯奖励",
  1007. belongTopMenu: "/operateManager",
  1008. activeMenu: "/operateManager/branchActiveManager/branchActive",
  1009. id: "3527"
  1010. }
  1011. },
  1012. {
  1013. name: "修改阶梯奖励",
  1014. path: "branchActiveOperation",
  1015. component: () =>
  1016. import("@/views/categroyManager/insideSetting/branchActiveOperation"),
  1017. hidden: true,
  1018. meta: {
  1019. noCache: "1",
  1020. title: "修改阶梯奖励",
  1021. belongTopMenu: "/operateManager",
  1022. activeMenu: "/operateManager/branchActiveManager/branchActive",
  1023. id: "3528"
  1024. }
  1025. },
  1026. {
  1027. name: "添加问卷",
  1028. path: "questionOperations",
  1029. component: () => import("@/views/setQuestions/operation"),
  1030. hidden: true,
  1031. meta: {
  1032. noCache: "1",
  1033. title: "添加问卷",
  1034. belongTopMenu: "/operateManager",
  1035. activeMenu: "/operateManager/setQuestions",
  1036. id: "4286"
  1037. }
  1038. },
  1039. {
  1040. name: "2021memeberActionManager",
  1041. path: "/2021memeberActionManager",
  1042. component: () => import("@/views/2021memeberActionManager"),
  1043. hidden: true,
  1044. meta: {
  1045. noCache: "1",
  1046. title: "2021会员活动",
  1047. belongTopMenu: "/operateManager",
  1048. activeMenu: "/activeMarketing",
  1049. id: "4550"
  1050. }
  1051. },
  1052. {
  1053. name: "memberActiveDetail",
  1054. path: "memberActiveDetail",
  1055. component: () =>
  1056. import("@/views/2021memeberActionManager/memberActiveDetail"),
  1057. hidden: true,
  1058. meta: {
  1059. noCache: "1",
  1060. title: "2021十一活动详情",
  1061. belongTopMenu: "/operateManager",
  1062. activeMenu: "/activeMarketing",
  1063. id: "4551"
  1064. }
  1065. },
  1066. {
  1067. name: "2021double11List",
  1068. path: "/2021double11List",
  1069. component: () =>
  1070. import("@/views/activityScheduling/2021double11List"),
  1071. hidden: true,
  1072. meta: {
  1073. noCache: "1",
  1074. title: "双十一活动",
  1075. belongTopMenu: "/operateManager",
  1076. activeMenu: "/activeMarketing",
  1077. id: "4594"
  1078. }
  1079. },
  1080. {
  1081. name: "2021doubleDetail",
  1082. path: "2021doubleDetail",
  1083. component: () =>
  1084. import("@/views/activityScheduling/2021doubleDetail"),
  1085. hidden: true,
  1086. meta: {
  1087. noCache: "1",
  1088. title: "双十一活动详情",
  1089. belongTopMenu: "/operateManager",
  1090. activeMenu: "/activeMarketing",
  1091. id: "4595"
  1092. }
  1093. },
  1094. {
  1095. name: "新增优惠券",
  1096. path: "couponUpdate",
  1097. component: () => import("@/views/couponManager/couponUpdate"),
  1098. hidden: true,
  1099. meta: {
  1100. noCache: "1",
  1101. title: "新增优惠券",
  1102. belongTopMenu: "/operateManager",
  1103. activeMenu: "/couponManager",
  1104. id: "4553"
  1105. }
  1106. },
  1107. {
  1108. name: "发放优惠券",
  1109. path: "couponGrant",
  1110. component: () => import("@/views/couponManager/couponGrant"),
  1111. hidden: true,
  1112. meta: {
  1113. noCache: "1",
  1114. title: "发放优惠券",
  1115. belongTopMenu: "/operateManager",
  1116. activeMenu: "/couponManager",
  1117. id: "xx19"
  1118. }
  1119. },
  1120. {
  1121. name: "答题详情",
  1122. path: "userAskList",
  1123. component: () => import("@/views/setQuestions/userAskList"),
  1124. hidden: true,
  1125. meta: {
  1126. noCache: "1",
  1127. title: "答题详情",
  1128. belongTopMenu: "/operateManager",
  1129. activeMenu: "/operateManager/setQuestions",
  1130. id: "xx19"
  1131. }
  1132. },
  1133. {
  1134. name: "训练营详情",
  1135. path: "aristCampDetail",
  1136. component: () => import("@/views/littleArtistCamp/aristCampDetail"),
  1137. hidden: true,
  1138. meta: {
  1139. noCache: "1",
  1140. title: "训练营详情",
  1141. belongTopMenu: "/operateManager",
  1142. activeMenu: "/littleArtistCamp",
  1143. id: "xx19"
  1144. }
  1145. },
  1146. {
  1147. name: "群聊详情",
  1148. path: "chatDetail",
  1149. component: () => import("@/views/groupChatManager/chatDetail"),
  1150. hidden: true,
  1151. meta: {
  1152. noCache: "1",
  1153. title: "群聊详情",
  1154. belongTopMenu: "/operateManager",
  1155. activeMenu: "/groupChatManager",
  1156. id: "xx19"
  1157. }
  1158. }
  1159. ]);
  1160. }
  1161. if (route.path == "/financialManager") {
  1162. route.children = route.children.concat([
  1163. {
  1164. name: "经营报表详情",
  1165. path: "businessStatementDetail",
  1166. component: () =>
  1167. import("@/views/businessManager/orderManager/businessStatementDetail"),
  1168. hidden: true,
  1169. meta: {
  1170. noCache: "1",
  1171. title: "经营报表详情",
  1172. belongTopMenu: "/financialManager",
  1173. activeMenu: "/businessStatement",
  1174. id: "4217"
  1175. }
  1176. },
  1177. {
  1178. name: "缴费项目列表",
  1179. path: "payschoolList",
  1180. component: () => import("@/views/branchPayManager/payschoolList"),
  1181. hidden: true,
  1182. meta: {
  1183. noCache: "1",
  1184. title: "缴费项目列表",
  1185. belongTopMenu: "/financialManager",
  1186. activeMenu: "/branchPayManager",
  1187. id: "4217"
  1188. }
  1189. }
  1190. ]);
  1191. }
  1192. if (route.path == "/contentManager") {
  1193. route.children = route.children.concat([
  1194. {
  1195. name: "帮助中心分类",
  1196. path: "helpCategory",
  1197. component: () => import("@/views/helpCenter/helpCategory"),
  1198. hidden: true,
  1199. meta: {
  1200. noCache: "1",
  1201. title: "帮助中心分类",
  1202. belongTopMenu: "/contentManager",
  1203. activeMenu: "/contentManager/helpContent",
  1204. id: "3596"
  1205. }
  1206. },
  1207. {
  1208. name: "添加&修改内容管理",
  1209. path: "contentOperation",
  1210. component: () => import("@/views/contentManager/contentOperation"),
  1211. hidden: true,
  1212. meta: {
  1213. noCache: "1",
  1214. title: "添加&修改内容管理",
  1215. belongTopMenu: "/contentManager",
  1216. activeMenu: "/contentManager/contentManager",
  1217. id: "xx22"
  1218. }
  1219. }
  1220. ]);
  1221. }
  1222. if (route.path == "/shopManager") {
  1223. route.children = route.children.concat([
  1224. {
  1225. name: "进货清单",
  1226. path: "purchaseLlist",
  1227. component: () =>
  1228. import("@/views/businessManager/shopManager/purchase-llist"),
  1229. hidden: true,
  1230. meta: {
  1231. noCache: "1",
  1232. title: "进货清单",
  1233. belongTopMenu: "/shopManager",
  1234. activeMenu: "/shopList",
  1235. id: "3618"
  1236. }
  1237. },
  1238. {
  1239. name: "添加修改商品",
  1240. path: "shopOperation",
  1241. component: () =>
  1242. import("@/views/businessManager/shopManager/shopOperation"),
  1243. hidden: true,
  1244. meta: {
  1245. noCache: "1",
  1246. title: "添加修改商品",
  1247. belongTopMenu: "/shopManager",
  1248. activeMenu: "/shopList",
  1249. id: "3617"
  1250. }
  1251. }
  1252. ]);
  1253. }
  1254. if (route.path == "/systemManager") {
  1255. route.children = route.children.concat([
  1256. {
  1257. name: "创建&修改汇付账号",
  1258. path: "adapayOperation",
  1259. component: () => import("@/views/adapayAccount/form"),
  1260. hidden: true,
  1261. meta: {
  1262. noCache: "1",
  1263. title: "创建&修改汇付账号",
  1264. belongTopMenu: "/systemManager",
  1265. activeMenu: "/sysBasics/adapayManager",
  1266. id: "3748"
  1267. }
  1268. },
  1269. {
  1270. name: "添加&查看时间充值活动",
  1271. path: "entryOperation",
  1272. component: () => import("@/views/app/entryOperation"),
  1273. hidden: true,
  1274. meta: {
  1275. noCache: "1",
  1276. title: "添加&查看时间充值活动",
  1277. belongTopMenu: "/systemManager",
  1278. activeMenu: "/sysBasics/entryActivities",
  1279. id: "3773"
  1280. }
  1281. },
  1282. {
  1283. name: "添加&修改系统权限",
  1284. path: "adminOperation",
  1285. component: () =>
  1286. import("@/views/categroyManager/insideSetting/adminOperation"),
  1287. hidden: true,
  1288. meta: {
  1289. noCache: "1",
  1290. title: "添加&修改系统权限",
  1291. belongTopMenu: "/systemManager",
  1292. activeMenu: "/adminManager",
  1293. id: "3993"
  1294. }
  1295. },
  1296. {
  1297. name: "扣费记录",
  1298. path: "chargingRecord",
  1299. component: () => import("@/views/tenantSetting/chargingRecord.vue"),
  1300. hidden: true,
  1301. meta: {
  1302. noCache: "1",
  1303. title: "扣费记录",
  1304. belongTopMenu: "/systemManager",
  1305. activeMenu: "/productService",
  1306. id: "4741"
  1307. }
  1308. }
  1309. // /parameter/adminManager adminOperation
  1310. ]);
  1311. }
  1312. if (route.path == "/platformManager") {
  1313. route.children = route.children.concat([
  1314. {
  1315. name: "添加&修改",
  1316. path: "serviceOperation",
  1317. component: () =>
  1318. import("@/views/platformManager/serviceManager/form"),
  1319. hidden: true,
  1320. meta: {
  1321. noCache: "1",
  1322. title: "添加&修改",
  1323. belongTopMenu: "/platformManager",
  1324. activeMenu: "/serviceManager/serviceList",
  1325. id: "4631"
  1326. }
  1327. },
  1328. {
  1329. name: "添加&修改",
  1330. path: "organOperation",
  1331. component: () => import("@/views/organManager/organOperation"),
  1332. hidden: true,
  1333. meta: {
  1334. noCache: "1",
  1335. title: "添加&修改",
  1336. belongTopMenu: "/platformManager",
  1337. activeMenu: "/organManager/organList",
  1338. id: "4652"
  1339. }
  1340. },
  1341. {
  1342. name: "平台角色设置",
  1343. path: "adminOperation",
  1344. component: () =>
  1345. import("@/views/platformManager/paltformAdmin/paltformOperation"),
  1346. hidden: true,
  1347. meta: {
  1348. noCache: "1",
  1349. title: "平台角色设置",
  1350. belongTopMenu: "/platformManager",
  1351. activeMenu: "/platformAdminManger",
  1352. id: "3993"
  1353. }
  1354. }
  1355. ]);
  1356. }
  1357. });
  1358. return accessedRoutes;
  1359. }
  1360. const actions = {
  1361. generateRoutes({ commit }) {
  1362. return new Promise(resolve => {
  1363. // 获取接口返回的权限菜单
  1364. getSilder().then(async res => {
  1365. if (res.code == 200) {
  1366. let result = addTopMenu(res.data);
  1367. if (res.data?.length < 1) {
  1368. // 一条权限都没有
  1369. //退出 跳到登录页 提示'该账号无任何权限'
  1370. // console.log(store.dispatch)
  1371. await store.dispatch("user/logout");
  1372. localStorage.removeItem("firstMenuUrl");
  1373. // await this.$store.dispatch("permission/removePermission")
  1374. Message.error("该用户无访问权限");
  1375. removeToken();
  1376. router.push(`/login`);
  1377. // window.location.reload();
  1378. }
  1379. let newData = recursionRouter(result);
  1380. newData = getFirstMenu(newData);
  1381. recursionPermission(res.data);
  1382. let accessedRoutes;
  1383. // 生成异步路由表
  1384. accessedRoutes = generateAsyncRouter(asyncRoutes, newData);
  1385. accessedRoutes = setDetailRoute(accessedRoutes);
  1386. // console.log('生成出来的异步路由', accessedRoutes)
  1387. // var result = accessedRoutes.concat({ path: '*', redirect: '/404', hidden: true })
  1388. commit("SET_ROUTES", accessedRoutes);
  1389. // commit('SET_PERMISSION', recursionPermission(res.data).flat(Infinity))
  1390. window.localStorage.removeItem("permission");
  1391. window.localStorage.setItem("permission", tempArr);
  1392. this.dispatch("app/setDotStatus");
  1393. this.dispatch("app/setServiceInfo"); // 获取机构信息,用于续费弹窗和个人信息
  1394. resolve(accessedRoutes);
  1395. }
  1396. });
  1397. });
  1398. },
  1399. removePermission({ commit }) {
  1400. window.localStorage.removeItem("permission");
  1401. commit("SET_PERMISSION", []);
  1402. }
  1403. };
  1404. export default {
  1405. namespaced: true,
  1406. state,
  1407. mutations,
  1408. actions
  1409. };