0422
This commit is contained in:
parent
c76a039bbb
commit
20654838fe
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<div class="faceLoginWrap">
|
||||
<div style="height: 500px;">
|
||||
<div style="height:fit-content;">
|
||||
<div class="video-box">
|
||||
<video id="video" width="500" height="500" preload autoplay loop muted></video>
|
||||
<canvas id="canvas" width="500" height="500"></canvas>
|
||||
<video id="video" width="600" preload autoplay muted></video>
|
||||
<canvas id="canvas" width="600" height="500"></canvas>
|
||||
</div>
|
||||
<canvas id="screenshotCanvas" width="500" height="500"></canvas>
|
||||
<canvas id="screenshotCanvas" width="600" height="500"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -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;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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();
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue