index.mock.ts 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235
  1. import Mock from 'mockjs'
  2. import { SUCCESS_CODE } from '@/constants'
  3. import { toAnyString } from '@/utils'
  4. const timeout = 1000
  5. const adminList = [
  6. {
  7. path: '/dashboard',
  8. component: '#',
  9. redirect: '/dashboard/analysis',
  10. name: 'Dashboard',
  11. meta: {
  12. title: 'router.dashboard',
  13. icon: 'vi-ant-design:dashboard-filled',
  14. alwaysShow: true
  15. },
  16. children: [
  17. {
  18. path: 'analysis',
  19. component: 'views/Dashboard/Analysis',
  20. name: 'Analysis',
  21. meta: {
  22. title: 'router.analysis',
  23. noCache: true,
  24. affix: true
  25. }
  26. },
  27. {
  28. path: 'workplace',
  29. component: 'views/Dashboard/Workplace',
  30. name: 'Workplace',
  31. meta: {
  32. title: 'router.workplace',
  33. noCache: true,
  34. affix: true
  35. }
  36. }
  37. ]
  38. },
  39. {
  40. path: '/external-link',
  41. component: '#',
  42. meta: {},
  43. name: 'ExternalLink',
  44. children: [
  45. {
  46. path: 'https://element-plus-admin-doc.cn/',
  47. name: 'DocumentLink',
  48. meta: {
  49. title: 'router.document',
  50. icon: 'vi-clarity:document-solid'
  51. }
  52. }
  53. ]
  54. },
  55. {
  56. path: '/guide',
  57. component: '#',
  58. name: 'Guide',
  59. meta: {},
  60. children: [
  61. {
  62. path: 'index',
  63. component: 'views/Guide/Guide',
  64. name: 'GuideDemo',
  65. meta: {
  66. title: 'router.guide',
  67. icon: 'vi-cib:telegram-plane'
  68. }
  69. }
  70. ]
  71. },
  72. {
  73. path: '/components',
  74. component: '#',
  75. redirect: '/components/form/default-form',
  76. name: 'ComponentsDemo',
  77. meta: {
  78. title: 'router.component',
  79. icon: 'vi-bx:bxs-component',
  80. alwaysShow: true
  81. },
  82. children: [
  83. {
  84. path: 'form',
  85. component: '##',
  86. name: 'Form',
  87. meta: {
  88. title: 'router.form',
  89. alwaysShow: true
  90. },
  91. children: [
  92. {
  93. path: 'default-form',
  94. component: 'views/Components/Form/DefaultForm',
  95. name: 'DefaultForm',
  96. meta: {
  97. title: 'router.defaultForm'
  98. }
  99. },
  100. {
  101. path: 'use-form',
  102. component: 'views/Components/Form/UseFormDemo',
  103. name: 'UseForm',
  104. meta: {
  105. title: 'UseForm'
  106. }
  107. }
  108. ]
  109. },
  110. {
  111. path: 'table',
  112. component: '##',
  113. redirect: '/components/table/default-table',
  114. name: 'TableDemo',
  115. meta: {
  116. title: 'router.table',
  117. alwaysShow: true
  118. },
  119. children: [
  120. {
  121. path: 'default-table',
  122. component: 'views/Components/Table/DefaultTable',
  123. name: 'DefaultTable',
  124. meta: {
  125. title: 'router.defaultTable'
  126. }
  127. },
  128. {
  129. path: 'use-table',
  130. component: 'views/Components/Table/UseTableDemo',
  131. name: 'UseTable',
  132. meta: {
  133. title: 'UseTable'
  134. }
  135. },
  136. {
  137. path: 'tree-table',
  138. component: 'views/Components/Table/TreeTable',
  139. name: 'TreeTable',
  140. meta: {
  141. title: 'TreeTable'
  142. }
  143. },
  144. {
  145. path: 'table-image-preview',
  146. component: 'views/Components/Table/TableImagePreview',
  147. name: 'TableImagePreview',
  148. meta: {
  149. title: 'router.PicturePreview'
  150. }
  151. },
  152. {
  153. path: 'table-video-preview',
  154. component: 'views/Components/Table/TableVideoPreview',
  155. name: 'TableVideoPreview',
  156. meta: {
  157. title: 'router.tableVideoPreview'
  158. }
  159. },
  160. {
  161. path: 'card-table',
  162. component: 'views/Components/Table/CardTable',
  163. name: 'CardTable',
  164. meta: {
  165. title: 'router.cardTable'
  166. }
  167. }
  168. // {
  169. // path: 'ref-table',
  170. // component: 'views/Components/Table/RefTable',
  171. // name: 'RefTable',
  172. // meta: {
  173. // title: 'RefTable'
  174. // }
  175. // }
  176. ]
  177. },
  178. {
  179. path: 'editor-demo',
  180. component: '##',
  181. redirect: '/components/editor-demo/editor',
  182. name: 'EditorDemo',
  183. meta: {
  184. title: 'router.editor',
  185. alwaysShow: true
  186. },
  187. children: [
  188. {
  189. path: 'editor',
  190. component: 'views/Components/Editor/Editor',
  191. name: 'Editor',
  192. meta: {
  193. title: 'router.richText'
  194. }
  195. },
  196. {
  197. path: 'json-editor',
  198. component: 'views/Components/Editor/JsonEditor',
  199. name: 'JsonEditor',
  200. meta: {
  201. title: 'router.jsonEditor'
  202. }
  203. },
  204. {
  205. path: 'code-editor',
  206. component: 'views/Components/Editor/CodeEditor',
  207. name: 'CodeEditor',
  208. meta: {
  209. title: 'router.codeEditor'
  210. }
  211. }
  212. ]
  213. },
  214. {
  215. path: 'search',
  216. component: 'views/Components/Search',
  217. name: 'Search',
  218. meta: {
  219. title: 'router.search'
  220. }
  221. },
  222. {
  223. path: 'descriptions',
  224. component: 'views/Components/Descriptions',
  225. name: 'Descriptions',
  226. meta: {
  227. title: 'router.descriptions'
  228. }
  229. },
  230. {
  231. path: 'image-viewer',
  232. component: 'views/Components/ImageViewer',
  233. name: 'ImageViewer',
  234. meta: {
  235. title: 'router.imageViewer'
  236. }
  237. },
  238. {
  239. path: 'dialog',
  240. component: 'views/Components/Dialog',
  241. name: 'Dialog',
  242. meta: {
  243. title: 'router.dialog'
  244. }
  245. },
  246. {
  247. path: 'icon',
  248. component: 'views/Components/Icon',
  249. name: 'Icon',
  250. meta: {
  251. title: 'router.icon'
  252. }
  253. },
  254. {
  255. path: 'icon-picker',
  256. component: 'views/Components/IconPicker',
  257. name: 'IconPicker',
  258. meta: {
  259. title: 'router.iconPicker'
  260. }
  261. },
  262. {
  263. path: 'echart',
  264. component: 'views/Components/Echart',
  265. name: 'Echart',
  266. meta: {
  267. title: 'router.echart'
  268. }
  269. },
  270. {
  271. path: 'count-to',
  272. component: 'views/Components/CountTo',
  273. name: 'CountTo',
  274. meta: {
  275. title: 'router.countTo'
  276. }
  277. },
  278. {
  279. path: 'qrcode',
  280. component: 'views/Components/Qrcode',
  281. name: 'Qrcode',
  282. meta: {
  283. title: 'router.qrcode'
  284. }
  285. },
  286. {
  287. path: 'highlight',
  288. component: 'views/Components/Highlight',
  289. name: 'Highlight',
  290. meta: {
  291. title: 'router.highlight'
  292. }
  293. },
  294. {
  295. path: 'infotip',
  296. component: 'views/Components/Infotip',
  297. name: 'Infotip',
  298. meta: {
  299. title: 'router.infotip'
  300. }
  301. },
  302. {
  303. path: 'input-password',
  304. component: 'views/Components/InputPassword',
  305. name: 'InputPassword',
  306. meta: {
  307. title: 'router.inputPassword'
  308. }
  309. },
  310. {
  311. path: 'waterfall',
  312. component: 'views/Components/Waterfall',
  313. name: 'Waterfall',
  314. meta: {
  315. title: 'router.waterfall'
  316. }
  317. },
  318. {
  319. path: 'image-cropping',
  320. component: 'views/Components/ImageCropping',
  321. name: 'ImageCropping',
  322. meta: {
  323. title: 'router.imageCropping'
  324. }
  325. },
  326. {
  327. path: 'video-player',
  328. component: 'views/Components/VideoPlayer',
  329. name: 'VideoPlayer',
  330. meta: {
  331. title: 'router.videoPlayer'
  332. }
  333. },
  334. {
  335. path: 'avatars',
  336. component: 'views/Components/Avatars',
  337. name: 'Avatars',
  338. meta: {
  339. title: 'router.avatars'
  340. }
  341. },
  342. {
  343. path: 'i-agree',
  344. component: 'views/Components/IAgree',
  345. name: 'IAgree',
  346. meta: {
  347. title: 'router.iAgree'
  348. }
  349. },
  350. {
  351. path: 'tree',
  352. component: 'views/Components/Tree',
  353. name: 'Tree',
  354. meta: {
  355. title: 'router.tree'
  356. }
  357. }
  358. ]
  359. },
  360. {
  361. path: '/function',
  362. component: '#',
  363. redirect: '/function/multipleTabs',
  364. name: 'Function',
  365. meta: {
  366. title: 'router.function',
  367. icon: 'vi-ri:function-fill',
  368. alwaysShow: true
  369. },
  370. children: [
  371. {
  372. path: 'multipleTabs',
  373. component: 'views/Function/MultipleTabs',
  374. name: 'MultipleTabs',
  375. meta: {
  376. title: 'router.multipleTabs'
  377. }
  378. },
  379. {
  380. path: 'multiple-tabs-demo/:id',
  381. component: 'views/Function/MultipleTabsDemo',
  382. name: 'MultipleTabsDemo',
  383. meta: {
  384. hidden: true,
  385. title: 'router.details',
  386. canTo: true
  387. }
  388. },
  389. {
  390. path: 'request',
  391. component: 'views/Function/Request',
  392. name: 'Request',
  393. meta: {
  394. title: 'router.request'
  395. }
  396. },
  397. {
  398. path: 'test',
  399. component: 'views/Function/Test',
  400. name: 'Test',
  401. meta: {
  402. title: 'router.permission',
  403. permission: ['add', 'edit', 'delete']
  404. }
  405. }
  406. ]
  407. },
  408. {
  409. path: '/hooks',
  410. component: '#',
  411. redirect: '/hooks/useWatermark',
  412. name: 'Hooks',
  413. meta: {
  414. title: 'hooks',
  415. icon: 'vi-ic:outline-webhook',
  416. alwaysShow: true
  417. },
  418. children: [
  419. {
  420. path: 'useWatermark',
  421. component: 'views/hooks/useWatermark',
  422. name: 'UseWatermark',
  423. meta: {
  424. title: 'useWatermark'
  425. }
  426. },
  427. {
  428. path: 'useTagsView',
  429. component: 'views/hooks/useTagsView',
  430. name: 'UseTagsView',
  431. meta: {
  432. title: 'useTagsView'
  433. }
  434. },
  435. {
  436. path: 'useValidator',
  437. component: 'views/hooks/useValidator',
  438. name: 'UseValidator',
  439. meta: {
  440. title: 'useValidator'
  441. }
  442. },
  443. {
  444. path: 'useCrudSchemas',
  445. component: 'views/hooks/useCrudSchemas',
  446. name: 'UseCrudSchemas',
  447. meta: {
  448. title: 'useCrudSchemas'
  449. }
  450. },
  451. {
  452. path: 'useClipboard',
  453. component: 'views/hooks/useClipboard',
  454. name: 'UseClipboard',
  455. meta: {
  456. title: 'useClipboard'
  457. }
  458. },
  459. {
  460. path: 'useNetwork',
  461. component: 'views/hooks/useNetwork',
  462. name: 'UseNetwork',
  463. meta: {
  464. title: 'useNetwork'
  465. }
  466. }
  467. ]
  468. },
  469. {
  470. path: '/level',
  471. component: '#',
  472. redirect: '/level/menu1/menu1-1/menu1-1-1',
  473. name: 'Level',
  474. meta: {
  475. title: 'router.level',
  476. icon: 'vi-carbon:skill-level-advanced'
  477. },
  478. children: [
  479. {
  480. path: 'menu1',
  481. name: 'Menu1',
  482. component: '##',
  483. redirect: '/level/menu1/menu1-1/menu1-1-1',
  484. meta: {
  485. title: 'router.menu1'
  486. },
  487. children: [
  488. {
  489. path: 'menu1-1',
  490. name: 'Menu11',
  491. component: '##',
  492. redirect: '/level/menu1/menu1-1/menu1-1-1',
  493. meta: {
  494. title: 'router.menu11',
  495. alwaysShow: true
  496. },
  497. children: [
  498. {
  499. path: 'menu1-1-1',
  500. name: 'Menu111',
  501. component: 'views/Level/Menu111',
  502. meta: {
  503. title: 'router.menu111'
  504. }
  505. }
  506. ]
  507. },
  508. {
  509. path: 'menu1-2',
  510. name: 'Menu12',
  511. component: 'views/Level/Menu12',
  512. meta: {
  513. title: 'router.menu12'
  514. }
  515. }
  516. ]
  517. },
  518. {
  519. path: 'menu2',
  520. name: 'Menu2Demo',
  521. component: 'views/Level/Menu2',
  522. meta: {
  523. title: 'router.menu2'
  524. }
  525. }
  526. ]
  527. },
  528. {
  529. path: '/example',
  530. component: '#',
  531. redirect: '/example/example-dialog',
  532. name: 'Example',
  533. meta: {
  534. title: 'router.example',
  535. icon: 'vi-ep:management',
  536. alwaysShow: true
  537. },
  538. children: [
  539. {
  540. path: 'example-dialog',
  541. component: 'views/Example/Dialog/ExampleDialog',
  542. name: 'ExampleDialog',
  543. meta: {
  544. title: 'router.exampleDialog'
  545. }
  546. },
  547. {
  548. path: 'example-page',
  549. component: 'views/Example/Page/ExamplePage',
  550. name: 'ExamplePage',
  551. meta: {
  552. title: 'router.examplePage'
  553. }
  554. },
  555. {
  556. path: 'example-add',
  557. component: 'views/Example/Page/ExampleAdd',
  558. name: 'ExampleAdd',
  559. meta: {
  560. title: 'router.exampleAdd',
  561. noTagsView: true,
  562. noCache: true,
  563. hidden: true,
  564. showMainRoute: true,
  565. activeMenu: '/example/example-page'
  566. }
  567. },
  568. {
  569. path: 'example-edit',
  570. component: 'views/Example/Page/ExampleEdit',
  571. name: 'ExampleEdit',
  572. meta: {
  573. title: 'router.exampleEdit',
  574. noTagsView: true,
  575. noCache: true,
  576. hidden: true,
  577. showMainRoute: true,
  578. activeMenu: '/example/example-page'
  579. }
  580. },
  581. {
  582. path: 'example-detail',
  583. component: 'views/Example/Page/ExampleDetail',
  584. name: 'ExampleDetail',
  585. meta: {
  586. title: 'router.exampleDetail',
  587. noTagsView: true,
  588. noCache: true,
  589. hidden: true,
  590. showMainRoute: true,
  591. activeMenu: '/example/example-page'
  592. }
  593. }
  594. ]
  595. },
  596. {
  597. path: '/error',
  598. component: '#',
  599. redirect: '/error/404',
  600. name: 'Error',
  601. meta: {
  602. title: 'router.errorPage',
  603. icon: 'vi-ci:error',
  604. alwaysShow: true
  605. },
  606. children: [
  607. {
  608. path: '404-demo',
  609. component: 'views/Error/404',
  610. name: '404Demo',
  611. meta: {
  612. title: '404'
  613. }
  614. },
  615. {
  616. path: '403-demo',
  617. component: 'views/Error/403',
  618. name: '403Demo',
  619. meta: {
  620. title: '403'
  621. }
  622. },
  623. {
  624. path: '500-demo',
  625. component: 'views/Error/500',
  626. name: '500Demo',
  627. meta: {
  628. title: '500'
  629. }
  630. }
  631. ]
  632. },
  633. {
  634. path: '/authorization',
  635. component: '#',
  636. redirect: '/authorization/user',
  637. name: 'Authorization',
  638. meta: {
  639. title: 'router.authorization',
  640. icon: 'vi-eos-icons:role-binding',
  641. alwaysShow: true
  642. },
  643. children: [
  644. {
  645. path: 'department',
  646. component: 'views/Authorization/Department/Department',
  647. name: 'Department',
  648. meta: {
  649. title: 'router.department'
  650. }
  651. },
  652. {
  653. path: 'user',
  654. component: 'views/Authorization/User/User',
  655. name: 'User',
  656. meta: {
  657. title: 'router.user'
  658. }
  659. },
  660. {
  661. path: 'menu',
  662. component: 'views/Authorization/Menu/Menu',
  663. name: 'Menu',
  664. meta: {
  665. title: 'router.menuManagement'
  666. }
  667. },
  668. {
  669. path: 'role',
  670. component: 'views/Authorization/Role/Role',
  671. name: 'Role',
  672. meta: {
  673. title: 'router.role'
  674. }
  675. }
  676. ]
  677. }
  678. ]
  679. const testList: string[] = [
  680. '/dashboard',
  681. '/dashboard/analysis',
  682. '/dashboard/workplace',
  683. 'external-link',
  684. 'https://element-plus-admin-doc.cn/',
  685. '/guide',
  686. '/guide/index',
  687. '/components',
  688. '/components/form',
  689. '/components/form/default-form',
  690. '/components/form/use-form',
  691. '/components/form/ref-form',
  692. '/components/table',
  693. '/components/table/default-table',
  694. '/components/table/use-table',
  695. '/components/table/tree-table',
  696. '/components/table/table-image-preview',
  697. '/components/table/table-video-preview',
  698. '/components/table/ref-table',
  699. '/components/table/card-table',
  700. '/components/editor-demo',
  701. '/components/editor-demo/editor',
  702. '/components/editor-demo/json-editor',
  703. '/components/editor-demo/code-editor',
  704. '/components/search',
  705. '/components/descriptions',
  706. '/components/image-viewer',
  707. '/components/dialog',
  708. '/components/icon',
  709. '/components/iconPicker',
  710. '/components/echart',
  711. '/components/count-to',
  712. '/components/qrcode',
  713. '/components/highlight',
  714. '/components/infotip',
  715. '/components/input-password',
  716. '/components/waterfall',
  717. '/components/image-cropping',
  718. '/components/video-player',
  719. '/components/avatars',
  720. '/components/i-agree',
  721. 'function',
  722. '/function/multiple-tabs',
  723. '/function/multiple-tabs-demo/:id',
  724. '/function/request',
  725. '/function/test',
  726. '/hooks',
  727. '/hooks/useWatermark',
  728. '/hooks/useTagsView',
  729. '/hooks/useValidator',
  730. '/hooks/useCrudSchemas',
  731. '/hooks/useClipboard',
  732. '/hooks/useNetwork',
  733. '/level',
  734. '/level/menu1',
  735. '/level/menu1/menu1-1',
  736. '/level/menu1/menu1-1/menu1-1-1',
  737. '/level/menu1/menu1-2',
  738. '/level/menu2',
  739. '/example',
  740. '/example/example-dialog',
  741. '/example/example-page',
  742. '/example/example-add',
  743. '/example/example-edit',
  744. '/example/example-detail',
  745. '/authorization',
  746. '/authorization/department',
  747. '/authorization/user',
  748. '/authorization/role',
  749. '/authorization/menu',
  750. '/error',
  751. '/error/404-demo',
  752. '/error/403-demo',
  753. '/error/500-demo'
  754. ]
  755. const List: any[] = []
  756. const roleNames = ['超级管理员', '管理员', '普通用户', '游客']
  757. const menus = [
  758. [
  759. {
  760. path: '/dashboard',
  761. component: '#',
  762. redirect: '/dashboard/analysis',
  763. name: 'Dashboard',
  764. status: Mock.Random.integer(0, 1),
  765. id: 1,
  766. meta: {
  767. title: '首页',
  768. icon: 'vi-ant-design:dashboard-filled',
  769. alwaysShow: true
  770. },
  771. children: [
  772. {
  773. path: 'analysis',
  774. component: 'views/Dashboard/Analysis',
  775. name: 'Analysis',
  776. status: Mock.Random.integer(0, 1),
  777. id: 2,
  778. meta: {
  779. title: '分析页',
  780. noCache: true
  781. }
  782. },
  783. {
  784. path: 'workplace',
  785. component: 'views/Dashboard/Workplace',
  786. name: 'Workplace',
  787. status: Mock.Random.integer(0, 1),
  788. id: 3,
  789. meta: {
  790. title: '工作台',
  791. noCache: true
  792. }
  793. }
  794. ]
  795. },
  796. {
  797. path: '/external-link',
  798. component: '#',
  799. meta: {
  800. title: '文档',
  801. icon: 'vi-clarity:document-solid'
  802. },
  803. name: 'ExternalLink',
  804. status: Mock.Random.integer(0, 1),
  805. id: 4,
  806. children: [
  807. {
  808. path: 'https://element-plus-admin-doc.cn/',
  809. name: 'DocumentLink',
  810. status: Mock.Random.integer(0, 1),
  811. id: 5,
  812. meta: {
  813. title: '文档'
  814. }
  815. }
  816. ]
  817. },
  818. {
  819. path: '/level',
  820. component: '#',
  821. redirect: '/level/menu1/menu1-1/menu1-1-1',
  822. name: 'Level',
  823. status: Mock.Random.integer(0, 1),
  824. id: 6,
  825. meta: {
  826. title: '菜单',
  827. icon: 'vi-carbon:skill-level-advanced'
  828. },
  829. children: [
  830. {
  831. path: 'menu1',
  832. name: 'Menu1',
  833. component: '##',
  834. status: Mock.Random.integer(0, 1),
  835. id: 7,
  836. redirect: '/level/menu1/menu1-1/menu1-1-1',
  837. meta: {
  838. title: '菜单1'
  839. },
  840. children: [
  841. {
  842. path: 'menu1-1',
  843. name: 'Menu11',
  844. component: '##',
  845. status: Mock.Random.integer(0, 1),
  846. id: 8,
  847. redirect: '/level/menu1/menu1-1/menu1-1-1',
  848. meta: {
  849. title: '菜单1-1',
  850. alwaysShow: true
  851. },
  852. children: [
  853. {
  854. path: 'menu1-1-1',
  855. name: 'Menu111',
  856. component: 'views/Level/Menu111',
  857. status: Mock.Random.integer(0, 1),
  858. id: 9,
  859. permission: ['edit', 'add', 'delete'],
  860. meta: {
  861. title: '菜单1-1-1',
  862. permission: ['edit', 'add', 'delete']
  863. }
  864. }
  865. ]
  866. },
  867. {
  868. path: 'menu1-2',
  869. name: 'Menu12',
  870. component: 'views/Level/Menu12',
  871. status: Mock.Random.integer(0, 1),
  872. id: 10,
  873. permission: ['edit', 'add', 'delete'],
  874. meta: {
  875. title: '菜单1-2',
  876. permission: ['edit', 'add', 'delete']
  877. }
  878. }
  879. ]
  880. },
  881. {
  882. path: 'menu2',
  883. name: 'Menu2Demo',
  884. component: 'views/Level/Menu2',
  885. status: Mock.Random.integer(0, 1),
  886. id: 11,
  887. permission: ['edit', 'add', 'delete'],
  888. meta: {
  889. title: '菜单2',
  890. permission: ['edit', 'add', 'delete']
  891. }
  892. }
  893. ]
  894. },
  895. {
  896. path: '/example',
  897. component: '#',
  898. redirect: '/example/example-dialog',
  899. name: 'Example',
  900. status: Mock.Random.integer(0, 1),
  901. id: 12,
  902. meta: {
  903. title: '综合示例',
  904. icon: 'vi-ep:management',
  905. alwaysShow: true
  906. },
  907. children: [
  908. {
  909. path: 'example-dialog',
  910. component: 'views/Example/Dialog/ExampleDialog',
  911. name: 'ExampleDialog',
  912. status: Mock.Random.integer(0, 1),
  913. id: 13,
  914. permission: ['edit', 'add', 'delete'],
  915. meta: {
  916. title: '综合示例-弹窗',
  917. permission: ['edit', 'add', 'delete']
  918. }
  919. },
  920. {
  921. path: 'example-page',
  922. component: 'views/Example/Page/ExamplePage',
  923. name: 'ExamplePage',
  924. status: Mock.Random.integer(0, 1),
  925. id: 14,
  926. permission: ['edit', 'add', 'delete'],
  927. meta: {
  928. title: '综合示例-页面',
  929. permission: ['edit', 'add', 'delete']
  930. }
  931. },
  932. {
  933. path: 'example-add',
  934. component: 'views/Example/Page/ExampleAdd',
  935. name: 'ExampleAdd',
  936. status: Mock.Random.integer(0, 1),
  937. id: 15,
  938. permission: ['edit', 'add', 'delete'],
  939. meta: {
  940. title: '综合示例-新增',
  941. noTagsView: true,
  942. noCache: true,
  943. hidden: true,
  944. showMainRoute: true,
  945. activeMenu: '/example/example-page',
  946. permission: ['edit', 'add', 'delete']
  947. }
  948. },
  949. {
  950. path: 'example-edit',
  951. component: 'views/Example/Page/ExampleEdit',
  952. name: 'ExampleEdit',
  953. status: Mock.Random.integer(0, 1),
  954. id: 16,
  955. permission: ['edit', 'add', 'delete'],
  956. meta: {
  957. title: '综合示例-编辑',
  958. noTagsView: true,
  959. noCache: true,
  960. hidden: true,
  961. showMainRoute: true,
  962. activeMenu: '/example/example-page',
  963. permission: ['edit', 'add', 'delete']
  964. }
  965. },
  966. {
  967. path: 'example-detail',
  968. component: 'views/Example/Page/ExampleDetail',
  969. name: 'ExampleDetail',
  970. status: Mock.Random.integer(0, 1),
  971. id: 17,
  972. permission: ['edit', 'add', 'delete'],
  973. meta: {
  974. title: '综合示例-详情',
  975. noTagsView: true,
  976. noCache: true,
  977. hidden: true,
  978. showMainRoute: true,
  979. activeMenu: '/example/example-page',
  980. permission: ['edit', 'add', 'delete']
  981. }
  982. }
  983. ]
  984. }
  985. ],
  986. [
  987. {
  988. path: '/dashboard',
  989. component: '#',
  990. redirect: '/dashboard/analysis',
  991. name: 'Dashboard',
  992. status: Mock.Random.integer(0, 1),
  993. id: 1,
  994. meta: {
  995. title: '首页',
  996. icon: 'vi-ant-design:dashboard-filled',
  997. alwaysShow: true
  998. },
  999. children: [
  1000. {
  1001. path: 'analysis',
  1002. component: 'views/Dashboard/Analysis',
  1003. name: 'Analysis',
  1004. status: Mock.Random.integer(0, 1),
  1005. id: 2,
  1006. meta: {
  1007. title: '分析页',
  1008. noCache: true
  1009. }
  1010. },
  1011. {
  1012. path: 'workplace',
  1013. component: 'views/Dashboard/Workplace',
  1014. name: 'Workplace',
  1015. status: Mock.Random.integer(0, 1),
  1016. id: 3,
  1017. meta: {
  1018. title: '工作台',
  1019. noCache: true
  1020. }
  1021. }
  1022. ]
  1023. }
  1024. ],
  1025. [
  1026. {
  1027. path: '/external-link',
  1028. component: '#',
  1029. meta: {
  1030. title: '文档',
  1031. icon: 'vi-clarity:document-solid'
  1032. },
  1033. name: 'ExternalLink',
  1034. status: Mock.Random.integer(0, 1),
  1035. id: 4,
  1036. children: [
  1037. {
  1038. path: 'https://element-plus-admin-doc.cn/',
  1039. name: 'DocumentLink',
  1040. status: Mock.Random.integer(0, 1),
  1041. id: 5,
  1042. meta: {
  1043. title: '文档'
  1044. }
  1045. }
  1046. ]
  1047. },
  1048. {
  1049. path: '/level',
  1050. component: '#',
  1051. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1052. name: 'Level',
  1053. status: Mock.Random.integer(0, 1),
  1054. id: 6,
  1055. meta: {
  1056. title: '菜单',
  1057. icon: 'vi-carbon:skill-level-advanced'
  1058. },
  1059. children: [
  1060. {
  1061. path: 'menu1',
  1062. name: 'Menu1',
  1063. component: '##',
  1064. status: Mock.Random.integer(0, 1),
  1065. id: 7,
  1066. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1067. meta: {
  1068. title: '菜单1'
  1069. },
  1070. children: [
  1071. {
  1072. path: 'menu1-1',
  1073. name: 'Menu11',
  1074. component: '##',
  1075. status: Mock.Random.integer(0, 1),
  1076. id: 8,
  1077. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1078. meta: {
  1079. title: '菜单1-1',
  1080. alwaysShow: true
  1081. },
  1082. children: [
  1083. {
  1084. path: 'menu1-1-1',
  1085. name: 'Menu111',
  1086. component: 'views/Level/Menu111',
  1087. status: Mock.Random.integer(0, 1),
  1088. id: 9,
  1089. permission: ['edit', 'add', 'delete'],
  1090. meta: {
  1091. title: '菜单1-1-1',
  1092. permission: ['edit', 'add', 'delete']
  1093. }
  1094. }
  1095. ]
  1096. },
  1097. {
  1098. path: 'menu1-2',
  1099. name: 'Menu12',
  1100. component: 'views/Level/Menu12',
  1101. status: Mock.Random.integer(0, 1),
  1102. id: 10,
  1103. permission: ['edit', 'add', 'delete'],
  1104. meta: {
  1105. title: '菜单1-2',
  1106. permission: ['edit', 'add', 'delete']
  1107. }
  1108. }
  1109. ]
  1110. },
  1111. {
  1112. path: 'menu2',
  1113. name: 'Menu2Demo',
  1114. component: 'views/Level/Menu2',
  1115. status: Mock.Random.integer(0, 1),
  1116. id: 11,
  1117. permission: ['edit', 'add', 'delete'],
  1118. meta: {
  1119. title: '菜单2',
  1120. permission: ['edit', 'add', 'delete']
  1121. }
  1122. }
  1123. ]
  1124. }
  1125. ],
  1126. [
  1127. {
  1128. path: '/example',
  1129. component: '#',
  1130. redirect: '/example/example-dialog',
  1131. name: 'Example',
  1132. status: Mock.Random.integer(0, 1),
  1133. id: 12,
  1134. meta: {
  1135. title: '综合示例',
  1136. icon: 'vi-ep:management',
  1137. alwaysShow: true
  1138. },
  1139. children: [
  1140. {
  1141. path: 'example-detail',
  1142. component: 'views/Example/Page/ExampleDetail',
  1143. name: 'ExampleDetail',
  1144. status: Mock.Random.integer(0, 1),
  1145. id: 17,
  1146. permission: ['edit', 'add', 'delete'],
  1147. meta: {
  1148. title: '综合示例-详情',
  1149. noTagsView: true,
  1150. noCache: true,
  1151. hidden: true,
  1152. showMainRoute: true,
  1153. activeMenu: '/example/example-page',
  1154. permission: ['edit', 'add', 'delete']
  1155. }
  1156. }
  1157. ]
  1158. }
  1159. ]
  1160. ]
  1161. for (let i = 0; i < 4; i++) {
  1162. List.push(
  1163. Mock.mock({
  1164. id: toAnyString(),
  1165. // timestamp: +Mock.Random.date('T'),
  1166. roleName: roleNames[i],
  1167. role: '@first',
  1168. status: Mock.Random.integer(0, 1),
  1169. createTime: '@datetime',
  1170. remark: '@cword(10, 15)',
  1171. menu: menus[i]
  1172. })
  1173. )
  1174. }
  1175. export default [
  1176. // 列表接口
  1177. {
  1178. url: '/mock/role/list',
  1179. method: 'get',
  1180. timeout,
  1181. response: () => {
  1182. return {
  1183. code: SUCCESS_CODE,
  1184. data: adminList
  1185. }
  1186. }
  1187. },
  1188. {
  1189. url: '/mock/role/table',
  1190. method: 'get',
  1191. timeout,
  1192. response: () => {
  1193. return {
  1194. code: SUCCESS_CODE,
  1195. data: {
  1196. list: List,
  1197. total: 4
  1198. }
  1199. }
  1200. }
  1201. },
  1202. // 列表接口
  1203. {
  1204. url: '/mock/role/list2',
  1205. method: 'get',
  1206. timeout,
  1207. response: () => {
  1208. return {
  1209. code: SUCCESS_CODE,
  1210. data: testList
  1211. }
  1212. }
  1213. },
  1214. {
  1215. url: '/mock/role/table',
  1216. method: 'get',
  1217. timeout,
  1218. response: () => {
  1219. return {
  1220. code: SUCCESS_CODE,
  1221. data: {
  1222. list: List,
  1223. total: 4
  1224. }
  1225. }
  1226. }
  1227. }
  1228. ]