blob: 7828d2b3040c33d7af46d6d2ed540786c9fe1bf3 [file] [log] [blame]
<template>
<view class="changeLoginPwd">
<view class="changeLoginPwd-list">
<u-field v-model="oldpwd" label="原登陆密码" :field-style="fieldStyle" placeholder="请输入登陆密码"
label-width="160" maxlength="12" :password="true" clear-size="40"></u-field>
<u-field v-model="newpwd" label="新登陆密码" :field-style="fieldStyle" placeholder="请设置6-12位密码"
label-width="160" maxlength="12" :password="true" clear-size="40"></u-field>
<u-field v-model="renewpwd" label="确认密码" :field-style="fieldStyle" placeholder="请确认新密码"
label-width="160" maxlength="12" :password="true" clear-size="40"></u-field>
</view>
<u-button @click="changeLoginPwd" :custom-style="changeLoginPwdBtn">确认修改</u-button>
</view>
</template>
<script>
export default {
data() {
return {
oldpwd: "",
newpwd: "",
renewpwd: "",
fieldStyle:{'font-size':'30rpx','color':'#999999'},
changeLoginPwdBtn:{
width: '600rpx',
backgroundColor: '#2FA8E1',
color: '#FFFFFF',
fontFamily: "PingFang-SC-Medium",
fontSize: '30rpx',
marginTop: '100rpx',
padding: '50rpx 0'
}
}
},
methods: {
changeLoginPwd() {
let that = this
let {
newpwd,
renewpwd,
oldpwd
} = that
if (oldpwd == "") {
uni.showToast({
title: "请输入原登录密码",
icon: "none",
duration: 800
})
return false
}
if (newpwd.length < 6) {
uni.showToast({
title: "新密码必须6位以上字符",
icon: "none",
duration: 800
})
return false
}
if (newpwd != renewpwd) {
uni.showToast({
title: "两次密码不一致,请确认后重新输入",
icon: "none",
duration: 800
})
return false
}
let param = {
"newpwd": newpwd,
"renewpwd": renewpwd,
"oldpwd": oldpwd
}
that.$u.post("/v1/pwdset", param).then((res) => {
uni.showToast({
title: "密码修改成功",
icon: "none",
duration: 800,
complete(res) {
setTimeout(() => {
uni.switchTab({
url: "/pages/sub_tabbar/index"
})
}, 1500)
}
})
})
}
}
}
</script>
<style lang="scss" scoped>
.changeLoginPwd {
width: 100vw;
// height: 100vh;
background-color: #F3F3F3;
overflow: hidden;
padding-bottom: 30rpx;
&-list {
background-color: #FFFFFF;
margin-top: 30rpx;
}
&-btn {
width: 600rpx;
background-color: #2FA8E1;
color: #FFFFFF;
font-family: "PingFang-SC-Medium";
font-size: 30rpx;
margin-top: 100rpx;
padding: 50rpx 0;
}
}
</style>