Bladeren bron

Merge branch 'master' into gcj

gcj 2 jaren geleden
bovenliggende
commit
b3873a45c7

+ 6 - 16
src/components/Adult/preview/ConfigurableTable.vue

@@ -3,20 +3,8 @@
     class="config-table"
     v-if="judgeAnswer == 'standardAnswer' ? (userError ? true : false) : true"
   >
-    <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>
+    <AnswerTitle :judgeAnswer="judgeAnswer" />
+
     <table
       :style="{
         'box-shadow': `${
@@ -75,7 +63,7 @@
               :class="[
                 { underline: col.isUnderline },
                 judgeAnswer == 'standardAnswer' ? 'correct' : '',
-                judgeAnswer == 'studentAnswer'
+                judgeAnswer == 'studentAnswer' || judgeAnswer == 'userAnswer'
                   ? curQue.Bookanswer[i].content[j].userAnswerJudge ==
                     '[JUDGE##T##JUDGE]'
                     ? 'correct'
@@ -258,9 +246,10 @@
 
 <script>
 import CrossTick from "./HeaderSparate/CrossTick.vue";
+import AnswerTitle from "../preview/components/AnswerTitle.vue";
 
 export default {
-  components: { CrossTick },
+  components: { CrossTick, AnswerTitle },
   props: {
     curQue: {
       type: Object,
@@ -342,6 +331,7 @@ export default {
   methods: {
     enterAnswer(i, j, type) {
       if (type == "input") {
+        this.$forceUpdate();
         if (
           this.curQue.Bookanswer[i].content[j].answer ==
           this.curQue.tableData.body[i].content[j].answer

+ 5 - 16
src/components/Adult/preview/HeaderSparate/index.vue

@@ -3,20 +3,7 @@
     class="header-separate"
     v-if="judgeAnswer == 'standardAnswer' ? (userError ? true : false) : true"
   >
-    <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>
+    <AnswerTitle :judgeAnswer="judgeAnswer" />
     <table>
       <colgroup>
         <col
@@ -58,7 +45,7 @@
                 { underline: col.isUnderline },
                 `${curQue.firstColAligin === 'center' ? 'col-center' : ''}`,
                 judgeAnswer == 'standardAnswer' ? 'correct' : '',
-                judgeAnswer == 'studentAnswer'
+                judgeAnswer == 'studentAnswer' || judgeAnswer == 'userAnswer'
                   ? curQue.Bookanswer[i].content[j].userAnswerJudge ==
                     '[JUDGE##T##JUDGE]'
                     ? 'correct'
@@ -207,9 +194,10 @@
 
 <script>
 import CrossTick from "./CrossTick.vue";
+import AnswerTitle from "../../preview/components/AnswerTitle.vue";
 
 export default {
-  components: { CrossTick },
+  components: { CrossTick, AnswerTitle },
   props: {
     curQue: {
       type: Object,
@@ -316,6 +304,7 @@ export default {
   methods: {
     enterAnswer(i, j, type) {
       if (type == "input") {
+        this.$forceUpdate();
         if (
           this.curQue.Bookanswer[i].content[j].answer ==
           this.curQue.tableData.body[i].content[j].answer

+ 13 - 17
src/components/Adult/preview/InputHasRecord.vue

@@ -11,20 +11,7 @@
         : true
     "
   >
-    <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' && userErrList.length > 0"
-      class="standardTitle"
-      style="margin: 10px 0 8px 24px"
-    >
-      Standard answer
-    </h6>
+    <AnswerTitle :judgeAnswer="judgeAnswer" />
     <template v-if="judgeAnswer == 'standardAnswer'">
       <div v-for="(items, indexs) in userErrList" :key="indexs">
         <div class="item-content">
@@ -140,6 +127,7 @@
             placeholder="输入"
             maxlength="200"
             :readonly="TaskModel == 'ANSWER'"
+            @input="forupdata"
             @change="changeuserAnswerJudge(indexs)"
           ></el-input>
           <div v-if="items.record" class="luyin-inner">
@@ -299,7 +287,8 @@
                     'textarea',
                     items.record ? '' : 'textareaNoRecord',
                     judgeAnswer == 'studentAnswer' ||
-                    judgeAnswer == 'standardAnswer'
+                    judgeAnswer == 'standardAnswer' ||
+                    judgeAnswer == 'userAnswer'
                       ? curQue.Bookanswer[indexs].userAnswerJudge ==
                         '[JUDGE##T##JUDGE]'
                         ? 'correct'
@@ -311,6 +300,7 @@
                   placeholder="输入"
                   maxlength="200"
                   :readonly="TaskModel == 'ANSWER'"
+                  @input="forupdata"
                   @change="changeuserAnswerJudge(indexs)"
                 ></el-input>
                 <div v-if="items.record" class="luyin-inner">
@@ -442,7 +432,8 @@
                 'textarea',
                 items.record ? '' : 'textareaNoRecord',
                 judgeAnswer == 'studentAnswer' ||
-                judgeAnswer == 'standardAnswer'
+                judgeAnswer == 'standardAnswer' ||
+                judgeAnswer == 'userAnswer'
                   ? curQue.Bookanswer[indexs].userAnswerJudge ==
                     '[JUDGE##T##JUDGE]'
                     ? 'correct'
@@ -454,6 +445,7 @@
               placeholder="输入"
               maxlength="200"
               :readonly="TaskModel == 'ANSWER'"
+              @input="forupdata"
               @change="changeuserAnswerJudge(indexs)"
             ></el-input>
             <div v-if="items.record" class="luyin-inner">
@@ -475,8 +467,9 @@
 
 <script>
 import Soundrecord from "../preview/Soundrecord.vue"; // 录音模板
+import AnswerTitle from "../preview/components/AnswerTitle.vue";
 export default {
-  components: { Soundrecord },
+  components: { Soundrecord, AnswerTitle },
   props: ["curQue", "TaskModel", "judgeAnswer"],
   data() {
     return {
@@ -492,6 +485,9 @@ export default {
   watch: {},
   //方法集合
   methods: {
+    forupdata() {
+      this.$forceUpdate();
+    },
     changeuserAnswerJudge(index) {
       let _this = this;
       if (_this.curQue.option[index].answer) {

+ 20 - 18
src/components/Adult/preview/Ligature.vue

@@ -9,20 +9,8 @@
         : true
     "
   >
-    <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>
+    <AnswerTitle :judgeAnswer="judgeAnswer" />
+
     <div class="main">
       <div style="text-align: center">{{ curQue.title }}</div>
       <div :id="'container' + number" class="container">
@@ -248,9 +236,13 @@
 <script>
 //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 //例如:import 《组件名称》from ‘《组件路径》';
+import AnswerTitle from "../preview/components/AnswerTitle.vue";
+
 export default {
   //import引入的组件需要注入到对象中才能使用
-  components: {},
+  components: {
+    AnswerTitle,
+  },
   props: ["curQue", "TaskModel", "number", "judgeAnswer"],
   data() {
     //这里存放数据
@@ -275,7 +267,10 @@ export default {
   methods: {
     // 判断对错
     YouranswerClass(item, type) {
-      if (this.judgeAnswer == "studentAnswer") {
+      if (
+        this.judgeAnswer == "studentAnswer" ||
+        this.judgeAnswer == "userAnswer"
+      ) {
         let clss = "";
         this.data.data.forEach((items) => {
           if (type == "left") {
@@ -537,6 +532,7 @@ export default {
     this.allimgnumber = 0;
     if (!this.curQue.Bookanswer) {
       // sData = JSON.parse(sessionStorage.getItem("LineData"));
+      this.curQue.Bookanswer = this.data;
     } else {
       this.data = JSON.parse(JSON.stringify(this.curQue.Bookanswer));
     }
@@ -582,7 +578,10 @@ export default {
       }
     });
 
-    if (this.judgeAnswer == "studentAnswer") {
+    if (
+      this.judgeAnswer == "studentAnswer" ||
+      this.judgeAnswer == "userAnswer"
+    ) {
       let conData = JSON.parse(JSON.stringify(this.curQue));
       this.curQue.con.forEach((item, i) => {
         let nodeId = item.Isexample
@@ -648,7 +647,10 @@ export default {
           });
         }
       });
-    } else if (this.judgeAnswer == "studentAnswer") {
+    } else if (
+      this.judgeAnswer == "studentAnswer" ||
+      this.judgeAnswer == "userAnswer"
+    ) {
       this.data.data.forEach((item) => {
         this.curQue.con.forEach((con) => {
           if (item.source == con.nodeId) {

+ 6 - 16
src/components/Adult/preview/SentenceInput.vue

@@ -10,20 +10,7 @@
         : true
     "
   >
-    <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>
+    <AnswerTitle :judgeAnswer="judgeAnswer" />
     <h2 v-if="curQue.title">{{ curQue.title }}</h2>
     <ul>
       <li
@@ -35,7 +22,7 @@
           judgeAnswer == 'standardAnswer' ? 'standardAnswer' : '',
           judgeAnswer == 'standardAnswer'
             ? 'correct'
-            : judgeAnswer == 'studentAnswer'
+            : judgeAnswer == 'studentAnswer' || judgeAnswer == 'userAnswer'
             ? curQue.Bookanswer[indexs].userAnswerJudge
               ? curQue.Bookanswer[indexs].userAnswerJudge == '[JUDGE##F##JUDGE]'
                 ? 'error'
@@ -290,8 +277,10 @@
 <script>
 import Soundrecord from "../preview/Soundrecord.vue"; // 录音模板
 import EditDiv from "../preview/EditDiv.vue";
+import AnswerTitle from "../preview/components/AnswerTitle.vue";
+
 export default {
-  components: { Soundrecord, EditDiv },
+  components: { Soundrecord, EditDiv, AnswerTitle },
   props: ["curQue", "TaskModel", "judgeAnswer"],
   data() {
     return {
@@ -441,6 +430,7 @@ export default {
     handleSelectJudge(obj, index) {
       if (!this.TaskModel || this.TaskModel != "ANSWER") {
         this.curQue.Bookanswer[index].answer = obj;
+        this.$forceUpdate();
       }
       this.changeuserAnswerJudge(index);
     },

+ 28 - 52
src/components/Adult/preview/SentenceSortQP.vue

@@ -10,20 +10,8 @@
         : true
     "
   >
-    <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>
+    <AnswerTitle :judgeAnswer="judgeAnswer" />
+
     <h2>{{ curQue.title }}</h2>
     <div
       class="item-box"
@@ -43,7 +31,7 @@
           :options="{
             group: { name: 'itxst' + index, pull: 'clone' },
           }"
-          :sort="TaskModel == 'ANSWER' ? 'false' : 'true'"
+          :sort="TaskModel == 'ANSWER' ? false : true"
           class="content-box"
         >
           <transition-group>
@@ -55,7 +43,8 @@
                   : '',
                 judgeAnswer == 'standardAnswer'
                   ? 'correct'
-                  : judgeAnswer == 'studentAnswer'
+                  : judgeAnswer == 'studentAnswer' ||
+                    judgeAnswer == 'userAnswer'
                   ? itemNode.correct == 'correct'
                     ? 'correct'
                     : 'error'
@@ -89,8 +78,10 @@
 
 <script>
 import draggable from "vuedraggable";
+import AnswerTitle from "../preview/components/AnswerTitle.vue";
+
 export default {
-  components: { draggable },
+  components: { draggable, AnswerTitle },
   props: ["curQue", "TaskModel", "judgeAnswer"],
   data() {
     return {
@@ -133,11 +124,15 @@ export default {
     },
     // 清空当前选中的文字
     removeCurrentSortArr(item, index) {
+      if (this.TaskModel || this.TaskModel == "ANSWER") {
+        return;
+      }
       //this.$set(this.SortArr, index, []);
       let wordsList = JSON.parse(
         JSON.stringify(this.orgData[index].detail.wordsList)
       );
       this.$set(item.detail, "wordsList", wordsList);
+      this.$forceUpdate();
     },
     NOremove() {
       this.$message.warning("当前没有可清空的数据");
@@ -166,50 +161,28 @@ export default {
     },
     onStart(e, index) {
       this.drag = true;
-      this.dragData = JSON.parse(
-        JSON.stringify(this.curQue.option[index].detail.wordsList)
-      );
+      // this.dragData = JSON.parse(
+      //   JSON.stringify(this.curQue.option[index].detail.wordsList)
+      // );
     },
     //拖拽结束事件
     onEnd(e, index) {
       let _this = this;
       _this.drag = false;
-      let newarr = [
-        ...new Set(this.SortArr[index].map((item) => JSON.stringify(item))),
-      ];
-      let arr = newarr.map((item) => JSON.parse(item));
+      // let newarr = [
+      //   ...new Set(this.SortArr[index].map((item) => JSON.stringify(item))),
+      // ];
+      // let arr = newarr.map((item) => JSON.parse(item));
       // this.curQue.option[index].detail.wordsList = JSON.parse(
       //   JSON.stringify(this.dragData)
       // );
       this.changeuserAnswerJudge(index);
       //如果左边
-      if (arr.length == this.SortArr[index].length) {
-        return;
-      }
-      this.SortArr[index].splice(e.newDraggableIndex, 1);
-    },
-    onStart2(e, index) {
-      this.drag = true;
-      this.dragData = JSON.parse(JSON.stringify(this.SortArr[index]));
-    },
-    //拖拽结束事件
-    onEnd2(e, index) {
-      this.drag = false;
-      // 不再删除
-      this.SortArr[index] = this.dragData;
-      let newarr = [
-        ...new Set(
-          this.curQue.option[index].detail.wordsList.map((item) =>
-            JSON.stringify(item)
-          )
-        ),
-      ];
-      let arr = newarr.map((item) => JSON.parse(item));
-      //如果左边
-      if (arr.length == this.curQue.option[index].detail.wordsList.length) {
-        return;
-      }
-      this.curQue.option[index].detail.wordsList.splice(e.newDraggableIndex, 1);
+      // if (arr.length == this.SortArr[index].length) {
+      //   return;
+      // }
+      // this.SortArr[index].splice(e.newDraggableIndex, 1);
+      this.$forceUpdate();
     },
     onMove(e) {
       // this.moveId = e.relatedContext.element.id;
@@ -250,7 +223,10 @@ export default {
           );
         }
       });
-    } else if (this.judgeAnswer == "studentAnswer") {
+    } else if (
+      this.judgeAnswer == "studentAnswer" ||
+      this.judgeAnswer == "userAnswer"
+    ) {
       this.curQue.Bookanswer.forEach((item) => {
         if (item.userAnswerJudge == "[JUDGE##F##JUDGE]") {
           item.detail.wordsList.forEach((items, i) => {

+ 8 - 16
src/components/Adult/preview/TextInputRecord.vue

@@ -10,20 +10,8 @@
         : true
     "
   >
-    <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>
+    <AnswerTitle :judgeAnswer="judgeAnswer" />
+
     <h2 v-if="curQue.title">{{ curQue.title }}</h2>
     <div
       class="aduioLine-box"
@@ -117,9 +105,10 @@
 import Soundrecord from "../preview/Soundrecord.vue"; // 录音模板
 import Audio from "../preview/components/AudioRed.vue"; // 音频播放
 import AudioLine from "../preview/AudioLine.vue";
+import AnswerTitle from "../preview/components/AnswerTitle.vue";
 
 export default {
-  components: { Soundrecord, Audio, AudioLine },
+  components: { Soundrecord, Audio, AudioLine, AnswerTitle },
   props: ["curQue", "themeColor", "TaskModel", "judgeAnswer"],
   data() {
     return {
@@ -148,7 +137,10 @@ export default {
   //方法集合
   methods: {
     YouranswerClass(item, index) {
-      if (this.judgeAnswer == "studentAnswer") {
+      if (
+        this.judgeAnswer == "studentAnswer" ||
+        this.judgeAnswer == "userAnswer"
+      ) {
         let clss = "error";
         if (item.answer == this.curQue.Bookanswer[index].answer) {
           clss = "correct";