| | |
| | | </view> |
| | | </view> |
| | | <view class="password_footer"> |
| | | <button v-preventReClick class="password_footer_submit"> |
| | | <button class="password_footer_submit" @click="submit"> |
| | | <text>完成</text> |
| | | </button> |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { updatePwd } from '@/util/api/PersonalAPI' |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | confirmPassword: '' |
| | | } |
| | | }; |
| | | }, |
| | | methods: { |
| | | // 忘记密码 |
| | | forgotPassword() { |
| | | |
| | | }, |
| | | // 提交修改 |
| | | submit() { |
| | | if (!this.form.originalPassword) { |
| | | uni.showToast({ title: '原密码不能为空', icon: 'none', duration: 2000 }); |
| | | } else if (!this.form.newPassword) { |
| | | uni.showToast({ title: '新密码不能为空', icon: 'none', duration: 2000 }); |
| | | } else if (!/^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{6,}$/.test(this.form.newPassword)) { |
| | | uni.showToast({ title: '密码格式不正确', icon: 'none', duration: 2000 }); |
| | | } else if (!this.form.confirmPassword) { |
| | | uni.showToast({ title: '确认密码不能为空', icon: 'none', duration: 2000 }); |
| | | } else if (this.form.newPassword !== this.form.confirmPassword) { |
| | | uni.showToast({ title: '两次输入的密码不一致', icon: 'none', duration: 2000 }); |
| | | } else { |
| | | updatePwd({ |
| | | newPwd: this.form.newPassword, |
| | | oldPwd: this.form.originalPassword |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | uni.showToast({ title: '修改成功', icon: 'success', duration: 2000, mask: true }); |
| | | setTimeout(() => { |
| | | uni.navigateBack({ delta: 1 }); |
| | | }, 2000) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |