| | |
| | | ProFormDigit |
| | | } from '@ant-design/pro-components'; |
| | | import { Button, Input, message, Upload, Form } from 'antd'; |
| | | import { FormattedMessage, useIntl } from '@umijs/max'; |
| | | import React from 'react'; |
| | | import useStyles from './index.style'; |
| | | import Http from '@/utils/http'; |
| | | |
| | | import defaultAvat from '/public/img/defaultAva.png' |
| | | |
| | | const handleUpdate = async (val) => { |
| | | const hide = message.loading('正在更新'); |
| | | const handleUpdate = async (val, intl) => { |
| | | const hide = message.loading(intl.formatMessage({ id: 'page.updating', defaultMessage: '正在更新' })); |
| | | try { |
| | | const resp = await Http.doPost('api/user/update', val); |
| | | if (resp.code === 200) { |
| | | message.success('更新成功'); |
| | | message.success(intl.formatMessage({ id: 'page.update.success', defaultMessage: '更新成功' })); |
| | | return true; |
| | | } else { |
| | | message.error(resp.msg); |
| | | return false; |
| | | } |
| | | } catch (error) { |
| | | message.error('配置失败请重试!'); |
| | | message.error(intl.formatMessage({ id: 'page.update.fail', defaultMessage: '更新失败请重试!' })); |
| | | return false; |
| | | } finally { |
| | | hide(); |
| | |
| | | }; |
| | | |
| | | const BaseView = () => { |
| | | const intl = useIntl(); |
| | | const { styles } = useStyles(); |
| | | const [loading, setLoading] = React.useState(false); |
| | | const [currentUser, setCurrentUser] = React.useState({}); |
| | |
| | | }; |
| | | |
| | | const handleFinish = async (values) => { |
| | | handleUpdate(values); |
| | | handleUpdate(values, intl); |
| | | }; |
| | | |
| | | return ( |
| | |
| | | onFinish={handleFinish} |
| | | submitter={{ |
| | | searchConfig: { |
| | | submitText: '更新基本信息', |
| | | submitText: intl.formatMessage({ id: 'personal.base.button.name', defaultMessage: '更新基本信息' }), |
| | | }, |
| | | render: (_, dom) => dom[1], |
| | | }} |