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.
122 lines
2.3 KiB
122 lines
2.3 KiB
<template>
|
|
|
|
<view class="pageBgImg">
|
|
<topNavbar title="修改密码"></topNavbar>
|
|
<view class="form pad">
|
|
<view class="card">
|
|
<view class="form-item">
|
|
<view class="lab">原密码</view>
|
|
<view class="inputBox my">
|
|
<u-input placeholder="输入旧密码" v-model="FormData.oldPwd" border="none"></u-input>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="card">
|
|
<view class="form-item border">
|
|
<view class="lab">新密码</view>
|
|
<view class="inputBox my">
|
|
<u-input placeholder="输入新密码" v-model="FormData.pwd1" border="none"></u-input>
|
|
</view>
|
|
</view>
|
|
<view class="form-item">
|
|
<view class="lab">新密码</view>
|
|
<view class="inputBox my">
|
|
<u-input placeholder="再次输入新密码" v-model="FormData.pwd2" border="none"></u-input>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="btnBg" :class="{hui: !highlight}" @click="updatePasswordFn">确认修改</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { updatePassword } from '@/config/api.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
FormData: {
|
|
oldPwd: '',
|
|
pwd1: '',
|
|
pwd2: '',
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
highlight() {
|
|
let { FormData } = this
|
|
if(FormData.oldPwd&&FormData.pwd1&&FormData.pwd2) {
|
|
return true
|
|
}else {
|
|
return false
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
async updatePasswordFn() {
|
|
let obj = {
|
|
newPassword: this.FormData.pwd1,
|
|
oldPassword: this.FormData.oldPwd
|
|
}
|
|
const res = await updatePassword(obj)
|
|
if(res.code==0) {
|
|
this.$u.toast('密码修改成功')
|
|
setTimeout(()=>{
|
|
uni.switchTab({
|
|
url: '/pages/tabbar/mine/index'
|
|
})
|
|
},1500)
|
|
this.FormData = {
|
|
oldPwd: '',
|
|
pwd1: '',
|
|
pwd2: '',
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.pageBgImg {
|
|
|
|
|
|
.form {
|
|
.card {
|
|
padding: 0 20rpx;
|
|
margin-bottom: 20rpx;
|
|
.form-item {
|
|
height: 104rpx;
|
|
line-height: 104rpx;
|
|
font-size: 28rpx;
|
|
color: #333;
|
|
display: flex;
|
|
align-items: center;
|
|
&.border {
|
|
border-bottom: 1px solid #F6F6F6;
|
|
}
|
|
.lab {
|
|
width: 180rpx;
|
|
}
|
|
|
|
.inputBox {
|
|
flex: 1;
|
|
u-input {
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.btnBg {
|
|
width: 396rpx;
|
|
margin: 136rpx auto;
|
|
&.hui {
|
|
opacity: 0.3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|