Browse Source

feat: 补充了多选题答案的储存方式

mjh 4 years ago
parent
commit
b75c430871
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/components/QuestionCreator/SingleQuestionCreator.vue

+ 6 - 4
src/components/QuestionCreator/SingleQuestionCreator.vue

@@ -127,7 +127,7 @@ export default {
     },
 
     async handleAckButtonClick() {
-      if(this.checkFormCompletion()){
+      if (this.checkFormCompletion()) {
         let questionVO = this.formatQuestionVO2backend();
         let res = await this.$api.createQuestion(questionVO);
         console.log(res);
@@ -289,6 +289,10 @@ export default {
       for (let option of this.form.options) {
         options[option.label] = option.content;
       }
+      let multi_answer;
+      if (this.form.type === 2) {
+        multi_answer = this.form.multi_answer.sort().join("");
+      }
       let knowledgeId = [];
       for (let knowledgeIdElement of this.form.knowledgeId) {
         knowledgeId.push(knowledgeIdElement[knowledgeIdElement.length - 1]);
@@ -296,12 +300,10 @@ export default {
       let tags = [this.form.tags];
 
       return {
-        ...this.form,
         stem: this.form.stem,
         type,
         options,
-        answer: this.form.answer,
-        multi_answer: this.form.multi_answer,
+        answer: (this.form.type !== 2) ? this.form.answer : multi_answer,
         analysis: this.form.analysis,
         difficulty: this.form.difficulty,
         knowledgeId,