roleManagement.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const List = [
  2. {
  3. id: "@id",
  4. role: "admin",
  5. },
  6. {
  7. id: "@id",
  8. role: "editor",
  9. },
  10. ];
  11. module.exports = [
  12. {
  13. url: "/roleManagement/getList",
  14. type: "get",
  15. response(config) {
  16. const { role, pageNo = 1, pageSize = 20 } = config.query;
  17. let mockList = List.filter((item) => {
  18. if (role && item.title.indexOf(role) < 0) return false;
  19. return true;
  20. });
  21. const pageList = mockList.filter(
  22. (item, index) =>
  23. index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
  24. );
  25. return {
  26. code: 200,
  27. msg: "success",
  28. totalCount: mockList.length,
  29. data: pageList,
  30. };
  31. },
  32. },
  33. {
  34. url: "/roleManagement/doEdit",
  35. type: "post",
  36. response(config) {
  37. return {
  38. code: 200,
  39. msg: "模拟保存成功",
  40. };
  41. },
  42. },
  43. {
  44. url: "/roleManagement/doDelete",
  45. type: "post",
  46. response(config) {
  47. return {
  48. code: 200,
  49. msg: "模拟删除成功",
  50. };
  51. },
  52. },
  53. ];