林旭祥 пре 3 недеља
родитељ
комит
873f43ca38
1 измењених фајлова са 7 додато и 17 уклоњено
  1. 7 17
      src/components/OnlineFaceWindow/index.vue

+ 7 - 17
src/components/OnlineFaceWindow/index.vue

@@ -55,10 +55,15 @@ onMounted(() => {
  * 初始化
  */
 const getInit = async () => {
+  let deviceid = localStorage.getItem('deviceid') || '';
+  if (!deviceid) {
+    proxy?.$modal.msgError(`请重新登录绑定设备号后使用`);
+    return false;
+  }
   faceWs((e: any) => {
     if (e?.wksid) {
       //获取设备信息
-      getDevice();
+      startDevice({ deviceid: deviceid });
     }
     //接收设备信息并发送请求
     if (e?.device_info) {
@@ -84,32 +89,17 @@ const getInit = async () => {
         openFace(handcontroller_id);
       }
     }
-    if (e?.data) {
+    if (e?.data?.student_id) {
       //返回人脸信息然后跳转
       let id = e.data.student_id;
       let name = e.data.student_name;
       let pic = e.data.student_icon;
-      if (!id) {
-        proxy?.$modal.msgWarning(`缺少参数`);
-        return false;
-      }
       let obj = { id, name, pic }
       router.push({ path: '/score', query: obj });
     }
   });
 };
 
-/**
- * 获取设备信息
- */
-const getDevice = async () => {
-  let deviceid = localStorage.getItem('deviceid') || '';
-  if (!deviceid) {
-    proxy?.$modal.msgError(`请重新登录绑定设备号后使用`);
-    return false;
-  }
-  startDevice({ deviceid: deviceid });
-};
 
 /**
  * 查成绩