2023-11-21 18:54:33 +08:00
|
|
|
<template>
|
|
|
|
<view class="content">
|
|
|
|
<view class="reset-password">
|
2023-12-14 11:27:14 +08:00
|
|
|
<u--form ref="formRef" :rules="rules" :model="formData" labelPosition='top'>
|
|
|
|
<u-form-item label="原密码" labelWidth="140rpx" borderBottom prop="old_password" left-icon='lock'>
|
2023-11-30 17:51:39 +08:00
|
|
|
|
|
|
|
<u-input placeholder="请输入原密码" border="surround" v-model="formData.old_password"
|
2023-12-14 11:27:14 +08:00
|
|
|
:password="!pwdShow.old_password" class="ipt" customStyle='padding:20rpx 10rpx'>
|
|
|
|
<!-- <template #suffix>
|
2023-11-30 17:51:39 +08:00
|
|
|
<u-icon :name="pwdShow.old_password?'eye-off':'eye-fill'" size="25"
|
|
|
|
@click="pwdShow.old_password=!pwdShow.old_password"></u-icon>
|
2023-12-14 11:27:14 +08:00
|
|
|
</template> -->
|
2023-11-30 17:51:39 +08:00
|
|
|
</u-input>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-21 18:54:33 +08:00
|
|
|
</u-form-item>
|
2023-12-14 11:27:14 +08:00
|
|
|
<u-form-item label="新密码" labelWidth="140rpx" borderBottom prop="password" left-icon='lock'>
|
2023-11-30 17:51:39 +08:00
|
|
|
|
|
|
|
|
2023-12-14 11:27:14 +08:00
|
|
|
<u-input border="surround" class="ipt" customStyle='padding:20rpx 10rpx' v-model="formData.password"
|
|
|
|
:password="!pwdShow.password" placeholder="请输入新密码">
|
|
|
|
<!--
|
2023-11-30 17:51:39 +08:00
|
|
|
<template #suffix>
|
|
|
|
<u-icon :name="pwdShow.password?'eye-off':'eye-fill'" size="25"
|
|
|
|
@click="pwdShow.password=!pwdShow.password"></u-icon>
|
2023-12-14 11:27:14 +08:00
|
|
|
</template> -->
|
2023-11-30 17:51:39 +08:00
|
|
|
</u-input>
|
|
|
|
|
|
|
|
|
2023-11-21 18:54:33 +08:00
|
|
|
</u-form-item>
|
2023-12-14 11:27:14 +08:00
|
|
|
<u-form-item label="确认密码" labelWidth="180rpx" borderBottom prop="password_confirm" left-icon='lock'>
|
2023-11-30 17:51:39 +08:00
|
|
|
<u-input border="surround" v-model="formData.password_confirm" :password="!pwdShow.password_confirm"
|
2023-12-14 11:27:14 +08:00
|
|
|
placeholder="请确认新密码" class="ipt" customStyle='padding:20rpx 10rpx'>
|
2023-11-30 17:51:39 +08:00
|
|
|
|
2023-12-14 11:27:14 +08:00
|
|
|
<!-- <template #suffix>
|
2023-11-30 17:51:39 +08:00
|
|
|
<u-icon :name="pwdShow.password_confirm?'eye-off':'eye-fill'" size="25"
|
|
|
|
@click="pwdShow.password_confirm=!pwdShow.password_confirm"></u-icon>
|
2023-12-14 11:27:14 +08:00
|
|
|
</template> -->
|
2023-11-30 17:51:39 +08:00
|
|
|
</u-input>
|
|
|
|
|
2023-11-21 18:54:33 +08:00
|
|
|
</u-form-item>
|
2023-12-14 11:27:14 +08:00
|
|
|
<u-button style="margin-top: 28rpx;background-color:#34D190;color: #fff;"
|
|
|
|
customStyle="border-radius: 50rpx;height:100rpx" @click="submit">提交</u-button>
|
2023-11-21 18:54:33 +08:00
|
|
|
</u--form>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-11-23 10:58:26 +08:00
|
|
|
import {
|
|
|
|
changePassword
|
2023-11-28 18:08:39 +08:00
|
|
|
} from '@/api/api.js'
|
2023-11-21 18:54:33 +08:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
pwdShow: {
|
|
|
|
old_password: false,
|
|
|
|
password: false,
|
|
|
|
password_confirm: false,
|
|
|
|
},
|
|
|
|
formData: {
|
|
|
|
old_password: '', // 原密码
|
|
|
|
password: '', // 新密码
|
|
|
|
password_confirm: '', // 确认密码
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
old_password: {
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
min: 6,
|
|
|
|
max: 18,
|
|
|
|
message: '请输入6-18位密码',
|
|
|
|
trigger: ['change', 'blur']
|
|
|
|
},
|
|
|
|
password: {
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
min: 6,
|
|
|
|
max: 18,
|
|
|
|
message: '请输入6-18位密码',
|
|
|
|
trigger: ['change', 'blur']
|
|
|
|
},
|
|
|
|
password_confirm: {
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
min: 6,
|
|
|
|
max: 18,
|
|
|
|
message: '请输入6-18位密码',
|
|
|
|
trigger: ['change', 'blur']
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submit() {
|
|
|
|
this.$refs.formRef.validate().then(async (e) => {
|
|
|
|
if (e) {
|
2023-11-28 18:08:39 +08:00
|
|
|
if (this.formData.password == this.formData.old_password) return uni.$u.toast(
|
|
|
|
'新密码不能与原密码一致');
|
2023-11-23 10:58:26 +08:00
|
|
|
if (this.formData.password !== this.formData.password_confirm) return uni.$u.toast(
|
2023-11-21 18:54:33 +08:00
|
|
|
'两次新密码不一致');
|
2023-11-30 17:51:39 +08:00
|
|
|
|
2023-11-28 18:08:39 +08:00
|
|
|
changePassword(
|
|
|
|
this.formData
|
|
|
|
).then((res) => {
|
2023-11-30 17:51:39 +08:00
|
|
|
|
2023-11-28 18:08:39 +08:00
|
|
|
if (res.code == 1) {
|
|
|
|
uni.$u.toast('修改成功');
|
|
|
|
uni.switchTab({
|
|
|
|
url: '/pages/index/personal',
|
|
|
|
|
2023-11-21 18:54:33 +08:00
|
|
|
})
|
2023-11-28 18:08:39 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-23 10:58:26 +08:00
|
|
|
|
|
|
|
|
2023-11-21 18:54:33 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.content {
|
|
|
|
padding-top: 10rpx;
|
|
|
|
background-color: $theme-bg-color;
|
|
|
|
height: 100vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
.reset-password {
|
|
|
|
margin: 28rpx;
|
|
|
|
padding: 28rpx;
|
|
|
|
background-color: #fff;
|
|
|
|
border-radius: 14rpx;
|
2023-12-14 11:27:14 +08:00
|
|
|
box-shadow: 1rpx 1rpx 10rpx 1rpx rgba(0, 0, 0, 0.1);
|
|
|
|
}
|
|
|
|
|
|
|
|
.ipt {
|
|
|
|
background-color: #EBEBEB;
|
|
|
|
border-radius: 50rpx;
|
|
|
|
border: none;
|
|
|
|
// border-radius: 20rpx;
|
|
|
|
// padding: 10rpx 0;
|
2023-11-21 18:54:33 +08:00
|
|
|
}
|
|
|
|
</style>
|