api.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import { $httpWithMsg } from "../../plugins/axios";
  2. import { QUESTION_API } from "@/constants/constants.js";
  3. const transformFormData = (datas) => {
  4. let formData = new FormData();
  5. Object.keys(datas).forEach((k) => {
  6. formData.append(k, datas[k]);
  7. });
  8. return formData;
  9. };
  10. // synthesis paper
  11. export const synthesizePaperPageListApi = (datas) => {
  12. return $httpWithMsg.post(
  13. `${QUESTION_API}/synthesize/paper/page`,
  14. transformFormData(datas)
  15. );
  16. };
  17. export const synthesizePaperDeleteApi = (ids) => {
  18. return $httpWithMsg.post(
  19. QUESTION_API + "/synthesize/paper/delete",
  20. {},
  21. {
  22. params: { ids: ids.join() },
  23. }
  24. );
  25. };
  26. export const synthesizePaperDownloadApi = (datas) => {
  27. return $httpWithMsg.post(
  28. QUESTION_API + "/synthesize/paper/download",
  29. transformFormData(datas),
  30. {
  31. responseType: "blob",
  32. }
  33. );
  34. };
  35. export const synthesizePaperPreviewApi = (synthesizePaperId) => {
  36. return $httpWithMsg.get(QUESTION_API + "/synthesize/paper/preview", {
  37. params: { synthesizePaperId },
  38. responseType: "blob",
  39. });
  40. };
  41. export const paperPageListApi = (datas) => {
  42. return $httpWithMsg.post(
  43. `${QUESTION_API}/synthesize/paper/source/page`,
  44. transformFormData(datas)
  45. );
  46. // return $httpWithMsg.post(`${QUESTION_API}/user/assignteacher/1/100`, datas);
  47. };
  48. export const courseQueryApi = (name, enable) => {
  49. return $httpWithMsg.get(`${QUESTION_API}/course/query`, {
  50. params: {
  51. name,
  52. enable: enable || undefined,
  53. },
  54. });
  55. };
  56. export const synthesisBuildPaperApi = (datas) => {
  57. return $httpWithMsg.post(`${QUESTION_API}/synthesize/paper/build`, datas);
  58. };
  59. //
  60. export const orgAiTransactionListApi = (rootOrgId) => {
  61. return $httpWithMsg.post(
  62. `${QUESTION_API}/ai/transaction/list`,
  63. {},
  64. { params: { rootOrgId } }
  65. );
  66. };
  67. export const orgAiTransactionSaveApi = (datas) => {
  68. return $httpWithMsg.post(`${QUESTION_API}/ai/transaction/save`, datas);
  69. };
  70. // course
  71. export const courseExportApi = (params) => {
  72. return $httpWithMsg.get(QUESTION_API + "/course/export", {
  73. params,
  74. responseType: "blob",
  75. });
  76. };
  77. export const courseOurlineImportApi = (data, headData) => {
  78. return $httpWithMsg.post(QUESTION_API + "/course/outline/upload", data, {
  79. headers: headData,
  80. });
  81. };