fix: 人脸对比失败问题处理

This commit is contained in:
wangzhongjie 2025-09-11 11:05:00 +08:00
parent e46f6213e5
commit e3d6ab8e24
2 changed files with 38 additions and 28 deletions

View File

@ -34,7 +34,7 @@ struct ExaminerLoginPage {
})
Row() {
Text("请考官输入用户名和密码")
.fontSize(40)
.fontSize(50)
.fontColor("#EF9335")
.width("100%")
.height(50)
@ -152,7 +152,7 @@ struct ExaminerLoginPage {
} catch (e) {
this.loadingDialog.close();
dConsole.error(ExaminerLoginTag, 'examinerLogin error: ' + e);
dConsole.error(ExaminerLoginTag, 'examinerLogin error: ' + JSON.stringify(e));
Prompt.showToast({
message: "登录失败,请稍后重试",
duration: 2000
@ -194,7 +194,7 @@ struct btnComponent {
build() {
Row() {
if (this.text != "确定" && this.text !== "退格" && this.text !== "清空") {
Text(this.text).fontSize(40).fontColor("#F0DEC5")
Text(this.text).fontSize(50).fontColor("#F0DEC5")
}
}
.backgroundImage(this.text === "确定" ? $r("app.media.queding_nor") : this.text === "退格" ? $r("app.media.delete_nor") : this.text === "清空" ? $r("app.media.clear_nor") : $r("app.media.nor_btn"))

View File

@ -2,7 +2,7 @@ import { faceCompare } from '../../api/userInfo';
import common from '@ohos.app.ability.common';
import { GlobalConfig } from '../../config/index';
import { FaceCompareTag, GlobalConfig } from '../../config/index';
import { VideoConfigData } from '../../mock';
import { CarInfoType, UDPParamType, VideoConfig } from '../../model';
import { NumberToByteArray } from '../../utils/Common';
@ -11,6 +11,7 @@ import { CenterUDPBusinessInstance } from '../../utils/business/CenterUdpBusines
import { takePhoto, takePhotoParam } from '../../utils/Video';
import { voiceService } from '../../utils/Voice';
import { dConsole } from '../../utils/LogWorker';
import { BusinessError } from '@ohos.base';
@Component
@ -56,31 +57,33 @@ export default struct FaceCompare {
}
async faceCompareFn() {
dConsole.log('mmmmm0', 2)
dConsole.log(FaceCompareTag, '人脸对比开始', 2)
this.param.pztd = this.param.rlls
const data: takePhotoParam = await takePhoto(this.param, this.context, 'jt/', 1,)
this.base64 = this.imageBase64 + (data?.base64 || "")
dConsole.log('mmmmt', this.base64)
faceCompare({
sfzh: this.sfzh.toString(),
firstImage: this.firstImage.substr(22),
secondImage: data?.base64 || "",
type: "2",
verifyType: "1"
})
.then(res => {
dConsole.log('mmmmm8', JSON.stringify(res))
}).then(res => {
dConsole.log(FaceCompareTag, '人脸比对结果', JSON.stringify(res))
if (res.imageCompareRsp?.head?.resultCode == '0') {
this.controller.stop()
this.showFaceCompare = !this.showFaceCompare
this.showFaceCompareFlag = !this.showFaceCompareFlag
this.faceCompareSuccess = 1;
dConsole.log(FaceCompareTag, "人脸对比成功")
// this.faceCatchImg = result
this.vocObj.playAudio({
type: 1,
name: 'yzcg.wav'
})
} else {
dConsole.log(FaceCompareTag, "人脸对比失败")
this.times++;
//3s后开始语音提示
this.vocObj.playAudio({
@ -89,8 +92,15 @@ export default struct FaceCompare {
})
}
}).catch((err: BusinessError) => {
console.log(FaceCompareTag, "人脸对比失败", JSON.stringify(err))
this.times++;
//3s后开始语音提示
this.vocObj.playAudio({
type: 1,
name: 'face_fail.mp3'
})
})
dConsole.log('mmmmm8', 9)
}
async heartMsg() {