import { $httpWithMsg } from "../../plugins/axios"; import { QUESTION_API } from "@/constants/constants.js"; const transformFormData = (datas) => { let formData = new FormData(); Object.keys(datas).forEach((k) => { formData.append(k, datas[k]); }); return formData; }; // synthesis paper export const synthesizePaperPageListApi = (datas) => { return $httpWithMsg.post( `${QUESTION_API}/synthesize/paper/page`, transformFormData(datas) ); }; export const synthesizePaperDeleteApi = (ids) => { return $httpWithMsg.post( QUESTION_API + "/synthesize/paper/delete", {}, { params: { ids: ids.join() }, } ); }; export const synthesizePaperDownloadApi = (datas) => { return $httpWithMsg.post( QUESTION_API + "/synthesize/paper/download", transformFormData(datas), { responseType: "blob", } ); }; export const synthesizePaperPreviewApi = (synthesizePaperId) => { return $httpWithMsg.get(QUESTION_API + "/synthesize/paper/preview", { params: { synthesizePaperId }, responseType: "blob", }); }; export const paperPageListApi = (datas) => { return $httpWithMsg.post( `${QUESTION_API}/synthesize/paper/source/page`, transformFormData(datas) ); // return $httpWithMsg.post(`${QUESTION_API}/user/assignteacher/1/100`, datas); }; export const courseQueryApi = (name, enable) => { return $httpWithMsg.get(`${QUESTION_API}/course/query`, { params: { name, enable: enable || undefined, }, }); }; export const synthesisBuildPaperApi = (datas) => { return $httpWithMsg.post(`${QUESTION_API}/synthesize/paper/build`, datas); }; // export const orgAiTransactionListApi = (rootOrgId) => { return $httpWithMsg.post( `${QUESTION_API}/ai/transaction/list`, {}, { params: { rootOrgId } } ); }; export const orgAiTransactionSaveApi = (datas) => { return $httpWithMsg.post(`${QUESTION_API}/ai/transaction/save`, datas); }; // course export const courseExportApi = (params) => { return $httpWithMsg.get(QUESTION_API + "/course/export", { params, responseType: "blob", }); }; export const courseOurlineImportApi = (data, headData) => { return $httpWithMsg.post(QUESTION_API + "/course/outline/upload", data, { headers: headData, }); };