You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
high-mini-manage/pages/login/updatePsd/updatePsd.vue

122 lines
3.0 KiB

<template>
<view>
<image src="../../../static/img/logo.png" mode="widthFix" class="mart40 alijus imgs"></image>
<view class="main mart40">
<wInput v-model="usedPass" type="password" placeholder="原始密码" isShowPass="true"></wInput>
<wInput v-model="newPass" type="password" placeholder="新密码" isShowPass="true"></wInput>
<wInput v-model="conNewPass" type="password" placeholder="确认新密码" isShowPass="true"></wInput>
</view>
<view class="height40p"></view>
<wButton class="wbutton mart20" text="修 改" bgColor="#089bf5" :rotate="isRotate" @click="sendUserPass"></wButton>
</view>
</template>
<script>
import wInput from '../../../components/watch-login/watch-input.vue' //input
import wButton from '../../../components/watch-login/watch-button.vue' //button
import {
sendUserPass
} from '../../../Utils/Api.js';
let app = getApp();
export default {
components: {
wInput,
wButton,
},
data() {
return {
usedPass: '', //旧密码
newPass: '', //新密码
conNewPass: '', //确认密码
isRotate: false, //是否加载旋转
}
},
methods: {
//修改密码
sendUserPass() {
let that = this;
if (that.usedPass.length == "") {
uni.showToast({
icon: 'none',
duration: 2000,
title: '请输入旧密码'
});
return;
}
if (that.newPass.length == "") {
uni.showToast({
icon: 'none',
duration: 2000,
title: '请输入新密码'
});
return;
}
if (that.conNewPass.length == "") {
uni.showToast({
icon: 'none',
duration: 2000,
title: '请输入确认密码'
});
return;
}
if (that.conNewPass != that.newPass) {
uni.showToast({
icon: 'none',
duration: 2000,
title: '输入的两次密码不正确'
});
return;
}
uni.showModal({
title: '修改密码',
content: '是否修改当前密码',
success: function(res) {
if (res.confirm) {
uni.showLoading({
title: '操作中'
})
let datas = {
"userId": app.globalData.userInfo.secUser.id,
"oldPassword": that.usedPass,
"newPassword": that.conNewPass,
}
sendUserPass(datas).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
uni.showToast({
title: '修改成功',
icon: 'none',
duration: 2000,
success() {
setTimeout(() => {
uni.navigateBack({})
}, 1500);
}
})
} else {
uni.showToast({
title: res.return_msg,
duration: 2000,
icon: 'none'
})
}
});
}
}
})
}
}
}
</script>
<style lang="scss">
.imgs {
width: 30%;
margin-left: 35%;
}
@import url("../../../components/watch-login/css/icon.css");
@import url("../css/main.css");
</style>