permission.js 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347
  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. {
  284. name: "exerciseDurationDetail",
  285. path: "/exerciseDurationDetail",
  286. component: () =>
  287. import("@/views/main/cloudDate/exerciseDurationDetail.vue"),
  288. hidden: true,
  289. meta: {
  290. noCache: "1",
  291. title: "练习时长详情",
  292. belongTopMenu: "/main",
  293. activeMenu: "/workbench"
  294. }
  295. }
  296. // /hasfreeCourse 排课时长消耗异常
  297. ]);
  298. }
  299. if (route.path == "/business") {
  300. // import('@/views/resetTeaming/components/strudentPayInfo'),
  301. route.children = route.children.concat([
  302. {
  303. name: "学员缴费详情",
  304. path: "strudentPayInfo",
  305. component: () =>
  306. import("@/views/resetTeaming/components/strudentPayInfo"),
  307. hidden: true,
  308. meta: {
  309. noCache: "1",
  310. title: "学员缴费详情",
  311. belongTopMenu: "/business",
  312. activeMenu: "/teamList",
  313. id: "xx3"
  314. }
  315. },
  316. {
  317. name: "缴费设置",
  318. path: "studentPaySet",
  319. component: () =>
  320. import("@/views/resetTeaming/components/payInfoDetail"),
  321. hidden: true,
  322. meta: {
  323. noCache: "1",
  324. title: "缴费设置",
  325. belongTopMenu: "/business",
  326. activeMenu: "/teamList",
  327. id: "xx3"
  328. }
  329. },
  330. {
  331. name: "乐团详情",
  332. path: "resetTeaming",
  333. component: () => import("@/views/resetTeaming/index"),
  334. hidden: true,
  335. meta: {
  336. noCache: "1",
  337. title: "乐团详情",
  338. belongTopMenu: "/business",
  339. activeMenu: "/teamList",
  340. id: "3953"
  341. }
  342. },
  343. {
  344. name: "乐团档案",
  345. path: "musicArchices",
  346. component: () =>
  347. import("@/views/resetTeaming/components/musicArchices"),
  348. hidden: true,
  349. meta: {
  350. noCache: "1",
  351. title: "乐团档案",
  352. belongTopMenu: "/business",
  353. activeMenu: "/teamList",
  354. id: "xx4"
  355. }
  356. },
  357. //musicArchices
  358. {
  359. name: "会员排课列表",
  360. path: "memberClassList",
  361. component: () =>
  362. import("@/views/teamDetail/components/memberClassList"),
  363. hidden: true,
  364. meta: {
  365. noCache: "1",
  366. title: "会员排课列表",
  367. belongTopMenu: "/business",
  368. activeMenu: "/teamList",
  369. id: "xx28"
  370. }
  371. },
  372. {
  373. name: "相册详情",
  374. path: "photo-detail",
  375. component: () => import("@/views/photo-detail"),
  376. hidden: true,
  377. meta: {
  378. noCache: "1",
  379. title: "相册详情",
  380. belongTopMenu: "/business",
  381. activeMenu: "/teamList",
  382. id: "xxx28"
  383. }
  384. },
  385. // 相册详情
  386. {
  387. name: "全部证书",
  388. path: "performance",
  389. component: () => import("@/views/photo-detail"),
  390. hidden: true,
  391. meta: {
  392. noCache: "1",
  393. title: "全部证书",
  394. belongTopMenu: "/business",
  395. activeMenu: "/teamList",
  396. id: "xxx28"
  397. }
  398. },
  399. // 全部证书
  400. {
  401. name: "新建vip",
  402. path: "buildVip",
  403. component: () => import("@/views/buildVip/index"),
  404. hidden: true,
  405. meta: {
  406. noCache: "1",
  407. title: "VIP/乐理课申请",
  408. belongTopMenu: "/business",
  409. activeMenu: "/vipManager/vipList",
  410. id: "xx5"
  411. }
  412. },
  413. {
  414. name: "网管课",
  415. path: "newPractice",
  416. component: () => import("@/views/buildVip/index"),
  417. hidden: true,
  418. meta: {
  419. noCache: "1",
  420. title: "网管课申请",
  421. belongTopMenu: "/business",
  422. activeMenu: "/accompanyManager/accompany",
  423. id: "xx5"
  424. }
  425. },
  426. {
  427. name: "vip修改",
  428. path: "vipReset",
  429. component: () => import("@/views/vipClass/vipReset"),
  430. hidden: true,
  431. meta: {
  432. noCache: "1",
  433. title: "VIP/乐理课修改",
  434. belongTopMenu: "/business",
  435. activeMenu: "/vipManager/vipList",
  436. id: "xx6"
  437. }
  438. },
  439. {
  440. name: "vip详情",
  441. path: "vipDetail",
  442. component: () => import("@/views/vipClass/vipDetail"),
  443. hidden: true,
  444. meta: {
  445. noCache: "1",
  446. title: "vip详情",
  447. belongTopMenu: "/business",
  448. activeMenu: "/vipManager/vipList",
  449. id: "xx7"
  450. }
  451. },
  452. {
  453. name: "网管课详情",
  454. path: "accompanys",
  455. component: () => import("@/views/accompanyManager/accompanys"),
  456. hidden: true,
  457. meta: {
  458. noCache: "1",
  459. title: "网管课详情",
  460. belongTopMenu: "/business",
  461. activeMenu: "/accompanyManager/accompany",
  462. id: "xx8"
  463. }
  464. },
  465. {
  466. name: "评价详情",
  467. path: "evaluateDetail",
  468. component: () => import("@/views/evaluateManager/evaluateDetail"),
  469. hidden: true,
  470. meta: {
  471. noCache: "1",
  472. title: "评价详情",
  473. belongTopMenu: "/business",
  474. activeMenu: "/commentManager",
  475. id: "xx9"
  476. }
  477. },
  478. {
  479. name: "课外训练详情",
  480. path: "afterSchoolDetail",
  481. component: () =>
  482. import("@/views/afterSchoolManager/afterSchoolDetail"),
  483. hidden: true,
  484. meta: {
  485. noCache: "1",
  486. title: "训练详情",
  487. belongTopMenu: "/business",
  488. activeMenu: "/afterSchoolManager",
  489. id: "xx10"
  490. }
  491. },
  492. {
  493. name: "课外训练详情",
  494. path: "afterSchoolDetailold",
  495. component: () =>
  496. import("@/views/afterSchoolManager/oldafterScDetail"),
  497. hidden: true,
  498. meta: {
  499. noCache: "1",
  500. title: "训练详情",
  501. belongTopMenu: "/business",
  502. activeMenu: "/afterSchoolManager",
  503. id: "xx10"
  504. }
  505. },
  506. {
  507. name: "学员详情",
  508. path: "studentDetail",
  509. component: () => import("@/views/studentManager/index"),
  510. hidden: true,
  511. meta: {
  512. noCache: "1",
  513. title: "学员详情",
  514. belongTopMenu: "/business",
  515. activeMenu: "/studentManager/studentList",
  516. id: "4083"
  517. }
  518. },
  519. {
  520. name: "老师详情",
  521. path: "teacherDetail",
  522. component: () => import("@/views/teacherManager/teacherDetail/index"),
  523. hidden: true,
  524. meta: {
  525. noCache: "1",
  526. title: "老师详情",
  527. belongTopMenu: "/business",
  528. activeMenu: "/teacherManager/teacherList",
  529. id: "4118"
  530. }
  531. },
  532. {
  533. name: "老师修改",
  534. path: "teacherOperation",
  535. component: () =>
  536. import("@/views/teacherManager/teacherOperation/index"),
  537. hidden: true,
  538. meta: {
  539. noCache: "1",
  540. title: "老师修改",
  541. belongTopMenu: "/business",
  542. activeMenu: "/teacherManager/teacherList",
  543. id: "4174"
  544. }
  545. },
  546. {
  547. name: "问答详情",
  548. path: "answer",
  549. component: () => import("@/views/reaplceMusicPlayer/answerList"),
  550. hidden: true,
  551. meta: {
  552. noCache: "1",
  553. title: "问答详情",
  554. belongTopMenu: "/business",
  555. activeMenu: "/otherManager/reaplceMusicPlayer",
  556. id: "4293"
  557. }
  558. },
  559. {
  560. name: "活动详情",
  561. path: "childrensdayDetail",
  562. component: () => import("@/views/childrensDay/detail"),
  563. hidden: true,
  564. meta: {
  565. noCache: "1",
  566. title: "活动详情",
  567. belongTopMenu: "/business",
  568. activeMenu: "/childrensDay"
  569. }
  570. },
  571. {
  572. name: "新建直播课",
  573. path: "createLiveClass",
  574. component: () => import("@/views/liveClassManager/newLiveClass"),
  575. hidden: true,
  576. meta: {
  577. noCache: "1",
  578. title: "新建直播课",
  579. belongTopMenu: "/business",
  580. activeMenu: "/liveClassManager"
  581. }
  582. },
  583. {
  584. name: "商品设置",
  585. path: "liveShopControl",
  586. component: () => import("@/views/liveClassManager/liveShopControl"),
  587. hidden: true,
  588. meta: {
  589. noCache: "1",
  590. title: "商品设置",
  591. belongTopMenu: "/business",
  592. activeMenu: "/liveClassManager"
  593. }
  594. },
  595. {
  596. name: "直播课详情",
  597. path: "liveClassDetail",
  598. component: () => import("@/views/liveClassManager/liveClassDetail"),
  599. hidden: true,
  600. meta: {
  601. noCache: "1",
  602. title: "直播课详情",
  603. belongTopMenu: "/business",
  604. activeMenu: "/liveClassManager"
  605. }
  606. },
  607. {
  608. name: "黑名单",
  609. path: "liveBlackList",
  610. component: () => import("@/views/liveClassManager/studentBlacklist"),
  611. hidden: true,
  612. meta: {
  613. noCache: "1",
  614. title: "黑名单",
  615. belongTopMenu: "/business",
  616. activeMenu: "/liveClassManager"
  617. }
  618. },
  619. {
  620. name: "直播学员",
  621. path: "liveStudentList",
  622. component: () => import("@/views/liveClassManager/addStudentList"),
  623. hidden: true,
  624. meta: {
  625. noCache: "1",
  626. title: "直播学员",
  627. belongTopMenu: "/business",
  628. activeMenu: "/liveClassManager"
  629. }
  630. },
  631. {
  632. name: "学员缴费设置",
  633. path: "studentPaySet",
  634. component: () =>
  635. import("@/views/resetTeaming/components/payInfoDetail"),
  636. hidden: true,
  637. meta: {
  638. noCache: "1",
  639. title: "学员缴费设置",
  640. belongTopMenu: "/business",
  641. activeMenu: "/teamList",
  642. id: "xx3"
  643. }
  644. },
  645. {
  646. name: "乐团详情",
  647. path: "resetTeaming",
  648. component: () => import("@/views/resetTeaming/index"),
  649. hidden: true,
  650. meta: {
  651. noCache: "1",
  652. title: "乐团详情",
  653. belongTopMenu: "/business",
  654. activeMenu: "/teamList",
  655. id: "3953"
  656. }
  657. },
  658. {
  659. name: "乐团档案",
  660. path: "musicArchices",
  661. component: () =>
  662. import("@/views/resetTeaming/components/musicArchices"),
  663. hidden: true,
  664. meta: {
  665. noCache: "1",
  666. title: "乐团档案",
  667. belongTopMenu: "/business",
  668. activeMenu: "/teamList",
  669. id: "xx4"
  670. }
  671. },
  672. //musicArchices
  673. {
  674. name: "会员排课列表",
  675. path: "memberClassList",
  676. component: () =>
  677. import("@/views/teamDetail/components/memberClassList"),
  678. hidden: true,
  679. meta: {
  680. noCache: "1",
  681. title: "会员排课列表",
  682. belongTopMenu: "/business",
  683. activeMenu: "/teamList",
  684. id: "xx28"
  685. }
  686. },
  687. {
  688. name: "相册详情",
  689. path: "photo-detail",
  690. component: () => import("@/views/photo-detail"),
  691. hidden: true,
  692. meta: {
  693. noCache: "1",
  694. title: "相册详情",
  695. belongTopMenu: "/business",
  696. activeMenu: "/teamList",
  697. id: "xxx28"
  698. }
  699. },
  700. // 相册详情
  701. {
  702. name: "全部证书",
  703. path: "performance",
  704. component: () => import("@/views/photo-detail"),
  705. hidden: true,
  706. meta: {
  707. noCache: "1",
  708. title: "全部证书",
  709. belongTopMenu: "/business",
  710. activeMenu: "/teamList",
  711. id: "xxx28"
  712. }
  713. },
  714. // 全部证书
  715. {
  716. name: "新建vip",
  717. path: "buildVip",
  718. component: () => import("@/views/buildVip/index"),
  719. hidden: true,
  720. meta: {
  721. noCache: "1",
  722. title: "VIP/乐理课申请",
  723. belongTopMenu: "/business",
  724. activeMenu: "/vipManager/vipList",
  725. id: "xx5"
  726. }
  727. },
  728. {
  729. name: "网管课",
  730. path: "newPractice",
  731. component: () => import("@/views/buildVip/index"),
  732. hidden: true,
  733. meta: {
  734. noCache: "1",
  735. title: "网管课申请",
  736. belongTopMenu: "/business",
  737. activeMenu: "/accompanyManager/accompany",
  738. id: "xx5"
  739. }
  740. },
  741. {
  742. name: "vip修改",
  743. path: "vipReset",
  744. component: () => import("@/views/vipClass/vipReset"),
  745. hidden: true,
  746. meta: {
  747. noCache: "1",
  748. title: "VIP/乐理课修改",
  749. belongTopMenu: "/business",
  750. activeMenu: "/vipManager/vipList",
  751. id: "xx6"
  752. }
  753. },
  754. {
  755. name: "vip详情",
  756. path: "vipDetail",
  757. component: () => import("@/views/vipClass/vipDetail"),
  758. hidden: true,
  759. meta: {
  760. noCache: "1",
  761. title: "vip详情",
  762. belongTopMenu: "/business",
  763. activeMenu: "/vipManager/vipList",
  764. id: "xx7"
  765. }
  766. },
  767. {
  768. name: "网管课详情",
  769. path: "accompanys",
  770. component: () => import("@/views/accompanyManager/accompanys"),
  771. hidden: true,
  772. meta: {
  773. noCache: "1",
  774. title: "网管课详情",
  775. belongTopMenu: "/business",
  776. activeMenu: "/accompanyManager/accompany",
  777. id: "xx8"
  778. }
  779. },
  780. {
  781. name: "评价详情",
  782. path: "evaluateDetail",
  783. component: () => import("@/views/evaluateManager/evaluateDetail"),
  784. hidden: true,
  785. meta: {
  786. noCache: "1",
  787. title: "评价详情",
  788. belongTopMenu: "/business",
  789. activeMenu: "/commentManager",
  790. id: "xx9"
  791. }
  792. },
  793. {
  794. name: "课外训练详情",
  795. path: "afterSchoolDetail",
  796. component: () =>
  797. import("@/views/afterSchoolManager/afterSchoolDetail"),
  798. hidden: true,
  799. meta: {
  800. noCache: "1",
  801. title: "VIP/乐理课详情",
  802. belongTopMenu: "/business",
  803. activeMenu: "/afterSchoolManager",
  804. id: "xx10"
  805. }
  806. },
  807. {
  808. name: "学员详情",
  809. path: "studentDetail",
  810. component: () => import("@/views/studentManager/index"),
  811. hidden: true,
  812. meta: {
  813. noCache: "1",
  814. title: "学员详情",
  815. belongTopMenu: "/business",
  816. activeMenu: "/studentManager/studentList",
  817. id: "4083"
  818. }
  819. },
  820. {
  821. name: "老师详情",
  822. path: "teacherDetail",
  823. component: () => import("@/views/teacherManager/teacherDetail/index"),
  824. hidden: true,
  825. meta: {
  826. noCache: "1",
  827. title: "老师详情",
  828. belongTopMenu: "/business",
  829. activeMenu: "/teacherManager/teacherList",
  830. id: "4118"
  831. }
  832. },
  833. {
  834. name: "老师修改",
  835. path: "teacherOperation",
  836. component: () =>
  837. import("@/views/teacherManager/teacherOperation/index"),
  838. hidden: true,
  839. meta: {
  840. noCache: "1",
  841. title: "老师修改",
  842. belongTopMenu: "/business",
  843. activeMenu: "/teacherManager/teacherList",
  844. id: "4174"
  845. }
  846. },
  847. {
  848. name: "问答详情",
  849. path: "answer",
  850. component: () => import("@/views/reaplceMusicPlayer/answerList"),
  851. hidden: true,
  852. meta: {
  853. noCache: "1",
  854. title: "问答详情",
  855. belongTopMenu: "/business",
  856. activeMenu: "/otherManager/reaplceMusicPlayer",
  857. id: "4293"
  858. }
  859. },
  860. {
  861. name: "活动详情",
  862. path: "childrensdayDetail",
  863. component: () => import("@/views/childrensDay/detail"),
  864. hidden: true,
  865. meta: {
  866. noCache: "1",
  867. title: "活动详情",
  868. belongTopMenu: "/business",
  869. activeMenu: "/childrensDay"
  870. }
  871. }
  872. // /otherManager/reaplceMusicPlayer /reaplceMusicPlayer/answer
  873. ]);
  874. }
  875. if (route.path == "/operateManager") {
  876. route.children = route.children.concat([
  877. {
  878. name: "服务指标(详情)",
  879. path: "serverIndexDetail",
  880. component: () => import("@/views/operateManager/serverIndexDetail"),
  881. hidden: true,
  882. meta: {
  883. noCache: "1",
  884. title: "服务指标(详情)",
  885. belongTopMenu: "/operateManager",
  886. activeMenu: "/serverIndexManager/serverIndexList",
  887. id: "3513"
  888. }
  889. },
  890. {
  891. name: "新建活动方案",
  892. path: "vipNewActive",
  893. component: () => import("@/views/categroyManager/vipNewActive"),
  894. hidden: true,
  895. meta: {
  896. noCache: "1",
  897. title: "新建活动方案",
  898. belongTopMenu: "/operateManager",
  899. activeMenu: "/vipActiveManager/vipActiveList",
  900. id: "3558"
  901. }
  902. },
  903. {
  904. name: "活动资格管理",
  905. path: "activeSenior",
  906. component: () => import("@/views/categroyManager/activeSenior"),
  907. hidden: true,
  908. meta: {
  909. noCache: "1",
  910. title: "活动资格管理",
  911. belongTopMenu: "/operateManager",
  912. activeMenu: "/vipActiveManager/vipActiveList",
  913. id: "4610"
  914. }
  915. },
  916. // activeSenior
  917. {
  918. name: "添加阶梯奖励",
  919. path: "branchActiveOperationAdd",
  920. component: () =>
  921. import("@/views/categroyManager/insideSetting/branchActiveOperation"),
  922. hidden: true,
  923. meta: {
  924. noCache: "1",
  925. title: "添加阶梯奖励",
  926. belongTopMenu: "/operateManager",
  927. activeMenu: "/operateManager/branchActiveManager/branchActive",
  928. id: "3527"
  929. }
  930. },
  931. {
  932. name: "修改阶梯奖励",
  933. path: "branchActiveOperation",
  934. component: () =>
  935. import("@/views/categroyManager/insideSetting/branchActiveOperation"),
  936. hidden: true,
  937. meta: {
  938. noCache: "1",
  939. title: "修改阶梯奖励",
  940. belongTopMenu: "/operateManager",
  941. activeMenu: "/operateManager/branchActiveManager/branchActive",
  942. id: "3528"
  943. }
  944. },
  945. {
  946. name: "添加问卷",
  947. path: "questionOperations",
  948. component: () => import("@/views/setQuestions/operation"),
  949. hidden: true,
  950. meta: {
  951. noCache: "1",
  952. title: "添加问卷",
  953. belongTopMenu: "/operateManager",
  954. activeMenu: "/operateManager/setQuestions",
  955. id: "4286"
  956. }
  957. },
  958. {
  959. name: "2021memeberActionManager",
  960. path: "/2021memeberActionManager",
  961. component: () => import("@/views/2021memeberActionManager"),
  962. hidden: true,
  963. meta: {
  964. noCache: "1",
  965. title: "2021会员活动",
  966. belongTopMenu: "/operateManager",
  967. activeMenu: "/activeMarketing",
  968. id: "4550"
  969. }
  970. },
  971. {
  972. name: "memberActiveDetail",
  973. path: "memberActiveDetail",
  974. component: () =>
  975. import("@/views/2021memeberActionManager/memberActiveDetail"),
  976. hidden: true,
  977. meta: {
  978. noCache: "1",
  979. title: "2021十一活动详情",
  980. belongTopMenu: "/operateManager",
  981. activeMenu: "/activeMarketing",
  982. id: "4551"
  983. }
  984. },
  985. {
  986. name: "2021double11List",
  987. path: "/2021double11List",
  988. component: () =>
  989. import("@/views/activityScheduling/2021double11List"),
  990. hidden: true,
  991. meta: {
  992. noCache: "1",
  993. title: "双十一活动",
  994. belongTopMenu: "/operateManager",
  995. activeMenu: "/activeMarketing",
  996. id: "4594"
  997. }
  998. },
  999. {
  1000. name: "2021doubleDetail",
  1001. path: "2021doubleDetail",
  1002. component: () =>
  1003. import("@/views/activityScheduling/2021doubleDetail"),
  1004. hidden: true,
  1005. meta: {
  1006. noCache: "1",
  1007. title: "双十一活动详情",
  1008. belongTopMenu: "/operateManager",
  1009. activeMenu: "/activeMarketing",
  1010. id: "4595"
  1011. }
  1012. },
  1013. {
  1014. name: "新增优惠券",
  1015. path: "couponUpdate",
  1016. component: () => import("@/views/couponManager/couponUpdate"),
  1017. hidden: true,
  1018. meta: {
  1019. noCache: "1",
  1020. title: "新增优惠券",
  1021. belongTopMenu: "/operateManager",
  1022. activeMenu: "/couponManager",
  1023. id: "4553"
  1024. }
  1025. },
  1026. {
  1027. name: "发放优惠券",
  1028. path: "couponGrant",
  1029. component: () => import("@/views/couponManager/couponGrant"),
  1030. hidden: true,
  1031. meta: {
  1032. noCache: "1",
  1033. title: "发放优惠券",
  1034. belongTopMenu: "/operateManager",
  1035. activeMenu: "/couponManager",
  1036. id: "xx19"
  1037. }
  1038. },
  1039. {
  1040. name: "答题详情",
  1041. path: "userAskList",
  1042. component: () => import("@/views/setQuestions/userAskList"),
  1043. hidden: true,
  1044. meta: {
  1045. noCache: "1",
  1046. title: "答题详情",
  1047. belongTopMenu: "/operateManager",
  1048. activeMenu: "/operateManager/setQuestions",
  1049. id: "xx19"
  1050. }
  1051. },
  1052. {
  1053. name: "训练营详情",
  1054. path: "aristCampDetail",
  1055. component: () => import("@/views/littleArtistCamp/aristCampDetail"),
  1056. hidden: true,
  1057. meta: {
  1058. noCache: "1",
  1059. title: "训练营详情",
  1060. belongTopMenu: "/operateManager",
  1061. activeMenu: "/littleArtistCamp",
  1062. id: "xx19"
  1063. }
  1064. },
  1065. {
  1066. name: "群聊详情",
  1067. path: "chatDetail",
  1068. component: () => import("@/views/groupChatManager/chatDetail"),
  1069. hidden: true,
  1070. meta: {
  1071. noCache: "1",
  1072. title: "群聊详情",
  1073. belongTopMenu: "/operateManager",
  1074. activeMenu: "/groupChatManager",
  1075. id: "xx19"
  1076. }
  1077. }
  1078. ]);
  1079. }
  1080. if (route.path == "/financialManager") {
  1081. route.children = route.children.concat([
  1082. {
  1083. name: "经营报表详情",
  1084. path: "businessStatementDetail",
  1085. component: () =>
  1086. import("@/views/businessManager/orderManager/businessStatementDetail"),
  1087. hidden: true,
  1088. meta: {
  1089. noCache: "1",
  1090. title: "经营报表详情",
  1091. belongTopMenu: "/financialManager",
  1092. activeMenu: "/businessStatement",
  1093. id: "4217"
  1094. }
  1095. },
  1096. {
  1097. name: "缴费项目列表",
  1098. path: "payschoolList",
  1099. component: () => import("@/views/branchPayManager/payschoolList"),
  1100. hidden: true,
  1101. meta: {
  1102. noCache: "1",
  1103. title: "缴费项目列表",
  1104. belongTopMenu: "/financialManager",
  1105. activeMenu: "/branchPayManager",
  1106. id: "4217"
  1107. }
  1108. }
  1109. ]);
  1110. }
  1111. if (route.path == "/contentManager") {
  1112. route.children = route.children.concat([
  1113. {
  1114. name: "帮助中心分类",
  1115. path: "helpCategory",
  1116. component: () => import("@/views/helpCenter/helpCategory"),
  1117. hidden: true,
  1118. meta: {
  1119. noCache: "1",
  1120. title: "帮助中心分类",
  1121. belongTopMenu: "/contentManager",
  1122. activeMenu: "/contentManager/helpContent",
  1123. id: "3596"
  1124. }
  1125. },
  1126. {
  1127. name: "添加&修改内容管理",
  1128. path: "contentOperation",
  1129. component: () => import("@/views/contentManager/contentOperation"),
  1130. hidden: true,
  1131. meta: {
  1132. noCache: "1",
  1133. title: "添加&修改内容管理",
  1134. belongTopMenu: "/contentManager",
  1135. activeMenu: "/contentManager/contentManager",
  1136. id: "xx22"
  1137. }
  1138. }
  1139. ]);
  1140. }
  1141. if (route.path == "/shopManager") {
  1142. route.children = route.children.concat([
  1143. {
  1144. name: "进货清单",
  1145. path: "purchaseLlist",
  1146. component: () =>
  1147. import("@/views/businessManager/shopManager/purchase-llist"),
  1148. hidden: true,
  1149. meta: {
  1150. noCache: "1",
  1151. title: "进货清单",
  1152. belongTopMenu: "/shopManager",
  1153. activeMenu: "/shopList",
  1154. id: "3618"
  1155. }
  1156. },
  1157. {
  1158. name: "添加修改商品",
  1159. path: "shopOperation",
  1160. component: () =>
  1161. import("@/views/businessManager/shopManager/shopOperation"),
  1162. hidden: true,
  1163. meta: {
  1164. noCache: "1",
  1165. title: "添加修改商品",
  1166. belongTopMenu: "/shopManager",
  1167. activeMenu: "/shopList",
  1168. id: "3617"
  1169. }
  1170. }
  1171. ]);
  1172. }
  1173. if (route.path == "/systemManager") {
  1174. route.children = route.children.concat([
  1175. {
  1176. name: "创建&修改汇付账号",
  1177. path: "adapayOperation",
  1178. component: () => import("@/views/adapayAccount/form"),
  1179. hidden: true,
  1180. meta: {
  1181. noCache: "1",
  1182. title: "创建&修改汇付账号",
  1183. belongTopMenu: "/systemManager",
  1184. activeMenu: "/sysBasics/adapayManager",
  1185. id: "3748"
  1186. }
  1187. },
  1188. {
  1189. name: "添加&查看时间充值活动",
  1190. path: "entryOperation",
  1191. component: () => import("@/views/app/entryOperation"),
  1192. hidden: true,
  1193. meta: {
  1194. noCache: "1",
  1195. title: "添加&查看时间充值活动",
  1196. belongTopMenu: "/systemManager",
  1197. activeMenu: "/sysBasics/entryActivities",
  1198. id: "3773"
  1199. }
  1200. },
  1201. {
  1202. name: "添加&修改系统权限",
  1203. path: "adminOperation",
  1204. component: () =>
  1205. import("@/views/categroyManager/insideSetting/adminOperation"),
  1206. hidden: true,
  1207. meta: {
  1208. noCache: "1",
  1209. title: "添加&修改系统权限",
  1210. belongTopMenu: "/systemManager",
  1211. activeMenu: "/adminManager",
  1212. id: "3993"
  1213. }
  1214. },
  1215. {
  1216. name: "扣费记录",
  1217. path: "chargingRecord",
  1218. component: () => import("@/views/tenantSetting/chargingRecord.vue"),
  1219. hidden: true,
  1220. meta: {
  1221. noCache: "1",
  1222. title: "扣费记录",
  1223. belongTopMenu: "/systemManager",
  1224. activeMenu: "/productService",
  1225. id: "4741"
  1226. }
  1227. }
  1228. // /parameter/adminManager adminOperation
  1229. ]);
  1230. }
  1231. if (route.path == "/platformManager") {
  1232. route.children = route.children.concat([
  1233. {
  1234. name: "添加&修改",
  1235. path: "serviceOperation",
  1236. component: () =>
  1237. import("@/views/platformManager/serviceManager/form"),
  1238. hidden: true,
  1239. meta: {
  1240. noCache: "1",
  1241. title: "添加&修改",
  1242. belongTopMenu: "/platformManager",
  1243. activeMenu: "/serviceManager/serviceList",
  1244. id: "4631"
  1245. }
  1246. },
  1247. {
  1248. name: "添加&修改",
  1249. path: "organOperation",
  1250. component: () => import("@/views/organManager/organOperation"),
  1251. hidden: true,
  1252. meta: {
  1253. noCache: "1",
  1254. title: "添加&修改",
  1255. belongTopMenu: "/platformManager",
  1256. activeMenu: "/organManager/organList",
  1257. id: "4652"
  1258. }
  1259. },
  1260. {
  1261. name: "平台角色设置",
  1262. path: "adminOperation",
  1263. component: () =>
  1264. import("@/views/platformManager/paltformAdmin/paltformOperation"),
  1265. hidden: true,
  1266. meta: {
  1267. noCache: "1",
  1268. title: "平台角色设置",
  1269. belongTopMenu: "/platformManager",
  1270. activeMenu: "/platformAdminManger",
  1271. id: "3993"
  1272. }
  1273. }
  1274. ]);
  1275. }
  1276. });
  1277. return accessedRoutes;
  1278. }
  1279. const actions = {
  1280. generateRoutes({ commit }) {
  1281. return new Promise(resolve => {
  1282. // 获取接口返回的权限菜单
  1283. getSilder().then(async res => {
  1284. if (res.code == 200) {
  1285. let result = addTopMenu(res.data);
  1286. if (res.data?.length < 1) {
  1287. // 一条权限都没有
  1288. //退出 跳到登录页 提示'该账号无任何权限'
  1289. // console.log(store.dispatch)
  1290. await store.dispatch("user/logout");
  1291. localStorage.removeItem("firstMenuUrl");
  1292. // await this.$store.dispatch("permission/removePermission")
  1293. Message.error("该用户无访问权限");
  1294. router.push(`/login`);
  1295. // window.location.reload();
  1296. }
  1297. let newData = recursionRouter(result);
  1298. newData = getFirstMenu(newData);
  1299. recursionPermission(res.data);
  1300. let accessedRoutes;
  1301. // 生成异步路由表
  1302. accessedRoutes = generateAsyncRouter(asyncRoutes, newData);
  1303. accessedRoutes = setDetailRoute(accessedRoutes);
  1304. // console.log('生成出来的异步路由', accessedRoutes)
  1305. // var result = accessedRoutes.concat({ path: '*', redirect: '/404', hidden: true })
  1306. commit("SET_ROUTES", accessedRoutes);
  1307. // commit('SET_PERMISSION', recursionPermission(res.data).flat(Infinity))
  1308. window.localStorage.removeItem("permission");
  1309. window.localStorage.setItem("permission", tempArr);
  1310. this.dispatch("app/setDotStatus");
  1311. this.dispatch("app/setServiceInfo"); // 获取机构信息,用于续费弹窗和个人信息
  1312. resolve(accessedRoutes);
  1313. }
  1314. });
  1315. });
  1316. },
  1317. removePermission({ commit }) {
  1318. window.localStorage.removeItem("permission");
  1319. commit("SET_PERMISSION", []);
  1320. }
  1321. };
  1322. export default {
  1323. namespaced: true,
  1324. state,
  1325. mutations,
  1326. actions
  1327. };