<template>
	<view class="cont">
		<view class="isok" v-if="success=='true'">
			<image src="https://api.yruibao.com/crmebimage/public/store/2024/03/13/890e232fe2134c59af708047981d905f3rcqj6uvey.png" mode=""></image>
			<div class="text">验证成功</div>
			<view class="button" @click="toindex()">
				完成
			</view>
		</view>
		<view class="isfalse"  v-if="success=='false'">
			<view class="topbox">
				<image src="https://api.yruibao.com/crmebimage/public/store/2024/03/13/23196fa3fa654d82bf9ceafe56f35d16d70mi7bq6k.png" mode=""></image>
				<view class="button" @click="topage()">
					重新识别
				</view>
			</view>
			<view class="texts">
				<view class="point">
				</view>
				确保本人面部出现在框内
			</view>
			<view class="texts">
				<view class="point">
				</view>
				确保面部与屏幕保持适当距离
			</view>
			<view class="texts">
				<view class="point">
				</view>
				保持光线充足和均匀
			</view>
			<view class="texts">
				<view class="point">
				</view>
				摘掉眼镜并露出耳朵
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getfaceToken,getfaceInfo
	} from '@/api/api.js'
	export default {
		data() {
			return {
				success:false,
				token:''
			}
		},
		onLoad(option) {
			let abb =option
			console.log(option);
			
			if(abb.success=='false'){
				this.success=abb.success
			}else if(abb.success=='true'){
				// let token ='2024031320063af586f9fb214f61bec2'
				// uni.setStorageSync('faceToken',token)
				console.log('panduan');
				// uni.showLoading({
				// 	title: '信息核验中...'
				// });
				if(uni.getStorageSync('faceToken')){
					this.token=uni.getStorageSync('faceToken')
				}
				this.getfaceinfo()
			}
			
		},
		methods: {
			getfaceinfo(){
				let data ={
					uid: this.$store.getters.uid,
					token:this.token
				}
				
			
				getfaceInfo(data).then(res => {
					
					if (res.code== '200') {
						console.log(res);
						if(res.data.result==0){
							this.success='true'
						}else{
							this.success='false'
						}
						
					}
					uni.hideLoading();
				}).catch(error => {
					uni.hideLoading();
					this.$util.Tips({
						title: error
					});
				});
			},
			topage(){
				uni.navigateTo({
					url:'/pages/users/faceTest/index'
				})
			},
			toindex(){
				uni.switchTab({
					url:'/pages/user/index'
				})
			}
			
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #FFFFFF !important;
	}
	.cont{
		width: 100%;
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		.isok{
			width: 100%;
			display: flex;
			flex-wrap: wrap;
			justify-content: center;
			image{
				margin-top: 190rpx;
				width: 302rpx;
				height: 302rpx;
			}
			.text{
				margin-top: 58rpx;
				width: 100%;
				text-align: center;
				font-weight: 500;
				font-size: 48rpx;
				color: #279EFB;
			}
			.button{
				margin-top: 160rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				width: 500rpx;
				height: 82rpx;
				background: #409EFF;
				border-radius: 10rpx 10rpx 10rpx 10rpx;
				
				font-weight: 500;
				font-size: 32rpx;
				color: #FFFFFF;
				line-height: 44rpx;
			}
		}
		.isfalse{
			.topbox{
				width: 100%;
				display: flex;
				flex-wrap: wrap;
				justify-content: center;
				image{
					margin-top: 246rpx;
					width: 592rpx;
					height: 388rpx;
				}
				
				.button{
					margin-top: 40rpx;
					margin-bottom: 44rpx;
					display: flex;
					justify-content: center;
					align-items: center;
					width: 500rpx;
					height: 82rpx;
					background: #409EFF;
					border-radius: 10rpx 10rpx 10rpx 10rpx;
					
					font-weight: 500;
					font-size: 32rpx;
					color: #FFFFFF;
					line-height: 44rpx;
				}
			}
			.texts{
				margin-top: 20rpx;
				padding-left: 100rpx;
				display: flex;
				flex-wrap: nowrap;
				align-items: center;
				
				font-weight: 400;
				font-size: 32rpx;
				color: #3D3D3D;
				line-height: 44rpx;
				.point{
					margin-right: 18rpx;
					width: 10rpx;
					height: 10rpx;
					background: #279EFB;
					border-radius: 50%;
				}
			}
		}
	}
</style>