refactor(train_management): 优化人脸认证页面代码结构
-调整代码格式,提高可读性 - 移除冗余的空行和注释 - 统一代码风格 -优化部分变量和方法的命名hyx_2025-01-13_xgf2.0
							parent
							
								
									25d047341a
								
							
						
					
					
						commit
						4934e79c45
					
				|  | @ -5,7 +5,8 @@ | |||
| 		</view> | ||||
| 		<view class="livefater"> | ||||
| 			<view style="width: 700upx; height: 700upx; border-radius: 700upx; overflow: hidden"> | ||||
| 				<live-pusher id="livePusher" ref="livePusher" class="livePusher" url="" mode="SD" :muted="true" :enable-camera="true" :auto-focus="true" :beauty="1" whiteness="2" aspect="1:1" /> | ||||
| 				<live-pusher id="livePusher" ref="livePusher" class="livePusher" url="" mode="SD" :muted="true" | ||||
| 					:enable-camera="true" :auto-focus="true" :beauty="1" whiteness="2" aspect="1:1" /> | ||||
| 			</view> | ||||
| 			<cover-image src="/static/images/gaiz.png" class="gaiimg"></cover-image> | ||||
| 		</view> | ||||
|  | @ -17,10 +18,14 @@ | |||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| // import {setMeetingFace, setScanCodeToVerifyFace, setUserFace, setVerifyFace} from "@/api"; | ||||
| import { submitEditUserFace, compareUserFaceCertify, compareUserExamFaceCertify } from '@/api'; | ||||
| 	// import {setMeetingFace, setScanCodeToVerifyFace, setUserFace, setVerifyFace} from "@/api"; | ||||
| 	import { | ||||
| 		submitEditUserFace, | ||||
| 		compareUserFaceCertify, | ||||
| 		compareUserExamFaceCertify | ||||
| 	} from '@/api'; | ||||
| 
 | ||||
| export default { | ||||
| 	export default { | ||||
| 		data() { | ||||
| 			return { | ||||
| 				startPreviewTimer: null, // 开始预览计时器实例 | ||||
|  | @ -57,11 +62,17 @@ export default { | |||
| 			this.routeQueryparams = query ?? {} | ||||
| 		}, | ||||
| 		onBackPress(event) { | ||||
| 		if (event.from === 'backbutton') { | ||||
| 			if ((this.type === 'scan_face' && this.isFirst === '1') || this.type === 'learning_certification' || this.type === 'facial_input') { | ||||
| 				uni.$u.toast('请完成人脸验证') | ||||
| 				return true | ||||
| 			} | ||||
| 			// if (event.from === 'backbutton') { | ||||
| 			// 	if ((this.type === 'scan_face' && this.isFirst === '1') || this.type === 'learning_certification' || this.type === 'facial_input') { | ||||
| 			// 		uni.$u.toast('请完成人脸验证') | ||||
| 			// 		return true | ||||
| 			// 	} | ||||
| 			// } | ||||
| 			if (this.type === 'facial_input') { | ||||
| 				uni.$u.route({ | ||||
| 					type: 'redirect', | ||||
| 					url: '/pages/index/index', | ||||
| 				}) | ||||
| 			} | ||||
| 			return false | ||||
| 		}, | ||||
|  | @ -89,8 +100,7 @@ export default { | |||
| 				}) | ||||
| 			}, | ||||
| 			getMinImage(imgPath) { | ||||
| 			plus.zip.compressImage( | ||||
| 				{ | ||||
| 				plus.zip.compressImage({ | ||||
| 						src: imgPath, | ||||
| 						dst: imgPath, | ||||
| 						overwrite: true, | ||||
|  | @ -102,7 +112,8 @@ export default { | |||
| 							reader.onloadend = async (res) => { | ||||
| 								const speech = res.target.result | ||||
| 								// 获取 base 64 图片编码的前缀 | ||||
| 							const USERAVATARPREFIX = speech.substring(0, speech.indexOf('base64,') + 7) | ||||
| 								const USERAVATARPREFIX = speech.substring(0, speech.indexOf( | ||||
| 									'base64,') + 7) | ||||
| 								// 获取 base 64 图片的二进制到文本 | ||||
| 								const USERAVATARURL = speech.substring(speech.indexOf('base64,') + 7) | ||||
| 								try { | ||||
|  | @ -110,7 +121,8 @@ export default { | |||
| 										...this.routeQueryparams | ||||
| 									} | ||||
| 									delete otherParams.type | ||||
| 								if (this.type === 'facial_input' || this.type === 'update_facial_input') { | ||||
| 									if (this.type === 'facial_input' || this.type === | ||||
| 										'update_facial_input') { | ||||
| 										await submitEditUserFace({ | ||||
| 											...otherParams, | ||||
| 											USERAVATARPREFIX, | ||||
|  | @ -165,41 +177,41 @@ export default { | |||
| 				) | ||||
| 			} | ||||
| 		} | ||||
| } | ||||
| 	} | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
| .container { | ||||
| 	.container { | ||||
| 		background-color: #fff; | ||||
| } | ||||
| 	} | ||||
| 
 | ||||
| .livePusher { | ||||
| 	.livePusher { | ||||
| 		width: 700upx; | ||||
| 		height: 700upx; | ||||
| } | ||||
| 	} | ||||
| 
 | ||||
| .livefater { | ||||
| 	.livefater { | ||||
| 		display: flex; | ||||
| 		justify-content: center; | ||||
| 		flex-direction: column; | ||||
| 		align-items: center; | ||||
| 		margin-bottom: 100upx; | ||||
| 		height: 700upx; | ||||
| } | ||||
| 	} | ||||
| 
 | ||||
| .fat { | ||||
| 	.fat { | ||||
| 		margin: 100upx; | ||||
| } | ||||
| 	} | ||||
| 
 | ||||
| .fatt { | ||||
| 	.fatt { | ||||
| 		text-align: center; | ||||
| 		font-size: 36upx; | ||||
| 		font-weight: 800; | ||||
| } | ||||
| 	} | ||||
| 
 | ||||
| .gaiimg { | ||||
| 	.gaiimg { | ||||
| 		width: 700upx; | ||||
| 		height: 700upx; | ||||
| 		margin-top: -700upx; | ||||
| } | ||||
| 	} | ||||
| </style> | ||||
		Loading…
	
		Reference in New Issue