Bläddra i källkod

定时保存简答题答案

Michael Wang 6 år sedan
förälder
incheckning
ba8b474a44
1 ändrade filer med 73 tillägg och 13 borttagningar
  1. 73 13
      src/features/OnlineExam/Examing/TextQuestionView.vue

+ 73 - 13
src/features/OnlineExam/Examing/TextQuestionView.vue

@@ -1,6 +1,12 @@
 <template>
-  <div v-if="isSyncState" class="question-view">
-    <question-body :questionBody="question.body" :examQuestion="examQuestion"></question-body>
+  <div
+    v-if="isSyncState"
+    class="question-view"
+  >
+    <question-body
+      :questionBody="question.body"
+      :examQuestion="examQuestion"
+    ></question-body>
     <div class="ops">
       <div class="score">({{examQuestion.questionScore}}分)</div>
     </div>
@@ -9,21 +15,75 @@
 
       <div>
         <div class="menu">
-          <i-button type="info" class="text-ops" size="small" @click="textCopy">复制</i-button>
-          <i-button type="info" class="text-ops" size="small" @click="textCut">剪切</i-button>
-          <i-button type="info" class="text-ops" size="small" @click="textPaste">粘贴</i-button>
-          <i-button type="info" class="text-ops" size="small" @click="textSup">上标</i-button>
-          <i-button type="info" class="text-ops" size="small" @click="undoTextSup">取消上标</i-button>
-          <i-button type="info" class="text-ops" size="small" @click="textSub">下标</i-button>
-          <i-button type="info" class="text-ops" size="small" @click="undoTextSup">取消下标</i-button>
+          <i-button
+            type="info"
+            class="text-ops"
+            size="small"
+            @click="textCopy"
+          >复制</i-button>
+          <i-button
+            type="info"
+            class="text-ops"
+            size="small"
+            @click="textCut"
+          >剪切</i-button>
+          <i-button
+            type="info"
+            class="text-ops"
+            size="small"
+            @click="textPaste"
+          >粘贴</i-button>
+          <i-button
+            type="info"
+            class="text-ops"
+            size="small"
+            @click="textSup"
+          >上标</i-button>
+          <i-button
+            type="info"
+            class="text-ops"
+            size="small"
+            @click="undoTextSup"
+          >取消上标</i-button>
+          <i-button
+            type="info"
+            class="text-ops"
+            size="small"
+            @click="textSub"
+          >下标</i-button>
+          <i-button
+            type="info"
+            class="text-ops"
+            size="small"
+            @click="undoTextSup"
+          >取消下标</i-button>
         </div>
-        <div ref="answerDiv" :contenteditable="true" v-html="studentAnswer" @blur="($event) => textInput($event)" class="stu-answer">
+        <div
+          ref="answerDiv"
+          :contenteditable="true"
+          v-html="studentAnswer"
+          v-once
+          @input="($event) => textInput($event)"
+          @blur="($event) => textInput($event)"
+          class="stu-answer"
+        >
         </div>
       </div>
-      <div class="reset" style="padding-top: 20px">
-        <i-button type="warning" size="large" @click="studentAnswer=null">重置答案</i-button>
+      <div
+        class="reset"
+        style="padding-top: 20px"
+      >
+        <i-button
+          type="warning"
+          size="large"
+          @click="studentAnswer=null"
+        >重置答案</i-button>
         <span v-if="examShouldShowAnswer()">
-          &nbsp;&nbsp;&nbsp;<i-button type="info" size="large" @click="showAnswer">显示答案</i-button>
+          &nbsp;&nbsp;&nbsp;<i-button
+            type="info"
+            size="large"
+            @click="showAnswer"
+          >显示答案</i-button>
         </span>
         <div v-if="examShouldShowAnswer() && isShowAnswer">
           正确答案:<div v-html="rightAnswerTransform"></div>