resource.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { randomSelectOne, randomSelectN } from './utils';
  2. const lodash = require('lodash');
  3. const Mock = require('mockjs');
  4. const Random = Mock.Random;
  5. let imageDatabase = []; //图片资源库
  6. let videoDatabase = []; //视频资源库
  7. const baseImageData = [{
  8. id: 1,
  9. code: 'J-02-01-612101',
  10. name: '破解表情密码01',
  11. size: 90,
  12. status: 'NORMAL',
  13. gmtCreated: Random.datetime('yyyy-MM-dd'),
  14. gmtModified: Random.datetime('yyyy-MM-dd'),
  15. url: 'http://efunimgs.oss-cn-beijing.aliyuncs.com/resources/J/02/01/612102.jpg',
  16. },{
  17. id: 2,
  18. code: 'J-02-01-612102',
  19. name: '破解表情秘码02',
  20. size: 90,
  21. status: 'NORMAL',
  22. gmtCreated: Random.datetime('yyyy-MM-dd'),
  23. gmtModified: Random.datetime('yyyy-MM-dd'),
  24. url: 'http://efunimgs.oss-cn-beijing.aliyuncs.com/resources/J/02/01/612101.jpg',
  25. },{
  26. id: 3,
  27. code: 'J-02-01-611901',
  28. name: '看得见的旗语01',
  29. size: 90,
  30. status: 'NORMAL',
  31. gmtCreated: Random.datetime('yyyy-MM-dd'),
  32. gmtModified: Random.datetime('yyyy-MM-dd'),
  33. url: 'http://efunimgs.oss-cn-beijing.aliyuncs.com/resources/J/02/01/611901.jpg',
  34. }];
  35. const baseVideoData = [{
  36. id: 1,
  37. code: 'J-03-02-600149',
  38. name: '自制保险箱',
  39. size: 90,
  40. status: 'NORAML',
  41. gmtCreated: Random.datetime('yyyy-MM-dd'),
  42. gmtModified: Random.datetime('yyyy-MM-dd'),
  43. url: 'http://efunvideo.ai160.com/vs2m/015/01503009/01503009031/01503009031.m3u8',
  44. }];
  45. for (let i = 1; i < 200; i++) {
  46. let imageItem = randomSelectOne(baseImageData);
  47. let videoItem = randomSelectOne(baseVideoData);
  48. let imgTmp = lodash.cloneDeep(imageItem);
  49. let videoTmp = lodash.cloneDeep(videoItem);
  50. imgTmp.key = i;
  51. videoTmp.key = i;
  52. imageDatabase.push(imgTmp);
  53. videoDatabase.push(videoTmp);
  54. }
  55. module.exports = {
  56. imageDatabase,
  57. videoDatabase,
  58. }