Przeglądaj źródła

显示题干答案

xiatian 2 lat temu
rodzic
commit
61630f070a

+ 7 - 2
src/modules/marking/views/Marking.vue

@@ -229,9 +229,11 @@
             @changePaperSign="changePaperSign"
             @clearScores="clearScores"
             @changeSignScores="changeSignScores"
+            @showAnswerChange="showAnswerChange"
           ></tpMain>
           <!-- 文本图片给分板 -->
           <tpScoreboard
+            ref="scoreboard"
             :objective-score="studentPaper.objectiveScore"
             :paper-mark-sign="paperMarkSign"
             :sign-item="signItem"
@@ -244,6 +246,7 @@
             :student-paper-id="studentPaper.id"
             :score-step="studentPaper.scoreStep"
             :mark-task-id="task.id"
+            :exam-type="examType"
             @submitMark="getNext"
             @changeSign="changeSign"
           ></tpScoreboard>
@@ -373,6 +376,10 @@ export default {
     this.loading = false;
   },
   methods: {
+    showAnswerChange() {
+      this.$refs.scoreboard.showBodyChange();
+      this.$refs.scoreboard.showAnswerChange();
+    },
     getTags() {
       this.$http.get(MARKING_API + "/markResults/tag").then((response) => {
         this.tags = response.data;
@@ -543,7 +550,6 @@ export default {
       this.changeTasks = tempData;
     },
     async getPaper() {
-      console.log("getPaper");
       var self = this;
       await self.$http
         .get(DATA_PROCESS_API + "/studentPapers?markTaskId=" + self.task.id)
@@ -552,7 +558,6 @@ export default {
             self.studentPaper = response.data.data;
             self.examType = self.studentPaper.examType;
             self.paperMark = true;
-            console.log("paper", self.studentPaper);
           } else {
             if (response.data.resultCode == "1") {
               self.$notify({

+ 12 - 0
src/modules/marking/views/TpMain.vue

@@ -173,6 +173,9 @@ export default {
       }
     },
     studentPaper() {
+      this.$nextTick(() => {
+        this.$emit("showAnswerChange");
+      });
       if (this.markSign) {
         this.intMarkDraw();
       }
@@ -540,6 +543,15 @@ img {
   background: rgb(250, 250, 250);
   overflow-wrap: break-word;
 }
+.paper >>> .right-answer {
+  border: 1px solid #ccc;
+  border-radius: 5px;
+  margin: 10px;
+  padding: 0 10px;
+  background: rgb(250, 250, 250);
+  color: rgb(85, 191, 255);
+  overflow-wrap: break-word;
+}
 .paper >>> .right-font {
   font-weight: bold;
   color: rgb(85, 191, 255);

+ 42 - 0
src/modules/marking/views/TpScoreBoard.vue

@@ -12,6 +12,10 @@
           inactive-color="#13ce66"
         ></el-switch>
       </div>
+      <div v-show="examType != 'OFFLINE'" class="first-board">
+        <el-checkbox v-model="showBody">显示题干</el-checkbox
+        ><el-checkbox v-model="showAnswer">显示标答</el-checkbox>
+      </div>
       <div class="second-board">
         <div class="board-title"><span>总分</span></div>
         <div class="board-score">
@@ -266,9 +270,15 @@ export default {
       type: Number,
       default: 0.5,
     },
+    examType: {
+      type: String,
+      default: "",
+    },
   },
   data() {
     return {
+      showBody: true,
+      showAnswer: true,
       resultItemsData: this.resultItems,
       signOptionData: this.signOption,
       signScoresData: this.signScores,
@@ -415,12 +425,44 @@ export default {
         this.initKeyBoardMode();
       }
     },
+    showAnswer: {
+      immediate: false,
+      handler() {
+        this.showAnswerChange();
+      },
+    },
+    showBody: {
+      immediate: false,
+      handler() {
+        this.showBodyChange();
+      },
+    },
   },
   created() {
     this.getTags();
   },
   methods: {
     ...mapActions([USER_SIGNOUT]),
+    showAnswerChange() {
+      if (this.examType == "OFFLINE") {
+        return;
+      }
+      var es = Array.from(document.getElementsByClassName("right-answer"));
+      var displayVal = this.showAnswer ? "block" : "none";
+      es.forEach((element) => {
+        element.style.display = displayVal;
+      });
+    },
+    showBodyChange() {
+      if (this.examType == "OFFLINE") {
+        return;
+      }
+      var es = Array.from(document.getElementsByClassName("question-body"));
+      var displayVal = this.showBody ? "block" : "none";
+      es.forEach((element) => {
+        element.style.display = displayVal;
+      });
+    },
     resetProblem() {
       if (this.markedResultData.tag) {
         this.markedResultData.tag = "";