|
@@ -6,7 +6,7 @@ |
|
|
@click-left="$router.back(-1)" |
|
|
@click-left="$router.back(-1)" |
|
|
/> |
|
|
/> |
|
|
<van-cell-group style="width: 96%;margin:2%;border-radius: 6px;overflow: hidden;padding-top: 10px;padding-bottom: 10px;box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);"> |
|
|
<van-cell-group style="width: 96%;margin:2%;border-radius: 6px;overflow: hidden;padding-top: 10px;padding-bottom: 10px;box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);"> |
|
|
<van-field type="password" v-model="user.oldPassword" placeholder="" > |
|
|
|
|
|
|
|
|
<van-field type="password" v-model="user.oldPassword" placeholder="" @input="clearError" > |
|
|
<template #left-icon> |
|
|
<template #left-icon> |
|
|
<van-image |
|
|
<van-image |
|
|
height="20" |
|
|
height="20" |
|
@@ -17,7 +17,7 @@ |
|
|
<H4 style="margin-left: 5px">原密码</H4> |
|
|
<H4 style="margin-left: 5px">原密码</H4> |
|
|
</template> |
|
|
</template> |
|
|
</van-field> |
|
|
</van-field> |
|
|
<van-field type="password" v-model="user.newPassword" placeholder="" > |
|
|
|
|
|
|
|
|
<van-field type="password" :error-message="validate.newPassword" v-model="user.newPassword" placeholder="" @input="clearError" @blur="validate_newPassword"> |
|
|
<template #left-icon> |
|
|
<template #left-icon> |
|
|
<van-image |
|
|
<van-image |
|
|
height="20" |
|
|
height="20" |
|
@@ -28,7 +28,7 @@ |
|
|
<H4 style="margin-left: 5px">新密码</H4> |
|
|
<H4 style="margin-left: 5px">新密码</H4> |
|
|
</template> |
|
|
</template> |
|
|
</van-field> |
|
|
</van-field> |
|
|
<van-field type="password" v-model="user.confirmPassword" placeholder="" > |
|
|
|
|
|
|
|
|
<van-field type="password" v-model="user.confirmPassword" placeholder="" @input="clearError"> |
|
|
<template #left-icon> |
|
|
<template #left-icon> |
|
|
<van-image |
|
|
<van-image |
|
|
height="20" |
|
|
height="20" |
|
@@ -49,6 +49,8 @@ |
|
|
<script> |
|
|
<script> |
|
|
import onlineHomeIndex from "../onlineHomeIndex"; |
|
|
import onlineHomeIndex from "../onlineHomeIndex"; |
|
|
import {updateUserPwd} from "../../api/onlineHome/my"; |
|
|
import {updateUserPwd} from "../../api/onlineHome/my"; |
|
|
|
|
|
import {REGEXP} from "@/utils/global"; |
|
|
|
|
|
import {Notify} from "vant"; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
components: { |
|
|
components: { |
|
@@ -62,10 +64,15 @@ |
|
|
newPassword: undefined, |
|
|
newPassword: undefined, |
|
|
confirmPassword: undefined |
|
|
confirmPassword: undefined |
|
|
}, |
|
|
}, |
|
|
|
|
|
validate: { |
|
|
|
|
|
newPassword: '', |
|
|
|
|
|
}, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
submit() { |
|
|
submit() { |
|
|
|
|
|
if(!this.validate_newPassword()) |
|
|
|
|
|
return; |
|
|
console.log(this.user) |
|
|
console.log(this.user) |
|
|
if(this.user.confirmPassword |
|
|
if(this.user.confirmPassword |
|
|
!=this.user.newPassword){ |
|
|
!=this.user.newPassword){ |
|
@@ -73,14 +80,19 @@ |
|
|
icon: 'error', // 找到自己需要的图标 |
|
|
icon: 'error', // 找到自己需要的图标 |
|
|
message: '两次密码不同,请重新输入', |
|
|
message: '两次密码不同,请重新输入', |
|
|
duration:"1000", |
|
|
duration:"1000", |
|
|
onClose:function(){ |
|
|
|
|
|
this.user.oldPassword="" |
|
|
|
|
|
this.user.newPassword="" |
|
|
|
|
|
this.user.confirmPassword="" |
|
|
|
|
|
|
|
|
onClose:() => { |
|
|
|
|
|
if(0) |
|
|
|
|
|
{ |
|
|
|
|
|
this.user.oldPassword="" |
|
|
|
|
|
this.user.newPassword="" |
|
|
|
|
|
this.user.confirmPassword="" |
|
|
|
|
|
} |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}else{ |
|
|
}else{ |
|
|
|
|
|
if(!this.validatePassword(this.user.newPassword)) |
|
|
|
|
|
return; |
|
|
updateUserPwd(this.user.oldPassword, this.user.newPassword).then( |
|
|
updateUserPwd(this.user.oldPassword, this.user.newPassword).then( |
|
|
response => { |
|
|
response => { |
|
|
let _this =this |
|
|
let _this =this |
|
@@ -95,7 +107,43 @@ |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
validatePassword(what) { |
|
|
|
|
|
if(!(REGEXP.PASSWORD.test(what))) |
|
|
|
|
|
{ |
|
|
|
|
|
Notify.clear(); |
|
|
|
|
|
Notify({ type: 'danger', message: '密码至少8个字符,必须包括字母、数字、特殊符号!' }); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
}, |
|
|
|
|
|
validate_newPassword() { |
|
|
|
|
|
let password = this.user.newPassword; |
|
|
|
|
|
if(!password) |
|
|
|
|
|
{ |
|
|
|
|
|
this.validate.newPassword = ''; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
if(password.length < 8) |
|
|
|
|
|
{ |
|
|
|
|
|
this.validate.newPassword = '密码长度至少8位'; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
if(password.length > 20) |
|
|
|
|
|
{ |
|
|
|
|
|
this.validate.newPassword = '密码长度不能超过20位'; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
if(!(REGEXP.PASSWORD.test(password))) |
|
|
|
|
|
{ |
|
|
|
|
|
this.validate.newPassword = '密码必须包括字母、数字、特殊符号!'; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
this.validate.newPassword = ''; |
|
|
|
|
|
return true; |
|
|
|
|
|
}, |
|
|
|
|
|
clearError() { |
|
|
|
|
|
this.validate.newPassword = ''; |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|