<template>
  <view class="ezy-login-page">
	  <view class="ezy-login-wrap" >
			<view class="login-body-box">
				<view class="login-title-img"></view>
				<view class="phone-prefix">验证码已发送至：{{data.phoneNumber}}</view>
				<view class="phone-input-box">
					<input class="phone-input" type="text" v-model="data.yzmNumber" placeholder="请输入验证码" 
					maxlength="6" :value="data.yzmNumber" @input="clearYzmInput" />
					<view class="close-btn" v-if="data.clearYzmIcon" @click="clearYzm"></view>
				</view>
				<view class="yzm-btn-disabled" @click="loginBtn" :class="data.yzmStatus"></view>
			</view>
		</view>
		  
  </view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from "vue"
	
	const data = reactive({
		phoneNumber: null,
		yzmNumber: null,
		clearYzmIcon: false,
		yzmStatus:'',
	})
	
	/********* 验证码 *********/
	const loginBtn = () => {
		uni.switchTab({
			url: '/pages/study/index'
		});
		/* uni.navigateTo({
			url: `/pages/study/index?gradeId=${options.grade}&termId=${options.term}&text=${text1}${text2}`
		}) */
	}
	
	const clearYzmInput = (event) => {
		if (event.detail.value.length > 0) {
		    data.clearYzmIcon = true;
		} else {
		    data.clearYzmIcon = false;
		}
	}
	
	const clearYzm = () => {
		data.yzmNumber = '';
		data.clearYzmIcon = false;
	}
	
	
</script>
