import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons'; import { Descriptions, Divider, Space, Spin, Typography } from 'antd'; import Link from 'antd/lib/typography/Link'; import { memo, useEffect, useState } from 'react'; import { useIntl, useRequest } from 'umi'; import { getAppDetail } from '../server'; import UserLink from '../UserInfo/link'; import style from './index.less'; interface AppInfoDescriptionProps { /** * @description appId */ appId: number; /** * @description title 默认标题 应用信息 */ title?: string | JSX.Element; /** * @description 简洁模式 */ simple?: boolean; /** * @description ant desgin Descriptions 其余属性 包括 column(几列) */ [key: string]: any; } const AppInfoDescriptions = (props: AppInfoDescriptionProps) => { const { appId, title, simple = false, ...restProps } = props; const { formatMessage } = useIntl(); const [more, setMore] = useState(false); const { Text } = Typography; const { data, run, loading } = useRequest(() => getAppDetail(appId), { manual: true, }); useEffect(() => { if (appId) { run(); } }, [appId, run]); return ( {data?.name} {data?.domain} {data?.intro} {!simple && ( <> {more ? ( } wrap> {data?.manager?.map?.((item: any) => ( ))} setMore(false)}> {formatMessage({ id: 'base.common.collapse' })} ) : ( } wrap> {data?.manager?.length > 1 && ( setMore(true)}> {formatMessage({ id: 'base.common.expand.more' })} )} )} )} ); }; export default memo(AppInfoDescriptions);