Răsfoiți Sursa

答题时间到了的时候偶现的由于接口cancel导致的message弹出的优化型bug修复

刘洋 2 ani în urmă
părinte
comite
0f45f5b89e

+ 2 - 1
src/features/OnlineExam/Examing/RemainTime.vue

@@ -116,7 +116,8 @@ async function getRemainTimeFromServer() {
       ext: { remainTime: res.data, diff: remainTime && remainTime - res.data },
     });
     remainTime = rt;
-  } catch (error) {
+  } catch (error: any) {
+    if (error?.message === "canceled") return;
     if (handledNetworkException) return;
     // 如果不处理,由于心跳请求有多次,延迟下来,可能有多次心跳请求的错误处理会进下面
     handledNetworkException = true;

+ 3 - 3
src/features/OnlineExam/FaceRecognition.vue

@@ -24,8 +24,8 @@ const {
   examRecordDataId = -1,
   showRecognizeButton = false,
 } = defineProps<{
-  width: string;
-  height: string;
+  width: string | number;
+  height: string | number;
   showRecognizeButton: boolean;
   snapId?: number;
   examRecordDataId?: number;
@@ -217,7 +217,7 @@ async function getSnapShot(compareSync: boolean): Promise<Blob | unknown> {
     context?.drawImage(video, 0, 0, 220, 165);
 
     canvas.toBlob((blob) => resolve(blob!), "image/png", 0.95);
-  })
+  });
   // .finally(() => void videoStartPlay()); // finally 会在返回前执行,满足我们的要求
 }
 

+ 1 - 1
src/plugins/axiosApp.ts

@@ -102,7 +102,7 @@ _axiosApp.interceptors.response.use(
     }
     const showErrorMessage = !config?.noErrorMessage;
     if (!error.response) {
-      if (showErrorMessage) {
+      if (showErrorMessage && error?.message !== "canceled") {
         // "Network Error" 网络不通,直接返回
         $message.error("网络连接异常,请检查网络设置。");
       }

+ 1 - 1
vite.config.ts

@@ -150,7 +150,7 @@ export default defineConfig({
     ssr: false,
     // FIXME: 为初期测试开启的调试
     sourcemap: !!disableObfuse,
-    target: ["chrome58"],
+    target: ["chrome52"],
   },
   // define: {
   //   __VUE_PROD_DEVTOOLS__: true, // no effect