index.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. import { MockMethod } from 'vite-plugin-mock';
  2. import Mock from 'mockjs';
  3. export default [
  4. {
  5. url: '/api/get-purchase-list',
  6. method: 'get',
  7. response: () => ({
  8. code: 0,
  9. data: {
  10. ...Mock.mock({
  11. 'list|1-100': [
  12. {
  13. index: /S20201228115950[0-9][0-9][0-9]/,
  14. pdName: 'Macbook',
  15. pdNum: 'p_tmp_60a637cd0d',
  16. 'purchaseNum|1-100': 100,
  17. adminName: '财务部111',
  18. updateTime: '2020-05-20@date("HH:mm:ss")',
  19. pdType: '电子产品',
  20. },
  21. {
  22. index: /S20201228115950[0-9][0-9][0-9]/,
  23. pdName: 'Macbook',
  24. pdNum: 'p_tmp_60a637cd0d',
  25. 'purchaseNum|1-100': 100,
  26. adminName: '财务部',
  27. updateTime: '2020-05-20@date("HH:mm:ss")',
  28. },
  29. ],
  30. }),
  31. },
  32. }),
  33. },
  34. {
  35. url: '/api/get-list',
  36. method: 'get',
  37. response: () => ({
  38. code: 0,
  39. data: {
  40. ...Mock.mock({
  41. 'list|1-100': [
  42. {
  43. 'index|+1': 1,
  44. 'status|1': '@natural(0, 4)',
  45. no: 'BH00@natural(01, 100)',
  46. name: '@city()办公用品采购项目',
  47. 'paymentType|1': '@natural(0, 1)',
  48. 'contractType|1': '@natural(0, 2)',
  49. updateTime: '2020-05-30 @date("HH:mm:ss")',
  50. amount: '@natural(10, 500),000,000',
  51. adminName: '@cname()',
  52. },
  53. ],
  54. }),
  55. },
  56. }),
  57. },
  58. {
  59. url: '/api/detail-basic',
  60. method: 'get',
  61. response: () => ({
  62. code: 0,
  63. data: {
  64. ...Mock.mock({
  65. name: 'td_20023747',
  66. loginType: 'Web',
  67. currentRole: 'Admin',
  68. rightsList: '通用权限',
  69. userStatus: '启用',
  70. language: '简体中文',
  71. timeZone: '(GMT+08:00)中国时区—北京(Asia/Beijing)',
  72. }),
  73. },
  74. }),
  75. },
  76. {
  77. url: '/api/get-card-list',
  78. method: 'get',
  79. response: () => ({
  80. code: 0,
  81. data: {
  82. ...Mock.mock({
  83. 'list|48-50': [
  84. {
  85. 'index|+1': 1,
  86. isSetup: '@boolean',
  87. 'type|1': '@natural(1, 5)',
  88. 'banner|1': [
  89. 'https://tdesign.gtimg.com/starter/cloud-db.jpg',
  90. 'https://tdesign.gtimg.com/starter/cloud-server.jpg',
  91. 'https://tdesign.gtimg.com/starter/ssl.jpg',
  92. 'https://tdesign.gtimg.com/starter/t-sec.jpg',
  93. 'https://tdesign.gtimg.com/starter/face-recognition.jpg',
  94. ],
  95. 'name|1': ['人脸识别', 'SSL证书', 'CVM', '云数据库', 'T-Sec 云防火墙'],
  96. 'description|1': [
  97. '基于腾讯优图强大的面部分析技术,提供包括人脸检测与分析、五官定位、人脸搜索、人脸比对、人脸',
  98. '云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗',
  99. 'SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部',
  100. '腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客',
  101. '云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。',
  102. ],
  103. },
  104. ],
  105. }),
  106. },
  107. }),
  108. },
  109. {
  110. url: '/api/get-project-list',
  111. method: 'get',
  112. response: () => ({
  113. code: 0,
  114. data: {
  115. ...Mock.mock({
  116. 'list|1-50': [
  117. {
  118. 'index|+1': 1,
  119. adminPhone: '+86 13587609955',
  120. updateTime: '2020-05-30 @date("HH:mm:ss")',
  121. 'adminName|1': ['顾娟 ', '常刚', '郑洋'],
  122. 'name|1': [
  123. '沧州市办公用品采购项目',
  124. '红河哈尼族彝族自治州办公用品采购项目 ',
  125. '铜川市办公用品采购项目',
  126. '陇南市办公用品采购项目 ',
  127. '六安市办公用品采购项目 ',
  128. ],
  129. },
  130. ],
  131. }),
  132. },
  133. }),
  134. },
  135. {
  136. url: '/api/post',
  137. method: 'post',
  138. timeout: 2000,
  139. response: {
  140. code: 0,
  141. data: {
  142. name: 'vben',
  143. },
  144. },
  145. },
  146. ] as MockMethod[];