mock.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. import Mock from 'mockjs';
  2. import setupMock, { successResponseWrap } from '@/utils/setup-mock';
  3. import { ServiceRecord } from '@/api/list';
  4. const qualityInspectionList: ServiceRecord[] = [
  5. {
  6. id: 1,
  7. name: 'quality',
  8. title: '视频类-历史导入',
  9. description: '2021-10-12 00:00:00',
  10. data: [
  11. {
  12. label: '待质检数',
  13. value: '120',
  14. },
  15. {
  16. label: '积压时长',
  17. value: '60s',
  18. },
  19. {
  20. label: '待抽检数',
  21. value: '0',
  22. },
  23. ],
  24. },
  25. {
  26. id: 2,
  27. name: 'quality',
  28. title: '图文类-图片版权',
  29. description: '2021-12-11 18:30:00',
  30. data: [
  31. {
  32. label: '待质检数',
  33. value: '120',
  34. },
  35. {
  36. label: '积压时长',
  37. value: '60s',
  38. },
  39. {
  40. label: '待抽检数',
  41. value: '0',
  42. },
  43. ],
  44. },
  45. {
  46. id: 3,
  47. name: 'quality',
  48. title: '图文类-高清图片',
  49. description: '2021-10-15 08:10:00',
  50. data: [
  51. {
  52. label: '待质检数',
  53. value: '120',
  54. },
  55. {
  56. label: '积压时长',
  57. value: '60s',
  58. },
  59. {
  60. label: '待抽检数',
  61. value: '0',
  62. },
  63. ],
  64. },
  65. ];
  66. const theServiceList: ServiceRecord[] = [
  67. {
  68. id: 1,
  69. icon: 'code',
  70. title: '漏斗分析',
  71. description:
  72. '用户行为分析之漏斗分析模型是企业实现精细化运营、进行用户行为分析的重要数据分析模型。',
  73. enable: true,
  74. actionType: 'button',
  75. },
  76. {
  77. id: 2,
  78. icon: 'edit',
  79. title: '用户分布',
  80. description:
  81. '快速诊断用户人群,地域细分情况,了解数据分布的集中度,以及主要的数据分布的区间段是什么。',
  82. enable: true,
  83. actionType: 'button',
  84. expires: true,
  85. },
  86. {
  87. id: 3,
  88. icon: 'user',
  89. title: '资源分发',
  90. description:
  91. '移动端动态化资源分发解决方案。提供稳定大流量服务支持、灵活定制的分发圈选规则,通过离线化预加载。',
  92. enable: false,
  93. actionType: 'button',
  94. },
  95. {
  96. id: 4,
  97. icon: 'user',
  98. title: '用户画像分析',
  99. description:
  100. '用户画像就是将典型用户信息标签化,根据用户特征、业务场景和用户行为等信息,构建一个标签化的用户模型。',
  101. enable: true,
  102. actionType: 'button',
  103. },
  104. ];
  105. const rulesPresetList: ServiceRecord[] = [
  106. {
  107. id: 1,
  108. title: '内容屏蔽规则',
  109. description:
  110. '用户在执行特定的内容分发任务时,可使用内容屏蔽规则根据特定标签,过滤内容集合。',
  111. enable: true,
  112. actionType: 'switch',
  113. },
  114. {
  115. id: 2,
  116. title: '内容置顶规则',
  117. description:
  118. '该规则支持用户在执行特定内容分发任务时,对固定的几条内容置顶。',
  119. enable: true,
  120. actionType: 'switch',
  121. },
  122. {
  123. id: 3,
  124. title: '内容加权规则',
  125. description: '选定内容加权规则后可自定义从不同内容集合获取内容的概率。',
  126. enable: false,
  127. actionType: 'switch',
  128. },
  129. {
  130. id: 4,
  131. title: '内容分发规则',
  132. description: '内容分发时,对某些内容需要固定在C端展示的位置。',
  133. enable: true,
  134. actionType: 'switch',
  135. },
  136. {
  137. id: 5,
  138. title: '违禁内容识别',
  139. description: '精准识别赌博、刀枪、毒品、造假、贩假等违规物品和违规行为。',
  140. enable: false,
  141. actionType: 'switch',
  142. },
  143. {
  144. id: 6,
  145. title: '多语言文字符号识别',
  146. description:
  147. '精准识别英语、维语、藏语、蒙古语、朝鲜语等多种语言以及emoji表情形态的语义识别。',
  148. enable: false,
  149. actionType: 'switch',
  150. },
  151. ];
  152. setupMock({
  153. setup() {
  154. // Quality Inspection
  155. Mock.mock(new RegExp('/api/list/quality-inspection'), () => {
  156. return successResponseWrap(
  157. qualityInspectionList.map((_, index) => ({
  158. ...qualityInspectionList[index % qualityInspectionList.length],
  159. id: Mock.Random.guid(),
  160. }))
  161. );
  162. });
  163. // the service
  164. Mock.mock(new RegExp('/api/list/the-service'), () => {
  165. return successResponseWrap(
  166. theServiceList.map((_, index) => ({
  167. ...theServiceList[index % theServiceList.length],
  168. id: Mock.Random.guid(),
  169. }))
  170. );
  171. });
  172. // rules preset
  173. Mock.mock(new RegExp('/api/list/rules-preset'), () => {
  174. return successResponseWrap(
  175. rulesPresetList.map((_, index) => ({
  176. ...rulesPresetList[index % rulesPresetList.length],
  177. id: Mock.Random.guid(),
  178. }))
  179. );
  180. });
  181. },
  182. });