|
|
@@ -4,8 +4,8 @@
|
|
|
<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 :labelWidth="80" label="手机号:" prop="username" ref="item1">
|
|
|
+ <u--input v-model="form.username" placeholder="请输入手机号"></u--input>
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item :labelWidth="80" label="原密码:" prop="oldPassword" ref="item1">
|
|
|
@@ -19,7 +19,7 @@
|
|
|
</u--form>
|
|
|
|
|
|
<view :style="{'marginTop':'100rpx'}">
|
|
|
- <u-button type="primary" text="提交" @click="updatePassword"></u-button>
|
|
|
+ <u-button class="custom-style" text="提交" @click="updatePassword"></u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -30,12 +30,12 @@
|
|
|
data() {
|
|
|
return {
|
|
|
form:{
|
|
|
- phone:'',
|
|
|
+ username:'',
|
|
|
oldPassword:'',
|
|
|
newPassword:''
|
|
|
},
|
|
|
rules: {
|
|
|
- 'phone': {
|
|
|
+ 'username': {
|
|
|
type: 'string',
|
|
|
required: true,
|
|
|
min:11,
|
|
|
@@ -45,7 +45,7 @@
|
|
|
},
|
|
|
'oldPassword': {
|
|
|
type: 'string',
|
|
|
- min:11,
|
|
|
+ min:6,
|
|
|
max: 16,
|
|
|
required: true,
|
|
|
message: '请输入6-18位老密码',
|
|
|
@@ -66,11 +66,27 @@
|
|
|
updatePassword(){
|
|
|
console.log("+++++++++++++++++++")
|
|
|
this.$refs.uForm.validate().then(res => {
|
|
|
- uni.$u.toast('校验通过')
|
|
|
- }).catch(errors => {
|
|
|
- uni.$u.toast('校验失败')
|
|
|
+ this.$api.login.updatePassword(this.form).then(res=>{
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'success',
|
|
|
+ duration: 2000,
|
|
|
+ title: '修改成功,即将跳转登录页'
|
|
|
+ });
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.logout()
|
|
|
+ },2000)
|
|
|
+
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
+ logout(){
|
|
|
+ this.$api.login.logout().then(res=>{
|
|
|
+ uni.clearStorageSync();
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'/pages/login/login'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|