|
@@ -137,6 +137,10 @@ export default {
|
|
|
"摄像头打开耗时",
|
|
|
Math.floor((_openEndTime - _openStartTime) / 1000) + "秒",
|
|
|
]);
|
|
|
+ console.log(
|
|
|
+ "摄像头打开耗时",
|
|
|
+ Math.floor((_openEndTime - _openStartTime) / 1000) + "秒"
|
|
|
+ );
|
|
|
} catch (error) {
|
|
|
console.log("摄像头没有正常启用", error);
|
|
|
this.$Message.error({
|
|
@@ -201,7 +205,7 @@ export default {
|
|
|
async snapTimer() {
|
|
|
try {
|
|
|
const examRecordDataId = this.$route.params.examRecordDataId;
|
|
|
- const captureBlob = await this.getSnapShot();
|
|
|
+ const captureBlob = await this.getSnapShot({ compareSync: false });
|
|
|
this.videoStartPlay();
|
|
|
console.log("抓拍照片的大小:" + captureBlob.size);
|
|
|
if (captureBlob.size < 10 * 1024) {
|
|
@@ -223,6 +227,7 @@ export default {
|
|
|
signIdentifier,
|
|
|
examRecordDataId
|
|
|
);
|
|
|
+ console.log("定时抓拍流程成功", signIdentifier);
|
|
|
} catch (error) {
|
|
|
console.log("定时抓拍流程失败", error);
|
|
|
window._hmt.push([
|
|
@@ -269,7 +274,8 @@ export default {
|
|
|
// return;
|
|
|
// if(this.disableSnap) return; // 避免界面没有更新。
|
|
|
this.msg = "拍照中...";
|
|
|
- const captureBlob = await this.getSnapShot();
|
|
|
+ const captureBlob = await this.getSnapShot({ compareSync: true });
|
|
|
+ console.log("抓拍照片大小", captureBlob.size);
|
|
|
if (captureBlob.size < 10 * 1024) {
|
|
|
this.$Message.error({
|
|
|
content: "抓拍照片太小!",
|
|
@@ -287,11 +293,14 @@ export default {
|
|
|
}
|
|
|
this.videoStartPlay();
|
|
|
this.msg = "上传照片中...";
|
|
|
+ console.log(this.msg);
|
|
|
const [captureFilePath, signIdentifier] = await this.uploadToServer(
|
|
|
captureBlob
|
|
|
);
|
|
|
this.msg = "人脸比对中...";
|
|
|
+ console.log(this.msg);
|
|
|
await this.faceCompareSync(captureFilePath, signIdentifier);
|
|
|
+ console.log("人脸比对成功");
|
|
|
} catch (error) {
|
|
|
console.log("同步照片比对流程失败");
|
|
|
throw error;
|
|
@@ -301,7 +310,7 @@ export default {
|
|
|
this.disableSnap = false;
|
|
|
}
|
|
|
},
|
|
|
- async getSnapShot() {
|
|
|
+ async getSnapShot({ compareSync }) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
const video = this.$refs.video;
|
|
|
if (video.readyState !== 4 || !video.srcObject.active) {
|
|
@@ -310,19 +319,22 @@ export default {
|
|
|
duration: 5,
|
|
|
closable: true,
|
|
|
});
|
|
|
+
|
|
|
window._hmt.push([
|
|
|
"_trackEvent",
|
|
|
"摄像头框",
|
|
|
"摄像头状态",
|
|
|
- "摄像头没有正常启用-退出" +
|
|
|
- (this.lastSnapTime ? "(非初次抓拍)" : ""),
|
|
|
+ "摄像头没有正常启用" +
|
|
|
+ (!compareSync && this.lastSnapTime ? "-退出(非初次抓拍)" : ""),
|
|
|
]);
|
|
|
reject("摄像头没有正常启用");
|
|
|
- this.logout(
|
|
|
- "?LogoutReason=" +
|
|
|
- "摄像头没有正常启用-退出" +
|
|
|
- (this.lastSnapTime ? "(非初次抓拍)" : "")
|
|
|
- );
|
|
|
+ if (!compareSync) {
|
|
|
+ this.logout(
|
|
|
+ "?LogoutReason=" +
|
|
|
+ "摄像头没有正常启用" +
|
|
|
+ (!compareSync && this.lastSnapTime ? "-退出(非初次抓拍)" : "")
|
|
|
+ );
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
video.pause();
|