分类图片上传和用户等级图片上传
This commit is contained in:
@@ -14,6 +14,7 @@ import { useTranslation } from 'react-i18next';
|
||||
const ImageUploader: React.FC<ImageUploaderProps> = ({
|
||||
action,
|
||||
value,
|
||||
changeType,
|
||||
onChange,
|
||||
mode = 'single',
|
||||
disabled = false,
|
||||
@@ -115,9 +116,17 @@ const ImageUploader: React.FC<ImageUploaderProps> = ({
|
||||
.filter((file) => file.status === 'done' && file.response)
|
||||
.map((file) => file.response.data as ISysFileInfo);
|
||||
if( mode === 'single' ) {
|
||||
onChange?.(uploadedFiles[0]);
|
||||
if (changeType !== 'id') {
|
||||
onChange?.(uploadedFiles[0]);
|
||||
} else {
|
||||
onChange?.(uploadedFiles[0].id);
|
||||
}
|
||||
} else {
|
||||
onChange?.(uploadedFiles);
|
||||
if (changeType !== 'id') {
|
||||
onChange?.(uploadedFiles);
|
||||
} else {
|
||||
onChange?.(uploadedFiles.map(item => item.id!));
|
||||
}
|
||||
}
|
||||
// 上传失败的文件
|
||||
const errorFiles = newFileList.filter((file) => file.status === 'error');
|
||||
|
||||
Reference in New Issue
Block a user