index.mock.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. * @Author: 半生瓜 1515706227@qq.com
  3. * @Date: 2024-04-21 17:20:21
  4. * @LastEditors: 半生瓜 1515706227@qq.com
  5. * @LastEditTime: 2024-05-07 15:55:12
  6. * @FilePath: \vue-element-plus-admin-mini\mock\role\index.mock.ts
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. import { MockMethod } from 'vite-plugin-mock'
  10. import { SUCCESS_CODE } from '@/constants'
  11. const timeout = 1000
  12. const adminList = [
  13. {
  14. path: '/Template',
  15. component: '#',
  16. redirect: '/Template/TemplateManage',
  17. name: 'Template',
  18. meta: {
  19. title: 'router.level',
  20. },
  21. children: [
  22. {
  23. path: 'TemplateManage',
  24. name: 'TemplateManage',
  25. component: 'views/Template/TemplateManage',
  26. meta: {
  27. title: '模板管理',
  28. icon: 'ant-design:dashboard-filled',
  29. }
  30. }
  31. ]
  32. },
  33. {
  34. path: '/Resource',
  35. component: '#',
  36. redirect: '/Resource/ResourceManage',
  37. name: 'Resource',
  38. meta: {
  39. title: 'router.level'
  40. },
  41. children: [
  42. {
  43. path: 'ResourceManage',
  44. name: 'ResourceManage',
  45. component: 'views/Resource/ResourceManage',
  46. meta: {
  47. title: '资源管理',
  48. icon: 'carbon:skill-level-advanced'
  49. }
  50. }
  51. ]
  52. },
  53. {
  54. path: '/Audit',
  55. component: '#',
  56. redirect: '/Audit/AuditManage',
  57. name: 'Audit',
  58. meta: {
  59. title: '审核管理',
  60. },
  61. children: [
  62. {
  63. path: 'AuditManage',
  64. name: 'AuditManage',
  65. component: 'views/Audit/AuditManage',
  66. meta: {
  67. icon: 'ri:function-fill',
  68. title: '审核管理'
  69. }
  70. }
  71. ]
  72. },
  73. {
  74. path: '/Authority',
  75. component: '#',
  76. redirect: '/Authority/AuditManage',
  77. name: 'Authority',
  78. meta: {
  79. title: '权限管理',
  80. icon: 'eos-icons:role-binding',
  81. },
  82. children: [
  83. {
  84. path: 'User',
  85. name: 'User',
  86. component: 'views/Authority/User',
  87. meta: {
  88. title: '用户管理'
  89. }
  90. },
  91. {
  92. path: 'Role',
  93. name: 'Role',
  94. component: 'views/Authority/Role',
  95. meta: {
  96. title: '角色管理'
  97. }
  98. },
  99. ]
  100. },
  101. {
  102. path: '/System',
  103. component: '#',
  104. redirect: '/System/SystemSetting',
  105. name: 'System',
  106. meta: {
  107. title: '系统设置',
  108. },
  109. children: [
  110. {
  111. path: 'SystemSetting',
  112. name: 'SystemSetting',
  113. component: 'views/System/SystemSetting',
  114. meta: {
  115. icon: 'ic:outline-webhook',
  116. title: '系统设置'
  117. }
  118. }
  119. ]
  120. }
  121. ]
  122. const testList: string[] = [
  123. '/level',
  124. '/zy',
  125. '/zy/Menu12',
  126. '/level/menu1',
  127. '/level/menu1/menu1-1',
  128. '/level/menu1/menu1-1/menu1-1-1',
  129. '/level/menu1/menu1-2',
  130. '/level/menu2'
  131. ]
  132. export default [
  133. // 列表接口
  134. {
  135. url: '/mock/role/list',
  136. method: 'get',
  137. timeout,
  138. response: ({ query }) => {
  139. const { roleName } = query
  140. return {
  141. code: SUCCESS_CODE,
  142. data: roleName === 'admin' ? adminList : testList
  143. }
  144. }
  145. }
  146. ] as MockMethod[]