<template>
|
<!-- 修改密码 -->
|
<view class="container">
|
<view class="mt-30">
|
<input placeholder="旧密码" type="password" v-model="oldPassword" placeholder-class="placeholder" class="input-group-row"/>
|
<input placeholder="新密码" type="password" v-model="newPassword" placeholder-class="placeholder" class="input-group-row"/>
|
<input placeholder="确认密码" type="password" v-model="password" placeholder-class="placeholder" class="input-group-row"/>
|
</view>
|
<button :disabled="isDisabled" class="blue-btn btn" @click="change">确认修改</button>
|
</view>
|
</template>
|
|
<script>
|
export default{
|
data(){
|
return{
|
oldPassword:'',
|
newPassword:'',
|
password:'',
|
isDisabled:false
|
}
|
},
|
methods:{
|
valid(){
|
if(!this.oldPassword.trim()){
|
this.$toast.info('请输入旧密码');
|
return false;
|
}
|
if(!this.newPassword.trim()){
|
this.$toast.info('请输入新密码');
|
return false;
|
}
|
if(this.newPassword.trim()!==this.password.trim()){
|
this.$toast.info('两次密码不一致');
|
return false;
|
}
|
},
|
change(){
|
if(this.valid() === false){
|
return;
|
}
|
this.isDisabled = true;
|
this.$httpUtils.request('/api/user/modifyPwd',{
|
oldPwd: this.oldPassword.trim(),
|
newPwd: this.newPassword.trim()
|
},'post').then((res)=>{
|
if(res.status == 200){
|
uni.navigateBack();
|
}
|
this.$toast.info(res.info);
|
this.isDisabled = false;
|
}).catch((err) => {
|
this.isDisabled = false;
|
})
|
}
|
}
|
}
|
</script>
|
|
<style>
|
.container{
|
padding: 0 15px;
|
}
|
.btn{
|
margin-top: 40px;
|
}
|
</style>
|