|
@@ -27,6 +27,7 @@ import MD5 from "js-md5";
|
|
import { mapState as globalMapState } from "vuex";
|
|
import { mapState as globalMapState } from "vuex";
|
|
import { createNamespacedHelpers } from "vuex";
|
|
import { createNamespacedHelpers } from "vuex";
|
|
const { mapState, mapMutations } = createNamespacedHelpers("examingHomeModule");
|
|
const { mapState, mapMutations } = createNamespacedHelpers("examingHomeModule");
|
|
|
|
+import { chromeUA } from "@/utils/ua.js";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "FaceRecognition",
|
|
name: "FaceRecognition",
|
|
@@ -192,6 +193,16 @@ export default {
|
|
const captureBlob = await this.getSnapShot();
|
|
const captureBlob = await this.getSnapShot();
|
|
this.videoStartPlay();
|
|
this.videoStartPlay();
|
|
console.log("抓拍照片的大小:" + captureBlob.size);
|
|
console.log("抓拍照片的大小:" + captureBlob.size);
|
|
|
|
+ if (captureBlob.size < 10 * 1024) {
|
|
|
|
+ // 经查以前记录,不完整图片均为8192大小。此处设置小于10KB的图片为未抓拍成功
|
|
|
|
+ window._hmt.push([
|
|
|
|
+ "_trackEvent",
|
|
|
|
+ "摄像头框",
|
|
|
|
+ "定时抓拍照片较小" + chromeUA.major,
|
|
|
|
+ captureBlob.size,
|
|
|
|
+ ]);
|
|
|
|
+ throw "定时抓拍照片较小";
|
|
|
|
+ }
|
|
// this.serverLog("debug/S-004001", "抓拍照片的大小:" + captureBlob.size);
|
|
// this.serverLog("debug/S-004001", "抓拍照片的大小:" + captureBlob.size);
|
|
const [captureFilePath, signIdentifier] = await this.uploadToServer(
|
|
const [captureFilePath, signIdentifier] = await this.uploadToServer(
|
|
captureBlob
|
|
captureBlob
|
|
@@ -203,11 +214,11 @@ export default {
|
|
);
|
|
);
|
|
} catch (error) {
|
|
} catch (error) {
|
|
// FIXME: more processing
|
|
// FIXME: more processing
|
|
- console.log("定时抓拍流程失败");
|
|
|
|
|
|
+ console.log("定时抓拍流程失败", error);
|
|
window._hmt.push([
|
|
window._hmt.push([
|
|
"_trackEvent",
|
|
"_trackEvent",
|
|
"摄像头框",
|
|
"摄像头框",
|
|
- "定时抓拍流程失败",
|
|
|
|
|
|
+ "定时抓拍流程失败" + error,
|
|
(this.lastSnapTime ? "(非初次抓拍)" : "") + "将再次抓拍",
|
|
(this.lastSnapTime ? "(非初次抓拍)" : "") + "将再次抓拍",
|
|
]);
|
|
]);
|
|
this.retrySnapTimeout = setTimeout(() => {
|
|
this.retrySnapTimeout = setTimeout(() => {
|
|
@@ -249,6 +260,21 @@ export default {
|
|
// if(this.disableSnap) return; // 避免界面没有更新。
|
|
// if(this.disableSnap) return; // 避免界面没有更新。
|
|
this.msg = "拍照中...";
|
|
this.msg = "拍照中...";
|
|
const captureBlob = await this.getSnapShot();
|
|
const captureBlob = await this.getSnapShot();
|
|
|
|
+ if (captureBlob.size < 10 * 1024) {
|
|
|
|
+ this.$Message.error({
|
|
|
|
+ content: "抓拍照片太小!",
|
|
|
|
+ duration: 15,
|
|
|
|
+ closable: true,
|
|
|
|
+ });
|
|
|
|
+ // 经查以前记录,不完整图片均为8192大小。此处设置小于10KB的图片为未抓拍成功
|
|
|
|
+ window._hmt.push([
|
|
|
|
+ "_trackEvent",
|
|
|
|
+ "摄像头框",
|
|
|
|
+ "抓拍照片较小" + chromeUA.major,
|
|
|
|
+ captureBlob.size,
|
|
|
|
+ ]);
|
|
|
|
+ throw "抓拍照片较小";
|
|
|
|
+ }
|
|
this.videoStartPlay();
|
|
this.videoStartPlay();
|
|
this.msg = "上传照片中...";
|
|
this.msg = "上传照片中...";
|
|
const [captureFilePath, signIdentifier] = await this.uploadToServer(
|
|
const [captureFilePath, signIdentifier] = await this.uploadToServer(
|
|
@@ -298,7 +324,7 @@ export default {
|
|
var context = canvas.getContext("2d");
|
|
var context = canvas.getContext("2d");
|
|
context.drawImage(video, 0, 0, 220, 165);
|
|
context.drawImage(video, 0, 0, 220, 165);
|
|
|
|
|
|
- canvas.toBlob(resolve, "image/png", 0.95);
|
|
|
|
|
|
+ canvas.toBlob(resolve, "image/jpeg", 0.95);
|
|
});
|
|
});
|
|
},
|
|
},
|
|
async uploadToServer(captureBlob) {
|
|
async uploadToServer(captureBlob) {
|
|
@@ -324,7 +350,7 @@ export default {
|
|
console.log(fileMd5);
|
|
console.log(fileMd5);
|
|
|
|
|
|
const params = new URLSearchParams();
|
|
const params = new URLSearchParams();
|
|
- params.append("fileSuffix", "png");
|
|
|
|
|
|
+ params.append("fileSuffix", "jpg");
|
|
params.append("fileMd5", fileMd5);
|
|
params.append("fileMd5", fileMd5);
|
|
const res = await this.$http.get(
|
|
const res = await this.$http.get(
|
|
"/api/ecs_oe_student/examControl/getCapturePhotoUpYunSign?" + params
|
|
"/api/ecs_oe_student/examControl/getCapturePhotoUpYunSign?" + params
|