liyongli 2 年之前
父節點
當前提交
81fa16e704
共有 2 個文件被更改,包括 19 次插入3 次删除
  1. 1 1
      miniprogram/pages/downloadPage/index.ts
  2. 18 2
      miniprogram/pages/faceRecognitionVK/index.ts

+ 1 - 1
miniprogram/pages/downloadPage/index.ts

@@ -34,7 +34,7 @@ Page({
           res.PAY ? this.downloadVideo() : this.toPAY();
         },
       })
-    }, 200);
+    }, 1000);
   },
   downloadVideo() {
     wx.showLoading({

+ 18 - 2
miniprogram/pages/faceRecognitionVK/index.ts

@@ -17,6 +17,7 @@ const bottomTips = {
   error: '脸部信息录入失败'
 }
 let T: number = 0;
+let notify = ""
 const daoJiShi: number = 15;
 Page({
 
@@ -46,7 +47,8 @@ Page({
     })
     wx.nextTick(() => {
       this.getMssage().then(async (r: any) => {
-        console.log('是否授权发送消息:', r)
+        console.log('是否授权发送消息:', r);
+        notify = r;
         if (!ctx) ctx = wx.createCameraContext();
         this.createVK();
         ctx.startRecord({
@@ -138,6 +140,18 @@ Page({
       },
     })
     // 静态图片检测模式下,每调一次 detectFace 接口就会触发一次 updateAnchors 事件
+    createVKSession?.on('updateAnchors', (anchors)=> {
+      anchors.forEach((anchor:any) => {
+        const W = anchor.size.width * 100;
+        let titlet = "";
+        if(W < 20 || W > 80 ) titlet = "请远离屏幕"
+        if(W < 20) titlet = "请靠近屏幕"
+        titlet && wx.showToast({
+          icon: "none",
+          title: titlet
+        })
+      })
+    })
     createVKSession?.on('removeAnchors', () => {
       wx.showToast({
         title: "未检测到人脸, 请重新采集",
@@ -178,7 +192,9 @@ Page({
       url: base.url + '/v3/upload',
       filePath: res.tempVideoPath,
       name: 'file', //服务器定义的Key值
-      formData: {},
+      formData: {
+        notify
+      },
       header: {
         Authorization: wx.getStorageSync("token")
       },