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

fix: 回评问题卷的取消问题

zhangjie 2 сар өмнө
parent
commit
e716196479

+ 3 - 7
src/features/mark/composables/useQuestion.ts

@@ -1,8 +1,8 @@
 import { Question } from "@/types";
-import { useMarkStore } from "@/store";
+// import { useMarkStore } from "@/store";
 
 export default function useQuestion() {
-  const markStore = useMarkStore();
+  // const markStore = useMarkStore();
 
   // 是否处于仲裁阶段
   function isArbitrated(question: Question) {
@@ -19,11 +19,7 @@ export default function useQuestion() {
   }
 
   function isDisabledQuestion(question: Question) {
-    return (
-      (!markStore.historyOpen && !question.selfMark) ||
-      (markStore.historyOpen && question.problem) ||
-      isArbitrated(question)
-    );
+    return !question.selfMark || isArbitrated(question);
   }
 
   return {

+ 56 - 50
src/features/mark/composables/useTaskWatch.ts

@@ -18,59 +18,65 @@ export default function useTaskWatch() {
       if (task.previous && task.markResult) {
         task.markResult = undefined;
       }
-      if (!task.markResult) {
-        // 管理后台可能不设置 questionList, 而且它不用 markResult
-        if (!task.questionList) {
-          task.questionList = [];
-          // return;
+      if (task.markResult) return;
+      // 管理后台可能不设置 questionList, 而且它不用 markResult
+      if (!task.questionList) {
+        task.questionList = [];
+        // return;
+      }
+      // 初始化 __index
+      task.questionList.forEach((q, i) => {
+        q.__index = i;
+        // 回评的时候,如果是自己标记问题卷的题目,则转成非自己标记问题卷的题目
+        // 这样一来,就不能编辑问题卷,但是依旧可以编辑新设置未提交的问题卷
+        if (markStore.historyOpen && q.problem && q.selfMark) {
+          q.selfMark = false;
         }
-        // 初始化 __index
-        task.questionList.forEach((q, i, ar) => (ar[i].__index = i));
+      });
 
-        task.__markStartTime = Date.now();
-        const statusValue = markStore.setting.statusValue;
-        const { examId, studentId, paperNumber } = task;
+      task.__markStartTime = Date.now();
+      const statusValue = markStore.setting.statusValue;
+      const { examId, studentId, paperNumber } = task;
 
-        const selfQuestions = task.questionList.filter(
-          (q) => q.selfMark && !isArbitrated(q)
-        );
-        task.markResult = {
-          examId,
-          paperNumber,
-          studentId,
-          spent: 0,
-          statusValue,
-          questionList: task.questionList,
-          markedQuestionId: "",
-          markerTrackList: selfQuestions
-            .map((q) => {
-              const trackList =
-                q.headerTrackList && q.headerTrackList.length
-                  ? q.headerTrackList
-                  : q.markerTrackList;
-              return trackList || [];
-            })
-            .flat(),
-          markerTagList: selfQuestions
-            .map((q) => {
-              const tagList =
-                q.headerTagList && q.headerTagList.length
-                  ? q.headerTagList
-                  : q.markerTagList;
-              return tagList || [];
-            })
-            .flat(),
-          scoreList: task.questionList.map((q) =>
-            q.selfMark && !isArbitrated(q) ? q.markerScore : null
-          ),
-          markerScore: 0, // 后期通过 scoreList 自动更新
-        };
-        task.markResult.markerTrackList.forEach((t) => {
-          if (t.unanswered) {
-            t.score = -0;
-          }
-        });
-      }
+      const selfQuestions = task.questionList.filter(
+        (q) => q.selfMark && !isArbitrated(q)
+      );
+      task.markResult = {
+        examId,
+        paperNumber,
+        studentId,
+        spent: 0,
+        statusValue,
+        questionList: task.questionList,
+        markedQuestionId: "",
+        markerTrackList: selfQuestions
+          .map((q) => {
+            const trackList =
+              q.headerTrackList && q.headerTrackList.length
+                ? q.headerTrackList
+                : q.markerTrackList;
+            return trackList || [];
+          })
+          .flat(),
+        markerTagList: selfQuestions
+          .map((q) => {
+            const tagList =
+              q.headerTagList && q.headerTagList.length
+                ? q.headerTagList
+                : q.markerTagList;
+            return tagList || [];
+          })
+          .flat(),
+        scoreList: task.questionList.map((q) =>
+          q.selfMark && !isArbitrated(q) ? q.markerScore : null
+        ),
+        markerScore: 0, // 后期通过 scoreList 自动更新
+      };
+      task.markResult.markerTrackList.forEach((t) => {
+        if (t.unanswered) {
+          t.score = -0;
+        }
+      });
     }
   );
 

+ 0 - 1
src/features/mark/scoring/MarkBoardKeyBoard.vue

@@ -126,7 +126,6 @@
     </div>
     <div
       v-if="
-        !markStore.historyOpen &&
         markStore.currentQuestion?.problem &&
         markStore.currentQuestion?.selfMark
       "

+ 0 - 1
src/features/mark/scoring/MarkBoardMouse.vue

@@ -114,7 +114,6 @@
 
     <div
       v-if="
-        !markStore.historyOpen &&
         markStore.currentQuestion?.problem &&
         markStore.currentQuestion?.selfMark
       "

+ 0 - 1
src/features/mark/scoring/MarkBoardTrack.vue

@@ -174,7 +174,6 @@
 
       <qm-button
         v-if="
-          !markStore.historyOpen &&
           markStore.currentQuestion?.problem &&
           markStore.currentQuestion?.selfMark
         "