| | |
| | | import { updateUserPassword } from '#/api/system/user/profile'; |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | wrapperClass: 'grid-cols-1', |
| | | actionPosition: 'left', |
| | | actionLayout: 'newLine', |
| | | commonConfig: { |
| | | labelWidth: 70, |
| | | labelWidth: 84, |
| | | }, |
| | | schema: [ |
| | | { |
| | | component: 'InputPassword', |
| | | fieldName: 'oldPassword', |
| | | label: '旧密码', |
| | | label: '当前密码', |
| | | componentProps: { autocomplete: 'current-password', placeholder: '请输入当前登录密码' }, |
| | | rules: z |
| | | .string({ message: '请输入密码' }) |
| | | .min(5, '密码长度不能少于 5 个字符') |
| | |
| | | }, |
| | | fieldName: 'newPassword', |
| | | label: '新密码', |
| | | componentProps: { autocomplete: 'new-password', placeholder: '请输入 5–20 位新密码' }, |
| | | rules: 'required', |
| | | }, |
| | | { |
| | |
| | | }, |
| | | fieldName: 'confirmPassword', |
| | | label: '确认密码', |
| | | componentProps: { autocomplete: 'new-password', placeholder: '请再次输入新密码' }, |
| | | rules: 'required', |
| | | }, |
| | | ], |
| | |
| | | newPassword: values.newPassword, |
| | | }); |
| | | message.success($t('ui.actionMessage.operationSuccess')); |
| | | await formApi.resetForm(); |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="mt-4 md:w-full lg:w-1/2 2xl:w-2/5"> |
| | | <div class="profile-password-form"> |
| | | <p class="password-note">密码长度为 5–20 个字符,新密码需与当前密码不同。请勿与其他平台使用相同密码。</p> |
| | | <Form /> |
| | | </div> |
| | | </template> |
| | | <style scoped> |
| | | .profile-password-form { max-width: 560px; }.password-note { margin: 0 0 24px; padding: 13px 16px; color: #365e82; background: #f0f6fc; font-size: 12px; line-height: 1.8; }.profile-password-form :deep(.ant-input-affix-wrapper) { min-height: 38px; } |
| | | </style> |
| | | |