|
@@ -1,30 +1,27 @@
|
|
<template>
|
|
<template>
|
|
- <Modal v-model="faceCheckModalOpen" width="900" :mask-closable="false" :closable="false">
|
|
|
|
|
|
+ <Modal v-model="faceCheckModalOpen" width="900" :mask-closable="false" :closable="false" @on-visible-change="updateCameraState">
|
|
<div slot="header" style="display: flex; justify-content: space-between; align-items: center;">
|
|
<div slot="header" style="display: flex; justify-content: space-between; align-items: center;">
|
|
<div class="qm-title-text">人脸识别</div>
|
|
<div class="qm-title-text">人脸识别</div>
|
|
- <Icon type="ios-close" class="qm-icon-button" size="24" @click="close" />
|
|
|
|
|
|
+ <Icon type="ios-close" class="qm-icon-button" size="24" @click="closeModal" />
|
|
</div>
|
|
</div>
|
|
<div style="display: grid; grid-template-columns: 200px 400px 1fr; grid-gap: 5px;">
|
|
<div style="display: grid; grid-template-columns: 200px 400px 1fr; grid-gap: 5px;">
|
|
- <div class="avatar">
|
|
|
|
- <img :src="userPhoto" width="200px" alt="底照" />
|
|
|
|
- <div class="avatar-info" style="text-align: center; margin-top: -50px; color: white;">
|
|
|
|
|
|
+ <div class="avatar" :style="{ backgroundImage: `url('${userPhoto}')` }">
|
|
|
|
+ <!-- <img :src="userPhoto" width="200px" height="300px" alt="底照" /> -->
|
|
|
|
+ <div class="avatar-info" style="text-align: center; margin-top: 260px; color: white;">
|
|
<!-- FIXME: 没有底照的逻辑 -->
|
|
<!-- FIXME: 没有底照的逻辑 -->
|
|
<span style="background-color: rgba(0, 0, 0, 0.5); display: inline-block;padding: 6px 16px; border-radius: 6px;">我的底照</span>
|
|
<span style="background-color: rgba(0, 0, 0, 0.5); display: inline-block;padding: 6px 16px; border-radius: 6px;">我的底照</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="camera">
|
|
<div class="camera">
|
|
- <video id="video" width="400px" height="100%" autoplay>
|
|
|
|
- </video>
|
|
|
|
- <div class="avatar-info" style="text-align: center; margin-top: -50px; color: #232323;">
|
|
|
|
- <span class="verify-button" style="font-size: 16px; background-color: #ffcc00; display: inline-block;padding: 6px 16px; border-radius: 6px;">开始识别</span>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <FaceRecognition width="400" height="300" :close-camera="closeCamera" @on-recognize-result="getFaceRecognitionResult">
|
|
|
|
+ </FaceRecognition>
|
|
</div>
|
|
</div>
|
|
- <div class="verify-desc">
|
|
|
|
- <h4 class="font-thin m-t-none m-b text-info">操作提示:</h4>
|
|
|
|
- <p class="text-sm m-b-xs">1.请先确保摄像头设备已连接并能正常工作;</p>
|
|
|
|
- <p class="text-sm m-b-xs">2.请保持光源充足,不要逆光操作;</p>
|
|
|
|
- <p class="text-sm m-b-xs">3.请保证脸部正面面向摄像头,并适当调整姿势保证整个脸部能够进入左侧识别画面;</p>
|
|
|
|
- <p class="text-sm m-b-xs">4.系统识别通过后,将自动跳转进入考试界面;</p>
|
|
|
|
|
|
+ <div class="verify-desc qm-primary-text">
|
|
|
|
+ <h4 class="qm-big-text" style="font-weight: bold">操作提示:</h4>
|
|
|
|
+ <p>1.请先确保摄像头设备已连接并能正常工作;</p>
|
|
|
|
+ <p>2.请保持光源充足,不要逆光操作;</p>
|
|
|
|
+ <p>3.请保证脸部正面面向摄像头,并适当调整姿势保证整个脸部能够进入左侧识别画面;</p>
|
|
|
|
+ <p>4.系统识别通过后,将自动跳转进入考试界面;</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div slot="footer">
|
|
<div slot="footer">
|
|
@@ -33,12 +30,14 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import FaceRecognition from "@/components/FaceRecognition/FaceRecognition.vue";
|
|
import { createNamespacedHelpers } from "vuex";
|
|
import { createNamespacedHelpers } from "vuex";
|
|
const { mapState, mapMutations } = createNamespacedHelpers("examHomeModule");
|
|
const { mapState, mapMutations } = createNamespacedHelpers("examHomeModule");
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
|
+ name: "OnlineExamFaceCheckModal",
|
|
data() {
|
|
data() {
|
|
- return { userPhoto: null };
|
|
|
|
|
|
+ return { userPhoto: null, closeCamera: false };
|
|
},
|
|
},
|
|
props: {
|
|
props: {
|
|
open: Boolean
|
|
open: Boolean
|
|
@@ -66,9 +65,38 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...mapMutations(["toggleFaceCheckModal"]),
|
|
...mapMutations(["toggleFaceCheckModal"]),
|
|
- close() {
|
|
|
|
|
|
+ closeModal() {
|
|
|
|
+ this.closeCamera = true;
|
|
this.toggleFaceCheckModal(false);
|
|
this.toggleFaceCheckModal(false);
|
|
|
|
+ },
|
|
|
|
+ updateCameraState(modalVisible) {
|
|
|
|
+ console.log(modalVisible);
|
|
|
|
+ this.closeCamera = !modalVisible;
|
|
|
|
+ },
|
|
|
|
+ getFaceRecognitionResult(err, result) {
|
|
|
|
+ console.log(err);
|
|
|
|
+ if (!err) {
|
|
|
|
+ const { faceCount, verifyResult, fileName } = result;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ components: {
|
|
|
|
+ FaceRecognition
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+.avatar {
|
|
|
|
+ background: center no-repeat;
|
|
|
|
+ background-size: cover;
|
|
|
|
+ width: 200px;
|
|
|
|
+ height: 300px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.verify-desc {
|
|
|
|
+ padding: 0 1em;
|
|
|
|
+ line-height: 1.8em;
|
|
|
|
+}
|
|
|
|
+</style>
|
|
|
|
+
|