| | |
| | | }>(); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | wrapperClass: 'grid-cols-1', |
| | | actionPosition: 'left', |
| | | actionLayout: 'newLine', |
| | | commonConfig: { |
| | | labelWidth: 70, |
| | | labelWidth: 84, |
| | | }, |
| | | schema: [ |
| | | { |
| | | label: '用户昵称', |
| | | label: '显示名称', |
| | | fieldName: 'nickname', |
| | | component: 'Input', |
| | | componentProps: { |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | label: '用户手机', |
| | | label: '手机号码', |
| | | fieldName: 'mobile', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请输入用户手机', |
| | | autocomplete: 'tel', |
| | | }, |
| | | rules: z.string(), |
| | | rules: z.string().optional(), |
| | | }, |
| | | { |
| | | label: '用户邮箱', |
| | | label: '电子邮箱', |
| | | fieldName: 'email', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请输入用户邮箱', |
| | | autocomplete: 'email', |
| | | }, |
| | | rules: z.string().email('请输入正确的邮箱'), |
| | | rules: z.string().email('请输入正确的邮箱').or(z.literal('')).optional(), |
| | | }, |
| | | { |
| | | label: '用户性别', |
| | |
| | | buttonStyle: 'solid', |
| | | optionType: 'button', |
| | | }, |
| | | rules: z.number(), |
| | | rules: z.number().optional(), |
| | | }, |
| | | ], |
| | | resetButtonOptions: { |
| | | show: false, |
| | | }, |
| | | submitButtonOptions: { |
| | | content: '更新信息', |
| | | content: '保存修改', |
| | | }, |
| | | handleSubmit, |
| | | }); |
| | |
| | | () => props.profile, |
| | | (newProfile) => { |
| | | if (newProfile) { |
| | | formApi.setValues(newProfile); |
| | | formApi.setValues({ nickname: newProfile.nickname, mobile: newProfile.mobile ?? '', email: newProfile.email ?? '', sex: newProfile.sex }); |
| | | } |
| | | }, |
| | | { immediate: true }, |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="mt-4 md:w-full lg:w-1/2 2xl:w-2/5"> |
| | | <div class="profile-form"> |
| | | <Form /> |
| | | <p class="profile-form-note">账号、部门及岗位由管理员维护。如需调整,请联系管理员。</p> |
| | | </div> |
| | | </template> |
| | | <style scoped> |
| | | .profile-form { max-width: 560px; }.profile-form :deep(.ant-input),.profile-form :deep(.ant-input-affix-wrapper) { min-height: 38px; }.profile-form-note { margin: 18px 0 0 84px; color: var(--portal-muted); font-size: 12px; line-height: 1.8; }@media(max-width:520px) { .profile-form-note { margin-left: 0; } } |
| | | </style> |