import { TopicAddType } from "@/types"; import http from "@/utils/http"; import { AppDispatch } from ".."; /** * 获取列表数据 */ export const getTopicListAPI = (data: any) => { return async (dispatch: AppDispatch) => { const res = await http.post("cms/question/pageList", data); if (res.code === 0) { dispatch({ type: "topic/getList", payload: { list: res.data.records, total: res.data.total }, }); } }; }; /** * 内容-是否显示 */ export const topicDisplayAPI = (id: number, display: number) => { return http.get(`cms/question/display/${id}/${display}`); }; /** * 删除表格 */ export const topicRemoveAPI = (id: number) => { return http.get(`cms/question/remove/${id}`); }; /** * 搜索文物列表 */ export const topicGoodsSearchAPI = (name: string) => { return http.get(`cms/question/goods/search/${name}`); }; /** * 新增和编辑题目 */ export const topicSaveAPI = (data: TopicAddType) => { return http.post("cms/question/save", data); }; /** * 通过id获取详情 */ export const getTopicDetailAPI = (id: number) => { return http.get(`cms/question/detail/${id}`); }; /** * 通过id获取详情 */ export const topicGetBindingAPI = (goodsId: number) => { return http.get(`cms/question/getBinding/${goodsId}`); };