<template>
	<page-meta :page-style="themeColor"></page-meta>
	<div class="view">
		<div class="content">
			<u-input v-model="value1"  placeholder="请输入旧密码"></u-input>
			<u-input v-model="value2"  placeholder="请输入新密码"></u-input>
			<u-input v-model="value3"  placeholder="请输入新密码"></u-input>
			
			<div class="btn" @click="btn">
				确认修改
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				value1:'',
				value2:'',
				value3:''
			}
		},
		methods:{
			btn(){
				
				if(this.value1.length==0){
					this.$util.showToast({
						title: '请输入旧密码'
					});
					return
				}
				if(this.value2.length==0){
					this.$util.showToast({
						title: '请输入新密码'
					});
					return
				}
				if(this.value3.length==0){
					this.$util.showToast({
						title: '请再次输入新密码'
					});
					return
				}
				if(this.value3!=this.value2){
					this.$util.showToast({
						title: '两次密码不一致'
					});
					return
				}
				this.$api.sendRequest({
					url:'/api/member/modifypassword',
					data:{
						old_password:this.value1,
						new_password:this.value2
					},
					success:res=>{
						uni.removeStorage({
							key: 'token',
							success: function (res) {
							}
						});
						this.$util.showToast({
							title: '修改成功'
						});
						setTimeout(()=>{
							uni.navigateTo({
								url: '/pages_tool/login/login'
							});
						},500)
					}
				})
			}
		}
			
			
			
	}
</script>

<style lang="scss" scoped>
	
	.view {
		min-height: 100vh;
		background-color: white;
		.tips {
			padding: 24rpx 30rpx;
			background: rgba(33,187,243,0.08);
			
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: $base-color;
			
			line-height: 40rpx;
		}
		.content {
			padding: 40rpx;
			::v-deep {
				.u-input--radius {
					height: 92rpx;
					background: #F6F6F6;
					border-radius: 16rpx;
					border: 0;
					margin-bottom: 30rpx;
				}
				.uni-input-input{
					padding: 0 38rpx;
				}
				
				.uni-input-placeholder {
					margin-left: 38rpx;
				}
			}
			.suffix {
				width: 140rpx;
				height: 40rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #EF6154;
				line-height: 40rpx;
				margin-right: 10rpx;
			}
			.btn {
				margin-top: 80rpx;
				height: 80rpx;
				background: #21BBF3;
				border-radius: 50rpx;
				
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 600;
				color: #FFFFFF;
				
				display: flex;
				justify-content: center;
				align-items: center;
			}
		}
	}
</style>