index.mock.ts 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227
  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. },
  352. {
  353. path: '/function',
  354. component: '#',
  355. redirect: '/function/multipleTabs',
  356. name: 'Function',
  357. meta: {
  358. title: 'router.function',
  359. icon: 'vi-ri:function-fill',
  360. alwaysShow: true
  361. },
  362. children: [
  363. {
  364. path: 'multipleTabs',
  365. component: 'views/Function/MultipleTabs',
  366. name: 'MultipleTabs',
  367. meta: {
  368. title: 'router.multipleTabs'
  369. }
  370. },
  371. {
  372. path: 'multiple-tabs-demo/:id',
  373. component: 'views/Function/MultipleTabsDemo',
  374. name: 'MultipleTabsDemo',
  375. meta: {
  376. hidden: true,
  377. title: 'router.details',
  378. canTo: true
  379. }
  380. },
  381. {
  382. path: 'request',
  383. component: 'views/Function/Request',
  384. name: 'Request',
  385. meta: {
  386. title: 'router.request'
  387. }
  388. },
  389. {
  390. path: 'test',
  391. component: 'views/Function/Test',
  392. name: 'Test',
  393. meta: {
  394. title: 'router.permission',
  395. permission: ['add', 'edit', 'delete']
  396. }
  397. }
  398. ]
  399. },
  400. {
  401. path: '/hooks',
  402. component: '#',
  403. redirect: '/hooks/useWatermark',
  404. name: 'Hooks',
  405. meta: {
  406. title: 'hooks',
  407. icon: 'vi-ic:outline-webhook',
  408. alwaysShow: true
  409. },
  410. children: [
  411. {
  412. path: 'useWatermark',
  413. component: 'views/hooks/useWatermark',
  414. name: 'UseWatermark',
  415. meta: {
  416. title: 'useWatermark'
  417. }
  418. },
  419. {
  420. path: 'useTagsView',
  421. component: 'views/hooks/useTagsView',
  422. name: 'UseTagsView',
  423. meta: {
  424. title: 'useTagsView'
  425. }
  426. },
  427. {
  428. path: 'useValidator',
  429. component: 'views/hooks/useValidator',
  430. name: 'UseValidator',
  431. meta: {
  432. title: 'useValidator'
  433. }
  434. },
  435. {
  436. path: 'useCrudSchemas',
  437. component: 'views/hooks/useCrudSchemas',
  438. name: 'UseCrudSchemas',
  439. meta: {
  440. title: 'useCrudSchemas'
  441. }
  442. },
  443. {
  444. path: 'useClipboard',
  445. component: 'views/hooks/useClipboard',
  446. name: 'UseClipboard',
  447. meta: {
  448. title: 'useClipboard'
  449. }
  450. },
  451. {
  452. path: 'useNetwork',
  453. component: 'views/hooks/useNetwork',
  454. name: 'UseNetwork',
  455. meta: {
  456. title: 'useNetwork'
  457. }
  458. }
  459. ]
  460. },
  461. {
  462. path: '/level',
  463. component: '#',
  464. redirect: '/level/menu1/menu1-1/menu1-1-1',
  465. name: 'Level',
  466. meta: {
  467. title: 'router.level',
  468. icon: 'vi-carbon:skill-level-advanced'
  469. },
  470. children: [
  471. {
  472. path: 'menu1',
  473. name: 'Menu1',
  474. component: '##',
  475. redirect: '/level/menu1/menu1-1/menu1-1-1',
  476. meta: {
  477. title: 'router.menu1'
  478. },
  479. children: [
  480. {
  481. path: 'menu1-1',
  482. name: 'Menu11',
  483. component: '##',
  484. redirect: '/level/menu1/menu1-1/menu1-1-1',
  485. meta: {
  486. title: 'router.menu11',
  487. alwaysShow: true
  488. },
  489. children: [
  490. {
  491. path: 'menu1-1-1',
  492. name: 'Menu111',
  493. component: 'views/Level/Menu111',
  494. meta: {
  495. title: 'router.menu111'
  496. }
  497. }
  498. ]
  499. },
  500. {
  501. path: 'menu1-2',
  502. name: 'Menu12',
  503. component: 'views/Level/Menu12',
  504. meta: {
  505. title: 'router.menu12'
  506. }
  507. }
  508. ]
  509. },
  510. {
  511. path: 'menu2',
  512. name: 'Menu2Demo',
  513. component: 'views/Level/Menu2',
  514. meta: {
  515. title: 'router.menu2'
  516. }
  517. }
  518. ]
  519. },
  520. {
  521. path: '/example',
  522. component: '#',
  523. redirect: '/example/example-dialog',
  524. name: 'Example',
  525. meta: {
  526. title: 'router.example',
  527. icon: 'vi-ep:management',
  528. alwaysShow: true
  529. },
  530. children: [
  531. {
  532. path: 'example-dialog',
  533. component: 'views/Example/Dialog/ExampleDialog',
  534. name: 'ExampleDialog',
  535. meta: {
  536. title: 'router.exampleDialog'
  537. }
  538. },
  539. {
  540. path: 'example-page',
  541. component: 'views/Example/Page/ExamplePage',
  542. name: 'ExamplePage',
  543. meta: {
  544. title: 'router.examplePage'
  545. }
  546. },
  547. {
  548. path: 'example-add',
  549. component: 'views/Example/Page/ExampleAdd',
  550. name: 'ExampleAdd',
  551. meta: {
  552. title: 'router.exampleAdd',
  553. noTagsView: true,
  554. noCache: true,
  555. hidden: true,
  556. showMainRoute: true,
  557. activeMenu: '/example/example-page'
  558. }
  559. },
  560. {
  561. path: 'example-edit',
  562. component: 'views/Example/Page/ExampleEdit',
  563. name: 'ExampleEdit',
  564. meta: {
  565. title: 'router.exampleEdit',
  566. noTagsView: true,
  567. noCache: true,
  568. hidden: true,
  569. showMainRoute: true,
  570. activeMenu: '/example/example-page'
  571. }
  572. },
  573. {
  574. path: 'example-detail',
  575. component: 'views/Example/Page/ExampleDetail',
  576. name: 'ExampleDetail',
  577. meta: {
  578. title: 'router.exampleDetail',
  579. noTagsView: true,
  580. noCache: true,
  581. hidden: true,
  582. showMainRoute: true,
  583. activeMenu: '/example/example-page'
  584. }
  585. }
  586. ]
  587. },
  588. {
  589. path: '/error',
  590. component: '#',
  591. redirect: '/error/404',
  592. name: 'Error',
  593. meta: {
  594. title: 'router.errorPage',
  595. icon: 'vi-ci:error',
  596. alwaysShow: true
  597. },
  598. children: [
  599. {
  600. path: '404-demo',
  601. component: 'views/Error/404',
  602. name: '404Demo',
  603. meta: {
  604. title: '404'
  605. }
  606. },
  607. {
  608. path: '403-demo',
  609. component: 'views/Error/403',
  610. name: '403Demo',
  611. meta: {
  612. title: '403'
  613. }
  614. },
  615. {
  616. path: '500-demo',
  617. component: 'views/Error/500',
  618. name: '500Demo',
  619. meta: {
  620. title: '500'
  621. }
  622. }
  623. ]
  624. },
  625. {
  626. path: '/authorization',
  627. component: '#',
  628. redirect: '/authorization/user',
  629. name: 'Authorization',
  630. meta: {
  631. title: 'router.authorization',
  632. icon: 'vi-eos-icons:role-binding',
  633. alwaysShow: true
  634. },
  635. children: [
  636. {
  637. path: 'department',
  638. component: 'views/Authorization/Department/Department',
  639. name: 'Department',
  640. meta: {
  641. title: 'router.department'
  642. }
  643. },
  644. {
  645. path: 'user',
  646. component: 'views/Authorization/User/User',
  647. name: 'User',
  648. meta: {
  649. title: 'router.user'
  650. }
  651. },
  652. {
  653. path: 'menu',
  654. component: 'views/Authorization/Menu/Menu',
  655. name: 'Menu',
  656. meta: {
  657. title: 'router.menuManagement'
  658. }
  659. },
  660. {
  661. path: 'role',
  662. component: 'views/Authorization/Role/Role',
  663. name: 'Role',
  664. meta: {
  665. title: 'router.role'
  666. }
  667. }
  668. ]
  669. }
  670. ]
  671. const testList: string[] = [
  672. '/dashboard',
  673. '/dashboard/analysis',
  674. '/dashboard/workplace',
  675. 'external-link',
  676. 'https://element-plus-admin-doc.cn/',
  677. '/guide',
  678. '/guide/index',
  679. '/components',
  680. '/components/form',
  681. '/components/form/default-form',
  682. '/components/form/use-form',
  683. '/components/form/ref-form',
  684. '/components/table',
  685. '/components/table/default-table',
  686. '/components/table/use-table',
  687. '/components/table/tree-table',
  688. '/components/table/table-image-preview',
  689. '/components/table/table-video-preview',
  690. '/components/table/ref-table',
  691. '/components/table/card-table',
  692. '/components/editor-demo',
  693. '/components/editor-demo/editor',
  694. '/components/editor-demo/json-editor',
  695. '/components/editor-demo/code-editor',
  696. '/components/search',
  697. '/components/descriptions',
  698. '/components/image-viewer',
  699. '/components/dialog',
  700. '/components/icon',
  701. '/components/iconPicker',
  702. '/components/echart',
  703. '/components/count-to',
  704. '/components/qrcode',
  705. '/components/highlight',
  706. '/components/infotip',
  707. '/components/input-password',
  708. '/components/waterfall',
  709. '/components/image-cropping',
  710. '/components/video-player',
  711. '/components/avatars',
  712. '/components/i-agree',
  713. 'function',
  714. '/function/multiple-tabs',
  715. '/function/multiple-tabs-demo/:id',
  716. '/function/request',
  717. '/function/test',
  718. '/hooks',
  719. '/hooks/useWatermark',
  720. '/hooks/useTagsView',
  721. '/hooks/useValidator',
  722. '/hooks/useCrudSchemas',
  723. '/hooks/useClipboard',
  724. '/hooks/useNetwork',
  725. '/level',
  726. '/level/menu1',
  727. '/level/menu1/menu1-1',
  728. '/level/menu1/menu1-1/menu1-1-1',
  729. '/level/menu1/menu1-2',
  730. '/level/menu2',
  731. '/example',
  732. '/example/example-dialog',
  733. '/example/example-page',
  734. '/example/example-add',
  735. '/example/example-edit',
  736. '/example/example-detail',
  737. '/authorization',
  738. '/authorization/department',
  739. '/authorization/user',
  740. '/authorization/role',
  741. '/authorization/menu',
  742. '/error',
  743. '/error/404-demo',
  744. '/error/403-demo',
  745. '/error/500-demo'
  746. ]
  747. const List: any[] = []
  748. const roleNames = ['超级管理员', '管理员', '普通用户', '游客']
  749. const menus = [
  750. [
  751. {
  752. path: '/dashboard',
  753. component: '#',
  754. redirect: '/dashboard/analysis',
  755. name: 'Dashboard',
  756. status: Mock.Random.integer(0, 1),
  757. id: 1,
  758. meta: {
  759. title: '首页',
  760. icon: 'vi-ant-design:dashboard-filled',
  761. alwaysShow: true
  762. },
  763. children: [
  764. {
  765. path: 'analysis',
  766. component: 'views/Dashboard/Analysis',
  767. name: 'Analysis',
  768. status: Mock.Random.integer(0, 1),
  769. id: 2,
  770. meta: {
  771. title: '分析页',
  772. noCache: true
  773. }
  774. },
  775. {
  776. path: 'workplace',
  777. component: 'views/Dashboard/Workplace',
  778. name: 'Workplace',
  779. status: Mock.Random.integer(0, 1),
  780. id: 3,
  781. meta: {
  782. title: '工作台',
  783. noCache: true
  784. }
  785. }
  786. ]
  787. },
  788. {
  789. path: '/external-link',
  790. component: '#',
  791. meta: {
  792. title: '文档',
  793. icon: 'vi-clarity:document-solid'
  794. },
  795. name: 'ExternalLink',
  796. status: Mock.Random.integer(0, 1),
  797. id: 4,
  798. children: [
  799. {
  800. path: 'https://element-plus-admin-doc.cn/',
  801. name: 'DocumentLink',
  802. status: Mock.Random.integer(0, 1),
  803. id: 5,
  804. meta: {
  805. title: '文档'
  806. }
  807. }
  808. ]
  809. },
  810. {
  811. path: '/level',
  812. component: '#',
  813. redirect: '/level/menu1/menu1-1/menu1-1-1',
  814. name: 'Level',
  815. status: Mock.Random.integer(0, 1),
  816. id: 6,
  817. meta: {
  818. title: '菜单',
  819. icon: 'vi-carbon:skill-level-advanced'
  820. },
  821. children: [
  822. {
  823. path: 'menu1',
  824. name: 'Menu1',
  825. component: '##',
  826. status: Mock.Random.integer(0, 1),
  827. id: 7,
  828. redirect: '/level/menu1/menu1-1/menu1-1-1',
  829. meta: {
  830. title: '菜单1'
  831. },
  832. children: [
  833. {
  834. path: 'menu1-1',
  835. name: 'Menu11',
  836. component: '##',
  837. status: Mock.Random.integer(0, 1),
  838. id: 8,
  839. redirect: '/level/menu1/menu1-1/menu1-1-1',
  840. meta: {
  841. title: '菜单1-1',
  842. alwaysShow: true
  843. },
  844. children: [
  845. {
  846. path: 'menu1-1-1',
  847. name: 'Menu111',
  848. component: 'views/Level/Menu111',
  849. status: Mock.Random.integer(0, 1),
  850. id: 9,
  851. permission: ['edit', 'add', 'delete'],
  852. meta: {
  853. title: '菜单1-1-1',
  854. permission: ['edit', 'add', 'delete']
  855. }
  856. }
  857. ]
  858. },
  859. {
  860. path: 'menu1-2',
  861. name: 'Menu12',
  862. component: 'views/Level/Menu12',
  863. status: Mock.Random.integer(0, 1),
  864. id: 10,
  865. permission: ['edit', 'add', 'delete'],
  866. meta: {
  867. title: '菜单1-2',
  868. permission: ['edit', 'add', 'delete']
  869. }
  870. }
  871. ]
  872. },
  873. {
  874. path: 'menu2',
  875. name: 'Menu2Demo',
  876. component: 'views/Level/Menu2',
  877. status: Mock.Random.integer(0, 1),
  878. id: 11,
  879. permission: ['edit', 'add', 'delete'],
  880. meta: {
  881. title: '菜单2',
  882. permission: ['edit', 'add', 'delete']
  883. }
  884. }
  885. ]
  886. },
  887. {
  888. path: '/example',
  889. component: '#',
  890. redirect: '/example/example-dialog',
  891. name: 'Example',
  892. status: Mock.Random.integer(0, 1),
  893. id: 12,
  894. meta: {
  895. title: '综合示例',
  896. icon: 'vi-ep:management',
  897. alwaysShow: true
  898. },
  899. children: [
  900. {
  901. path: 'example-dialog',
  902. component: 'views/Example/Dialog/ExampleDialog',
  903. name: 'ExampleDialog',
  904. status: Mock.Random.integer(0, 1),
  905. id: 13,
  906. permission: ['edit', 'add', 'delete'],
  907. meta: {
  908. title: '综合示例-弹窗',
  909. permission: ['edit', 'add', 'delete']
  910. }
  911. },
  912. {
  913. path: 'example-page',
  914. component: 'views/Example/Page/ExamplePage',
  915. name: 'ExamplePage',
  916. status: Mock.Random.integer(0, 1),
  917. id: 14,
  918. permission: ['edit', 'add', 'delete'],
  919. meta: {
  920. title: '综合示例-页面',
  921. permission: ['edit', 'add', 'delete']
  922. }
  923. },
  924. {
  925. path: 'example-add',
  926. component: 'views/Example/Page/ExampleAdd',
  927. name: 'ExampleAdd',
  928. status: Mock.Random.integer(0, 1),
  929. id: 15,
  930. permission: ['edit', 'add', 'delete'],
  931. meta: {
  932. title: '综合示例-新增',
  933. noTagsView: true,
  934. noCache: true,
  935. hidden: true,
  936. showMainRoute: true,
  937. activeMenu: '/example/example-page',
  938. permission: ['edit', 'add', 'delete']
  939. }
  940. },
  941. {
  942. path: 'example-edit',
  943. component: 'views/Example/Page/ExampleEdit',
  944. name: 'ExampleEdit',
  945. status: Mock.Random.integer(0, 1),
  946. id: 16,
  947. permission: ['edit', 'add', 'delete'],
  948. meta: {
  949. title: '综合示例-编辑',
  950. noTagsView: true,
  951. noCache: true,
  952. hidden: true,
  953. showMainRoute: true,
  954. activeMenu: '/example/example-page',
  955. permission: ['edit', 'add', 'delete']
  956. }
  957. },
  958. {
  959. path: 'example-detail',
  960. component: 'views/Example/Page/ExampleDetail',
  961. name: 'ExampleDetail',
  962. status: Mock.Random.integer(0, 1),
  963. id: 17,
  964. permission: ['edit', 'add', 'delete'],
  965. meta: {
  966. title: '综合示例-详情',
  967. noTagsView: true,
  968. noCache: true,
  969. hidden: true,
  970. showMainRoute: true,
  971. activeMenu: '/example/example-page',
  972. permission: ['edit', 'add', 'delete']
  973. }
  974. }
  975. ]
  976. }
  977. ],
  978. [
  979. {
  980. path: '/dashboard',
  981. component: '#',
  982. redirect: '/dashboard/analysis',
  983. name: 'Dashboard',
  984. status: Mock.Random.integer(0, 1),
  985. id: 1,
  986. meta: {
  987. title: '首页',
  988. icon: 'vi-ant-design:dashboard-filled',
  989. alwaysShow: true
  990. },
  991. children: [
  992. {
  993. path: 'analysis',
  994. component: 'views/Dashboard/Analysis',
  995. name: 'Analysis',
  996. status: Mock.Random.integer(0, 1),
  997. id: 2,
  998. meta: {
  999. title: '分析页',
  1000. noCache: true
  1001. }
  1002. },
  1003. {
  1004. path: 'workplace',
  1005. component: 'views/Dashboard/Workplace',
  1006. name: 'Workplace',
  1007. status: Mock.Random.integer(0, 1),
  1008. id: 3,
  1009. meta: {
  1010. title: '工作台',
  1011. noCache: true
  1012. }
  1013. }
  1014. ]
  1015. }
  1016. ],
  1017. [
  1018. {
  1019. path: '/external-link',
  1020. component: '#',
  1021. meta: {
  1022. title: '文档',
  1023. icon: 'vi-clarity:document-solid'
  1024. },
  1025. name: 'ExternalLink',
  1026. status: Mock.Random.integer(0, 1),
  1027. id: 4,
  1028. children: [
  1029. {
  1030. path: 'https://element-plus-admin-doc.cn/',
  1031. name: 'DocumentLink',
  1032. status: Mock.Random.integer(0, 1),
  1033. id: 5,
  1034. meta: {
  1035. title: '文档'
  1036. }
  1037. }
  1038. ]
  1039. },
  1040. {
  1041. path: '/level',
  1042. component: '#',
  1043. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1044. name: 'Level',
  1045. status: Mock.Random.integer(0, 1),
  1046. id: 6,
  1047. meta: {
  1048. title: '菜单',
  1049. icon: 'vi-carbon:skill-level-advanced'
  1050. },
  1051. children: [
  1052. {
  1053. path: 'menu1',
  1054. name: 'Menu1',
  1055. component: '##',
  1056. status: Mock.Random.integer(0, 1),
  1057. id: 7,
  1058. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1059. meta: {
  1060. title: '菜单1'
  1061. },
  1062. children: [
  1063. {
  1064. path: 'menu1-1',
  1065. name: 'Menu11',
  1066. component: '##',
  1067. status: Mock.Random.integer(0, 1),
  1068. id: 8,
  1069. redirect: '/level/menu1/menu1-1/menu1-1-1',
  1070. meta: {
  1071. title: '菜单1-1',
  1072. alwaysShow: true
  1073. },
  1074. children: [
  1075. {
  1076. path: 'menu1-1-1',
  1077. name: 'Menu111',
  1078. component: 'views/Level/Menu111',
  1079. status: Mock.Random.integer(0, 1),
  1080. id: 9,
  1081. permission: ['edit', 'add', 'delete'],
  1082. meta: {
  1083. title: '菜单1-1-1',
  1084. permission: ['edit', 'add', 'delete']
  1085. }
  1086. }
  1087. ]
  1088. },
  1089. {
  1090. path: 'menu1-2',
  1091. name: 'Menu12',
  1092. component: 'views/Level/Menu12',
  1093. status: Mock.Random.integer(0, 1),
  1094. id: 10,
  1095. permission: ['edit', 'add', 'delete'],
  1096. meta: {
  1097. title: '菜单1-2',
  1098. permission: ['edit', 'add', 'delete']
  1099. }
  1100. }
  1101. ]
  1102. },
  1103. {
  1104. path: 'menu2',
  1105. name: 'Menu2Demo',
  1106. component: 'views/Level/Menu2',
  1107. status: Mock.Random.integer(0, 1),
  1108. id: 11,
  1109. permission: ['edit', 'add', 'delete'],
  1110. meta: {
  1111. title: '菜单2',
  1112. permission: ['edit', 'add', 'delete']
  1113. }
  1114. }
  1115. ]
  1116. }
  1117. ],
  1118. [
  1119. {
  1120. path: '/example',
  1121. component: '#',
  1122. redirect: '/example/example-dialog',
  1123. name: 'Example',
  1124. status: Mock.Random.integer(0, 1),
  1125. id: 12,
  1126. meta: {
  1127. title: '综合示例',
  1128. icon: 'vi-ep:management',
  1129. alwaysShow: true
  1130. },
  1131. children: [
  1132. {
  1133. path: 'example-detail',
  1134. component: 'views/Example/Page/ExampleDetail',
  1135. name: 'ExampleDetail',
  1136. status: Mock.Random.integer(0, 1),
  1137. id: 17,
  1138. permission: ['edit', 'add', 'delete'],
  1139. meta: {
  1140. title: '综合示例-详情',
  1141. noTagsView: true,
  1142. noCache: true,
  1143. hidden: true,
  1144. showMainRoute: true,
  1145. activeMenu: '/example/example-page',
  1146. permission: ['edit', 'add', 'delete']
  1147. }
  1148. }
  1149. ]
  1150. }
  1151. ]
  1152. ]
  1153. for (let i = 0; i < 4; i++) {
  1154. List.push(
  1155. Mock.mock({
  1156. id: toAnyString(),
  1157. // timestamp: +Mock.Random.date('T'),
  1158. roleName: roleNames[i],
  1159. role: '@first',
  1160. status: Mock.Random.integer(0, 1),
  1161. createTime: '@datetime',
  1162. remark: '@cword(10, 15)',
  1163. menu: menus[i]
  1164. })
  1165. )
  1166. }
  1167. export default [
  1168. // 列表接口
  1169. {
  1170. url: '/mock/role/list',
  1171. method: 'get',
  1172. timeout,
  1173. response: () => {
  1174. return {
  1175. code: SUCCESS_CODE,
  1176. data: adminList
  1177. }
  1178. }
  1179. },
  1180. {
  1181. url: '/mock/role/table',
  1182. method: 'get',
  1183. timeout,
  1184. response: () => {
  1185. return {
  1186. code: SUCCESS_CODE,
  1187. data: {
  1188. list: List,
  1189. total: 4
  1190. }
  1191. }
  1192. }
  1193. },
  1194. // 列表接口
  1195. {
  1196. url: '/mock/role/list2',
  1197. method: 'get',
  1198. timeout,
  1199. response: () => {
  1200. return {
  1201. code: SUCCESS_CODE,
  1202. data: testList
  1203. }
  1204. }
  1205. },
  1206. {
  1207. url: '/mock/role/table',
  1208. method: 'get',
  1209. timeout,
  1210. response: () => {
  1211. return {
  1212. code: SUCCESS_CODE,
  1213. data: {
  1214. list: List,
  1215. total: 4
  1216. }
  1217. }
  1218. }
  1219. }
  1220. ]