B5Topic.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { TopicAddType } from "@/types";
  2. import http from "@/utils/http";
  3. import { AppDispatch } from "..";
  4. /**
  5. * 获取列表数据
  6. */
  7. export const getTopicListAPI = (data: any) => {
  8. return async (dispatch: AppDispatch) => {
  9. const res = await http.post("cms/question/pageList", data);
  10. if (res.code === 0) {
  11. dispatch({
  12. type: "topic/getList",
  13. payload: { list: res.data.records, total: res.data.total },
  14. });
  15. }
  16. };
  17. };
  18. /**
  19. * 内容-是否显示
  20. */
  21. export const topicDisplayAPI = (id: number, display: number) => {
  22. return http.get(`cms/question/display/${id}/${display}`);
  23. };
  24. /**
  25. * 删除表格
  26. */
  27. export const topicRemoveAPI = (id: number) => {
  28. return http.get(`cms/question/remove/${id}`);
  29. };
  30. /**
  31. * 搜索文物列表
  32. */
  33. export const topicGoodsSearchAPI = (name: string) => {
  34. return http.get(`cms/question/goods/search/${name}`);
  35. };
  36. /**
  37. * 新增和编辑题目
  38. */
  39. export const topicSaveAPI = (data: TopicAddType) => {
  40. return http.post("cms/question/save", data);
  41. };
  42. /**
  43. * 通过id获取详情
  44. */
  45. export const getTopicDetailAPI = (id: number) => {
  46. return http.get(`cms/question/detail/${id}`);
  47. };
  48. /**
  49. * 通过id获取详情
  50. */
  51. export const topicGetBindingAPI = (goodsId: number) => {
  52. return http.get(`cms/question/getBinding/${goodsId}`);
  53. };