林旭祥 пре 7 месеци
родитељ
комит
53dd5d1a80

+ 30 - 8
src/components/MultipleItem/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="li" :class="{ 'disable': !area }">
+  <div class="li" :class="{ 'disable': !area, 'wait': [0].includes(examState), 'startedAlready': examState == 42 }">
     <div class="userInfo" @click="getChooseStudent">
       <div class="userInfo-center">
         <Transition :enter-active-class="proxy?.animate.dialog.enter">
@@ -257,7 +257,25 @@ const getAgain = async () => {
   await openOneTest(examId);
   await startFace(examId);
   await stopFace(examId);
-  getFaceConfirmOnly(student);
+  if (student.student_id) {
+    getFaceConfirmOnly(student);
+  }
+};
+
+/**
+ * 重新识别
+*/
+const getAllRetestFace = async () => {
+  //测试中
+  if (examState.value == 42) {
+    await finishOneTest(examId);
+  }
+  //其他状态
+  if (examState.value > 3) {
+    await closeOneTest(examId);
+  }
+  //重新走一次流程
+  await getOpenOneTestAndStartFace();
 };
 
 /**
@@ -273,15 +291,18 @@ const getChooseStudent = () => {
     proxy?.$modal.msgWarning(`当前状态:${examState.value}`);
     return false;
   }
-  if (examState.value == 3) {
-    if (!props.needStart) {
-      proxy?.$modal.msgWarning(`当前状态:${examState.value}`);
-    }
+  if (props.examState == 3 && (examState.value == 3 || examState.value == 40)) {
     if (props.needStart) {
-      proxy?.$modal.msgWarning(`请点击开始识别按钮`);
+      proxy?.$modal.msgWarning(`请点击右下角的【开始识别】,当前状态:${examState.value}`);
+    } else {
+      proxy?.$modal.msgWarning(`当前状态:${examState.value}`);
     }
     return false;
   }
+  if (props.examState == 41 && (examState.value == 3 || examState.value == 40)) {
+    proxy?.$modal.msgWarning(`当前状态:${examState.value}`);
+    return false;
+  }
   if (examState.value == 41) {
     chooseStudentRef.value.open();
   }
@@ -289,7 +310,7 @@ const getChooseStudent = () => {
     getRetestFace();
   }
   if (props.examState == 42) {
-    proxy?.$modal.msgWarning(`【${area}】正在测试请结束后再操作`);
+    proxy?.$modal.msgWarning(`【${area}】正在测试请结束后再操作:${examState.value}`);
     return false;
   }
 };
@@ -476,6 +497,7 @@ defineExpose({
   getStopFace,
   getStartOneTest,
   getAgain,
+  getAllRetestFace,
 })
 </script>
 

+ 3 - 0
src/components/OptionWindow/index.vue

@@ -268,6 +268,9 @@ const getAllArea = (data: any) => {
 
 //确定
 const confirm = () => {
+  if (loading.value == true) {
+    return false;
+  }
   console.log("project.value", project.value)
   optionForm.value.project = project.value.key;
   if (props.parentData.id) {

+ 21 - 16
src/views/home/index.vue

@@ -39,22 +39,27 @@ const getJump = (url: string, name: string) => {
     return false;
   }
   if (url == '/set') {
-    proxy?.$modal.prompt('请输入密码', 'password').then((e: any) => {
-      // console.log("e", e)
-      if (e.action == 'confirm' && e.value) {
-        let params = {
-          password: e.value
-        };
-        proxy?.$http.common.checkPassword(params).then((res: any) => {
-          if (res.status === 200 || res.status === 1) {
-            router.push({ path: url });
-          } else {
-            proxy?.$modal.msgError(res.message);
-          }
-        });
-      }
-    }).finally(() => {
-    });
+    if (import.meta.env.DEV) {
+      proxy?.$modal.msgSuccess('测试环境免密进入设置');
+      router.push({ path: url });
+    } else {
+      proxy?.$modal.prompt('请输入密码', 'password').then((e: any) => {
+        // console.log("e", e)
+        if (e.action == 'confirm' && e.value) {
+          let params = {
+            password: e.value
+          };
+          proxy?.$http.common.checkPassword(params).then((res: any) => {
+            if (res.status === 200 || res.status === 1) {
+              router.push({ path: url });
+            } else {
+              proxy?.$modal.msgError(res.message);
+            }
+          });
+        }
+      }).finally(() => {
+      });
+    }
   } else if (url == '/gesture') {
     proxy?.$modal.prompt('请输入设备码').then((e: any) => {
       // console.log("e", e)

+ 18 - 3
src/views/login/index.vue

@@ -14,7 +14,12 @@
               <input class="login-input login-input-password" type="password" autocomplete="off" placeholder="请输入密码"
                 v-model.trim="loginForm.password" />
             </div>
-            <div @click="getLogin" class="login-btn">登 录</div>
+            <div @click="getLogin" class="login-btn">
+              <el-icon class="is-loading" v-if="loading">
+                <Loading />
+              </el-icon>
+              登 录
+            </div>
           </div>
         </div>
       </div>
@@ -34,10 +39,11 @@ const data = reactive<any>({
     username: '',
     password: ''
   },
+  loading: false,
   key: 0,
 });
 
-const { loginForm, key } = toRefs(data);
+const { loginForm, loading, key } = toRefs(data);
 
 // 登录
 const getLogin = () => {
@@ -46,6 +52,7 @@ const getLogin = () => {
   if (!username || !password) {
     return false;
   }
+  loading.value = true;
   proxy?.$modal.loading();
   let params = {
     username,
@@ -58,6 +65,7 @@ const getLogin = () => {
       localStorage.setItem("token", token);
       //跳转
       router.push({ path: '/' });
+      loading.value = false;
       getUserInfo();
     }
   }).catch(() => {
@@ -167,9 +175,16 @@ $waiPadding: 6.51rem;
         font-size: 2rem;
         opacity: 1;
         text-align: center;
-        cursor: pointer;
         background: radial-gradient(141% 126% at 5% 93%, #8EFFA9 0%, #07FFE7 100%);
         box-shadow: inset 0px 1px 0px 2px rgba(255, 255, 255, 0.5577);
+        cursor: pointer;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+
+        .is-loading {
+          margin-right: 5px;
+        }
       }
     }
   }

+ 4 - 4
src/views/set/index.vue

@@ -41,19 +41,19 @@ const getConfig = () => {
 };
 
 // 退出
-const getLogout = () => {
-  proxy?.$modal.confirm("确定退出吗?").then(() => {
+const getLogout = async () => {
+  await proxy?.$modal.confirm("确定退出吗?").then(() => {
     proxy?.$modal.loading();
     let params = {};
     proxy?.$http.common.logout(params).then((res: any) => {
     });
     proxy?.$modal?.closeLoading()
-    //清空缓存
-    localStorage.clear();
     //跳转
     router.push({ path: '/login' });
   }).finally(() => {
   });
+  //清空缓存
+  localStorage.clear();
 };
 
 /**

+ 73 - 5
src/views/train/multiple.vue

@@ -25,6 +25,7 @@
         <div class="btn" @click="getOpenOneTestAndStartFace" v-if="examState < 41">开始识别</div>
         <div class="btn" @click="getStopFace" v-if="examState == 41">停止人脸识别</div>
         <div class="btn startBtn" @click="getStartOneTest" v-if="examState == 43">开始测试</div>
+        <div class="btn" @click="getAllRetestFace" v-if="examState == 43 || examState == 42">重新识别</div>
       </template>
       <template v-else>
         <div class="btn startBtn" @click="getReady" v-if="examState == 43">开始测试</div>
@@ -53,8 +54,8 @@
         <div class="confirmDiaBg" v-show="examState == 43 && time.ready">
           <div class="confirmDiaWindow">
             <div class="readyBox">
-              <div class="lable" :class="{ 'transparent': time.ready > 5 }">倒计时</div>
-              <div class="value">{{ time.ready }}</div>
+              <div class="lable">倒计时</div>
+              <div class="value" :class="{ 'transparent': time.ready > 5 }">{{ time.ready }}</div>
             </div>
           </div>
         </div>
@@ -180,12 +181,23 @@ const getStartOneTest = () => {
 */
 const getAgain = async () => {
   cleanData();
-  examState.value = 43;
+  examState.value = 41;
   for (let i = 0; i < multipleItemRefList.value.length; i++) {
     multipleItemRefList.value[i].getAgain()
   }
 };
 
+/**
+ * 重新识别
+*/
+const getAllRetestFace = async () => {
+  showTestAgain.value = false;
+  examState.value = 3;
+  for (let i = 0; i < multipleItemRefList.value.length; i++) {
+    multipleItemRefList.value[i].getAllRetestFace()
+  }
+};
+
 /**
  * 确认退出
 */
@@ -292,6 +304,15 @@ const returnData = (data: any) => {
     if (flag) {
       console.log("变更状态:", 3)
       examState.value = 3;
+      if (needStart.value) {
+        let handcontroller = parameter.value.handcontroller;
+        let ctrl = parameter.value.ctrl;
+        if (handcontroller && ctrl) {
+          speckText(`请${ctrl}区举左手开始识别`);
+        } else {
+          proxy?.$modal.msgWarning(`请点击右下角的【开始识别】`);
+        }
+      }
     }
   }
 
@@ -324,6 +345,18 @@ const returnData = (data: any) => {
       examState.value = 41;
       let txt = parameter.value.gesture ? "请举右手看摄像头人脸识别" : "请看摄像头进行人脸识别";
       speckText(txt);
+      //如果过段时候后仍在识别中就提示停止识别
+      // setTimeout(() => {
+      //   if (examState.value == 41) {
+      //     let handcontroller = parameter.value.handcontroller;
+      //     let ctrl = parameter.value.ctrl;
+      //     if (handcontroller && ctrl) {
+      //       speckText(`各就位后请${ctrl}区举左手停止识别`);
+      //     } else {
+      //       proxy?.$modal.msgWarning(`各就位后请点击右下角的【停止人脸识别】`);
+      //     }
+      //   }
+      // }, 15000)
     }
   }
 
@@ -342,6 +375,18 @@ const returnData = (data: any) => {
       console.log("变更状态:", 43)
       examState.value = 43;
       cleanData();
+      //如果过段时候后仍在识别中就提示停止识别
+      // setTimeout(() => {
+      //   if (examState.value == 43) {
+      //     let handcontroller = parameter.value.handcontroller;
+      //     let ctrl = parameter.value.ctrl;
+      //     if (handcontroller && ctrl) {
+      //       speckText(`请${ctrl}区举左手开始测试`);
+      //     } else {
+      //       proxy?.$modal.msgWarning(`请点击右下角的【开始测试】`);
+      //     }
+      //   }
+      // }, 10000)
     }
   }
 
@@ -488,6 +533,23 @@ const initHand = () => {
     }
     //举左手
     if (e?.data?.result == "left_hand") {
+      //开始识别
+      if (needStart.value && examState.value < 41) {
+        getOpenOneTestAndStartFace();
+      }
+      //停止人脸识别
+      if (needStart.value && examState.value == 41) {
+        getStopFace();
+      }
+      //开始测试
+      if (examState.value == 43) {
+        if (needStart.value) {
+          getStartOneTest();
+        } else {
+          getReady()
+        }
+      }
+      //确认退出
       if (exit.value) {
         exit.value = 0;
         //确认退出
@@ -504,8 +566,6 @@ const initHand = () => {
           cancelable: true // 是否可以取消事件的默认行为
         });
         document.activeElement?.dispatchEvent(keyEvent);
-      } else {
-        getReady()
       }
     }
     //退出
@@ -1432,6 +1492,14 @@ $waiPadding: 6.51rem;
     .disable {
       opacity: 0.5;
     }
+
+    .wait {
+      opacity: 0.75;
+    }
+
+    .startedAlready {
+      background: #15ef96;
+    }
   }
 }
 </style>

+ 17 - 3
src/views/train/test.vue

@@ -84,7 +84,7 @@
             <div class="btn" @click="getReady" v-if="needStart && examState == 43 && !time.ready && readyState">开 始
             </div>
             <!-- <div v-if="needStart"> -->
-            <!-- <div class="btn" @click="getOpenOneTestAndStartFace" v-if="examState == 3 || examState == 40">开始识别</div> -->
+            <!-- <div class="btn" @click="getOpenOneTestAndStartFace" v-if="examState < 41">开始识别</div> -->
             <!-- <div class="btn" @click="getStopFace" v-if="examState == 41 && !parameter.gesture">停止人脸识别</div> -->
             <!-- <div class="btn" @click="getStartOneTest" v-if="examState == 43">开始测试</div> -->
             <!-- <div @click="getRetestFace" v-if="examState == 43 || examState == 42">重新识别</div> -->
@@ -699,6 +699,22 @@ const initHand = () => {
     }
     //举左手
     if (e?.data?.result == "left_hand") {
+      //开始识别
+      if (needStart.value && examState.value < 41) {
+        getOpenOneTestAndStartFace();
+      }
+      //停止人脸识别
+      if (needStart.value && examState.value == 41) {
+        getStopFace();
+      }
+      //开始测试
+      if (examState.value == 43) {
+        if (needStart.value) {
+          getStartOneTest();
+        } else {
+          getReady()
+        }
+      }
       if (exit.value) {
         exit.value = 0;
         //确认退出
@@ -715,8 +731,6 @@ const initHand = () => {
           cancelable: true // 是否可以取消事件的默认行为
         });
         document.activeElement?.dispatchEvent(keyEvent);
-      } else {
-        getReady()
       }
     }
     //退出