diff --git a/src/components/FileIcon/FileIcon.tsx b/src/components/FileIcon/FileIcon.tsx index bf078af..b8a1f43 100644 --- a/src/components/FileIcon/FileIcon.tsx +++ b/src/components/FileIcon/FileIcon.tsx @@ -7,16 +7,18 @@ import { memoize } from 'lodash'; interface FileIconProps extends ImageProps { extension: string; + absolutePath?: string; } export default memo(function FileIcon(props: FileIconProps) { - const { className, extension, ...restProps } = props; + const { className, extension, absolutePath, ...restProps } = props; + const isImg = isImgFile(extension) && !!absolutePath; return (
@@ -28,6 +30,12 @@ const fileIconSrc = memoize((extension: string) => { return `assets/file_icon/${fixedExtension}.svg`; }); +const imgList: string[] = ['jpg', 'png', 'bmp', 'gif', 'jpeg']; + +function isImgFile(extension: string) { + return imgList.includes(extension); +} + export function matchFileImage(extension: string) { switch (extension) { case 'ppt': diff --git a/src/components/FileStatus/FileStatus.tsx b/src/components/FileStatus/FileStatus.tsx index fbd278b..642df3d 100644 --- a/src/components/FileStatus/FileStatus.tsx +++ b/src/components/FileStatus/FileStatus.tsx @@ -50,9 +50,13 @@ export default function FileStatus(props: FileStatusProps) { return (
- +
- +
{data.archName}
@@ -134,6 +138,11 @@ interface LoadDescProps { progress?: number; } +function fileFullName(data: DATA.SocketFileMsg) { + const extension = data.extension; + return `${data.archName}${extension ? '.' + extension : ''}`; +} + function LoadDesc(props: LoadDescProps) { const { result, type, loadingState, progress } = props; const keywords = type === 'UPLOAD' ? '上传' : '下载';