星油积分商城
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.
 
 
 
 

156 lines
3.2 KiB

<!-- 修改密码 -->
<template>
<view class="setingAccount-body">
<view class="form-container">
<view class="form-item">
<view class="form-item-label">
请输入旧密码
</view>
<view class="form-item-content">
<uni-easyinput v-model="form.pwd" type="password" placeholder="请输入旧密码" />
</view>
</view>
<view class="form-item">
<view class="form-item-label">
请输入新密码
</view>
<view class="form-item-content">
<uni-easyinput v-model="form.pwd1" type="password" placeholder="请输入新密码" />
</view>
</view>
<view class="form-item">
<view class="form-item-label">
确认密码
</view>
<view class="form-item-content">
<uni-easyinput v-model="form.pwd2" type="password" placeholder="请再次确认密码" />
</view>
</view>
</view>
<view class="seting-footer flex jc">
<view @click="save" class="seting-footer-button flex ac jc">确定</view>
<!-- <button type="primary" @tap="save">保存</button> -->
</view>
</view>
</template>
<script>
import md5 from 'js-md5'
// import userApi from "@/api/user-service/user.js"
export default {
data() {
return {
form: {}
}
},
methods: {
save(){
let that = this
if(!that.form.pwd){
uni.showToast({
title: '请输入旧密码',
icon: 'none'
});
return
}
if(!that.form.pwd1){
uni.showToast({
title: '请输入新密码',
icon: 'none'
});
return
}
if(!that.form.pwd2){
uni.showToast({
title: '请输入确认新密码',
icon: 'none'
});
return
}
if(that.form.pwd1!==that.form.pwd2){
uni.showToast({
title: '两次输入新密码不一致!',
icon: 'none'
});
return
}
let data = {
userId:uni.getStorageSync('loginUser').user.userId,
password:md5(this.form.pwd1),
oldPassword:md5(this.form.pwd)
}
userApi.resetPwd(data).then(res=>{
if(res.code===20000){
// uni.navigateBack()
uni.showToast({
title:'修改成功',
icon:'none',
success() {
setTimeout(()=>{
uni.reLaunch({
url:'/pages/login/index'
})
},2000)
}
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
@import '../index/index.scss';
</style>
<style scoped>
.form-item{
margin-top: 80rpx;
}
.form-item-label{
font-size: 32rpx;
color: #000000;
}
::v-deep .uni-easyinput__content{
background-color: #FAFAFA !important;
font-size: 28rpx !important;
}
::v-deep .uni-easyinput__content-input{
height: 104rpx !important;
font-size: 28rpx !important;
border-radius: 10rpx 10rpx 10rpx 10rpx !important;
}
::v-deep .is-input-border{
border:0rpx !important;
}
.setingAccount-body{
width: 100vw;
height: 100vh;
box-sizing: border-box;
padding: 20rpx 15rpx;
}
.form-item-content{
margin-top: 38rpx;
width: 100%;
height: 104rpx;
background: #FAFAFA;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
}
.form-container{
width: 100%;
/* height: 644rpx; */
background: #FFFFFF;
box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(132,132,132,0.05);
border-radius: 12rpx 12rpx 12rpx 12rpx;
opacity: 1;
box-sizing: border-box;
padding: 50rpx 35rpx;
}
</style>