api.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. import { imgMap, getUrlParams } from './utils';
  2. export function fakeList(count) {
  3. const titles = [
  4. '凤蝶',
  5. 'AntDesignPro',
  6. 'DesignLab',
  7. 'Basement',
  8. 'AntDesign',
  9. '云雀',
  10. '体验云',
  11. 'AntDesignMobile',
  12. ];
  13. const avatars = [
  14. 'https://gw.alipayobjects.com/zos/rmsportal/hYjIZrUoBfNxOAYBVDfc.png', // 凤蝶
  15. 'https://gw.alipayobjects.com/zos/rmsportal/HHWPIzPLCLYmVuPivyiA.png', // 云雀
  16. 'https://gw.alipayobjects.com/zos/rmsportal/irqByKtOdKfDojxIWTXF.png', // Basement
  17. 'https://gw.alipayobjects.com/zos/rmsportal/VcmdbCBcwPTGYgbYeMzX.png', // DesignLab
  18. ];
  19. const covers = [
  20. 'https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png',
  21. 'https://gw.alipayobjects.com/zos/rmsportal/xMPpMvGSIXusgtgUPAdw.png',
  22. 'https://gw.alipayobjects.com/zos/rmsportal/hQReiajgtqzIVFjLXjHp.png',
  23. 'https://gw.alipayobjects.com/zos/rmsportal/nczfTaXEzhSpvgZZjBev.png',
  24. ];
  25. const list = [];
  26. for (let i = 0; i < count; i += 1) {
  27. list.push({
  28. id: `fake-list-${i}`,
  29. owner: '曲丽丽',
  30. title: titles[i % 8],
  31. avatar: avatars[i % 4],
  32. cover: covers[i % 4],
  33. status: ['active', 'exception', 'normal'][i % 3],
  34. percent: Math.ceil(Math.random() * 50) + 50,
  35. logo: ['https://gw.alipayobjects.com/zos/rmsportal/KoJjkdbuTFxzJmmjuDVR.png', 'https://gw.alipayobjects.com/zos/rmsportal/UxGORCvEXJEsxOfEKZiA.png'][i % 2],
  36. href: 'https://ant.design',
  37. updatedAt: new Date(new Date().getTime() - (1000 * 60 * 60 * 2 * i)),
  38. createdAt: new Date(new Date().getTime() - (1000 * 60 * 60 * 2 * i)),
  39. subDescription: '一句话描述一句话描述',
  40. description: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',
  41. activeUser: Math.ceil(Math.random() * 100000) + 100000,
  42. newUser: Math.ceil(Math.random() * 1000) + 1000,
  43. star: Math.ceil(Math.random() * 100) + 100,
  44. like: Math.ceil(Math.random() * 100) + 100,
  45. message: Math.ceil(Math.random() * 10) + 10,
  46. content: '段落示意:蚂蚁金服设计平台 design.alipay.com,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 design.alipay.com,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。',
  47. members: [
  48. {
  49. avatar: 'https://gw.alipayobjects.com/zos/rmsportal/WPOxPBHGyqsgKPsFtVlJ.png',
  50. name: '王昭君',
  51. },
  52. {
  53. avatar: 'https://gw.alipayobjects.com/zos/rmsportal/WPOxPBHGyqsgKPsFtVlJ.png',
  54. name: '王昭君',
  55. },
  56. {
  57. avatar: 'https://gw.alipayobjects.com/zos/rmsportal/WPOxPBHGyqsgKPsFtVlJ.png',
  58. name: '王昭君',
  59. },
  60. {
  61. avatar: 'https://gw.alipayobjects.com/zos/rmsportal/WPOxPBHGyqsgKPsFtVlJ.png',
  62. name: '王昭君',
  63. },
  64. ],
  65. });
  66. }
  67. return list;
  68. }
  69. export function getFakeList(req, res, u) {
  70. let url = u;
  71. if (!url || Object.prototype.toString.call(url) !== '[object String]') {
  72. url = req.url;
  73. }
  74. const params = getUrlParams(url);
  75. const count = (params.count * 1) || 20;
  76. const result = fakeList(count);
  77. if (res && res.json) {
  78. res.json(result);
  79. } else {
  80. return result;
  81. }
  82. }
  83. export const getNotice = [
  84. {
  85. id: 'xxx1',
  86. title: '消息列表体验优化',
  87. logo: imgMap.b,
  88. description: '这是一条描述信息这是一条描述信息',
  89. updatedAt: new Date(),
  90. member: '蜂鸟项目组',
  91. },
  92. {
  93. id: 'xxx2',
  94. title: 'XX 平台',
  95. logo: imgMap.c,
  96. description: '这是一条描述信息',
  97. updatedAt: new Date('2017-07-24 11:00:00'),
  98. member: '凤蝶精英小分队',
  99. },
  100. {
  101. id: 'xxx3',
  102. title: '消息列表体验优化',
  103. logo: imgMap.a,
  104. description: '这是一条描述信息这是一条描述信息',
  105. updatedAt: new Date(),
  106. member: '蜂鸟项目组',
  107. },
  108. {
  109. id: 'xxx4',
  110. title: '文档中心1',
  111. logo: imgMap.a,
  112. description: '这是一条描述信息这是一条描述信息',
  113. updatedAt: new Date('2017-07-23 06:23:00'),
  114. member: '成都超级小分队',
  115. },
  116. {
  117. id: 'xxx5',
  118. title: '文档中心2',
  119. logo: imgMap.b,
  120. description: '这是一条描述信息这是一条描述信息',
  121. updatedAt: new Date('2017-07-23 06:23:00'),
  122. member: '成都超级小分队',
  123. },
  124. {
  125. id: 'xxx6',
  126. title: '智能运营中心',
  127. logo: imgMap.c,
  128. description: '这是一条描述信息这是一条描述信息',
  129. updatedAt: new Date('2017-07-23 06:23:00'),
  130. member: '成都超级小分队',
  131. },
  132. ];
  133. export const getActivities = [
  134. {
  135. id: 'trend-1',
  136. updatedAt: new Date(),
  137. user: {
  138. name: '林东东',
  139. avatar: imgMap.a,
  140. },
  141. action: '在 [凤蝶精英小分队](http://github.com/) 新建项目 [六月迭代](http://github.com/)',
  142. },
  143. {
  144. id: 'trend-2',
  145. updatedAt: new Date(),
  146. user: {
  147. name: '林嘻嘻',
  148. avatar: imgMap.c,
  149. },
  150. action: '在 [凤蝶精英小分队](http://github.com/) 新建项目 [六月迭代](http://github.com/)',
  151. },
  152. {
  153. id: 'trend-3',
  154. updatedAt: new Date(),
  155. user: {
  156. name: '林囡囡',
  157. avatar: imgMap.b,
  158. },
  159. action: '在 [凤蝶精英小分队](http://github.com/) 新建项目 [六月迭代](http://github.com/)',
  160. },
  161. {
  162. id: 'trend-4',
  163. updatedAt: new Date(),
  164. user: {
  165. name: '林贝贝',
  166. avatar: imgMap.c,
  167. },
  168. action: '在 [5 月日常迭代](http://github.com/) 更新至已发布状态',
  169. },
  170. {
  171. id: 'trend-5',
  172. updatedAt: new Date(),
  173. user: {
  174. name: '林忠忠',
  175. avatar: imgMap.a,
  176. },
  177. action: '在 [工程效能](http://github.com/) 发布了 [留言](http://github.com/)',
  178. },
  179. {
  180. id: 'trend-6',
  181. updatedAt: new Date(),
  182. user: {
  183. name: '林呜呜',
  184. avatar: imgMap.d,
  185. },
  186. action: '在 [云雀](http://github.com/) 新建项目 [品牌迭代](http://github.com/)',
  187. },
  188. ];
  189. export default {
  190. getNotice,
  191. getActivities,
  192. getFakeList,
  193. };