<template>
	<view>
		<u-navbar title="修改密码" autoBack placeholder></u-navbar>
		<view class="card_password">
			<view class="item_pass">
				<view class="pass_title">旧密码<span style="color: red;">*</span></view>
				<u--input placeholder="请输入内容" type="password" border="surround" v-model="userInfo.oldCode"></u--input>
			</view>
			<view class="item_pass">
				<view class="pass_title">新密码<span style="color: red;">*</span></view>
				<u--input placeholder="请输入内容" type="password" border="surround"
					v-model="userInfo.sedNewCode"></u--input>
			</view>
			<view class="item_pass">
				<view class="pass_title">再次输入新密码<span style="color: red;">*</span></view>
				<u--input placeholder="请输入内容" type="password" border="surround" v-model="userInfo.newCode"></u--input>
			</view>
		</view>
		<view class="card_btn">
			<u-button type="primary" :disabled="disabled" text="提交" @click="amend"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {
					oldCode: '',
					sedNewCode: '',
					newCode: ''
				},
			}
		},
		computed: {
			disabled() {
				if (this.userInfo.oldCode == '' || this.userInfo.sedNewCode == '' || this.userInfo.newCode == '') {
					return true;
				} else {
					return false;
				}
			}
		},
		methods: {
			amend() {
				if (this.userInfo.sedNewCode == this.userInfo.newCode) {
					console.log(23)
				} else {
					uni.showToast({
						title: '输入两次密码不一样',
						icon: 'none'
					});
				}
			}
		}
	}
</script>

<style lang="scss">
	.card_password {
		padding: 20rpx 40rpx 40rpx 40rpx;
	}

	.item_pass {
		margin-top: 30rpx;
	}

	.pass_title {
		margin-bottom: 20rpx;
	}

	.card_btn {
		margin: 40rpx;
	}
</style>