import { Descriptions } from 'antd'; import moment from 'moment'; import { memo, useEffect, useState } from 'react'; import { useIntl } from 'umi'; import { formatUserRender } from '../utils'; import style from './index.less'; export interface UserInfo { entryData?: number; nameZh?: string; account?: string; nameEn?: string; state?: number | string; department?: string; jobName?: string; [key: string]: any; } const UserInfoDescriptions = ({ currentUser, ...props }) => { const [userInfo, setUserInfo] = useState(); const { formatMessage } = useIntl(); useEffect(() => { setUserInfo(currentUser); // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentUser?.id]); return ( <> {userInfo?.entryData && moment(userInfo?.entryData * 1000)?.format('YYYY-MM-DD HH:mm:ss')} {formatUserRender({ nameZh: userInfo?.nameZh, account: userInfo?.account || userInfo?.nameEn, state: userInfo?.state, })} {userInfo?.department?.replaceAll?.('>', '-')} {userInfo?.jobName} ); }; export default memo(UserInfoDescriptions);