A1Project.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import http from "@/utils/http";
  2. import { AppDispatch } from "..";
  3. /**
  4. * 获取列表
  5. */
  6. export const A1_APIgetList = (data: any) => {
  7. return async (dispatch: AppDispatch) => {
  8. const res = await http.post("cms/project/pageList", data);
  9. if (res.code === 0) {
  10. const obj = {
  11. list: res.data.records,
  12. total: res.data.total,
  13. };
  14. dispatch({ type: "A1/getList", payload: obj });
  15. }
  16. };
  17. };
  18. /**
  19. * 新增、编辑 项目
  20. */
  21. export const A2_APIaddProject = (data: any) => {
  22. return http.post("cms/project/save", data);
  23. };
  24. /**
  25. * 通过id获取项目详情
  26. */
  27. export const A2_APIgetInfoById = (id: number) => {
  28. return http.get(`cms/project/detail/${id}`);
  29. };
  30. /**
  31. * 通过id删除项目
  32. */
  33. export const A2_APIdelProject = (id: number) => {
  34. return http.get(`cms/project/remove/${id}`);
  35. };
  36. /**
  37. * 通过id删除项目
  38. */
  39. export const A2_APIgetDownList = (id: number) => {
  40. return http.get(`cms/inside/download/echoList/${id}`);
  41. };
  42. // -------------------------- 项目文件
  43. /**
  44. * 获取 左侧一级 写死目录
  45. */
  46. export const A2_APIOgetHardCoded = () => {
  47. return async (dispatch: AppDispatch) => {
  48. const res = await http.get("cms/item/getHardCoded");
  49. if (res.code === 0) {
  50. dispatch({ type: "A1/outLeftArr", payload: res.data });
  51. }
  52. };
  53. };
  54. /**
  55. * 新增、修改
  56. */
  57. export const A2_APIOadd = (data: any) => {
  58. return http.post("cms/item/save", data);
  59. };
  60. /**
  61. * 获取列表
  62. */
  63. export const A1_APIOgetList = (data: any) => {
  64. return async (dispatch: AppDispatch) => {
  65. const res = await http.post("cms/item/pageList", data);
  66. if (res.code === 0) {
  67. const obj = {
  68. list: res.data.records,
  69. total: res.data.total,
  70. };
  71. dispatch({ type: "A1/outTableArr", payload: obj });
  72. }
  73. };
  74. };
  75. /**
  76. * 批量下载
  77. */
  78. export const A2_APIOdownload = (ids: string) => {
  79. return http.get(`cms/item/download/${ids}`);
  80. };
  81. /**
  82. * 批量下载
  83. */
  84. export const A2_APIOdel = (id: number) => {
  85. return http.get(`cms/item/remove/${id}`);
  86. };