183 lines
4.0 KiB
Vue
183 lines
4.0 KiB
Vue
<template>
|
|
<view>
|
|
<cu-custom bgColor="bg-gradual-blueness" :isBack="true">
|
|
<block slot="backText">返回</block>
|
|
<block slot="content">设置密码</block>
|
|
</cu-custom>
|
|
<view class="register">
|
|
<view class="reg-title mb40">
|
|
<text>修改密码</text>
|
|
</view>
|
|
<view class="reg-form">
|
|
<view class="reg-input">
|
|
<input password @input="oldInpPwd" placeholder="旧密码" name="input"></input>
|
|
</view>
|
|
</view>
|
|
<view class="reg-form">
|
|
<view class="reg-input">
|
|
<input password @input="nowInpPwd" placeholder="新密码" name="input"></input>
|
|
</view>
|
|
</view>
|
|
<view class="reg-form">
|
|
<view class="reg-input">
|
|
<input password @input="ConfirmInpPwd" placeholder="确认新密码" name="input"></input>
|
|
</view>
|
|
</view>
|
|
<view class="reg-title">
|
|
<text class="text-gray">需8-20位字符</text>
|
|
</view>
|
|
<view class="flex flex-direction mt50">
|
|
<button :loading="buttonloading" class="cu-btn bg-blue lg round" @click="updateUserPwd()">提交</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
basePath,loginUser,
|
|
} from '@/common/tool.js';
|
|
export default {
|
|
data() {
|
|
return {
|
|
oldPwd :'',
|
|
nowPwd :'',
|
|
buttonloading: false,
|
|
confirmPwd :'',
|
|
}
|
|
},
|
|
methods: {
|
|
oldInpPwd(e){
|
|
this.oldPwd = e.detail.value
|
|
},
|
|
nowInpPwd(e){
|
|
this.nowPwd = e.detail.value
|
|
},
|
|
ConfirmInpPwd(e){
|
|
this.confirmPwd = e.detail.value
|
|
},
|
|
//跳转事件
|
|
goToEdit(e) {
|
|
uni.navigateTo({
|
|
url: '/pages/application/basic-info-manage/basic-information/basic-information-edit'
|
|
});
|
|
},
|
|
updateUserPwd(){
|
|
var _this = this;
|
|
if (_this.oldPwd == '') {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '请输入旧密码',
|
|
duration: 2000
|
|
});
|
|
return;
|
|
}
|
|
if (_this.nowPwd == '') {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '请输入新密码',
|
|
duration: 2000
|
|
});
|
|
return;
|
|
}
|
|
if (_this.confirmPwd == '') {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '请输入确认密码',
|
|
duration: 2000
|
|
});
|
|
return;
|
|
}
|
|
if(_this.nowPwd != _this.confirmPwd){
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '两次输入的密码不一致',
|
|
duration: 2000
|
|
});
|
|
return;
|
|
}
|
|
if(_this.nowPwd.length < 8){
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '密码需要大于8位',
|
|
duration: 2000
|
|
});
|
|
return
|
|
}
|
|
if(_this.nowPwd.length > 20){
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '密码需要小于20位',
|
|
duration: 2000
|
|
});
|
|
return
|
|
}
|
|
this.buttonloading = true
|
|
uni.request({
|
|
url: basePath +'/app/user/editUserPwd' ,
|
|
method: 'POST',
|
|
dataType: 'json',
|
|
header: {
|
|
'Content-type':'application/x-www-form-urlencoded'
|
|
},
|
|
data: {
|
|
USERNAME:loginUser.USERNAME,
|
|
PASSWORD:_this.oldPwd,
|
|
NOWPASSWORD : _this.confirmPwd,
|
|
CORPINFO_ID:loginUser.CORPINFO_ID,
|
|
USER_ID:loginUser.USER_ID,
|
|
},
|
|
success: (res) => {
|
|
uni.hideLoading();//结束加载中动画
|
|
this.buttonloading = false
|
|
if (res.data != null) {
|
|
var result = res.data.result;
|
|
if ("success" == result) {
|
|
uni.showToast({
|
|
title: "密码修改成功",
|
|
duration: 1000
|
|
});
|
|
uni.navigateTo({
|
|
url: '/pages/login/home',
|
|
});
|
|
|
|
} else if ("usererror" == result) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: "密码有误",
|
|
duration: 2000
|
|
});
|
|
}else if ("exception" == result) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: res.data.exception,
|
|
duration: 2000
|
|
});
|
|
}else{
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: "登录错误!请联系管理员",
|
|
duration: 2000
|
|
});
|
|
}
|
|
}
|
|
|
|
}
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.mt50{
|
|
margin-top: 50upx;
|
|
}
|
|
.mb40{
|
|
margin-bottom: 40upx;
|
|
}
|
|
page{
|
|
background-color: #FFFFFF;
|
|
}
|
|
</style>
|