diff --git a/hb_client/src/components/faceLogin/tracking.vue b/hb_client/src/components/faceLogin/tracking.vue index 7596555..a5edb53 100644 --- a/hb_client/src/components/faceLogin/tracking.vue +++ b/hb_client/src/components/faceLogin/tracking.vue @@ -1,11 +1,11 @@ @@ -118,22 +118,20 @@ ctx.drawImage(video, 0, 0, canvas.width, canvas.height); let base64Img = canvas.toDataURL('image/jpeg'); let img = base64Img.split(',')[1]; - let imgData = {base64: img}; + let imgData = {base64: img,tolerance:0.42}; clockRecord(imgData).then((res) => { + debugger; if (res.code === 200 && res.data.id) { this.$message.success(res.data.name + '签到成功!'); setTimeout(() => { that.uploadLock = false; - }, 3000) + }, 5000) } else { - // 打开锁 that.uploadLock = false; - this.$message.error(res.msg); } }).catch(() => { // 打开锁 that.uploadLock = false; - // this.$message.error('面部识别失败请重新验证'); }); }, closeCamera() { @@ -157,8 +155,8 @@ } .video-box { - width: 500px; - height: 500px; + width: 600px; + height: fit-content; margin: auto; position: relative; } @@ -176,4 +174,3 @@ left: 0; } - diff --git a/hb_client/src/utils/request.js b/hb_client/src/utils/request.js index f89e07c..a8e9cbb 100644 --- a/hb_client/src/utils/request.js +++ b/hb_client/src/utils/request.js @@ -80,12 +80,16 @@ service.interceptors.response.use( } } else if (res.code >= 400) { - Message({ - message: res.msg || '请求出错', - type: 'error', - duration: 3 * 1000 - }) - return Promise.reject(new Error(res.msg || '请求出错')) + if(res.msg.indexOf('请调整位置')>-1){ + return; + }else{ + Message({ + message: res.msg || '请求出错', + type: 'error', + duration: 3 * 1000 + }) + return Promise.reject(new Error(res.msg || '请求出错')) + } } }, error => { diff --git a/hb_client/src/views/login/index.vue b/hb_client/src/views/login/index.vue index 392e3ac..411a472 100644 --- a/hb_client/src/views/login/index.vue +++ b/hb_client/src/views/login/index.vue @@ -77,6 +77,7 @@ import faceLogin from '@/components/faceLogin/tracking.vue' export default { name: "Login", + inject:['reload'], components:{ faceLogin }, @@ -182,11 +183,11 @@ //人脸登录 takePhoto(){ this.limitedPhoto = true; - this.openTheCamera(); }, /*关闭相机*/ closeCamera () { debugger; + this.reload(); this.$refs.faceTracking.closeCamera(); // this.thisVideo.srcObject.getTracks()[0].stop(); },