index.ts 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import { config } from '@/config/axios/config'
  2. import { MockMethod } from 'vite-plugin-mock'
  3. const { result_code } = config
  4. const timeout = 0
  5. export default [
  6. // 分析页统计接口
  7. {
  8. url: '/analysis/total',
  9. method: 'get',
  10. timeout,
  11. response: () => {
  12. return {
  13. code: result_code,
  14. data: {
  15. users: 102400,
  16. messages: 81212,
  17. moneys: 9280,
  18. shoppings: 13600
  19. }
  20. }
  21. }
  22. },
  23. // 用户来源
  24. {
  25. url: '/analysis/userAccessSource',
  26. method: 'get',
  27. timeout,
  28. response: () => {
  29. return {
  30. code: result_code,
  31. data: [
  32. { value: 10, name: 'analysis.directAccess' },
  33. { value: 310, name: 'analysis.mailMarketing' },
  34. { value: 234, name: 'analysis.allianceAdvertising' },
  35. { value: 135, name: 'analysis.videoAdvertising' },
  36. { value: 1548, name: 'analysis.searchEngines' }
  37. ]
  38. }
  39. }
  40. },
  41. // 每周用户活跃量
  42. {
  43. url: '/analysis/weeklyUserActivity',
  44. method: 'get',
  45. timeout,
  46. response: () => {
  47. return {
  48. code: result_code,
  49. data: [
  50. { value: 13253, name: 'analysis.monday' },
  51. { value: 34235, name: 'analysis.tuesday' },
  52. { value: 26321, name: 'analysis.wednesday' },
  53. { value: 12340, name: 'analysis.thursday' },
  54. { value: 24643, name: 'analysis.friday' },
  55. { value: 1322, name: 'analysis.saturday' },
  56. { value: 1324, name: 'analysis.sunday' }
  57. ]
  58. }
  59. }
  60. },
  61. // 每月销售额
  62. {
  63. url: '/analysis/monthlySales',
  64. method: 'get',
  65. timeout,
  66. response: () => {
  67. return {
  68. code: result_code,
  69. data: [
  70. { estimate: 100, actual: 120, name: 'analysis.january' },
  71. { estimate: 120, actual: 82, name: 'analysis.february' },
  72. { estimate: 161, actual: 91, name: 'analysis.march' },
  73. { estimate: 134, actual: 154, name: 'analysis.april' },
  74. { estimate: 105, actual: 162, name: 'analysis.may' },
  75. { estimate: 160, actual: 140, name: 'analysis.june' },
  76. { estimate: 165, actual: 145, name: 'analysis.july' },
  77. { estimate: 114, actual: 250, name: 'analysis.august' },
  78. { estimate: 163, actual: 134, name: 'analysis.september' },
  79. { estimate: 185, actual: 56, name: 'analysis.october' },
  80. { estimate: 118, actual: 99, name: 'analysis.november' },
  81. { estimate: 123, actual: 123, name: 'analysis.december' }
  82. ]
  83. }
  84. }
  85. }
  86. ] as MockMethod[]