index.mock.ts 928 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { SUCCESS_CODE } from '@/constants'
  2. const timeout = 1000
  3. const dictObj: Recordable = {
  4. importance: [
  5. {
  6. value: 0,
  7. label: 'tableDemo.commonly'
  8. },
  9. {
  10. value: 1,
  11. label: 'tableDemo.good'
  12. },
  13. {
  14. value: 2,
  15. label: 'tableDemo.important'
  16. }
  17. ]
  18. }
  19. export default [
  20. // 字典接口
  21. {
  22. url: '/mock/dict/list',
  23. method: 'get',
  24. timeout,
  25. response: () => {
  26. return {
  27. code: SUCCESS_CODE,
  28. data: dictObj
  29. }
  30. }
  31. },
  32. // 获取某个字典
  33. {
  34. url: '/mock/dict/one',
  35. method: 'get',
  36. timeout,
  37. response: () => {
  38. return {
  39. code: SUCCESS_CODE,
  40. data: [
  41. {
  42. label: 'test1',
  43. value: 0
  44. },
  45. {
  46. label: 'test2',
  47. value: 1
  48. },
  49. {
  50. label: 'test3',
  51. value: 2
  52. }
  53. ]
  54. }
  55. }
  56. }
  57. ]