|
|
@@ -3,20 +3,25 @@
|
|
|
<div class="card" v-if="step === 1">
|
|
|
<div class="logo">
|
|
|
<img alt="RunForge" src="/logo.svg" height="40">
|
|
|
- <span class="title">RunForge | 人脸录入</span>
|
|
|
+ <span class="title">RunForge | 人脸采集</span>
|
|
|
</div>
|
|
|
|
|
|
<input type="text" id="name" placeholder="姓名">
|
|
|
<input type="text" id="student_num" placeholder="学号">
|
|
|
+ <input type="text" id="captcha" placeholder="验证码">
|
|
|
+ <div id="captchaImg" @click="getCaptcha()" title="点击更换验证码">
|
|
|
+ <img alt="点我重试" :src="ImageCaptcha" v-if="ImageCaptcha" />
|
|
|
+ <a-spin dot v-else />
|
|
|
+ </div>
|
|
|
|
|
|
<a-button type="primary" shape="round" size="large" @click="getUserInfo"
|
|
|
- :loading="buttonLoading">开始人脸识别</a-button>
|
|
|
+ :loading="buttonLoading">开始人脸采集</a-button>
|
|
|
</div>
|
|
|
|
|
|
<div class="card" v-else-if="step === 2">
|
|
|
<div class="logo">
|
|
|
<img alt="RunForge" src="/logo.svg" height="40">
|
|
|
- <span class="title">人脸识别注意事项</span>
|
|
|
+ <span class="title">人脸采集注意事项</span>
|
|
|
</div>
|
|
|
<Doc />
|
|
|
<a-button type="primary" shape="round" size="large" @click="step = 3"
|
|
|
@@ -26,9 +31,9 @@
|
|
|
<div class="card" v-else-if="step === 3">
|
|
|
<div class="logo">
|
|
|
<img alt="RunForge" src="/logo.svg" height="40">
|
|
|
- <span class="title">RunForge | 人脸识别</span>
|
|
|
+ <span class="title">RunForge | 人脸采集</span>
|
|
|
</div>
|
|
|
- <FaceReco :userInfo="userInfo"/>
|
|
|
+ <FaceReco :userInfo="userInfo" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -37,6 +42,7 @@
|
|
|
import { ref, reactive, onMounted } from 'vue'
|
|
|
import { Message } from '@arco-design/web-vue'
|
|
|
import { BeginFaceReco } from '@/api/lepao'
|
|
|
+import { getImageCaptcha } from '@/api/login'
|
|
|
import Doc from './components/doc.vue'
|
|
|
import FaceReco from './components/faceReco.vue'
|
|
|
|
|
|
@@ -44,17 +50,39 @@ const step = ref(1)
|
|
|
const buttonLoading = ref(false)
|
|
|
const userInfo = ref({})
|
|
|
|
|
|
+let CaptchaId = ref('')
|
|
|
+let ImageCaptcha = ref('')
|
|
|
+
|
|
|
+const getCaptcha = async () => {
|
|
|
+ try {
|
|
|
+ const res = await getImageCaptcha()
|
|
|
+ if (!res || res.code != 0)
|
|
|
+ return Message.error('获取图片验证码失败!' + res?.msg ?? '')
|
|
|
+ ImageCaptcha.value = res.data.img
|
|
|
+ CaptchaId.value = res.data.id
|
|
|
+ } catch (error) {
|
|
|
+ Message.error('获取图片验证码失败!')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const getUserInfo = async () => {
|
|
|
try {
|
|
|
buttonLoading.value = true
|
|
|
const name = document.getElementById('name').value
|
|
|
const student_num = document.getElementById('student_num').value
|
|
|
- if (!name || !student_num)
|
|
|
- return Message.error('请将姓名、学号填写完整')
|
|
|
+ const captchaEl = document.getElementById('captcha')
|
|
|
+ const captcha = captchaEl.value
|
|
|
+ if (!name || !student_num || !captcha)
|
|
|
+ return Message.error('请将信息填写完整')
|
|
|
+
|
|
|
+ const res = await BeginFaceReco({ name, student_num, captcha, id: CaptchaId.value })
|
|
|
+ if (!res || res.code !== 0) {
|
|
|
+ Message.error(res?.msg ?? '获取人脸识别信息失败!请稍后再试')
|
|
|
+ getCaptcha()
|
|
|
+ captchaEl.value = ''
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- const res = await BeginFaceReco({ name, student_num })
|
|
|
- if (!res || res.code !== 0)
|
|
|
- return Message.error(res?.msg ?? '获取人脸识别信息失败!请稍后再试')
|
|
|
userInfo.value = res.data
|
|
|
step.value = 2
|
|
|
} catch (error) {
|
|
|
@@ -66,6 +94,9 @@ const getUserInfo = async () => {
|
|
|
|
|
|
// 预加载模型
|
|
|
|
|
|
+onMounted(() => {
|
|
|
+ getCaptcha()
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
@@ -128,13 +159,13 @@ const getUserInfo = async () => {
|
|
|
}
|
|
|
|
|
|
button {
|
|
|
- padding: 10px 20px;
|
|
|
+ padding: 20px 20px;
|
|
|
border: none;
|
|
|
border-radius: 10px;
|
|
|
background-color: #4A90E2;
|
|
|
color: #fff;
|
|
|
cursor: pointer;
|
|
|
- margin-top: 10px;
|
|
|
+ margin-top: 20px;
|
|
|
}
|
|
|
}
|
|
|
</style>
|