5.20宁夏新增修改密码

This commit is contained in:
FrancisHu 2024-05-20 15:06:49 +08:00
parent b9d9e240f2
commit 7da9ce7d63
7 changed files with 165 additions and 8 deletions

View File

@ -36,6 +36,14 @@ const user = {
data, data,
header header
) )
},
async fixPwd (data = {} , header = {}){
return await Http.put(
HttpConfig.systemPath,
HttpConfig.serviceUrl.user.fixPwd,
data,
header
)
} }
} }

View File

@ -30,6 +30,7 @@ class HttpConfig {
}, },
user: { user: {
logOut: '/logout', // 退出登录 logOut: '/logout', // 退出登录
fixPwd: '/user/profile/updatePwd', //修改密码
}, },
index: { index: {
noticeCont: '/sysNotice/getList', // 获取公告内容 noticeCont: '/sysNotice/getList', // 获取公告内容

View File

@ -451,6 +451,14 @@
} }
} }
,{
"path" : "pages/fixPwd/fixPwd",
"style" :
{
"navigationBarTitleText": "修改密码"
}
}
], ],
"tabBar": { "tabBar": {
"color": "#2c2c2c", "color": "#2c2c2c",

127
pages/fixPwd/fixPwd.vue Normal file
View File

@ -0,0 +1,127 @@
<template>
<view>
<view class="form-area">
<uni-forms
ref="pwdForm"
:modelValue="pwdFormData"
:rules="pwdFormRules"
label-position="top"
>
<uni-forms-item name="oldPassword" required label="旧密码" label-width="100">
<uni-easyinput type="password" placeholder="请输入" maxlength="60"
v-model="pwdFormData.oldPassword"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="newPassword" required label="新密码" label-width="100">
<uni-easyinput type="password" placeholder="请输入" maxlength="60"
v-model="pwdFormData.newPassword"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="confirmNewPassword" required label="确认新密码" label-width="100">
<uni-easyinput type="password" placeholder="请输入" maxlength="60"
v-model="pwdFormData.confirmNewPassword"></uni-easyinput>
</uni-forms-item>
<view
class="sub-btn"
@click="submitForm"
>
保存
</view>
</uni-forms>
</view>
</view>
</template>
<script>
export default {
data() {
return {
pwdFormData: {
oldPassword: '',
newPassword: '',
confirmNewPassword: ''
},
pwdFormRules: {
oldPassword: {
rules: [
{
required: true,
errorMessage: '请输入旧密码!'
}
]
},
newPassword: {
rules: [
{
required: true,
errorMessage: '请输入新密码!'
}
]
},
confirmNewPassword: {
rules: [
{
required: true,
errorMessage: '请确认新密码!'
}
]
}
}
}
},
methods: {
submitForm() {
let that = this
that.$refs.pwdForm.validate().then(formData => {
if (formData.newPassword != formData.confirmNewPassword) {
uni.showToast({
icon: 'none',
title: '确认密码与新密码不一致!'
})
} else {
console.log(formData);
that.$api.user.fixPwd({
oldPassword: formData.oldPassword,
newPassword: formData.newPassword
}).then(res => {
console.log(res);
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: '修改成功!',
success: () => {
uni.navigateBack()
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
}
})
}
}
}
</script>
<style lang="scss">
.form-area{
width: 90%;
margin: 40rpx auto;
.sub-btn{
width: 40%;
margin: 100rpx auto;
box-sizing: border-box;
padding: 15rpx 30rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 15rpx;
background-color: #3888FF;
color: #fff;
}
}
</style>

View File

@ -27,13 +27,16 @@
<uni-easyinput type="password" placeholder="请输入密码" maxlength="60" <uni-easyinput type="password" placeholder="请输入密码" maxlength="60"
v-model="accountFormData.password"></uni-easyinput> v-model="accountFormData.password"></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<text style=" <text
style="
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
color: #3689FF; color: #3689FF;
font-size: 14px; font-size: 14px;
"> "
@click="forgetPwd"
>
忘记密码 忘记密码
</text> </text>
<button class="submit-btn" @click="accountSubmit">登录</button> <button class="submit-btn" @click="accountSubmit">登录</button>
@ -122,6 +125,9 @@ export default {
switchUpper(count) { switchUpper(count) {
this.switchStatus = count this.switchStatus = count
}, },
forgetPwd () {
console.log('忘记密码');
},
sendVeriCode() { sendVeriCode() {
let that = this let that = this
let phoneReg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/ let phoneReg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/

View File

@ -17,23 +17,23 @@
<span>已认证</span> <span>已认证</span>
</h4> </h4>
</view> </view>
<!-- <u-cell-group style="width: 95%; margin: 15rpx auto;" :border="false"> <u-cell-group style="width: 95%; margin: 15rpx auto;" :border="false">
<u-cell <!-- <u-cell
title="个人信息" title="个人信息"
:isLink="true" :isLink="true"
icon="/static/personal.png" icon="/static/personal.png"
:border="false" :border="false"
> >
</u-cell> </u-cell> -->
<u-cell <u-cell
title="设置" title="修改密码"
:isLink="true" :isLink="true"
icon="/static/setting.png" icon="/static/setting.png"
url="/pages/fixPwd/fixPwd"
:border="false" :border="false"
> >
</u-cell> </u-cell>
</u-cell-group> --> </u-cell-group>
<!-- <button ></button> -->
<view <view
class="exit-log" class="exit-log"
@click="exitLogin" @click="exitLogin"

View File

@ -412,6 +412,13 @@ const router = createRouter({
"meta": { "meta": {
"needAuth": "true" "needAuth": "true"
} }
},
{
"path" : "/pages/fixPwd/fixPwd",
"name": 'fixPwd',
"meta": {
"needAuth": "true"
}
} }
] ]
}) })