소스 검색

优化剩余时间计算

Michael Wang 3 년 전
부모
커밋
8fd154b191
2개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 0
      src/features/OnlineExam/Examing/FaceTracking.vue
  2. 3 1
      src/features/OnlineExam/Examing/RemainTime.vue

+ 1 - 0
src/features/OnlineExam/Examing/FaceTracking.vue

@@ -271,6 +271,7 @@ let detectFacesTimeout: number;
 
 /** 定时检测人脸 */
 async function detectFaces() {
+  if (import.meta.env.DEV) return;
   if (
     disableFaceTracking ||
     singleTimeUsage > 10 * 1000 ||

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

@@ -15,7 +15,9 @@ let remainTime: number | null = $ref(null);
 let enhancedRemainTimeStyle = $ref(true);
 
 const remainTimeFormatted = $computed(() =>
-  remainTime ? moment.utc(remainTime).format("HH:mm:ss") : "计算中"
+  typeof remainTime === "number"
+    ? moment.utc(remainTime).format("HH:mm:ss")
+    : "计算中"
 );
 
 const { addTimeout, addInterval } = useTimers();