mirror of https://gitee.com/topiam/eiam
✨ 优化暂未配置存储提供商提示
parent
e229b1a723
commit
b863dce0ed
|
@ -110,6 +110,7 @@ const BaseView = () => {
|
|||
const [loading, setLoading] = useState<boolean>();
|
||||
const { initialState, setInitialState } = useModel('@@initialState');
|
||||
const [avatarURL, setAvatarURL] = useState<string | undefined>(initialState?.currentUser?.avatar);
|
||||
const [avatarUploaded, setAvatarUploaded] = useState<boolean>(false);
|
||||
const [name, setName] = useState<string>('');
|
||||
|
||||
useAsyncEffect(async () => {
|
||||
|
@ -126,7 +127,8 @@ const BaseView = () => {
|
|||
const handleFinish = async (values: Record<string, string>) => {
|
||||
const { success } = await changeBaseInfo({
|
||||
fullName: values.fullName,
|
||||
nikeName: values.nikeName,
|
||||
nickName: values.nickName,
|
||||
avatar: avatarUploaded ? avatarURL : undefined,
|
||||
});
|
||||
if (success) {
|
||||
useApp.message.success(intl.formatMessage({ id: 'app.update_success' }));
|
||||
|
@ -283,7 +285,14 @@ const BaseView = () => {
|
|||
</ProForm>
|
||||
</div>
|
||||
<div className={classnames(`${prefixCls}-right`, hashId)}>
|
||||
<AvatarView avatar={avatarURL} callBack={setAvatarURL} name={name} />
|
||||
<AvatarView
|
||||
avatar={avatarURL}
|
||||
callBack={(avatarUrl: string) => {
|
||||
setAvatarURL(avatarUrl);
|
||||
setAvatarUploaded(true);
|
||||
}}
|
||||
name={name}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
|
|
@ -16,11 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { UploadOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
ProForm,
|
||||
ProFormText,
|
||||
useStyle as useAntdStyle,
|
||||
} from '@ant-design/pro-components';
|
||||
import { ProForm, ProFormText, useStyle as useAntdStyle } from '@ant-design/pro-components';
|
||||
import { App, Avatar, Button, Form, Skeleton, Upload } from 'antd';
|
||||
import { useState } from 'react';
|
||||
|
||||
|
@ -116,7 +112,8 @@ const BaseView = () => {
|
|||
const [loading, setLoading] = useState<boolean>();
|
||||
const { initialState } = useModel('@@initialState');
|
||||
const [avatarURL, setAvatarURL] = useState<string | undefined>(initialState?.currentUser?.avatar);
|
||||
const [name, setName] = useState<string>('');
|
||||
const [avatarUploaded, setAvatarUploaded] = useState<boolean>(false);
|
||||
const [name, setName] = useState<string>();
|
||||
|
||||
useAsyncEffect(async () => {
|
||||
setLoading(true);
|
||||
|
@ -137,7 +134,7 @@ const BaseView = () => {
|
|||
fullName: values.fullName,
|
||||
nickName: values.nickName,
|
||||
personalProfile: values.personalProfile,
|
||||
avatar: avatarURL,
|
||||
avatar: avatarUploaded ? avatarURL : undefined,
|
||||
}),
|
||||
publicSecret,
|
||||
),
|
||||
|
@ -162,7 +159,7 @@ const BaseView = () => {
|
|||
callBack,
|
||||
}: {
|
||||
avatar: string | undefined;
|
||||
name: string;
|
||||
name?: string;
|
||||
callBack: any;
|
||||
}) => (
|
||||
<>
|
||||
|
@ -178,7 +175,7 @@ const BaseView = () => {
|
|||
className={classnames(`${prefixCls}-avatar-name`, hashId)}
|
||||
size={144}
|
||||
>
|
||||
{name.substring(0, 1)}
|
||||
{name?.substring(0, 1)}
|
||||
</Avatar>
|
||||
)}
|
||||
</div>
|
||||
|
@ -229,7 +226,7 @@ const BaseView = () => {
|
|||
onFinish={handleFinish}
|
||||
submitter={{
|
||||
render: (p, dom) => {
|
||||
return <Form.Item wrapperCol={{ span: 19 , offset: 5 }}>{dom}</Form.Item>;
|
||||
return <Form.Item wrapperCol={{ span: 19, offset: 5 }}>{dom}</Form.Item>;
|
||||
},
|
||||
searchConfig: {
|
||||
submitText: intl.formatMessage({ id: 'app.save' }),
|
||||
|
@ -287,7 +284,14 @@ const BaseView = () => {
|
|||
</ProForm>
|
||||
</div>
|
||||
<div className={classnames(`${prefixCls}-right`, hashId)}>
|
||||
<AvatarView avatar={avatarURL} callBack={setAvatarURL} name={name} />
|
||||
<AvatarView
|
||||
avatar={avatarURL}
|
||||
callBack={(avatarUrl: string) => {
|
||||
setAvatarURL(avatarUrl);
|
||||
setAvatarUploaded(true);
|
||||
}}
|
||||
name={name}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
|
Loading…
Reference in New Issue