Ver código fonte

离开页面后,不要再进行人脸检测的告警

Michael Wang 3 anos atrás
pai
commit
be05cbaaea
1 arquivos alterados com 9 adições e 3 exclusões
  1. 9 3
      src/features/OnlineExam/Examing/FaceTracking.vue

+ 9 - 3
src/features/OnlineExam/Examing/FaceTracking.vue

@@ -250,15 +250,21 @@ function getFaceDetectorOptions() {
 
 let displayedMsg: MessageReactive | null = null;
 const indepentExamingMsg = throttle(
-  () => (displayedMsg = $message.warning("请独立完成考试")),
+  () =>
+    document.getElementById("video") &&
+    (displayedMsg = $message.warning("请独立完成考试")),
   20 * 1000
 );
 const posureExamingMsg = throttle(
-  () => (displayedMsg = $message.warning("请调整坐姿,诚信考试")),
+  () =>
+    document.getElementById("video") &&
+    (displayedMsg = $message.warning("请调整坐姿,诚信考试")),
   20 * 1000
 );
 const bgCheckExamingMsg = throttle(
-  () => $message.warning("请保持正确坐姿,确保脸部在摄像头内,背景无强光。"),
+  () =>
+    document.getElementById("video") &&
+    $message.warning("请保持正确坐姿,确保脸部在摄像头内,背景无强光。"),
   20 * 1000
 );