Pārlūkot izejas kodu

fix: 修复弹出打回原因页面卡死的问题

chenhao 2 gadi atpakaļ
vecāks
revīzija
fd3a0f7cb7
1 mainītis faili ar 10 papildinājumiem un 10 dzēšanām
  1. 10 10
      src/features/mark/Mark.vue

+ 10 - 10
src/features/mark/Mark.vue

@@ -55,7 +55,7 @@
 </template>
 
 <script setup lang="ts">
-import { onMounted, watch, h } from "vue";
+import { onMounted, watch, h, nextTick } from "vue";
 import {
   clearMarkTask,
   getGroup,
@@ -230,7 +230,7 @@ watch(
 
 const showRejectedReason = (task: Task) => {
   if (task.rejected && task.rejectReason) {
-    const [reasonType,reasonDesc] = task.rejectReason.split(':')
+    const [reasonType, reasonDesc] = task.rejectReason.split(":");
     Modal.info({
       title: null,
       closable: false,
@@ -262,11 +262,7 @@ const showRejectedReason = (task: Task) => {
               h("span", reasonType),
             ]),
             h("div", { style: { fontWeight: "bold" } }, "详情描述: "),
-            h(
-              "div",
-              { style: { padding: "4px 2px" } },
-              reasonDesc
-            ),
+            h("div", { style: { padding: "4px 2px" } }, reasonDesc),
           ]
         ),
     });
@@ -280,9 +276,13 @@ watch(
     // 重置当前选择的quesiton和score
     store.currentQuestion = undefined;
     store.currentScore = undefined;
-    if (store.currentTask) {
-      showRejectedReason(store.currentTask);
-    }
+    nextTick()
+      .then(() => {
+        if (store.currentTask) {
+          showRejectedReason(store.currentTask);
+        }
+      })
+      .catch(() => {});
   }
 );