permission.js 38 KB

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