|
@@ -75,14 +75,16 @@ export default {
|
|
|
},
|
|
|
async snapTimer() {
|
|
|
const captureBlob = await this.getSnapShot();
|
|
|
- const captureFilePath = await this.uploadToServer(captureBlob);
|
|
|
- await this.faceCompare(captureFilePath);
|
|
|
+ const [fileName, captureFilePath] = await this.uploadToServer(
|
|
|
+ captureBlob
|
|
|
+ );
|
|
|
+ await this.faceCompare(fileName, captureFilePath);
|
|
|
const video = this.$refs.video;
|
|
|
video && video.play();
|
|
|
},
|
|
|
async snap() {
|
|
|
const captureBlob = await this.getSnapShot();
|
|
|
- const captureFilePath = await this.uploadToServer(captureBlob);
|
|
|
+ const [, captureFilePath] = await this.uploadToServer(captureBlob);
|
|
|
await this.faceCompareSync(UPYUN_URL + captureFilePath);
|
|
|
const video = this.$refs.video;
|
|
|
video && video.play();
|
|
@@ -117,7 +119,7 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- return "/capture_photo/" + this.user.userId + "/" + fileName;
|
|
|
+ return [fileName, "/capture_photo/" + this.user.userId + "/" + fileName];
|
|
|
},
|
|
|
async faceCompareSync(captureFilePath) {
|
|
|
try {
|
|
@@ -138,39 +140,41 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
},
|
|
|
- async faceCompare(captureFilePath) {
|
|
|
+ async faceCompare(fileName, captureFilePath) {
|
|
|
try {
|
|
|
await this.$http.post(
|
|
|
"/api/ecs_oe_student_face/examCaptureQueue/uploadExamCapture?fileUrl=" +
|
|
|
UPYUN_URL +
|
|
|
captureFilePath +
|
|
|
"&fileName=" +
|
|
|
- captureFilePath +
|
|
|
+ fileName +
|
|
|
"&examRecordDataId=" +
|
|
|
this.$route.params.examRecordDataId
|
|
|
);
|
|
|
- this.showSnapResult(captureFilePath);
|
|
|
+ await this.showSnapResult(fileName);
|
|
|
} catch (e) {
|
|
|
console.log(e);
|
|
|
this.$Message.error(e.message);
|
|
|
return;
|
|
|
}
|
|
|
},
|
|
|
- async showSnapResult(captureFilePath) {
|
|
|
+ async showSnapResult(fileName) {
|
|
|
try {
|
|
|
// 获取抓拍结果
|
|
|
const snapRes = (await this.$http.get(
|
|
|
"/api/ecs_oe_student_face/examCaptureQueue/getExamCaptureResult?fileName=" +
|
|
|
- captureFilePath +
|
|
|
+ fileName +
|
|
|
"&examRecordDataId=" +
|
|
|
this.$route.params.examRecordDataId
|
|
|
)).data;
|
|
|
- if (snapRes) {
|
|
|
- if (snapRes.stranger) {
|
|
|
+ if (snapRes.isCompleted) {
|
|
|
+ if (snapRes.isStranger) {
|
|
|
this.$Message.error("请独立考试");
|
|
|
+ } else if (!snapRes.isPass) {
|
|
|
+ this.$Message.error("请保持正确坐姿");
|
|
|
}
|
|
|
} else {
|
|
|
- setTimeout(this.showSnapResult.bind(this, captureFilePath), 3000);
|
|
|
+ setTimeout(this.showSnapResult.bind(this, fileName), 10 * 1000);
|
|
|
}
|
|
|
} catch (e) {
|
|
|
console.log(e);
|