Kaynağa Gözat

fixbug: 无法清除最后一道题的分数

Michael Wang 4 yıl önce
ebeveyn
işleme
6e0a4c31f1

+ 10 - 2
src/features/mark/MarkBoardTrack.vue

@@ -295,7 +295,13 @@ export default defineComponent({
           q.mainNumber === store.currentQuestion?.mainNumber &&
           q.subNumber === store.currentQuestion?.subNumber
       );
-      if (ts.length === 0) return;
+      if (ts.length === 0) {
+        return;
+      }
+      if (ts.length === 1) {
+        // 即将清除最后一条记录,置为0,因为watch trackList 算分要考虑不同模式的回评,无法自动
+        store.currentQuestion.score = null;
+      }
       const maxNumber = Math.max(...ts.map((q) => q.number));
       const idx = store.currentMarkResult.trackList.findIndex(
         (q) =>
@@ -303,11 +309,12 @@ export default defineComponent({
           q.subNumber === store.currentQuestion?.subNumber &&
           q.number === maxNumber
       );
-      if (idx >= 0)
+      if (idx >= 0) {
         store.removeScoreTracks = store.currentMarkResult.trackList.splice(
           idx,
           1
         );
+      }
     }
 
     function clearAllMarksOfCurrentQuetion() {
@@ -325,6 +332,7 @@ export default defineComponent({
             q.subNumber === store.currentQuestion?.subNumber
           )
       );
+      store.currentQuestion.score = null;
     }
 
     function submit() {

+ 3 - 3
src/features/mark/MarkBody.vue

@@ -530,7 +530,7 @@ export default defineComponent({
       () => {
         if (store.setting.mode !== ModeEnum.TRACK) return;
         const markResult = store.currentMarkResult;
-        if (markResult && store.currentMarkResult) {
+        if (markResult) {
           const cq = store.currentQuestion;
           // 当无轨迹时,不更新;无轨迹时,将分数置null
           if (cq) {
@@ -548,8 +548,8 @@ export default defineComponent({
                 cq.score = null;
               }
             } else {
-              // 此时的场景是回评普通模式评的分,需要看见
-              cq.score = cq.__origScore;
+              // TODO: 不需要?如果此行代码生效,则无法清除最后一道题的分数 此时的场景是回评普通模式评的分,需要看见
+              // cq.score = cq.__origScore;
             }
           }
           // renderPaperAndMark();