<template>
	<view>
		<!-- 头部 -->
		<headContent>
			<template #left>
				<view class="head-revers-back iconfont" @click.stop="reversBackBtn()">&#xe604;</view>
			</template>
			<template #content>
				<view class="haed-title">安全验证</view>
			</template>
		</headContent>
		<view class="page-content">
			<text class="login-title">谷歌验证</text>
			<text class="login-content">谷歌验证具有时效性，请于限时前输入</text>
			<view class="form-item">

				<input class="form-input" v-model="code" placeholder-class="form-input-place" :placeholder="`请输入验证码`" />

			</view>
			<view :class="['form-btn' , code ? '' : 'invalid-form-btn']" style="margin-top: 28rpx;"
				@click.stop="formSubmit">
				确定
			</view>
		</view>



	</view>
</template>

<script>
	import {
		reverseBack
	} from "@/utils/common.js"
	import {
		Api_checkGoogle
	} from "@/api/index.js"
	export default {
		name: 'google-verification',
		data() {
			return {
				code: '',
			};
		},
		onLoad(opt) {

		},


		methods: {

			reversBackBtn() {
				reverseBack()
			},

			formSubmit() {
				uni.showLoading({
					title: '',
					mask: true
				});
				Api_checkGoogle({
					code: this.code
				}).then(res => {
					setTimeout(() => {
						uni.showToast({
							title: `验证成功`,
							icon: "none"
						})
						setTimeout(() => {
							uni.reLaunch({
								url: '/pages/content/mine'
							});
						}, 1000)
					}, 300)
				}).catch(err =>{}).finally(() => {
						setTimeout(() => {
							uni.hideLoading()
						}, 200)
				})
				// Api_checkGoogle().then(res => {
				// 	setTimeout(() => {
				// 		uni.showToast({
				// 			title: `验证成功`,
				// 			icon: "none"
				// 		})
				// 		setTimeout(() => {
				// 			uni.reLaunch({
				// 				url: '/pages/content/mine'
				// 			});
				// 		}, 1000)
				// 	}, 300)
				// }).catch(err => {

				// }).failly(() => {
				// 	setTimeout(() => {
				// 		uni.hideLoading()
				// 	}, 200)
				// })

			}
		}
	}
</script>

<style lang="scss" scoped>
	.head-revers-back {
		font-size: 52rpx;
		color: #000;
	}

	.page-content {
		width: 100%;
		padding: 30rpx 60rpx 0;

		.login-title {
			display: block;
			font-size: 68rpx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: 700;
			color: #333333;
			line-height: 1.2;
			letter-spacing: 0.96rpx;
		}

		.login-content {

			display: block;
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC-Regular;
			font-weight: 400;
			color: #808080;
			line-height: 1.2;
			letter-spacing: 0.56rpx;
			padding: 20rpx 0 40rpx;
		}

	}

	.tab-box {
		padding-bottom: 44rpx;
	}

	.tab {
		width: 100%;
		display: flex;
		align-items: center;
		padding-top: 46rpx;

		.tab-item {
			font-size: 30rpx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: 700;
			color: #1a1a1a;
			line-height: 38rpx;
			letter-spacing: 0.6rpx;

			+.tab-item {
				margin-left: 50rpx;
			}
		}

		.active-tab-item {
			color: $Theme-Color;
			position: relative;

			&::before {
				position: absolute;
				left: 0;
				bottom: -11rpx;
				content: '';
				width: 100%;
				height: 6rpx;
				border-radius: 2rpx;
				background-color: $Theme-Color;
			}
		}

	}

	.form-lable-icon {
		margin-left: 4px;
		font-size: 18rpx;
	}

	.login-form {
		width: 100%;

		.form-item {
			width: 100%;
			height: 90rpx;
			padding: 0 20rpx;
			display: flex;
			align-items: center;
			background-color: $box-bg;
			border-radius: 6rpx;
			margin-top: 20rpx;

			&:first-child {
				margin-top: 0;
			}

			.form-lable {
				width: 140rpx;
				height: 100%;
				font-size: 24rpx;
				flex-wrap: 700;
				display: flex;
				align-items: center;
			}

			.form-input {
				flex: 1;
				height: 100%;
				font-size: 28rpx;
			}

			.form-input-place {
				font-size: 28rpx;
				color: #938989;
			}
		}


	}

	.form-agreement {
		width: 100%;
		display: flex;
		align-items: center;
		font-size: 26rpx;
		color: #938989;
		padding: 26rpx 0;

		.agreement-confirm {
			width: 30rpx;
			height: 30rpx;
			background-color: $box-bg;
			margin-right: 10rpx;
			border-radius: 6rpx;

			.confirm-icon {
				width: 100%;
				height: 100%;
				background-color: $Theme-Color;
				color: #fff;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 24rpx;
			}
		}

		.agreement-name {
			color: $Theme-Color;
		}
	}

	.form-btn {
		width: 100%;
		height: 90rpx;
		background-color: $Theme-Color;
		border-radius: 8rpx;
		text-align: center;
		line-height: 90rpx;
		color: #fff;
		font-size: 32rpx;
		font-weight: bold;
	}

	.invalid-form-btn {
		background-color: #e3e0e0;
	}

	.form-hint {
		width: 100%;
		padding: 46rpx 0 0;
		font-size: 24rpx;
		line-height: 1.2;
		color: #c1c1c1;
		display: flex;
		justify-content: center;
		align-items: stretch;

		.hint-btn {
			color: $Theme-Color;
		}

		.form-hint-link {
			margin: 0 10px;
			width: 1rpx;
			background-color: #cfcfcf;
		}
	}

	.code-box {
		width: 100%;
		margin-top: 50rpx;

		.code-hint {
			margin-top: 50rpx;
			font-size: 28rpx;
			display: inline-block;
			color: #666;
		}
	}

	.login-title {
		font-size: 34rpx !important;
	}

	.login-content {
		padding-bottom: 0 !important;
	}

	.form-lable {
		min-width: 100rpx;
		text-align: center;
		padding: 0 20rpx;
		flex-shrink: 0;
	}

	.form-item {
		width: 100%;
		min-height: 100rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1rpx solid $border-color4;

		.form-input {
			flex: 1;
			font-size: 26rpx;
		}

		.form-input-place {
			font-size: 26rpx;
			font-weight: 800;
		}

		.form-code {
			flex-shrink: 0;
			padding-left: 10rpx;
			font-size: 26rpx;
			color: $Theme-Color;
		}
	}


	.form-btn {
		margin-top: 80rpx !important;
	}
</style>