<template>
	<view class="content">

		<view v-if="step === 1">
			<view style="height: 138rpx; width: 100%;"></view>
			<view class="a1 flex">
				<image src="/static/icons/icon7.png" style="width: 29rpx;height: 32rpx; margin-right: 10rpx" />
				<span>手机号快捷登录</span>
			</view>
			<view class="a2">未注册手机号将自动创建账号</view>
			<view class="a3"></view>
			<view class="a4 flex">
				<view class="left-area">+86</view>
				<input placeholder="请输入手机号" />
			</view>
			<button class="a5" @click="clickSendCode">下一步</button>
		</view>

		<view v-if="step === 2">
			<view class="b1">
				<span>输入验证码</span>
			</view>
			<view class="b2">
				验证码已发送至{{ phone }}
			</view>
			<view>
				<view class="flex flex-sb" style="padding: 40rpx; width: calc(100% - 80rpx)">
					<input v-for="i in 6" class="input-m" type="number" :class="{active: i === code.length+1}"
						:focus="i === code.length+1" :value="code[i-1]" @click="clickNum(i)" @input="inputNum" />
				</view>
			</view>
			<view class="b3">
				没收到验证码?<span>重新发送</span>
			</view>
			<view class="b4">
				确认绑定
			</view>
		</view>

	</view>
</template>

<script>
	import md5 from '@/utils/md5.js'
	export default {
		data() {
			return {
				step: 1,
				openid: '',
				code: '',
				phone : '156**3437'
			}
		},
		onShow() {
			
		},
		methods: {
			clickCancel() {
				uni.switchTab({
					url: '/pages/index/index'
				})
			},
			clickSendCode() {
				this.step = 2
			},
			clickNum(i) {
				this.code = this.code.substring(0, i - 1)
			},
			inputNum(event) {
				if (event) {
					this.code = this.code + event.detail.value.toString().substring(0, 1)
					if (this.code.length === 6) {
						this.checkCode()
					}
				}
			},
			checkCode() {
				this.clickCancel()
			},

		}
	}
</script>

<style>
	.b1 {
		width: 100%;
		height: 56rpx;
		font-size: 40rpx;
		font-family: PingFang SC, PingFang SC-Heavy;
		font-weight: 800;
		text-align: center;
		color: #333333;

		margin-top: 38rpx;
	}

	.b2 {
		width: 100%;
		height: 40rpx;
		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC-Regular;
		font-weight: 400;
		text-align: center;
		color: #a5a5a5;

		margin-top: 20rpx;
	}

	.input-m {
		width: 96rpx;
		height: 136rpx;
		background: #f8f8f8;
		border-radius: 16rpx;

		line-height: 136rpx;

		font-size: 52rpx;
		font-family: PingFang SC, PingFang SC-Heavy;
		font-weight: 800;
		text-align: center;
		color: #333333;
	}

	.input-m.active {
		width: 90rpx;
		height: 130rpx;
		border: 3rpx solid #F6BEC3;
	}

	.b3 {
		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC-Regular;
		font-weight: 400;
		text-align: center;
		color: #666666;
	}

	.b3 span {
		color: #F6BEC3;
	}

	.b4 {
		width: 556rpx;
		height: 90rpx;
		line-height: 90rpx;
		border-radius: 46rpx;
		background: #F6BEC3;

		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC-Regular;
		font-weight: 400;
		text-align: center;
		color: #ffffff;

		margin: 94rpx auto;
	}









	.a1 {
		font-size: 32rpx;
		line-height: 38rpx;
		font-family: PingFang SC, PingFang SC-Heavy, serif;
		font-weight: 800;
		text-align: left;
		color: #333333;

		margin-left: 98rpx;
		margin-bottom: 12rpx;
	}

	.a2 {
		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC-Regular;
		font-weight: 400;
		text-align: left;
		color: #a5a5a5;

		margin-left: 98rpx;
	}

	.a3 {
		width: 100%;
		height: 120rpx;
		background: #fff;
	}

	.a4 {
		width: 556rpx;
		height: 90rpx;
		line-height: 90rpx;
		background: #f5f5f5;
		border-radius: 45rpx;

		margin: 0 auto;
	}

	.left-area {
		width: 136rpx;
		font-size: 32rpx;
		font-family: PingFang SC, PingFang SC-Bold;
		font-weight: 700;
		text-align: center;
		color: #333333;
	}

	.a4 input {
		line-height: 90rpx;
		padding: 22rpx 0;
		font-size: 32rpx;
		font-family: PingFang SC, PingFang SC-Bold;
		font-weight: 700;
		color: #333333;
	}

	.a5 {
		width: 556rpx;
		height: 90rpx;
		line-height: 90rpx;
		background: #F6BEC3;
		border-radius: 46px;

		margin: 60rpx auto;

		font-size: 28rpx;
		font-family: PingFang SC, PingFang SC-Regular;
		font-weight: 400;
		text-align: center;
		color: #ffffff;
	}
</style>