<template>
	<view>
		<headContent>
			<template #left>
				<view class="head-revers-back iconfont" @click.stop="reversBackBtn()">&#xe604;</view>
			</template>
		</headContent>

		<view class="page-content">
			<text class="login-title">注册</text>
			<text class="login-content">验证码已发送至{{email}}</text>

			<view class="code-box">
				<u-code-input v-model="emailCode" :maxlength="6" :focus="true"></u-code-input>
				<view class="code-hint" @click.stop="resendCode()">重新发送</view>
			</view>


		</view>
	</view>
</template>

<script>
	import {
		Api_getEmailCode
	} from "@/api/index.js"
	import {
		reverseBack
	} from "@/utils/common.js"


	export default {
		name: 'emailVerify',

		data() {
			return {
				email: '',
				emailCode: ''
			};
		},
		onLoad(opt) {
			this.email = opt?.email;
			this.getEmailCode()
		},
		methods: {
			getEmailCode() {
				Api_getEmailCode({
					user_string: this.email
				}).then(res => {

				}).catch(err => {

				})
			},

			reversBackBtn() {
				reverseBack()
			},
			
			resendCode(){
				this.getEmailCode()
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "~./common.scss"
</style>