Browse Source

修复多选题

Michael Wang 6 năm trước cách đây
mục cha
commit
f4bbe0fcf0

+ 4 - 4
src/features/OnlineExam/Examing/ExamingHome.vue

@@ -163,12 +163,12 @@ export default {
     $route: function() {
       this.examQuestion();
     },
-    shouldSubmitPaper(val) {
+    shouldSubmitPaper() {
       this.realSubmitPaper();
-    },
-    examQuestionList(val, oldVal) {
-      // console.log(val, oldVal);
     }
+    // examQuestionList(val, oldVal) {
+    //   // console.log(val, oldVal);
+    // }
   },
   components: {
     RemainTime,

+ 13 - 7
src/features/OnlineExam/Examing/MultipleQuestionView.vue

@@ -5,10 +5,10 @@
       <div class="stu-answer"> {{studentAnswer}}</div>
       <div class="score">({{question.questionScore}}分)</div>
     </div>
-    <div v-for="(option, index) in question.options" :key="option.id" class="option" @click="toggleAnswer(index)">
+    <div v-for="(option, index) in question.questionOptionList" :key="option.id" class="option" @click="toggleAnswer(index)">
       <input type="checkbox" name="question" value="optionName[index]" :checked="studentAnswer && studentAnswer.includes(optionName[index])" />
       <span style="padding: 0 10px;">{{optionName[index]}}: </span>
-      <span class="question-options" v-html="option.content"></span>
+      <span class="question-options" v-html="option.body"></span>
     </div>
     <div class="reset">
       <i-button type="warning" size="large" @click="() => answerQuestion(examQuestion.id, null)">重置答案</i-button>
@@ -57,7 +57,7 @@ export default {
       ) {
         if (
           ["KeyA", "KeyB", "KeyC", "KeyD", "KeyE", "KeyF", "KeyG"]
-            .slice(0, this.question.options.length)
+            .slice(0, this.question.questionOptionList.length)
             .includes(e.code)
         ) {
           if (this.studentAnswer.includes(e.code[3])) {
@@ -90,11 +90,17 @@ export default {
         realAnswer = null;
       }
       if (realAnswer !== this.examQuestion.studentAnswer) {
-        await this.$http.put("/api/exam_question/" + examQuestionId, {
-          studentAnswer: realAnswer
-        });
+        await this.$http.post(
+          "/api/ecs_oe_student/examQuestion/submitQuestionAnswer",
+          [
+            {
+              order: this.examQuestion.order,
+              studentAnswer: realAnswer
+            }
+          ]
+        );
         this.updateExamQuestion({
-          examQuestionId,
+          order: this.$route.params.order,
           studentAnswer: realAnswer
         });
       }

+ 1 - 1
src/features/OnlineExam/Examing/QuestionView.vue

@@ -6,7 +6,7 @@
     <template v-if="question.questionType === 'SINGLE_CHOICE'">
       <single-question-view :question="question" :examQuestion="examQuestion" />
     </template>
-    <template v-if="question.questionType === 'MULTIPLE_ANSWER_QUESTION'">
+    <template v-if="question.questionType === 'MULTIPLE_CHOICE'">
       <multiple-question-view :question="question" :examQuestion="examQuestion" />
     </template>
     <template v-if="question.questionType === 'BOOL_ANSWER_QUESTION'">

+ 0 - 1
src/features/OnlineExam/Examing/SingleQuestionView.vue

@@ -87,7 +87,6 @@ export default {
     },
     question(question) {
       this.questionBody = question.body;
-      console.log(this.questionBody);
     }
   },
   computed: {

+ 22 - 14
src/features/OnlinePractice/OnlinePracticeHome.vue

@@ -7,10 +7,9 @@
 
     <div class="home">
 
-      <div style="margin-bottom: 20px; width: 320px; display: flex; justify-content: space-between">
-        <i-button size="small" :class="courseType === 'active' ? 'qm-primary-button' : 'qm-secondary-button'" @click="courseType='active'">进行中</i-button>
-        <i-button size="small" :class="courseType !== 'active' ? 'qm-primary-button' : 'qm-secondary-button'" @click="courseType='inactive'">已过期</i-button>
-      </div>
+      选择考试批次:<Select v-model="examId" style="width:200px" @on-change="fetchList">
+        <Option v-for="item in examList" :value="item.id" :key="item.id">{{ item.name }}</Option>
+      </Select>
 
       <i-table border :columns="columns" :data="courses"></i-table>
 
@@ -23,11 +22,12 @@ export default {
   name: "OnlinePracticeHome",
   data() {
     return {
-      courseType: "active",
+      examId: null,
+      examList: [],
       columns: [
         {
           title: "课程",
-          key: "courseName"
+          key: "name"
         },
         {
           title: "专业",
@@ -55,16 +55,24 @@ export default {
   },
   async mounted() {
     const res = await this.$http.get(
-      "/api/ecs_oe_student/practice/queryPracticeCourseList"
+      "/api/ecs_exam_work/exam/queryByNameLike?name=&examType=PRACTICE"
     );
+    this.examList = res.data;
+  },
+  methods: {
+    async fetchList(examId) {
+      const res = await this.$http.get(
+        "/api/ecs_oe_student/practice/queryPracticeCourseList?examId=" + examId
+      );
 
-    this.courses = res.data.map(c => ({
-      courseName: c.courseName,
-      specialtyName: c.specialtyName,
-      start2end: c.startTime + "<br> ~ <br>" + c.endTime,
-      times: c.allowExamCount,
-      operations: ""
-    }));
+      this.courses = res.data.map(c => ({
+        name: c.name,
+        specialtyName: c.specialtyName,
+        start2end: c.startTime + "<br> ~ <br>" + c.endTime,
+        times: c.allowExamCount,
+        operations: ""
+      }));
+    }
   }
 };
 </script>