Эх сурвалжийг харах

添加打分功能:未作答

Michael Wang 3 жил өмнө
parent
commit
0f146fc696

+ 1 - 1
src/features/mark/Mark.vue

@@ -343,7 +343,7 @@ const saveTaskToServer = async () => {
   } else {
     const trackScores =
       markResult.trackList
-        .map((q) => Math.round((q.score || 0) * 100))
+        .map((t) => Math.round((t.score || 0) * 100))
         .reduce((acc, s) => acc + s, 0) / 100;
     if (trackScores !== markResult.markerScore) {
       void message.error({

+ 20 - 1
src/features/mark/MarkBoardTrack.vue

@@ -169,7 +169,7 @@
         :style="{ height: `${100 - topPercent}%` }"
       >
         <div
-          v-for="(s, i) in questionScoreSteps"
+          v-for="(s, i) in questionScoreSteps.slice(1)"
           :key="i"
           class="single-score tw-cursor-pointer tw-font-bold"
           :class="isCurrentScore(s) && 'current-score'"
@@ -177,6 +177,20 @@
         >
           {{ s }}
         </div>
+        <div
+          class="single-score tw-cursor-pointer tw-font-bold"
+          :class="Object.is(store.currentScore, 0) && 'current-score'"
+          @click="chooseScore(0)"
+        >
+          0
+        </div>
+        <div
+          class="single-score tw-cursor-pointer tw-font-bold"
+          :class="Object.is(store.currentScore, -0) && 'current-score'"
+          @click="chooseScore(-0)"
+        >
+          空
+        </div>
       </div>
     </div>
     <div
@@ -295,6 +309,11 @@ function numberKeyListener(event: KeyboardEvent) {
   // console.log(event);
   if (!store.currentQuestion) return;
   if (" jiklc".includes(event.key)) return;
+  if (event.key === "#") {
+    keys = [];
+    store.currentScore = -0;
+    return;
+  }
 
   function indexOfCurrentQuestion() {
     return store.currentTask?.questionList.findIndex(

+ 30 - 21
src/features/mark/MarkBody.vue

@@ -7,7 +7,8 @@
   <div class="cursor">
     <div class="cursor-border">
       <span class="text">{{
-        store.currentSpecialTag || store.currentScore
+        store.currentSpecialTag ||
+        (Object.is(store.currentScore, -0) ? "空" : store.currentScore)
       }}</span>
     </div>
   </div>
@@ -36,17 +37,22 @@ const makeScoreTrack = (
   if (!store.currentQuestion || typeof store.currentScore === "undefined")
     return;
   const target = event.target as HTMLImageElement;
-  const track = {} as Track;
-  track.mainNumber = store.currentQuestion?.mainNumber;
-  track.subNumber = store.currentQuestion?.subNumber;
-  track.score = store.currentScore;
-  track.offsetIndex = item.indexInSliceUrls;
-  track.offsetX = Math.round(
-    event.offsetX * (target.naturalWidth / target.width) + item.dx
-  );
-  track.offsetY = Math.round(
-    event.offsetY * (target.naturalHeight / target.height) + item.dy
-  );
+  const track: Track = {
+    mainNumber: store.currentQuestion?.mainNumber,
+    subNumber: store.currentQuestion?.subNumber,
+    score: store.currentScore,
+    unanswered: Object.is(store.currentScore, -0),
+    offsetIndex: item.indexInSliceUrls,
+    offsetX: Math.round(
+      event.offsetX * (target.naturalWidth / target.width) + item.dx
+    ),
+    offsetY: Math.round(
+      event.offsetY * (target.naturalHeight / target.height) + item.dy
+    ),
+    positionX: -1,
+    positionY: -1,
+    number: -1,
+  };
   track.positionX = (track.offsetX - item.dx) / maxSliceWidth;
   track.positionY =
     (track.offsetY - item.dy + item.accumTopHeight) / theFinalHeight;
@@ -134,15 +140,18 @@ const makeSpecialTagTrack = (
   if (!store.currentTask || typeof store.currentSpecialTag === "undefined")
     return;
   const target = event.target as HTMLImageElement;
-  const track = {} as SpecialTag;
-  track.tagName = store.currentSpecialTag;
-  track.offsetIndex = item.indexInSliceUrls;
-  track.offsetX = Math.round(
-    event.offsetX * (target.naturalWidth / target.width) + item.dx
-  );
-  track.offsetY = Math.round(
-    event.offsetY * (target.naturalHeight / target.height) + item.dy
-  );
+  const track: SpecialTag = {
+    tagName: store.currentSpecialTag,
+    offsetIndex: item.indexInSliceUrls,
+    offsetX: Math.round(
+      event.offsetX * (target.naturalWidth / target.width) + item.dx
+    ),
+    offsetY: Math.round(
+      event.offsetY * (target.naturalHeight / target.height) + item.dy
+    ),
+    positionX: -1,
+    positionY: -1,
+  };
   track.positionX = (track.offsetX - item.dx) / maxSliceWidth;
   track.positionY =
     (track.offsetY - item.dy + item.accumTopHeight) / theFinalHeight;

+ 1 - 1
src/features/mark/MarkDrawTrack.vue

@@ -12,7 +12,7 @@
           :id="`a-${track.mainNumber}-${track.subNumber}-${track.offsetY}-${track.offsetX}`"
           class="tw-m-auto"
         >
-          {{ track.score }}
+          {{ track.unanswered ? "空" : track.score }}
         </span>
       </div>
     </template>

+ 1 - 1
src/features/student/studentInspect/MarkDrawTrack.vue

@@ -9,7 +9,7 @@
         :id="`a-${track.mainNumber}-${track.subNumber}-${track.offsetY}-${track.offsetX}`"
         class="tw-m-auto"
       >
-        {{ track.score }}
+        {{ track.unanswered ? "空" : track.score }}
       </span>
     </div>
   </template>

+ 5 - 0
src/store/store.ts

@@ -192,6 +192,11 @@ setTimeout(() => {
           problemTypeId: 0,
           unselective: false,
         };
+        task.markResult.trackList.forEach((t) => {
+          if (t.unanswered) {
+            t.score = -0;
+          }
+        });
       }
     }
   );

+ 2 - 0
src/types/index.ts

@@ -236,6 +236,8 @@ export interface Track {
   positionX: number;
   positionY: number;
   score: number;
+  /** 是否此处未作答,未作答时,score默认是-0分 */
+  unanswered: boolean;
 }
 
 export interface SpecialTag {