<template>

	<view class="container">
		<view class="page-title">设置登录密码</view>
		
		<form @submit="onSubmit">
			
			<view class="cell flex-row-between">
				<input type="text"  name="pass" 
				maxlength="16" placeholder="请输入6位-16位字符"></input>
			</view>
			
			<view class="cell flex-row-between">
				<input type="text" name="repass"  maxlength="16" placeholder="请再次输入登录密码"></input>
			</view>

			<button form-type="submit" class="login-btn">设置</button>
			<button class="login-btn" @click="setup" style="background:#FFBE2C;margin-top: 70rpx;">暂时不设置密码</button>
			
		</form>
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				
			}
		},
		onLoad(e) {
		   this.tel=e.tel;
		},
		methods:{
			setup(e){
				uni.reLaunch({
					url: "../index/index"
				})
			},
			
			onSubmit(e) {
				let data = e.detail.value;
				data.tel=this.tel;
				data.token=uni.getStorageSync("token");
				data.type=2;
				this.request({
					url: "user/edit_pass",
					data,
				}).then(res => {
					console.log(res, "res")
					if (res.code === '200') {
						uni.showToast({
							title: "设置成功",
							icon: 'none',
							duration: 2000
						})
						setTimeout(() => {
							uni.reLaunch({
								url: "../index/index"
							})
						}, 1500)
					}
				}).catch((res) => {
					uni.showToast({
						title: res.message,
						icon: 'none',
						duration: 2000
					})
				});
			},
		}
	}
</script>

<style>
	.container {
		padding: 0 60rpx;
	}
	.page-title {
		padding: 160rpx 0 90rpx;
		font-size: 54rpx;
		line-height: 1;
		font-weight: 700;
		color: #242424;
	}

	.cell {
		height: 90rpx;
		border-bottom: 2rpx solid #ededed;
		margin-bottom: 55rpx;
	}

	.cell .iconquchu {
		flex: none;
		font-size: 23rpx;
		color: #cbcbcb;

	}

	.cell .code-btn {
		flex: none;
		width: 170rpx;
		height: 60rpx;
		border-radius: 30rpx;
		background-color: #3387FF;
		text-align: center;
		line-height: 60rpx;
		color: #fff;
		font-size: 24rpx;
	}

	.cell input {
		flex: auto;
		margin-right: 40rpx;
	}
	.login-btn {
		width: 630rpx;
		height: 98rpx;
		background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
		border-radius: 8rpx;
		box-shadow: 0px 0px 8rpx 0px rgba(51, 135, 255, 0.2);
		font-size: 32rpx;
		font-weight: 500;
		text-align: center;
		color: #fff;
		line-height: 98rpx;
		margin: 100rpx auto 0;
	}
</style>
