param.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import Mock from 'mockjs'
  2. function getFakeList() {
  3. const json = {code: 200, success: true, msg: '操作成功'};
  4. const list = [];
  5. list.push(
  6. {
  7. id: '1',
  8. paramName: '是否开启注册功能--mock测试',
  9. paramKey: 'account.registerUser',
  10. paramValue: 'true',
  11. remark: '描述',
  12. },
  13. {
  14. id: '2',
  15. paramName: '账号初始密码--mock测试',
  16. paramKey: 'account.initPassword',
  17. paramValue: '123456',
  18. remark: '描述',
  19. }
  20. );
  21. json.data = {
  22. total: 10,
  23. size: 10,
  24. current: 1,
  25. searchCount: true,
  26. pages: 1,
  27. records: list,
  28. };
  29. return json;
  30. }
  31. function getFakeDetail() {
  32. const json = {code: 200, success: true, msg: '操作成功'};
  33. json.data = {
  34. id: '1',
  35. paramName: '是否开启注册功能',
  36. paramKey: 'account.registerUser',
  37. paramValue: 'true',
  38. remark: '描述',
  39. };
  40. return json;
  41. }
  42. function fakeSuccess() {
  43. return {code: 200, success: true, msg: '操作成功'};
  44. }
  45. export default ({mock}) => {
  46. if (!mock) return;
  47. Mock.mock(/\/api\/blade-system\/param\/list/, 'get', getFakeList);
  48. Mock.mock(/\/api\/blade-system\/param\/detail/, 'get', getFakeDetail);
  49. Mock.mock(/\/api\/blade-system\/param\/submit/, 'post', fakeSuccess);
  50. Mock.mock(/\/api\/blade-system\/param\/remove/, 'post', fakeSuccess);
  51. }