xnzt/xnzt-h5/pages/mine/pwd/index.vue
2024-11-11 10:27:27 +08:00

123 lines
2.3 KiB
Vue

<template>
<view class="container">
<view class="item">
<view class="title">
旧密码
</view>
<view class="input">
<input type="password" v-model="pw1" placeholder="请输入旧密码">
</view>
</view>
<view class="item">
<view class="title">
新密码
</view>
<view class="input">
<input type="password" v-model="pw2" placeholder="请输入新密码">
</view>
<view class="input">
<input type="password" v-model="pw3" placeholder="请再次输入新密码">
</view>
</view>
<view class="btn" @click="submit">
确认
</view>
</view>
</template>
<script>
import { updateUserPwd } from "@/api/system/user";
export default {
data() {
return {
pw1:"",
pw2:"",
pw3:"",
userId:'',
};
},
onReady() {
},
methods: {
submit() {
const _this = this;
if(!this.pw1){
uni.showToast({
title: '密码不能为空',
icon: "none",
duration: 1500
});
return
}
if(!this.pw2 || !this.pw3){
uni.showToast({
title: '密码不能为空',
icon: "none",
duration: 1500
});
return
}
if(this.pw2 !== this.pw3){
uni.showToast({
title: '2次密码不一致',
icon: "none",
duration: 1500
});
return
}
updateUserPwd(this.pw1, this.pw2).then(
(response) => {
this.$store.dispatch("LogOut").then(() => {
var failTimeout = setTimeout(function () {
_this.$modal.msgSuccess("密码修改成功");
}, 0);
this.$tab.reLaunch("/pages/login");
});
}
);
},
},
};
</script>
<style lang="scss">
$color: #4892FD;
.container {
padding: 30rpx;
min-height: 100vh;
box-sizing: border-box;
background-color: #fff;
.item{
width:100%;
margin-bottom: 20rpx;
.title{
font-size: 28rpx;color: #333;height: 80rpx;line-height: 80rpx;
}
.input{
background-color: #F7F7F7;
height: 80rpx;line-height: 80rpx;padding: 0 20rpx;
margin-bottom: 20rpx;
input{
width: 100%;font-size: 28rpx;color: #666;
height: 80rpx;line-height: 80rpx
}
}
}
.btn{
height: 90rpx;
line-height: 90rpx;
text-align: center;
background-color: $color;
color: #fff;
font-size: 28rpx;
border-radius: 20rpx;
width: 100%;
margin-top: 130rpx;
}
}
</style>