林旭祥 vor 3 Wochen
Ursprung
Commit
a1609c8379
2 geänderte Dateien mit 54 neuen und 6 gelöschten Zeilen
  1. 27 1
      src/components/MultipleItem/index.vue
  2. 27 5
      src/views/train/multiple.vue

+ 27 - 1
src/components/MultipleItem/index.vue

@@ -194,6 +194,30 @@ const getOpenOneTestAndStartFace = async () => {
   await props.parentTrainWsMethod.startFace(examId);
 };
 
+/**
+ * 开始项目
+*/
+const getOpenOneTest = async () => {
+  if (area == null || area == "") {
+    return false;
+  }
+  console.log("examId", examId)
+  if (examState.value > 3) {
+    await props.parentTrainWsMethod.closeOneTest(examId);
+  }
+  await props.parentTrainWsMethod.openOneTest(examId);
+};
+
+/**
+ * 开始识别
+*/
+const getStartFace = async () => {
+  if (area == null || area == "") {
+    return false;
+  }
+  await props.parentTrainWsMethod.startFace(examId);
+};
+
 /**
  * 停止人脸识别
 */
@@ -392,7 +416,7 @@ const initProject = () => {
     //再加一个判断以免和再测一次冲突
     if (examState.value == 3 || examState.value == 43) {
       console.log("执行了执行了执行了执行了执行了")
-      getOpenOneTestAndStartFace();
+      getOpenOneTest();
     }
   }, time)
 
@@ -545,6 +569,8 @@ onMounted(() => {
 defineExpose({
   getMessage,
   getOpenOneTestAndStartFace,
+  getOpenOneTest,
+  getStartFace,
   getStopFace,
   getStartOneTest,
   getAgain,

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

@@ -27,7 +27,7 @@
     <div class="footerBtn">
       <template v-if="needStart">
         <div class="btn" @click="getAgain" v-if="examState == 42 || showTestAgain">再测一次</div>
-        <div class="btn" @click="getOpenOneTestAndStartFace" v-if="examState < 41">开始识别</div>
+        <div class="btn" @click="getStartFace" v-if="examState < 41">开始识别</div>
         <div class="btn" @click="getStopFace" v-if="examState == 41">停止人脸识别</div>
         <div class="btn startBtn" @click="getReady" v-if="examState == 43">开始测试</div>
         <div class="btn" @click="getAllRetestFace" v-if="examState == 43 || examState == 42">重新识别</div>
@@ -160,16 +160,38 @@ const multipleItemRef = (el: any, index: number, area: any) => {
 };
 
 /**
- * 开始识别
+ * 开始项目和识别
  */
 const getOpenOneTestAndStartFace = () => {
   cleanData();
-  examState.value = 41;
+  examState.value = 40;
   for (let i = 0; i < multipleItemRefList.value.length; i++) {
     multipleItemRefList.value[i].getOpenOneTestAndStartFace();
   }
 };
 
+/**
+ * 开始项目
+ */
+const getOpenOneTest = () => {
+  cleanData();
+  examState.value = 40;
+  for (let i = 0; i < multipleItemRefList.value.length; i++) {
+    multipleItemRefList.value[i].getOpenOneTest();
+  }
+};
+
+/**
+ * 开始识别
+ */
+const getStartFace = () => {
+  cleanData();
+  examState.value = 41;
+  for (let i = 0; i < multipleItemRefList.value.length; i++) {
+    multipleItemRefList.value[i].getStartFace();
+  }
+};
+
 /**
  * 停止人脸识别
  */
@@ -732,8 +754,8 @@ const initHand = () => {
       //   return false;
       // }
       //开始识别
-      if (needStart.value && examState.value < 41) {
-        getOpenOneTestAndStartFace();
+      if (needStart.value && examState.value == 40) {
+        getStartFace();
         return false;
       }
       //停止人脸识别