Explorar o código

fix 回评时,没有恢复旧分数

Michael Wang %!s(int64=4) %!d(string=hai) anos
pai
achega
9ccc337398
Modificáronse 2 ficheiros con 17 adicións e 1 borrados
  1. 16 1
      src/features/mark/MarkHistory.vue
  2. 1 0
      src/types/index.ts

+ 16 - 1
src/features/mark/MarkHistory.vue

@@ -60,6 +60,7 @@ import { Task } from "@/types";
 import { defineComponent, ref, watch, watchEffect } from "vue";
 import { store } from "./store";
 import { CloseOutlined, SearchOutlined } from "@ant-design/icons-vue";
+import { cloneDeep } from "lodash";
 
 export default defineComponent({
   name: "MarkHistory",
@@ -113,11 +114,25 @@ export default defineComponent({
       });
       loading.value = false;
       if (res.data) {
-        store.historyTasks = res.data;
+        let data = cloneDeep(res.data) as Array<Task>;
+        data = data.map((t) => {
+          t.questionList.map((q) => {
+            q.__origScore = q.score;
+            return q;
+          });
+          return t;
+        });
+        store.historyTasks = data;
       }
     }
 
     function replaceCurrentTask(task: Task | undefined) {
+      if (task) {
+        task.questionList = task.questionList.map((q) => {
+          q.score = q.__origScore;
+          return q;
+        });
+      }
       store.currentTask = task;
     }
 

+ 1 - 0
src/types/index.ts

@@ -108,6 +108,7 @@ export interface Question {
   title: string; // 题目名称
   trackList: Array<Track>; // 轨迹列表
   score: number | null; //得分;null的值时是为打回时可以被修改的;null也是从未评分过的情况,要通过rejected来判断
+  __origScore: number | null; // 在回评是restore score
 }
 
 export interface Track {