<template>
	<view>

		<RefreshView ref="mescrollRef" :hasBack="true" text="用户认证" :useDownScroll="false" :useUpScroll="false">

			<view style="margin-top: 30rpx;">
				<view class="inputRow">
					<image src="../../static/login/username.png" mode="aspectFill" class="drawableLeft"></image>
					<input type="number" maxlength="11" @input="phoneText" placeholder="请输入手机号" class="input" />
					<SendCodeItem :phoneNum="page.phone" url="portal/v1/sysUserManagement/sendCodeFromAttestation" @click="send" ref="wxCodeItem"></SendCodeItem>
				</view>
			</view>


			<view class="inputRow">
				<image src="../../static/login/code.png" mode="aspectFill" class="drawableLeft"></image>
				<input type="number" @input="codeText" maxlength="6" placeholder="请输入验证码" class="input" />
			</view>

			<view class="btn" @click="next">
				<text class="btnText">验证</text>
			</view>

		</RefreshView>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: {
					phone: '',
					code: ''
				}
			};
		},
		methods: {
			next() {
				var phoneLength = this.page.phone.length;
				var codeLength = this.page.code.length;
				if (phoneLength == 0) {
					this.Toast("请输入手机号")
					return;
				}
				if (codeLength == 0) {
					this.Toast("验证码不能为空")
					return;
				}
				let _this = this
				this.HTTP({
					url: 'portal/v1/sysUserManagement/verifyCodeFromAttestation',
					data: {
						mobile: this.page.phone,
						code: this.page.code
					},
					method: 'GET',
					paramsType: "FORM",
					loading: true
				}).then((res) => {
					uni.navigateTo({
						url: '../info/RealInfo'
					})
				});


			},
			phoneText(e) {
				//手机号
				this.page.phone = e.detail.value;
			},
			send(e) { //发送验证码
				console.log(e);
			},
			codeText(e) {
				//验证码
				this.page.code = e.detail.value;
			}
		}
	};
</script>

<style lang="scss">
	.inputRow {
		display: flex;
		margin-left: 30rpx;
		margin-right: 30rpx;
		margin-bottom: 10rpx;
		margin-top: 10rpx;
		padding-bottom: 10rpx;
		border-bottom: 0.1px #F1F1F1 solid;
		align-items: center;

		.input {
			margin-left: 20rpx;
			height: 70rpx;
			flex: 1;
			font-size: 32rpx;
		}

		.drawableLeft {
			width: 40rpx;
			height: 40rpx;
			margin: 20rpx;
		}
	}

	.btn {
		display: flex;
		width: 90%;
		height: 80rpx;
		flex-direction: column;
		background-color: $uni-base-color;
		margin-top: 80rpx;
		margin-left: auto;
		margin-right: auto;
		align-items: center;
		justify-content: center;
		border-radius: 10rpx;

		.btnText {
			color: #ffffff;
			font-size: 33rpx;
		}
	}
</style>
