邓宏
2 years ago
11 changed files with 173 additions and 35 deletions
@ -0,0 +1,80 @@ |
|||||
|
<style lang="scss"> |
||||
|
.container{ |
||||
|
padding:30rpx 0; |
||||
|
background:#f6f6f6; |
||||
|
min-height:100%; |
||||
|
|
||||
|
.card{ |
||||
|
padding-bottom:100rpx; |
||||
|
input{ |
||||
|
background:#F7F7F7; |
||||
|
height:80rpx; |
||||
|
border-radius: 24rpx; |
||||
|
font-size:25rpx; |
||||
|
padding:0 28rpx; |
||||
|
&+input{ |
||||
|
margin-top:28rpx; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</style> |
||||
|
<template> |
||||
|
<view class="container"> |
||||
|
<d-navbar text="修改密码" isBack style="--bg:#10C176;--c:#fff;"> |
||||
|
<button slot="right" class="cu-btn round" @click="submit">提交</button> |
||||
|
</d-navbar> |
||||
|
|
||||
|
<view class="card"> |
||||
|
<input placeholder="请输入新密码(6-20位字母和数字的组合)" type="password" v-model="formData.password"/> |
||||
|
<input placeholder="再次输入新密码" type="password" v-model="formData.confirmPassword"/> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
<script> |
||||
|
import request from '@/common/request' |
||||
|
export default{ |
||||
|
data(){ |
||||
|
return{ |
||||
|
formData:{ |
||||
|
confirmPassword: "", |
||||
|
password: "", |
||||
|
username: this.$store.getters['userInfo'].username, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods:{ |
||||
|
check(){ |
||||
|
if(!this.formData.password){ |
||||
|
uni.showToast({title:"请输入密码!",icon:"none"}) |
||||
|
return false |
||||
|
}else if(!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/.test(this.formData.password)){ |
||||
|
uni.showToast({title:"密码格式为6-20位字母和数字的组合!",icon:"none"}) |
||||
|
return false |
||||
|
}else if(!this.formData.confirmPassword){ |
||||
|
uni.showToast({title:"输入密码不一致!",icon:"none"}) |
||||
|
return false |
||||
|
} |
||||
|
return true |
||||
|
}, |
||||
|
async submit(){ |
||||
|
if(this.check()){ |
||||
|
var res=await request("/sys/user/changePassword",{ |
||||
|
method:"put", |
||||
|
suffix:"/jeecgboot", |
||||
|
body: this.formData |
||||
|
}) |
||||
|
if(res.statu){ |
||||
|
uni.navigateBack() |
||||
|
}else{ |
||||
|
uni.showModal({ |
||||
|
title:"提示", |
||||
|
content:res.msg||"修改失败!", |
||||
|
showCancel:false, |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
Loading…
Reference in new issue