<template>
	<view class="page">
		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="修改登录密码" @clickLeft="back" />
		<view :style="{'marginTop':'10rpx'}">
			<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">

				<u-form-item :labelWidth="80" label="手机号：" prop="phone" ref="item1">
					<u--input v-model="form.phone"  placeholder="请输入手机号"></u--input>
				</u-form-item>

				<u-form-item :labelWidth="80" label="原密码：" prop="oldPassword" ref="item1">
					<u--input v-model="form.oldPassword" placeholder="请输入原密码" type="password"></u--input>
				</u-form-item>

				<u-form-item :labelWidth="80" label="新密码：" prop="newPassword" ref="item1">
					<u--input v-model="form.newPassword" placeholder="请输入新密码" type="password"></u--input>
				</u-form-item>

			</u--form>

			<view :style="{'marginTop':'100rpx'}">
				<u-button type="primary" text="提交" @click="updatePassword"></u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form:{
					phone:'',
					oldPassword:'',
					newPassword:''
				},
				rules: {
					'phone': {
						type: 'string',
						required: true,
						min:11,
						max: 11,
						message: '请输入电话号码',
						trigger: ['blur', 'change']
					},
					'oldPassword': {
						type: 'string',
						min:11,
						max: 16,
						required: true,
						message: '请输入6-18位老密码',
						trigger: ['blur', 'change']
					},
					'newPassword': {
						type: 'string',
						min:6,
						max: 16,
						required: true,
						message: '请输入6-18位新密码',
						trigger: ['blur', 'change']
					}
				},
			}
		},
		methods: {
			updatePassword(){
				console.log("+++++++++++++++++++")
				this.$refs.uForm.validate().then(res => {
					uni.$u.toast('校验通过')
				}).catch(errors => {
					uni.$u.toast('校验失败')
				})
			},

		}
	}
</script>

<style>
	@import './index.rpx.css';
</style>
