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