fix: 人脸对比失败问题处理
This commit is contained in:
		
							parent
							
								
									e46f6213e5
								
							
						
					
					
						commit
						e3d6ab8e24
					
				| @ -34,7 +34,7 @@ struct ExaminerLoginPage { | |||||||
|       }) |       }) | ||||||
|       Row() { |       Row() { | ||||||
|         Text("请考官输入用户名和密码") |         Text("请考官输入用户名和密码") | ||||||
|           .fontSize(40) |           .fontSize(50) | ||||||
|           .fontColor("#EF9335") |           .fontColor("#EF9335") | ||||||
|           .width("100%") |           .width("100%") | ||||||
|           .height(50) |           .height(50) | ||||||
| @ -152,7 +152,7 @@ struct ExaminerLoginPage { | |||||||
| 
 | 
 | ||||||
|                   } catch (e) { |                   } catch (e) { | ||||||
|                     this.loadingDialog.close(); |                     this.loadingDialog.close(); | ||||||
|                     dConsole.error(ExaminerLoginTag, 'examinerLogin error: ' + e); |                     dConsole.error(ExaminerLoginTag, 'examinerLogin error: ' + JSON.stringify(e)); | ||||||
|                     Prompt.showToast({ |                     Prompt.showToast({ | ||||||
|                       message: "登录失败,请稍后重试", |                       message: "登录失败,请稍后重试", | ||||||
|                       duration: 2000 |                       duration: 2000 | ||||||
| @ -194,7 +194,7 @@ struct btnComponent { | |||||||
|   build() { |   build() { | ||||||
|     Row() { |     Row() { | ||||||
|       if (this.text != "确定" && this.text !== "退格" && this.text !== "清空") { |       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")) |     .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")) | ||||||
|  | |||||||
| @ -2,7 +2,7 @@ import { faceCompare } from '../../api/userInfo'; | |||||||
| 
 | 
 | ||||||
| import common from '@ohos.app.ability.common'; | import common from '@ohos.app.ability.common'; | ||||||
| 
 | 
 | ||||||
| import { GlobalConfig } from '../../config/index'; | import { FaceCompareTag, GlobalConfig } from '../../config/index'; | ||||||
| import { VideoConfigData } from '../../mock'; | import { VideoConfigData } from '../../mock'; | ||||||
| import { CarInfoType, UDPParamType, VideoConfig } from '../../model'; | import { CarInfoType, UDPParamType, VideoConfig } from '../../model'; | ||||||
| import { NumberToByteArray } from '../../utils/Common'; | import { NumberToByteArray } from '../../utils/Common'; | ||||||
| @ -11,6 +11,7 @@ import { CenterUDPBusinessInstance } from '../../utils/business/CenterUdpBusines | |||||||
| import { takePhoto, takePhotoParam } from '../../utils/Video'; | import { takePhoto, takePhotoParam } from '../../utils/Video'; | ||||||
| import { voiceService } from '../../utils/Voice'; | import { voiceService } from '../../utils/Voice'; | ||||||
| import { dConsole } from '../../utils/LogWorker'; | import { dConsole } from '../../utils/LogWorker'; | ||||||
|  | import { BusinessError } from '@ohos.base'; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @Component | @Component | ||||||
| @ -56,31 +57,33 @@ export default struct FaceCompare { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async faceCompareFn() { |   async faceCompareFn() { | ||||||
|     dConsole.log('mmmmm0', 2) |     dConsole.log(FaceCompareTag, '人脸对比开始', 2) | ||||||
|     this.param.pztd = this.param.rlls |     this.param.pztd = this.param.rlls | ||||||
|     const data: takePhotoParam = await takePhoto(this.param, this.context, 'jt/', 1,) |     const data: takePhotoParam = await takePhoto(this.param, this.context, 'jt/', 1,) | ||||||
|     this.base64 = this.imageBase64 + (data?.base64 || "") |     this.base64 = this.imageBase64 + (data?.base64 || "") | ||||||
|     dConsole.log('mmmmt', this.base64) | 
 | ||||||
|  | 
 | ||||||
|     faceCompare({ |     faceCompare({ | ||||||
|       sfzh: this.sfzh.toString(), |       sfzh: this.sfzh.toString(), | ||||||
|       firstImage: this.firstImage.substr(22), |       firstImage: this.firstImage.substr(22), | ||||||
|       secondImage: data?.base64 || "", |       secondImage: data?.base64 || "", | ||||||
|       type: "2", |       type: "2", | ||||||
|       verifyType: "1" |       verifyType: "1" | ||||||
|     }) |     }).then(res => { | ||||||
|       .then(res => { |       dConsole.log(FaceCompareTag, '人脸比对结果', JSON.stringify(res)) | ||||||
|         dConsole.log('mmmmm8', JSON.stringify(res)) |  | ||||||
|       if (res.imageCompareRsp?.head?.resultCode == '0') { |       if (res.imageCompareRsp?.head?.resultCode == '0') { | ||||||
|         this.controller.stop() |         this.controller.stop() | ||||||
|         this.showFaceCompare = !this.showFaceCompare |         this.showFaceCompare = !this.showFaceCompare | ||||||
|         this.showFaceCompareFlag = !this.showFaceCompareFlag |         this.showFaceCompareFlag = !this.showFaceCompareFlag | ||||||
|         this.faceCompareSuccess = 1; |         this.faceCompareSuccess = 1; | ||||||
|  |         dConsole.log(FaceCompareTag, "人脸对比成功") | ||||||
|         // this.faceCatchImg = result |         // this.faceCatchImg = result | ||||||
|         this.vocObj.playAudio({ |         this.vocObj.playAudio({ | ||||||
|           type: 1, |           type: 1, | ||||||
|           name: 'yzcg.wav' |           name: 'yzcg.wav' | ||||||
|         }) |         }) | ||||||
|       } else { |       } else { | ||||||
|  |         dConsole.log(FaceCompareTag, "人脸对比失败") | ||||||
|         this.times++; |         this.times++; | ||||||
|         //3s后开始语音提示 |         //3s后开始语音提示 | ||||||
|         this.vocObj.playAudio({ |         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() { |   async heartMsg() { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user