瀏覽代碼

fix: 打分区域

zhangjie 2 月之前
父節點
當前提交
5e2979f3e7

+ 8 - 0
src/features/mark/MarkHistory.vue

@@ -237,6 +237,14 @@ async function updateHistoryTask({
   const res = await getHistory(params);
   loading = false;
   if (res?.data) {
+    res.data.records.forEach((task) => {
+      task.sliceConfig = (task.sliceConfig || []).map((item) => {
+        return {
+          ...item,
+          id: `${item.i}_${item.x}_${item.y}_${item.w}_${item.h}`,
+        };
+      });
+    });
     markStore.historyTasks = res.data.records;
     total = res.data.total;
     replaceCurrentTask(markStore.historyTasks[0]).catch((err) => {

+ 5 - 1
src/features/mark/composables/useMakeTrack.ts

@@ -145,7 +145,11 @@ export default function useMakeTrack() {
 
   // 标记轨迹
   function makeTrack(event: MouseEvent, item: SliceImage) {
-    if (markStore.currentQuestion && !checkTrackValidate(item)) {
+    if (
+      item.sliceId &&
+      markStore.currentQuestion &&
+      !checkTrackValidate(item)
+    ) {
       void message.warning({
         content: "只能在设置的评卷区中评卷",
         duration: 3,

+ 1 - 1
src/features/mark/composables/useSliceTrack.ts

@@ -105,7 +105,7 @@ export default function useSliceTrack(hasMarkResultToRender = false) {
 
       const sliceImageRendered = await loadImage(dataUrl);
       tempSliceImagesWithTrackList.push({
-        sliceId: sliceConfig.id,
+        sliceId: sliceConfig.id || "",
         url: dataUrl,
         indexInSliceUrls: sliceConfig.i,
         // 通过轨迹位置是否落在裁切图上来定位轨迹在第几张图片