remote-search.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  5. // +----------------------------------------------------------------------
  6. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  7. // +----------------------------------------------------------------------
  8. // | Author: CRMEB Team <admin@crmeb.com>
  9. // +----------------------------------------------------------------------
  10. import Mock from 'mockjs'
  11. const NameList = []
  12. const count = 100
  13. for (let i = 0; i < count; i++) {
  14. NameList.push(Mock.mock({
  15. name: '@first'
  16. }))
  17. }
  18. NameList.push({ name: 'mock-Pan' })
  19. export default [
  20. // username search
  21. {
  22. url: '/vue-element-admin/search/user',
  23. type: 'get',
  24. response: config => {
  25. const { name } = config.query
  26. const mockNameList = NameList.filter(item => {
  27. const lowerCaseName = item.name.toLowerCase()
  28. return !(name && lowerCaseName.indexOf(name.toLowerCase()) < 0)
  29. })
  30. return {
  31. code: 20000,
  32. data: { items: mockNameList }
  33. }
  34. }
  35. },
  36. // transaction list
  37. {
  38. url: '/vue-element-admin/transaction/list',
  39. type: 'get',
  40. response: _ => {
  41. return {
  42. code: 20000,
  43. data: {
  44. total: 20,
  45. 'items|20': [{
  46. order_no: '@guid()',
  47. timestamp: +Mock.Random.date('T'),
  48. username: '@name()',
  49. price: '@float(1000, 15000, 0, 2)',
  50. 'status|1': ['success', 'pending']
  51. }]
  52. }
  53. }
  54. }
  55. }
  56. ]