index.mock.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. import Mock from 'mockjs'
  2. import { SUCCESS_CODE } from '@/constants'
  3. const timeout = 1000
  4. export default [
  5. // 列表接口
  6. {
  7. url: '/mock/menu/list',
  8. method: 'get',
  9. timeout,
  10. response: () => {
  11. return {
  12. code: SUCCESS_CODE,
  13. data: {
  14. list: [
  15. {
  16. path: '/dashboard',
  17. component: '#',
  18. redirect: '/dashboard/analysis',
  19. name: 'Dashboard',
  20. status: Mock.Random.integer(0, 1),
  21. id: 1,
  22. type: 0,
  23. parentId: undefined,
  24. title: '首页',
  25. meta: {
  26. title: '首页',
  27. icon: 'vi-ant-design:dashboard-filled',
  28. alwaysShow: true
  29. },
  30. children: [
  31. {
  32. path: 'analysis',
  33. component: 'views/Dashboard/Analysis',
  34. name: 'Analysis',
  35. status: Mock.Random.integer(0, 1),
  36. id: 2,
  37. type: 1,
  38. parentId: 1,
  39. title: '分析页',
  40. permissionList: [
  41. {
  42. id: 1,
  43. label: '新增',
  44. value: 'add'
  45. },
  46. {
  47. id: 2,
  48. label: '编辑',
  49. value: 'edit'
  50. }
  51. ],
  52. meta: {
  53. title: '分析页',
  54. noCache: true,
  55. permission: ['add', 'edit']
  56. }
  57. },
  58. {
  59. path: 'workplace',
  60. component: 'views/Dashboard/Workplace',
  61. name: 'Workplace',
  62. status: Mock.Random.integer(0, 1),
  63. id: 3,
  64. type: 1,
  65. parentId: 1,
  66. title: '工作台',
  67. permissionList: [
  68. {
  69. id: 1,
  70. label: '新增',
  71. value: 'add'
  72. },
  73. {
  74. id: 2,
  75. label: '编辑',
  76. value: 'edit'
  77. },
  78. {
  79. id: 3,
  80. label: '删除',
  81. value: 'delete'
  82. }
  83. ],
  84. meta: {
  85. title: '工作台',
  86. noCache: true
  87. }
  88. }
  89. ]
  90. },
  91. {
  92. path: '/external-link',
  93. component: '#',
  94. meta: {
  95. title: '文档',
  96. icon: 'vi-clarity:document-solid'
  97. },
  98. name: 'ExternalLink',
  99. status: Mock.Random.integer(0, 1),
  100. id: 4,
  101. type: 0,
  102. parentId: undefined,
  103. title: '文档',
  104. children: [
  105. {
  106. path: 'https://element-plus-admin-doc.cn/',
  107. name: 'DocumentLink',
  108. status: Mock.Random.integer(0, 1),
  109. id: 5,
  110. type: 1,
  111. parentId: 4,
  112. title: '文档',
  113. meta: {
  114. title: '文档'
  115. }
  116. }
  117. ]
  118. },
  119. {
  120. path: '/level',
  121. component: '#',
  122. redirect: '/level/menu1/menu1-1/menu1-1-1',
  123. name: 'Level',
  124. status: Mock.Random.integer(0, 1),
  125. id: 6,
  126. type: 0,
  127. parentId: undefined,
  128. title: '菜单',
  129. meta: {
  130. title: '菜单',
  131. icon: 'vi-carbon:skill-level-advanced'
  132. },
  133. children: [
  134. {
  135. path: 'menu1',
  136. name: 'Menu1',
  137. component: '##',
  138. status: Mock.Random.integer(0, 1),
  139. id: 7,
  140. type: 0,
  141. parentId: 6,
  142. title: '菜单1',
  143. redirect: '/level/menu1/menu1-1/menu1-1-1',
  144. meta: {
  145. title: '菜单1'
  146. },
  147. children: [
  148. {
  149. path: 'menu1-1',
  150. name: 'Menu11',
  151. component: '##',
  152. status: Mock.Random.integer(0, 1),
  153. id: 8,
  154. type: 0,
  155. parentId: 7,
  156. title: '菜单1-1',
  157. redirect: '/level/menu1/menu1-1/menu1-1-1',
  158. meta: {
  159. title: '菜单1-1',
  160. alwaysShow: true
  161. },
  162. children: [
  163. {
  164. path: 'menu1-1-1',
  165. name: 'Menu111',
  166. component: 'views/Level/Menu111',
  167. status: Mock.Random.integer(0, 1),
  168. id: 9,
  169. type: 1,
  170. parentId: 8,
  171. title: '菜单1-1-1',
  172. meta: {
  173. title: '菜单1-1-1'
  174. }
  175. }
  176. ]
  177. },
  178. {
  179. path: 'menu1-2',
  180. name: 'Menu12',
  181. component: 'views/Level/Menu12',
  182. status: Mock.Random.integer(0, 1),
  183. id: 10,
  184. type: 1,
  185. parentId: 7,
  186. title: '菜单1-2',
  187. meta: {
  188. title: '菜单1-2'
  189. }
  190. }
  191. ]
  192. },
  193. {
  194. path: 'menu2',
  195. name: 'Menu2Demo',
  196. component: 'views/Level/Menu2',
  197. status: Mock.Random.integer(0, 1),
  198. id: 11,
  199. type: 1,
  200. parentId: 6,
  201. title: '菜单2',
  202. meta: {
  203. title: '菜单2'
  204. }
  205. }
  206. ]
  207. },
  208. {
  209. path: '/example',
  210. component: '#',
  211. redirect: '/example/example-dialog',
  212. name: 'Example',
  213. status: Mock.Random.integer(0, 1),
  214. id: 12,
  215. type: 0,
  216. parentId: undefined,
  217. title: '综合示例',
  218. meta: {
  219. title: '综合示例',
  220. icon: 'vi-ep:management',
  221. alwaysShow: true
  222. },
  223. children: [
  224. {
  225. path: 'example-dialog',
  226. component: 'views/Example/Dialog/ExampleDialog',
  227. name: 'ExampleDialog',
  228. status: Mock.Random.integer(0, 1),
  229. id: 13,
  230. type: 1,
  231. parentId: 12,
  232. title: '综合示例-弹窗',
  233. permissionList: [
  234. {
  235. id: 1,
  236. label: '新增',
  237. value: 'add'
  238. },
  239. {
  240. id: 2,
  241. label: '编辑',
  242. value: 'edit'
  243. },
  244. {
  245. id: 3,
  246. label: '删除',
  247. value: 'delete'
  248. },
  249. {
  250. id: 4,
  251. label: '查看',
  252. value: 'view'
  253. }
  254. ],
  255. meta: {
  256. title: '综合示例-弹窗'
  257. }
  258. },
  259. {
  260. path: 'example-page',
  261. component: 'views/Example/Page/ExamplePage',
  262. name: 'ExamplePage',
  263. status: Mock.Random.integer(0, 1),
  264. id: 14,
  265. type: 1,
  266. parentId: 12,
  267. title: '综合示例-页面',
  268. permissionList: [
  269. {
  270. id: 1,
  271. label: '新增',
  272. value: 'add'
  273. },
  274. {
  275. id: 2,
  276. label: '编辑',
  277. value: 'edit'
  278. },
  279. {
  280. id: 3,
  281. label: '删除',
  282. value: 'delete'
  283. },
  284. {
  285. id: 4,
  286. label: '查看',
  287. value: 'view'
  288. }
  289. ],
  290. meta: {
  291. title: '综合示例-页面'
  292. }
  293. },
  294. {
  295. path: 'example-add',
  296. component: 'views/Example/Page/ExampleAdd',
  297. name: 'ExampleAdd',
  298. status: Mock.Random.integer(0, 1),
  299. id: 15,
  300. type: 1,
  301. parentId: 12,
  302. title: '综合示例-新增',
  303. meta: {
  304. title: '综合示例-新增',
  305. noTagsView: true,
  306. noCache: true,
  307. hidden: true,
  308. showMainRoute: true,
  309. activeMenu: '/example/example-page'
  310. }
  311. },
  312. {
  313. path: 'example-edit',
  314. component: 'views/Example/Page/ExampleEdit',
  315. name: 'ExampleEdit',
  316. status: Mock.Random.integer(0, 1),
  317. id: 16,
  318. type: 1,
  319. parentId: 12,
  320. title: '综合示例-编辑',
  321. meta: {
  322. title: '综合示例-编辑',
  323. noTagsView: true,
  324. noCache: true,
  325. hidden: true,
  326. showMainRoute: true,
  327. activeMenu: '/example/example-page'
  328. }
  329. },
  330. {
  331. path: 'example-detail',
  332. component: 'views/Example/Page/ExampleDetail',
  333. name: 'ExampleDetail',
  334. status: Mock.Random.integer(0, 1),
  335. id: 17,
  336. type: 1,
  337. parentId: 12,
  338. title: '综合示例-详情',
  339. meta: {
  340. title: '综合示例-详情',
  341. noTagsView: true,
  342. noCache: true,
  343. hidden: true,
  344. showMainRoute: true,
  345. activeMenu: '/example/example-page'
  346. }
  347. }
  348. ]
  349. }
  350. ]
  351. }
  352. }
  353. }
  354. }
  355. ]