Ver Fonte

fix 回评提交后渲染最新结果

Michael Wang há 4 anos atrás
pai
commit
87b106eb22

+ 4 - 2
src/features/mark/MarkHistory.vue

@@ -84,8 +84,10 @@ export default defineComponent({
 
     watch(
       () => props.shouldReload,
-      () => {
-        updateHistoryTask({ pageNumber: currentPage.value });
+      async () => {
+        await updateHistoryTask({ pageNumber: currentPage.value });
+        // 提交后,渲染第一条
+        replaceCurrentTask(store.historyTasks[0]);
       }
     );
 

+ 2 - 2
src/features/mark/MarkProblemDialog.vue

@@ -68,7 +68,7 @@ export default defineComponent({
         return;
       }
       const res = await doProblemType(problemId);
-      if (res.data.success) {
+      if (res?.data.success) {
         message.success({ content: "问题卷处理成功", duration: 3 });
         visible.value = false;
         removeSubmitedTask();
@@ -77,7 +77,7 @@ export default defineComponent({
         }
         updateStatus();
       } else {
-        message.error({ content: res.data.message || "错误", duration: 5 });
+        message.error({ content: res?.data.message || "错误", duration: 5 });
       }
     };