Michael Wang 3 lat temu
rodzic
commit
4fa963c3fb

+ 8 - 4
src/features/mark/CommonMarkBody.vue

@@ -311,14 +311,17 @@ async function processSplitConfig() {
     images.push(image);
     images.push(image);
   }
   }
 
 
-  // 裁切块,可能是一块,两块,三块... [start, width ...] => [0, 0.3] | [0, 0.55, 0.45, 0.55] | [0, 0.35, 0.33, 0.35, 0.66, 0.35]
   // 如果拒绝裁切,则保持整卷
   // 如果拒绝裁切,则保持整卷
   if (!store.setting.enableSplit) {
   if (!store.setting.enableSplit) {
     store.setting.splitConfig = [0, 1];
     store.setting.splitConfig = [0, 1];
   }
   }
+  // 裁切块,可能是一块,两块,三块... [start, width ...] => [0, 0.3] | [0, 0.55, 0.45, 0.55] | [0, 0.35, 0.33, 0.35, 0.66, 0.35]
+  // 要转变为 [[0, 0.3]] | [[0, 0.55], [0.45, 0.55]] | [[0, 0.35], [0.33, 0.35], [0.66, 0.35]]
   const splitConfigPairs = store.setting.splitConfig
   const splitConfigPairs = store.setting.splitConfig
-    .filter((v, index) => index % 2 === 0)
-    .map<[number, number]>((v, index, ary) => [v, ary[index + 1]]);
+    .map<[number, number]>((v, index, ary) =>
+      index % 2 === 0 ? [v, ary[index + 1]] : [0, 0]
+    )
+    .filter((v) => v[0] === 0 && v[1] === 0);
 
 
   // 最大的 splitConfig 的宽度
   // 最大的 splitConfig 的宽度
   const maxSplitConfig = Math.max(
   const maxSplitConfig = Math.max(
@@ -700,7 +703,8 @@ function scrollToFirstScore() {
     window.requestAnimationFrame(scrollToFirstScore);
     window.requestAnimationFrame(scrollToFirstScore);
   }
   }
   addTimeout(() => {
   addTimeout(() => {
-    let firstScore = document.querySelector<HTMLDivElement>(".score-container");
+    const firstScore =
+      document.querySelector<HTMLDivElement>(".score-container");
     firstScore?.scrollIntoView({ behavior: "smooth" });
     firstScore?.scrollIntoView({ behavior: "smooth" });
   }, 1000);
   }, 1000);
 }
 }

+ 7 - 5
src/features/mark/MarkBoardTrack.vue

@@ -316,11 +316,13 @@ function numberKeyListener(event: KeyboardEvent) {
   }
   }
 
 
   function indexOfCurrentQuestion() {
   function indexOfCurrentQuestion() {
-    return store.currentTask?.questionList.findIndex(
-      (q) =>
-        q.mainNumber === store.currentQuestion?.mainNumber &&
-        q.subNumber === store.currentQuestion.subNumber
-    ) || -1;
+    return (
+      store.currentTask?.questionList.findIndex(
+        (q) =>
+          q.mainNumber === store.currentQuestion?.mainNumber &&
+          q.subNumber === store.currentQuestion.subNumber
+      ) ?? -1
+    );
   }
   }
 
 
   // tab 循环答题列表
   // tab 循环答题列表

+ 3 - 3
src/types/index.ts

@@ -89,7 +89,7 @@ export interface Setting {
   /** 只显示试评名称 TRIAL("试评"), FORMAL("正评"), FINISH("结束"): 结束状态不会在评卷端出现 */
   /** 只显示试评名称 TRIAL("试评"), FORMAL("正评"), FINISH("结束"): 结束状态不会在评卷端出现 */
   statusValue: "TRIAL" | "FORMAL" | null;
   statusValue: "TRIAL" | "FORMAL" | null;
   /** 问题卷类型 */
   /** 问题卷类型 */
-  problemTypes: Array<{ id: number; name: string }> | [];
+  problemTypes: Array<{ id: number; name: string }>;
   /** 当前评卷分组号 */
   /** 当前评卷分组号 */
   groupNumber: number;
   groupNumber: number;
   /** 当前评卷分组名称 */
   /** 当前评卷分组名称 */
@@ -401,8 +401,8 @@ export interface RichTextQuestion {
 }
 }
 
 
 export interface QuestionForRender extends Omit<RichTextQuestion, "answer"> {
 export interface QuestionForRender extends Omit<RichTextQuestion, "answer"> {
-  studentAnswer: RichTextQuestion['answer'];
-  standardAnswer: RichTextQuestion['answer'];
+  studentAnswer: RichTextQuestion["answer"];
+  standardAnswer: RichTextQuestion["answer"];
   score: number | null;
   score: number | null;
   totalScore: number;
   totalScore: number;
 }
 }

+ 4 - 2
src/utils/utils.ts

@@ -216,8 +216,10 @@ export async function preDrawImage(_currentTask: Task) {
     }
     }
 
 
     const splitConfigPairs = store.setting.splitConfig
     const splitConfigPairs = store.setting.splitConfig
-      .filter((v, index) => index % 2 === 0)
-      .map<[number, number]>((v, index, ary) => [v, ary[index + 1]]);
+      .map<[number, number]>((v, index, ary) =>
+        index % 2 === 0 ? [v, ary[index + 1]] : [0, 0]
+      )
+      .filter((v) => v[0] === 0 && v[1] === 0);
 
 
     const maxSplitConfig = Math.max(...store.setting.splitConfig);
     const maxSplitConfig = Math.max(...store.setting.splitConfig);
     maxSliceWidth =
     maxSliceWidth =