| | |
| | | ProForm, |
| | | ProFormText, |
| | | ProFormTextArea, |
| | | ProFormSelect |
| | | ProFormSelect, |
| | | ProFormDigit |
| | | } from '@ant-design/pro-components'; |
| | | import { Button, Input, message, Upload } from 'antd'; |
| | | import { Button, Input, message, Upload, Form } from 'antd'; |
| | | import React from 'react'; |
| | | import useStyles from './index.style'; |
| | | import Http from '@/utils/http'; |
| | |
| | | const { styles } = useStyles(); |
| | | const [loading, setLoading] = React.useState(false); |
| | | const [currentUser, setCurrentUser] = React.useState({}); |
| | | const [form] = Form.useForm(); |
| | | |
| | | const AvatarView = ({ avatar }) => ( |
| | | <> |
| | |
| | | if (currentUser.avatar) { |
| | | return currentUser.avatar; |
| | | } |
| | | const url = { defaultAvat }; |
| | | return url; |
| | | } |
| | | return defaultAvat; |
| | | }; |
| | | |
| | | const handleFinish = async () => { |
| | | handleUpdate(); |
| | | const handleFinish = async (values) => { |
| | | // console.log(values); return |
| | | handleUpdate(values); |
| | | }; |
| | | |
| | | return ( |
| | |
| | | <> |
| | | <div className={styles.left}> |
| | | <ProForm |
| | | form={form} |
| | | layout="vertical" |
| | | onFinish={handleFinish} |
| | | submitter={{ |
| | |
| | | }} |
| | | initialValues={{ |
| | | ...currentUser, |
| | | // phone: currentUser?.phone.split('-'), |
| | | }} |
| | | hideRequiredMark |
| | | > |
| | | <ProFormDigit |
| | | name="id" |
| | | disabled |
| | | hidden={true} |
| | | /> |
| | | <ProFormText |
| | | width="md" |
| | | name="username" |
| | |
| | | name="sex" |
| | | label="性别" |
| | | colProps={{ md: 12, xl: 12 }} |
| | | placeholder="请选择" |
| | | options={[ |
| | | { label: '未知', value: 0 }, |
| | | { label: '男', value: 1 }, |
| | |
| | | label="手机号" |
| | | rules={[ |
| | | { |
| | | required: true, |
| | | required: false, |
| | | message: '请输入您的手机号!', |
| | | }, |
| | | ]} |
| | |
| | | label="邮箱" |
| | | rules={[ |
| | | { |
| | | required: true, |
| | | required: false, |
| | | message: '请输入您的邮箱!', |
| | | }, |
| | | ]} |
| | |
| | | label="真实姓名" |
| | | rules={[ |
| | | { |
| | | required: true, |
| | | message: '请输入您的真实姓名!', |
| | | }, |
| | | ]} |
| | | /> |
| | | <ProFormText |
| | | width="md" |
| | | name="realName" |
| | | label="真实姓名" |
| | | rules={[ |
| | | { |
| | | required: true, |
| | | required: false, |
| | | message: '请输入您的真实姓名!', |
| | | }, |
| | | ]} |
| | |
| | | label="身份证号" |
| | | rules={[ |
| | | { |
| | | required: true, |
| | | required: false, |
| | | message: '请输入您的身份证号!', |
| | | }, |
| | | ]} |
| | |
| | | label="个人简介" |
| | | rules={[ |
| | | { |
| | | required: true, |
| | | required: false, |
| | | message: '请输入个人简介!', |
| | | }, |
| | | ]} |
| | | placeholder="个人简介" |
| | | /> |
| | | </ProForm> |
| | | </div> |