remaining.ts 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. import { Layout } from '@/utils/routerHelper'
  2. import UserAchievement from '@/views/system/workroomTeacher/userAchievement/index.vue'
  3. import UserAchievementcopy from '@/views/system/workroomCollege/userAchievement/index.vue'
  4. import deptInfo from '@/views/system/workroomCollege/deptInfo/index.vue'
  5. import * as LoginApi from '@/api/login'
  6. import supervisorSelectionSetting from "@/views/system/supervisorSelectionSetting/index.vue";
  7. import studentSelectSupervisorRecord from "@/views/system/studentSelectSupervisorRecord/index.vue";
  8. import studentForm from "@/views/system/userDetail/student.vue";
  9. const { t } = useI18n()
  10. /**
  11. * redirect: noredirect 当设置 noredirect 的时候该路由在面包屑导航中不可被点击
  12. * name:'router-name' 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
  13. * meta : {
  14. hidden: true 当设置 true 的时候该路由不会再侧边栏出现 如404,login等页面(默认 false)
  15. alwaysShow: true 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式,
  16. 只有一个时,会将那个子路由当做根路由显示在侧边栏,
  17. 若你想不管路由下面的 children 声明的个数都显示你的根路由,
  18. 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,
  19. 一直显示根路由(默认 false)
  20. title: 'title' 设置该路由在侧边栏和面包屑中展示的名字
  21. icon: 'svg-name' 设置该路由的图标
  22. noCache: true 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
  23. breadcrumb: false 如果设置为false,则不会在breadcrumb面包屑中显示(默认 true)
  24. affix: true 如果设置为true,则会一直固定在tag项中(默认 false)
  25. noTagsView: true 如果设置为true,则不会出现在tag中(默认 false)
  26. activeMenu: '/dashboard' 显示高亮的路由路径
  27. followAuth: '/dashboard' 跟随哪个路由进行权限过滤
  28. canTo: true 设置为true即使hidden为true,也依然可以进行路由跳转(默认 false)
  29. }
  30. **/
  31. // async function getUserType() {
  32. // const userType = await LoginApi.getInfo(); // 假设你有 LoginApi.getInfo() 方法获取用户信息
  33. // console.log(userType,'getUserType');
  34. // return userType.roles; // 假设返回的角色是一个数组
  35. // }
  36. const remainingRouter: AppRouteRecordRaw[] = [
  37. {
  38. path: '/system',
  39. component: Layout,
  40. name: 'System',
  41. meta: {
  42. // title: t('router.system'),
  43. icon: 'ep:setting',
  44. noCache: false,
  45. affix: false,
  46. breadcrumb: false,
  47. noTagsView: false,
  48. hidden: true
  49. },
  50. children: [
  51. {
  52. path: 'userDetail/student',
  53. component: studentForm,
  54. name: 'studentForm',
  55. meta: {
  56. title: '互选信息填写',
  57. icon: 'ep:user-filled',
  58. noCache: false,
  59. affix: false,
  60. breadcrumb: false,
  61. noTagsView: false,
  62. hidden: true
  63. }
  64. },
  65. {
  66. path: 'studentSelectSupervisorRecord/index',
  67. component: studentSelectSupervisorRecord,
  68. name: 'studentSelectSupervisorRecord',
  69. meta: {
  70. title: '师生互选记录',
  71. icon: 'ep:user-filled',
  72. noCache: false,
  73. affix: false,
  74. breadcrumb: false,
  75. noTagsView: false,
  76. hidden: true
  77. }
  78. },
  79. {
  80. path: 'supervisorSelectionSetting/index',
  81. component: supervisorSelectionSetting,
  82. name: 'supervisorSelectionSetting',
  83. meta: {
  84. title: '导师招生情况',
  85. icon: 'ep:user-filled',
  86. noCache: false,
  87. affix: false,
  88. breadcrumb: false,
  89. noTagsView: false,
  90. hidden: true
  91. }
  92. },
  93. {
  94. path: 'user-achievement',
  95. component: UserAchievement,
  96. name: 'UserAchievement',
  97. meta: {
  98. title: '成果信息',
  99. icon: 'ep:user-filled',
  100. noCache: false,
  101. affix: false,
  102. breadcrumb: false,
  103. noTagsView: false,
  104. hidden: true
  105. }
  106. },
  107. {
  108. path: 'user-achievementcopy',
  109. component: UserAchievementcopy,
  110. name: 'UserAchievementcopy',
  111. meta: {
  112. title: '成果信息',
  113. icon: 'ep:user-filled',
  114. noCache: false,
  115. affix: false,
  116. breadcrumb: false,
  117. noTagsView: false,
  118. hidden: true
  119. }
  120. },
  121. {
  122. path: 'dept-info',
  123. component: deptInfo,
  124. name: 'DeptInfo',
  125. meta: {
  126. title: '工作间信息',
  127. icon: 'ep:dept',
  128. noCache: false,
  129. affix: false,
  130. breadcrumb: false,
  131. noTagsView: false,
  132. hidden: true
  133. }
  134. },
  135. {
  136. path: '/system/Home/index',
  137. name: 'SystemHome',
  138. component: () => import('@/views/system/Home/Index.vue'),
  139. meta: {
  140. icon: 'ep:apple',
  141. title: '首页',
  142. }
  143. }
  144. ]
  145. },
  146. {
  147. path: '/redirect',
  148. component: Layout,
  149. name: 'Redirect',
  150. children: [
  151. {
  152. path: '/redirect/:path(.*)',
  153. name: 'RedirectDetail',
  154. component: () => import('@/views/Redirect/Redirect.vue'),
  155. meta: {}
  156. }
  157. ],
  158. meta: {
  159. hidden: true,
  160. noTagsView: true
  161. }
  162. },
  163. // {
  164. // path: '/system/Home',
  165. // component: Layout,
  166. // name: 'SystemHome',
  167. // meta: {
  168. // title: '工作台',
  169. // icon: 'ep:bell',
  170. // noCache: false,
  171. // affix: false,
  172. // breadcrumb: true,
  173. // noTagsView: true,
  174. // hidden: false
  175. // },
  176. // children: [
  177. // {
  178. // path: 'index',
  179. // component: () => import('@/views/system/Home/Index.vue'),
  180. // name: 'Index',
  181. // meta: {
  182. // title: t('router.home'),
  183. // icon: 'ep:home-filled',
  184. // noCache: false,
  185. // affix: true
  186. // }
  187. // },
  188. // // {
  189. // // path: 'index2',
  190. // // component: () => import('@/views/Home/Index2.vue'),
  191. // // name: 'Index2',
  192. // // meta: {
  193. // // title: '个人中心',
  194. // // icon: 'ep:user',
  195. // // noCache: false,
  196. // // affix: true
  197. // // }
  198. // // },
  199. // ]
  200. // },
  201. // {
  202. // path: '/',
  203. // component: Layout,
  204. // redirect: '/index',
  205. // name: 'Home',
  206. // meta: {},
  207. // children: [
  208. // {
  209. // path: 'index',
  210. // component: () => import('@/views/Home/Index.vue'),
  211. // name: 'Index',
  212. // meta: {
  213. // title: t('router.home'),
  214. // icon: 'ep:home-filled',
  215. // noCache: false,
  216. // affix: true
  217. // }
  218. // }
  219. // ]
  220. // },
  221. {
  222. path: '/user',
  223. component: Layout,
  224. name: 'UserInfo',
  225. meta: {
  226. hidden: true
  227. },
  228. children: [
  229. {
  230. path: '/',
  231. component: () => import('@/views/Profile/Index.vue'),
  232. name: 'Profile',
  233. meta: {
  234. canTo: true,
  235. hidden: true,
  236. noTagsView: false,
  237. icon: 'ep:user',
  238. title: t('common.profile')
  239. }
  240. },
  241. {
  242. path: 'notify-message',
  243. component: () => import('@/views/system/notify/my/index.vue'),
  244. name: 'MyNotifyMessage',
  245. meta: {
  246. canTo: true,
  247. hidden: true,
  248. noTagsView: false,
  249. icon: 'ep:message',
  250. title: '我的站内信'
  251. }
  252. }
  253. ]
  254. },
  255. {
  256. path: '/dict',
  257. component: Layout,
  258. name: 'dict',
  259. meta: {
  260. hidden: true
  261. },
  262. children: [
  263. {
  264. path: 'type/data/:dictType',
  265. component: () => import('@/views/system/dict/data/index.vue'),
  266. name: 'SystemDictData',
  267. meta: {
  268. title: '字典数据',
  269. noCache: true,
  270. hidden: true,
  271. canTo: true,
  272. icon: '',
  273. activeMenu: '/system/dict'
  274. }
  275. }
  276. ]
  277. },
  278. {
  279. path: '/codegen',
  280. component: Layout,
  281. name: 'CodegenEdit',
  282. meta: {
  283. hidden: true
  284. },
  285. children: [
  286. {
  287. path: 'edit',
  288. component: () => import('@/views/infra/codegen/EditTable.vue'),
  289. name: 'InfraCodegenEditTable',
  290. meta: {
  291. noCache: true,
  292. hidden: true,
  293. canTo: true,
  294. icon: 'ep:edit',
  295. title: '修改生成配置',
  296. activeMenu: 'infra/codegen/index'
  297. }
  298. }
  299. ]
  300. },
  301. {
  302. path: '/job',
  303. component: Layout,
  304. name: 'JobL',
  305. meta: {
  306. hidden: true
  307. },
  308. children: [
  309. {
  310. path: 'job-log',
  311. component: () => import('@/views/infra/job/logger/index.vue'),
  312. name: 'InfraJobLog',
  313. meta: {
  314. noCache: true,
  315. hidden: true,
  316. canTo: true,
  317. icon: 'ep:edit',
  318. title: '调度日志',
  319. activeMenu: 'infra/job/index'
  320. }
  321. }
  322. ]
  323. },
  324. {
  325. path: '/login',
  326. component: () => import('@/views/Login/Login.vue'),
  327. name: 'Login',
  328. meta: {
  329. hidden: true,
  330. title: t('router.login'),
  331. noTagsView: true
  332. }
  333. },
  334. {
  335. path: '/sso',
  336. component: () => import('@/views/Login/Login.vue'),
  337. name: 'SSOLogin',
  338. meta: {
  339. hidden: true,
  340. title: t('router.login'),
  341. noTagsView: true
  342. }
  343. },
  344. {
  345. path: '/social-login',
  346. component: () => import('@/views/Login/SocialLogin.vue'),
  347. name: 'SocialLogin',
  348. meta: {
  349. hidden: true,
  350. title: t('router.socialLogin'),
  351. noTagsView: true
  352. }
  353. },
  354. {
  355. path: '/403',
  356. component: () => import('@/views/Error/403.vue'),
  357. name: 'NoAccess',
  358. meta: {
  359. hidden: true,
  360. title: '403',
  361. noTagsView: true
  362. }
  363. },
  364. {
  365. path: '/404',
  366. component: () => import('@/views/Error/404.vue'),
  367. name: 'NoFound',
  368. meta: {
  369. hidden: true,
  370. title: '404',
  371. noTagsView: true
  372. }
  373. },
  374. {
  375. path: '/500',
  376. component: () => import('@/views/Error/500.vue'),
  377. name: 'Error',
  378. meta: {
  379. hidden: true,
  380. title: '500',
  381. noTagsView: true
  382. }
  383. },
  384. {
  385. path: '/bpm',
  386. component: Layout,
  387. name: 'bpm',
  388. meta: {
  389. hidden: true
  390. },
  391. children: [
  392. {
  393. path: 'manager/form/edit',
  394. component: () => import('@/views/bpm/form/editor/index.vue'),
  395. name: 'BpmFormEditor',
  396. meta: {
  397. noCache: true,
  398. hidden: true,
  399. canTo: true,
  400. title: '设计流程表单',
  401. activeMenu: '/bpm/manager/form'
  402. }
  403. },
  404. {
  405. path: 'manager/model/edit',
  406. component: () => import('@/views/bpm/model/editor/index.vue'),
  407. name: 'BpmModelEditor',
  408. meta: {
  409. noCache: true,
  410. hidden: true,
  411. canTo: true,
  412. title: '设计流程',
  413. activeMenu: '/bpm/manager/model'
  414. }
  415. },
  416. {
  417. path: 'manager/simple/workflow/model/edit',
  418. component: () => import('@/views/bpm/simpleWorkflow/index.vue'),
  419. name: 'SimpleWorkflowDesignEditor',
  420. meta: {
  421. noCache: true,
  422. hidden: true,
  423. canTo: true,
  424. title: '仿钉钉设计流程',
  425. activeMenu: '/bpm/manager/model'
  426. }
  427. },
  428. {
  429. path: 'manager/definition',
  430. component: () => import('@/views/bpm/definition/index.vue'),
  431. name: 'BpmProcessDefinition',
  432. meta: {
  433. noCache: true,
  434. hidden: true,
  435. canTo: true,
  436. title: '流程定义',
  437. activeMenu: '/bpm/manager/model'
  438. }
  439. },
  440. {
  441. path: 'process-instance/detail',
  442. component: () => import('@/views/bpm/processInstance/detail/index.vue'),
  443. name: 'BpmProcessInstanceDetail',
  444. meta: {
  445. noCache: true,
  446. hidden: true,
  447. canTo: true,
  448. title: '流程详情',
  449. activeMenu: '/bpm/task/my'
  450. }
  451. },
  452. {
  453. path: 'oa/leave/create',
  454. component: () => import('@/views/bpm/oa/leave/create.vue'),
  455. name: 'OALeaveCreate',
  456. meta: {
  457. noCache: true,
  458. hidden: true,
  459. canTo: true,
  460. title: '发起 OA 请假',
  461. activeMenu: '/bpm/oa/leave'
  462. }
  463. },
  464. {
  465. path: 'oa/leave/detail',
  466. component: () => import('@/views/bpm/oa/leave/detail.vue'),
  467. name: 'OALeaveDetail',
  468. meta: {
  469. noCache: true,
  470. hidden: true,
  471. canTo: true,
  472. title: '查看 OA 请假',
  473. activeMenu: '/bpm/oa/leave'
  474. }
  475. }
  476. ]
  477. },
  478. {
  479. path: '/mall/product', // 商品中心
  480. component: Layout,
  481. name: 'ProductCenter',
  482. meta: {
  483. hidden: true
  484. },
  485. children: [
  486. {
  487. path: 'spu/add',
  488. component: () => import('@/views/mall/product/spu/form/index.vue'),
  489. name: 'ProductSpuAdd',
  490. meta: {
  491. noCache: false, // 需要缓存
  492. hidden: true,
  493. canTo: true,
  494. icon: 'ep:edit',
  495. title: '商品添加',
  496. activeMenu: '/mall/product/spu'
  497. }
  498. },
  499. {
  500. path: 'spu/edit/:id(\\d+)',
  501. component: () => import('@/views/mall/product/spu/form/index.vue'),
  502. name: 'ProductSpuEdit',
  503. meta: {
  504. noCache: true,
  505. hidden: true,
  506. canTo: true,
  507. icon: 'ep:edit',
  508. title: '商品编辑',
  509. activeMenu: '/mall/product/spu'
  510. }
  511. },
  512. {
  513. path: 'spu/detail/:id(\\d+)',
  514. component: () => import('@/views/mall/product/spu/form/index.vue'),
  515. name: 'ProductSpuDetail',
  516. meta: {
  517. noCache: true,
  518. hidden: true,
  519. canTo: true,
  520. icon: 'ep:view',
  521. title: '商品详情',
  522. activeMenu: '/mall/product/spu'
  523. }
  524. },
  525. {
  526. path: 'property/value/:propertyId(\\d+)',
  527. component: () => import('@/views/mall/product/property/value/index.vue'),
  528. name: 'ProductPropertyValue',
  529. meta: {
  530. noCache: true,
  531. hidden: true,
  532. canTo: true,
  533. icon: 'ep:view',
  534. title: '商品属性值',
  535. activeMenu: '/product/property'
  536. }
  537. }
  538. ]
  539. },
  540. {
  541. path: '/mall/trade', // 交易中心
  542. component: Layout,
  543. name: 'TradeCenter',
  544. meta: {
  545. hidden: true
  546. },
  547. children: [
  548. {
  549. path: 'order/detail/:id(\\d+)',
  550. component: () => import('@/views/mall/trade/order/detail/index.vue'),
  551. name: 'TradeOrderDetail',
  552. meta: { title: '订单详情', icon: 'ep:view', activeMenu: '/mall/trade/order' }
  553. },
  554. {
  555. path: 'after-sale/detail/:id(\\d+)',
  556. component: () => import('@/views/mall/trade/afterSale/detail/index.vue'),
  557. name: 'TradeAfterSaleDetail',
  558. meta: { title: '退款详情', icon: 'ep:view', activeMenu: '/mall/trade/after-sale' }
  559. }
  560. ]
  561. },
  562. {
  563. path: '/member',
  564. component: Layout,
  565. name: 'MemberCenter',
  566. meta: { hidden: true },
  567. children: [
  568. {
  569. path: 'user/detail/:id',
  570. name: 'MemberUserDetail',
  571. meta: {
  572. title: '会员详情',
  573. noCache: true,
  574. hidden: true
  575. },
  576. component: () => import('@/views/member/user/detail/index.vue')
  577. }
  578. ]
  579. },
  580. {
  581. path: '/pay',
  582. component: Layout,
  583. name: 'pay',
  584. meta: { hidden: true },
  585. children: [
  586. {
  587. path: 'cashier',
  588. name: 'PayCashier',
  589. meta: {
  590. title: '收银台',
  591. noCache: true,
  592. hidden: true
  593. },
  594. component: () => import('@/views/pay/cashier/index.vue')
  595. }
  596. ]
  597. },
  598. {
  599. path: '/diy',
  600. name: 'DiyCenter',
  601. meta: { hidden: true },
  602. component: Layout,
  603. children: [
  604. {
  605. path: 'template/decorate/:id',
  606. name: 'DiyTemplateDecorate',
  607. meta: {
  608. title: '模板装修',
  609. noCache: true,
  610. hidden: true,
  611. activeMenu: '/mall/promotion/diy/template'
  612. },
  613. component: () => import('@/views/mall/promotion/diy/template/decorate.vue')
  614. },
  615. {
  616. path: 'page/decorate/:id',
  617. name: 'DiyPageDecorate',
  618. meta: {
  619. title: '页面装修',
  620. noCache: true,
  621. hidden: true,
  622. activeMenu: '/mall/promotion/diy/page'
  623. },
  624. component: () => import('@/views/mall/promotion/diy/page/decorate.vue')
  625. }
  626. ]
  627. },
  628. {
  629. path: '/crm',
  630. component: Layout,
  631. name: 'CrmCenter',
  632. meta: { hidden: true },
  633. children: [
  634. {
  635. path: 'clue/detail/:id',
  636. name: 'CrmClueDetail',
  637. meta: {
  638. title: '线索详情',
  639. noCache: true,
  640. hidden: true,
  641. activeMenu: '/crm/clue'
  642. },
  643. component: () => import('@/views/crm/clue/detail/index.vue')
  644. },
  645. {
  646. path: 'customer/detail/:id',
  647. name: 'CrmCustomerDetail',
  648. meta: {
  649. title: '客户详情',
  650. noCache: true,
  651. hidden: true,
  652. activeMenu: '/crm/customer'
  653. },
  654. component: () => import('@/views/crm/customer/detail/index.vue')
  655. },
  656. {
  657. path: 'business/detail/:id',
  658. name: 'CrmBusinessDetail',
  659. meta: {
  660. title: '商机详情',
  661. noCache: true,
  662. hidden: true,
  663. activeMenu: '/crm/business'
  664. },
  665. component: () => import('@/views/crm/business/detail/index.vue')
  666. },
  667. {
  668. path: 'contract/detail/:id',
  669. name: 'CrmContractDetail',
  670. meta: {
  671. title: '合同详情',
  672. noCache: true,
  673. hidden: true,
  674. activeMenu: '/crm/contract'
  675. },
  676. component: () => import('@/views/crm/contract/detail/index.vue')
  677. },
  678. {
  679. path: 'receivable-plan/detail/:id',
  680. name: 'CrmReceivablePlanDetail',
  681. meta: {
  682. title: '回款计划详情',
  683. noCache: true,
  684. hidden: true,
  685. activeMenu: '/crm/receivable-plan'
  686. },
  687. component: () => import('@/views/crm/receivable/plan/detail/index.vue')
  688. },
  689. {
  690. path: 'receivable/detail/:id',
  691. name: 'CrmReceivableDetail',
  692. meta: {
  693. title: '回款详情',
  694. noCache: true,
  695. hidden: true,
  696. activeMenu: '/crm/receivable'
  697. },
  698. component: () => import('@/views/crm/receivable/detail/index.vue')
  699. },
  700. {
  701. path: 'contact/detail/:id',
  702. name: 'CrmContactDetail',
  703. meta: {
  704. title: '联系人详情',
  705. noCache: true,
  706. hidden: true,
  707. activeMenu: '/crm/contact'
  708. },
  709. component: () => import('@/views/crm/contact/detail/index.vue')
  710. },
  711. {
  712. path: 'product/detail/:id',
  713. name: 'CrmProductDetail',
  714. meta: {
  715. title: '产品详情',
  716. noCache: true,
  717. hidden: true,
  718. activeMenu: '/crm/product'
  719. },
  720. component: () => import('@/views/crm/product/detail/index.vue')
  721. }
  722. ]
  723. },
  724. {
  725. path: '/ai',
  726. component: Layout,
  727. name: 'Ai',
  728. meta: {
  729. hidden: true
  730. },
  731. children: [
  732. {
  733. path: 'image/square',
  734. component: () => import('@/views/ai/image/square/index.vue'),
  735. name: 'AiImageSquare',
  736. meta: {
  737. title: '绘图作品',
  738. icon: 'ep:home-filled',
  739. noCache: false
  740. }
  741. }
  742. ]
  743. },
  744. {
  745. path: '/:pathMatch(.*)*',
  746. component: () => import('@/views/Error/404.vue'),
  747. name: '',
  748. meta: {
  749. title: '404',
  750. hidden: true,
  751. breadcrumb: false
  752. }
  753. }
  754. ];
  755. // (async () => {
  756. // const userRoles = await getUserType();
  757. // // 判断用户是否具有 "student" 角色
  758. // if (userRoles.includes("student")) {
  759. // // 如果用户不属于 "student",则从路由中移除 /system/Home 路由
  760. // const systemHomeIndex = remainingRouter.findIndex(route => route.path === '/system/Home');
  761. // if (systemHomeIndex !== -1) {
  762. // remainingRouter.splice(systemHomeIndex, 1); // 移除该路由
  763. // }
  764. // }
  765. // })();
  766. export default remainingRouter;