permission.js 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443
  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. name: "bandGuidanceTrainingDetail",
  1161. path: "/bandGuidanceTrainingDetail",
  1162. component: () =>
  1163. import("@/views/band-guidance-training/detail"),
  1164. hidden: true,
  1165. meta: {
  1166. noCache: "1",
  1167. title: "乐队指导练习营详情",
  1168. belongTopMenu: "/operateManager",
  1169. activeMenu: "/bandGuidanceTraining",
  1170. id: "5269"
  1171. }
  1172. },
  1173. ]);
  1174. }
  1175. if (route.path == "/financialManager") {
  1176. route.children = route.children.concat([
  1177. {
  1178. name: "经营报表详情",
  1179. path: "businessStatementDetail",
  1180. component: () =>
  1181. import("@/views/businessManager/orderManager/businessStatementDetail"),
  1182. hidden: true,
  1183. meta: {
  1184. noCache: "1",
  1185. title: "经营报表详情",
  1186. belongTopMenu: "/financialManager",
  1187. activeMenu: "/businessStatement",
  1188. id: "4217"
  1189. }
  1190. },
  1191. {
  1192. name: "缴费项目列表",
  1193. path: "payschoolList",
  1194. component: () => import("@/views/branchPayManager/payschoolList"),
  1195. hidden: true,
  1196. meta: {
  1197. noCache: "1",
  1198. title: "缴费项目列表",
  1199. belongTopMenu: "/financialManager",
  1200. activeMenu: "/branchPayManager",
  1201. id: "4217"
  1202. }
  1203. }
  1204. ]);
  1205. }
  1206. if (route.path == "/contentManager") {
  1207. route.children = route.children.concat([
  1208. {
  1209. name: "帮助中心分类",
  1210. path: "helpCategory",
  1211. component: () => import("@/views/helpCenter/helpCategory"),
  1212. hidden: true,
  1213. meta: {
  1214. noCache: "1",
  1215. title: "帮助中心分类",
  1216. belongTopMenu: "/contentManager",
  1217. activeMenu: "/contentManager/helpContent",
  1218. id: "3596"
  1219. }
  1220. },
  1221. {
  1222. name: "添加&修改内容管理",
  1223. path: "contentOperation",
  1224. component: () => import("@/views/contentManager/contentOperation"),
  1225. hidden: true,
  1226. meta: {
  1227. noCache: "1",
  1228. title: "添加&修改内容管理",
  1229. belongTopMenu: "/contentManager",
  1230. activeMenu: "/contentManager/contentManager",
  1231. id: "xx22"
  1232. }
  1233. }
  1234. ]);
  1235. }
  1236. if (route.path == "/shopManager") {
  1237. route.children = route.children.concat([
  1238. {
  1239. name: "进货清单",
  1240. path: "purchaseLlist",
  1241. component: () =>
  1242. import("@/views/businessManager/shopManager/purchase-llist"),
  1243. hidden: true,
  1244. meta: {
  1245. noCache: "1",
  1246. title: "进货清单",
  1247. belongTopMenu: "/shopManager",
  1248. activeMenu: "/shopList",
  1249. id: "3618"
  1250. }
  1251. },
  1252. {
  1253. name: "添加修改商品",
  1254. path: "shopOperation",
  1255. component: () =>
  1256. import("@/views/businessManager/shopManager/shopOperation"),
  1257. hidden: true,
  1258. meta: {
  1259. noCache: "1",
  1260. title: "添加修改商品",
  1261. belongTopMenu: "/shopManager",
  1262. activeMenu: "/shopList",
  1263. id: "3617"
  1264. }
  1265. }
  1266. ]);
  1267. }
  1268. if (route.path == "/systemManager") {
  1269. route.children = route.children.concat([
  1270. {
  1271. name: "创建&修改汇付账号",
  1272. path: "adapayOperation",
  1273. component: () => import("@/views/adapayAccount/form"),
  1274. hidden: true,
  1275. meta: {
  1276. noCache: "1",
  1277. title: "创建&修改汇付账号",
  1278. belongTopMenu: "/systemManager",
  1279. activeMenu: "/sysBasics/adapayManager",
  1280. id: "3748"
  1281. }
  1282. },
  1283. {
  1284. name: "添加&查看时间充值活动",
  1285. path: "entryOperation",
  1286. component: () => import("@/views/app/entryOperation"),
  1287. hidden: true,
  1288. meta: {
  1289. noCache: "1",
  1290. title: "添加&查看时间充值活动",
  1291. belongTopMenu: "/systemManager",
  1292. activeMenu: "/sysBasics/entryActivities",
  1293. id: "3773"
  1294. }
  1295. },
  1296. {
  1297. name: "添加&修改系统权限",
  1298. path: "adminOperation",
  1299. component: () =>
  1300. import("@/views/categroyManager/insideSetting/adminOperation"),
  1301. hidden: true,
  1302. meta: {
  1303. noCache: "1",
  1304. title: "添加&修改系统权限",
  1305. belongTopMenu: "/systemManager",
  1306. activeMenu: "/adminManager",
  1307. id: "3993"
  1308. }
  1309. },
  1310. {
  1311. name: "扣费记录",
  1312. path: "chargingRecord",
  1313. component: () => import("@/views/tenantSetting/chargingRecord.vue"),
  1314. hidden: true,
  1315. meta: {
  1316. noCache: "1",
  1317. title: "扣费记录",
  1318. belongTopMenu: "/systemManager",
  1319. activeMenu: "/productService",
  1320. id: "4741"
  1321. }
  1322. }
  1323. // /parameter/adminManager adminOperation
  1324. ]);
  1325. }
  1326. if (route.path == "/platformManager") {
  1327. route.children = route.children.concat([
  1328. {
  1329. name: "添加&修改",
  1330. path: "serviceOperation",
  1331. component: () =>
  1332. import("@/views/platformManager/serviceManager/form"),
  1333. hidden: true,
  1334. meta: {
  1335. noCache: "1",
  1336. title: "添加&修改",
  1337. belongTopMenu: "/platformManager",
  1338. activeMenu: "/serviceManager/serviceList",
  1339. id: "4631"
  1340. }
  1341. },
  1342. {
  1343. name: "添加&修改",
  1344. path: "organOperation",
  1345. component: () => import("@/views/organManager/organOperation"),
  1346. hidden: true,
  1347. meta: {
  1348. noCache: "1",
  1349. title: "添加&修改",
  1350. belongTopMenu: "/platformManager",
  1351. activeMenu: "/organManager/organList",
  1352. id: "4652"
  1353. }
  1354. },
  1355. {
  1356. name: "平台角色设置",
  1357. path: "adminOperation",
  1358. component: () =>
  1359. import("@/views/platformManager/paltformAdmin/paltformOperation"),
  1360. hidden: true,
  1361. meta: {
  1362. noCache: "1",
  1363. title: "平台角色设置",
  1364. belongTopMenu: "/platformManager",
  1365. activeMenu: "/platformAdminManger",
  1366. id: "3993"
  1367. }
  1368. }
  1369. ]);
  1370. }
  1371. });
  1372. return accessedRoutes;
  1373. }
  1374. const actions = {
  1375. generateRoutes({ commit }) {
  1376. return new Promise(resolve => {
  1377. // 获取接口返回的权限菜单
  1378. getSilder().then(async res => {
  1379. if (res.code == 200) {
  1380. let result = addTopMenu(res.data);
  1381. if (res.data?.length < 1) {
  1382. // 一条权限都没有
  1383. //退出 跳到登录页 提示'该账号无任何权限'
  1384. // console.log(store.dispatch)
  1385. await store.dispatch("user/logout");
  1386. localStorage.removeItem("firstMenuUrl");
  1387. // await this.$store.dispatch("permission/removePermission")
  1388. Message.error("该用户无访问权限");
  1389. removeToken();
  1390. router.push(`/login`);
  1391. // window.location.reload();
  1392. }
  1393. let newData = recursionRouter(result);
  1394. newData = getFirstMenu(newData);
  1395. recursionPermission(res.data);
  1396. let accessedRoutes;
  1397. // 生成异步路由表
  1398. accessedRoutes = generateAsyncRouter(asyncRoutes, newData);
  1399. accessedRoutes = setDetailRoute(accessedRoutes);
  1400. // console.log('生成出来的异步路由', accessedRoutes)
  1401. // var result = accessedRoutes.concat({ path: '*', redirect: '/404', hidden: true })
  1402. commit("SET_ROUTES", accessedRoutes);
  1403. // commit('SET_PERMISSION', recursionPermission(res.data).flat(Infinity))
  1404. window.localStorage.removeItem("permission");
  1405. window.localStorage.setItem("permission", tempArr);
  1406. this.dispatch("app/setDotStatus");
  1407. this.dispatch("app/setServiceInfo"); // 获取机构信息,用于续费弹窗和个人信息
  1408. resolve(accessedRoutes);
  1409. }
  1410. });
  1411. });
  1412. },
  1413. removePermission({ commit }) {
  1414. window.localStorage.removeItem("permission");
  1415. commit("SET_PERMISSION", []);
  1416. }
  1417. };
  1418. export default {
  1419. namespaced: true,
  1420. state,
  1421. mutations,
  1422. actions
  1423. };