Commit 6c0178da authored by GuanHua's avatar GuanHua
parents 798857bd 7a07d622
...@@ -54,17 +54,19 @@ const ImgUpload = forwardRef((props: IProps, ref: any) => { ...@@ -54,17 +54,19 @@ const ImgUpload = forwardRef((props: IProps, ref: any) => {
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
setData(imgs: string[]) { setData(imgs: string[]) {
const newFileList = imgs.map((item, index) => { if (imgs) {
return { const newFileList = imgs.map((item, index) => {
uid: `uid${index}`, return {
name: 'image.png', uid: `uid${index}`,
status: 'done', name: 'image.png',
url: item, status: 'done',
} url: item,
}) }
// 直接走一次回调,使值可以set进表单 })
handleChange({ file: { status: 'success' }, fileList: newFileList}) // 直接走一次回调,使值可以set进表单
// setFileList(newFileList) handleChange({ file: { status: 'success' }, fileList: newFileList})
// setFileList(newFileList)
}
}, },
})) }))
...@@ -137,7 +139,7 @@ const ImgUpload = forwardRef((props: IProps, ref: any) => { ...@@ -137,7 +139,7 @@ const ImgUpload = forwardRef((props: IProps, ref: any) => {
{fileList.length >= maxCount || disabled ? null : uploadButtonElement} {fileList.length >= maxCount || disabled ? null : uploadButtonElement}
</Upload> </Upload>
{ {
tips && tips &&
<div className={styles.tips}> <div className={styles.tips}>
<div>支持 {fileType.map(item => item.split('/')[1]).join('/')}</div> <div>支持 {fileType.map(item => item.split('/')[1]).join('/')}</div>
<div>最大不超过 {maxSize} {unit}</div> <div>最大不超过 {maxSize} {unit}</div>
......
...@@ -156,8 +156,8 @@ const OwnMallAboutUs = () => { ...@@ -156,8 +156,8 @@ const OwnMallAboutUs = () => {
const { albumName, albumUrl, honorPics, workshopPics, ...rest } = data const { albumName, albumUrl, honorPics, workshopPics, ...rest } = data
const newAlbumUrls = albumName && albumUrl ? [{ name: albumName, url: albumUrl }] : [] const newAlbumUrls = albumName && albumUrl ? [{ name: albumName, url: albumUrl }] : []
workshopImgRef.current?.setData(workshopPics) workshopPics && workshopImgRef.current?.setData(workshopPics)
honorImgRef.current?.setData(honorPics) honorPics && honorImgRef.current?.setData(honorPics)
form.setFieldsValue({ form.setFieldsValue({
...rest, ...rest,
albumUrls: newAlbumUrls albumUrls: newAlbumUrls
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment