Jelajahi Sumber

接口调试

zhangjie 1 tahun lalu
induk
melakukan
f8dcf34c1d

+ 8 - 0
src/modules/question/api.js

@@ -315,6 +315,14 @@ export function gptQuestionListApi(data = {}) {
     { params: data }
   );
 }
+export function gptRebuildQuestionListApi(taskId) {
+  return $httpWithMsg.post(
+    `${QUESTION_API}/ai/question/find_rebuild_question,
+    `,
+    {},
+    { params: { taskId } }
+  );
+}
 export function saveGptQuestionApi(idList) {
   return $httpWithMsg.post(
     `${QUESTION_API}/ai/question/join`,

+ 10 - 11
src/modules/question/components/GptQuestionEditDialog.vue

@@ -106,7 +106,7 @@ import TextAnswerQuestion from "./edit/TextAnswerQuestion.vue";
 import { randomCode } from "@/plugins/utils";
 import {
   buildGptQuestionApi,
-  gptQuestionListApi,
+  gptRebuildQuestionListApi,
   updateGptQuestionApi,
   gptTaskDetailApi,
 } from "../api";
@@ -238,7 +238,7 @@ export default {
 
       const res = await buildGptQuestionApi({
         ...this.formModel,
-        sideQuestionId: this.questionModel.id,
+        insteadQuestionId: this.question.id,
       }).catch(() => {});
       this.buildLoading = false;
       if (!res) return;
@@ -278,15 +278,11 @@ export default {
       }, 3 * 1000);
     },
     async getResult() {
-      let data = {
-        courseId: this.formModel.courseId,
-        taskId: this.curTaskId,
-        curPage: 1,
-        pageSize: 1,
-      };
-      const res = await gptQuestionListApi(data).catch(() => {});
+      const res = await gptRebuildQuestionListApi(this.curTaskId).catch(
+        () => {}
+      );
       if (!res) return;
-      this.initData(res.data.content[0]);
+      this.initData(res.data);
     },
     async confirm() {
       const valid = await this.$refs.QuestionEditDetail.validate().catch(
@@ -298,7 +294,10 @@ export default {
       this.confirmLoading = true;
 
       let questionModel = this.$refs.QuestionEditDetail.getData();
-      const res = await updateGptQuestionApi(questionModel).catch(() => {});
+      const res = await updateGptQuestionApi({
+        ...questionModel,
+        propertyIdList: this.formModel.propertyIdList,
+      }).catch(() => {});
       this.confirmLoading = false;
       if (!res) return;