Browse Source

文本+输入+录音、句子填空、句子判断studentAnswer和standardAnswer预览完善
连线standardAnswerz全对判断完善
排序模板 studentAnswer和standardAnswer预览实现

qinpeng 2 years ago
parent
commit
6612b4a6a1

+ 10 - 1
src/components/Adult/preview/Ligature.vue

@@ -1,5 +1,14 @@
 <template>
-  <div class="JoinLine">
+  <div
+    class="JoinLine"
+    v-if="
+      judgeAnswer == 'standardAnswer'
+        ? curQue.Bookanswer.userAnswerJudge == '[JUDGE##F##JUDGE]'
+          ? true
+          : false
+        : true
+    "
+  >
     <h6
       v-if="judgeAnswer == 'userAnswer' || judgeAnswer == 'studentAnswer'"
       class="standardTitle"

+ 14 - 0
src/components/Adult/preview/SentenceInput.vue

@@ -1,6 +1,20 @@
 <!--  -->
 <template>
   <div class="Big-Book-prev-Textdes" v-if="curQue">
+        <h6
+      v-if="judgeAnswer == 'userAnswer' || judgeAnswer == 'studentAnswer'"
+      class="standardTitle"
+      style="margin: 10px 0 8px 24px"
+    >
+      {{ judgeAnswer == "userAnswer" ? "Your answer" : "Student answers" }}
+    </h6>
+    <h6
+      v-else-if="judgeAnswer == 'standardAnswer'"
+      class="standardTitle"
+      style="margin: 10px 0 8px 24px"
+    >
+      Standard answer
+    </h6>
     <h2 v-if="curQue.title">{{ curQue.title }}</h2>
     <ul>
       <li

+ 101 - 11
src/components/Adult/preview/SentenceSortQP.vue

@@ -1,8 +1,28 @@
 <!--  -->
 <template>
   <div class="Big-Book-prev-Textdes sentenceSort" v-if="curQue">
+    <h6
+      v-if="judgeAnswer == 'userAnswer' || judgeAnswer == 'studentAnswer'"
+      class="standardTitle"
+      style="margin: 10px 0 8px 24px"
+    >
+      {{ judgeAnswer == "userAnswer" ? "Your answer" : "Student answers" }}
+    </h6>
+    <h6
+      v-else-if="judgeAnswer == 'standardAnswer'"
+      class="standardTitle"
+      style="margin: 10px 0 8px 24px"
+    >
+      Standard answer
+    </h6>
     <h2>{{ curQue.title }}</h2>
-    <div class="item-box" v-for="(item, index) in curQue.Bookanswer" :key="index">
+    <div
+      class="item-box"
+      v-for="(item, index) in judgeAnswer == 'standardAnswer'
+        ? userErrList
+        : curQue.Bookanswer"
+      :key="index"
+    >
       <div class="item-right">
         <b>{{ index + 1 }}</b>
         <draggable
@@ -14,7 +34,7 @@
           :options="{
             group: { name: 'itxst' + index, pull: 'clone' },
           }"
-          :sort="TaskModel=='ANSWER'?'false':'true'"
+          :sort="TaskModel == 'ANSWER' ? 'false' : 'true'"
           class="content-box"
         >
           <transition-group>
@@ -24,8 +44,15 @@
                 JSON.stringify(SortArr[index]).indexOf(itemNode.index) != -1
                   ? 'select'
                   : '',
+                judgeAnswer == 'standardAnswer'
+                  ? 'correct'
+                  : itemNode.correct == 'correct'
+                  ? 'correct'
+                  : 'error',
               ]"
-              v-for="(itemNode, indexNode) in item.detail.wordsList"
+              v-for="(itemNode, indexNode) in judgeAnswer == 'standardAnswer'
+                ? item.correctWordsList
+                : item.detail.wordsList"
               :key="indexNode"
             >
               <p>
@@ -40,7 +67,7 @@
         <div class="fw">
           <span
             class="fw-btn"
-            :class="[!TaskModel||TaskModel!='ANSWER'?'sure-active':'']"
+            :class="[!TaskModel || TaskModel != 'ANSWER' ? 'sure-active' : '']"
             @click="removeCurrentSortArr(item, index)"
           ></span>
         </div>
@@ -53,7 +80,7 @@
 import draggable from "vuedraggable";
 export default {
   components: { draggable },
-  props: ["curQue","TaskModel"],
+  props: ["curQue", "TaskModel", "judgeAnswer"],
   data() {
     return {
       userList: [],
@@ -62,6 +89,7 @@ export default {
       moveId: null,
       dragData: null,
       orgData: null,
+      userErrList: [],
     };
   },
   computed: {},
@@ -104,6 +132,27 @@ export default {
       this.$message.warning("当前没有可清空的数据");
       return;
     },
+    // 判断对错
+    changeuserAnswerJudge(index) {
+      let flag = true;
+      for (
+        let i = 0;
+        i < this.curQue.Bookanswer[index].detail.wordsList.length;
+        i++
+      ) {
+        if (
+          this.curQue.Bookanswer[index].detail.wordsList[i].chs !=
+          this.curQue.Bookanswer[index].detail.segList[i]
+        ) {
+          flag = false;
+        }
+      }
+      if (flag) {
+        this.curQue.Bookanswer[index].userAnswerJudge = "[JUDGE##T##JUDGE]";
+      } else {
+        this.curQue.Bookanswer[index].userAnswerJudge = "[JUDGE##F##JUDGE]";
+      }
+    },
     onStart(e, index) {
       this.drag = true;
       this.dragData = JSON.parse(
@@ -121,6 +170,7 @@ export default {
       // this.curQue.option[index].detail.wordsList = JSON.parse(
       //   JSON.stringify(this.dragData)
       // );
+      this.changeuserAnswerJudge(index);
       //如果左边
       if (arr.length == this.SortArr[index].length) {
         return;
@@ -167,7 +217,10 @@ export default {
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
-    this.curQue.option.forEach((item) => {
+    console.log(this.curQue);
+    let data = JSON.parse(JSON.stringify(this.curQue.option));
+    data.forEach((item) => {
+      item.userAnswerJudge = "[JUDGE##F##JUDGE]";
       let arr = [];
       this.SortArr.push(arr);
       item.detail.wordsList.forEach((it, i) => {
@@ -176,7 +229,32 @@ export default {
     });
     this.orgData = JSON.parse(JSON.stringify(this.curQue.option));
     if (!this.curQue.Bookanswer) {
-        this.$set(this.curQue, "Bookanswer", JSON.parse(JSON.stringify(this.curQue.option)));
+      this.$set(this.curQue, "Bookanswer", data);
+    }
+    if (this.judgeAnswer == "standardAnswer") {
+      this.curQue.Bookanswer.forEach((item, i) => {
+        if (item.userAnswerJudge == "[JUDGE##F##JUDGE]") {
+          this.userErrList.push(
+            JSON.parse(JSON.stringify(this.curQue.option[i]))
+          );
+        }
+      });
+    } else if (this.judgeAnswer == "studentAnswer") {
+      this.curQue.Bookanswer.forEach((item) => {
+        if (item.userAnswerJudge == "[JUDGE##F##JUDGE]") {
+          item.detail.wordsList.forEach((items, i) => {
+            if (items.chs == item.correctWordsList[i].chs) {
+              items.correct = "correct";
+            } else {
+              items.correct = "error";
+            }
+          });
+        } else {
+          item.detail.wordsList.forEach((items, i) => {
+            items.correct = "correct";
+          });
+        }
+      });
     }
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
@@ -222,10 +300,10 @@ export default {
       margin-right: 4px;
       flex-shrink: 0;
     }
-    .content-box{
-        background: #E9E9E9;
-        padding: 8px;
-        border-radius: 8px;
+    .content-box {
+      background: #e9e9e9;
+      padding: 8px;
+      border-radius: 8px;
     }
   }
   .fw {
@@ -296,6 +374,18 @@ export default {
         .select {
           background: rgba(0, 0, 0, 0.06);
         }
+        .correct {
+          background: rgba(44, 167, 103, 0.1);
+          /* 正确答案 */
+
+          border: 1px solid #2ca767;
+        }
+        .error {
+          background: rgba(237, 52, 45, 0.1);
+          /* 错误颜色 */
+
+          border: 1px solid #ed342d;
+        }
       }
     }
   }

+ 20 - 2
src/components/Adult/preview/TextInputRecord.vue

@@ -1,9 +1,24 @@
 <!--  -->
 <template>
   <div class="Big-Book-prev-Textdes" v-if="curQue">
+    <h6
+      v-if="judgeAnswer == 'userAnswer' || judgeAnswer == 'studentAnswer'"
+      class="standardTitle"
+      style="margin: 10px 0 8px 24px"
+    >
+      {{ judgeAnswer == "userAnswer" ? "Your answer" : "Student answers" }}
+    </h6>
+    <h6
+      v-else-if="judgeAnswer == 'standardAnswer'"
+      class="standardTitle"
+      style="margin: 10px 0 8px 24px"
+    >
+      Standard answer
+    </h6>
     <h2 v-if="curQue.title">{{ curQue.title }}</h2>
     <div
       class="aduioLine-box"
+      :style="{ display: judgeAnswer == 'standardAnswer' ? 'none' : 'block' }"
       v-if="
         curQue.mp3_list && curQue.mp3_list.length > 0 && curQue.mp3_list[0].id
       "
@@ -63,8 +78,11 @@
         <input
           @blur="handleInput"
           :class="['item-input', items.Inputfont]"
-          v-model="judgeAnswer == 'standardAnswer'
-          ? items.answer: curQue.Bookanswer[indexs].answer"
+          v-model="
+            judgeAnswer == 'standardAnswer'
+              ? items.answer
+              : curQue.Bookanswer[indexs].answer
+          "
           @keyup.enter="handleReplaceTone($event, indexs)"
           placeholder="输入"
           maxlength="200"

+ 1 - 1
src/views/courseView.vue

@@ -109,7 +109,7 @@ export default {
           ],
         },
       ],
-      bookAnswerContent: "",
+      bookAnswerContent: `[{"table_list":[[{"data":{"Bookanswer":{"userAnswerJudge":"[JUDGE##T##JUDGE]","data":[{"source":"left_00_0_0_002-20221214-11-BLEVKSO9G9Isexample","target":"right_00_0_0_002-20221214-11-BLEVKSO9G9","index":0,"answer":0},{"answer":1,"index":1,"source":"left_10_0_0_002-20221214-11-BLEVKSO9G9","target":"right_10_0_0_002-20221214-11-BLEVKSO9G9"},{"answer":2,"index":2,"source":"left_20_0_0_002-20221214-11-BLEVKSO9G9","target":"right_20_0_0_002-20221214-11-BLEVKSO9G9"},{"answer":3,"index":3,"source":"left_30_0_0_002-20221214-11-BLEVKSO9G9","target":"right_30_0_0_002-20221214-11-BLEVKSO9G9"}]}}}]]}]`,
       TaskModel: "", // TEST 考试模式; PRACTICE 练习模式; ANSWER 查看答案模式; 空 预览模式
       category: "",
       FatherTreeData: null,