Files
CompanyProject/金壶/appV1/pages/my/change_password.vue
2024-09-27 01:32:49 +08:00

108 lines
3.8 KiB
Vue

<template>
<!-- 修改密码 页面 -->
<view class="content">
<HeaderTop page_title='修改密码'></HeaderTop>
<view class="padding-30">
<view class="padding-zy30 d-flex j-sb a-center border-bottom list">
<view class="">旧密码</view>
<input type="password" value="" placeholder="请输入旧密码" class="flex-1" v-if="is_seenOld==false" v-model="old_password"/>
<input type="text" value="" placeholder="请输入旧密码" class="flex-1" v-if="is_seenOld==true" v-model="old_password"/>
<image src="../../static/my/bukan.png" mode="" class="bukan" v-if="is_seenOld==false" @click="isChangeOld()"></image>
<image src="../../static/my/kan.png" mode="" class="kan" v-if="is_seenOld==true" @click="isChangeOld()"></image>
</view>
<view class="padding-zy30 d-flex j-sb a-center border-bottom list">
<view class="">新密码</view>
<input type="password" value="" placeholder="请输入新密码" class="flex-1" v-if="is_seenNew==false" v-model="new_password"/>
<input type="text" value="" placeholder="请输入新密码" class="flex-1" v-if="is_seenNew==true" v-model="new_password"/>
<image src="../../static/my/bukan.png" mode="" class="bukan" v-if="is_seenNew==false" @click="isChangeNew()"></image>
<image src="../../static/my/kan.png" mode="" class="kan" v-if="is_seenNew==true" @click="isChangeNew()"></image>
</view>
<view class="padding-zy30 d-flex j-sb a-center border-bottom list">
<view class="">确认密码</view>
<input type="password" value="" placeholder="请输入新密码" class="flex-1" ref='sure_pass' v-if="is_seenSure==false" v-model="sure_password"/>
<input type="text" value="" placeholder="请输入新密码" class="flex-1" ref='sure_pass' v-if="is_seenSure==true" v-model="sure_password"/>
<image src="../../static/my/bukan.png" mode="" class="bukan" v-if="is_seenSure==false" @click="isChangeSure()"></image>
<image src="../../static/my/kan.png" mode="" class="kan" v-if="is_seenSure==true" @click="isChangeSure()"></image>
</view>
<view class="x_public_box x-bg-159 esc_login x-text-white w-90" @click="surePassword()">确定</view>
</view>
</view>
</template>
<script>
import verification from '../../common/verification.js' //正则验证
import HeaderTop from '../../components/HeaderTop/HeaderTop.vue'
import X_login from '../../utils/models/x_login.js'
export default{
data(){
return {
old_password:'', //旧密码
new_password:'', //新密码
sure_password:'', //确认密码
is_seenOld:false,
is_seenNew:false,
is_seenSure:false
}
},
comments: {
HeaderTop
},
methods:{
isChangeOld(){
this.is_seenOld = ! this.is_seenOld
},
isChangeNew(){
this.is_seenNew = ! this.is_seenNew
},
isChangeSure(){
this.is_seenSure = ! this.is_seenSure
},
// 确认修改密码
async surePassword(){
verification.isNull(this.old_password, this.new_password, this.sure_password) // 非空验证
if (verification.isNull.prototype.the_Null == true) {
verification.isSamePsd(this.new_password,this.sure_password); // 两次密码是否相同
}
if (
verification.isNull.prototype.the_Null == true &&
verification.isSamePsd.prototype.the_isSamePsd == true
) {
let res = await X_login.X_editphone(this.old_password,this.new_password)
uni.clearStorage();
uni.redirectTo({
url:'./x_login'
})
this.handleError(res, res => {
this.list = res.data
})
// uni.navigateBack(2)
// console.log('修改成功');
}
}
}
}
</script>
<style lang="scss">
.content {
position: relative;
.list{
height: 83upx;
.bukan{
height:15upx;
width:47upx;
}
.kan{
height:36upx;
width:47upx;
}
}
.esc_login{
line-height: 82upx;
margin-top:200upx;
}
}
</style>