Update App.jsx via upload script - 2026-11-04 09:59:55
This commit is contained in:
parent
53a8300c49
commit
ac4714ed07
7
App.jsx
7
App.jsx
|
|
@ -6739,6 +6739,9 @@ function WebImageList({ draft, set, onNotify, field, max, label, cover, tall, ac
|
||||||
const images = Array.isArray(draft[field]) ? draft[field] : [];
|
const images = Array.isArray(draft[field]) ? draft[field] : [];
|
||||||
const [uploading, setUploading] = useState(false);
|
const [uploading, setUploading] = useState(false);
|
||||||
const [dragIdx, setDragIdx] = useState(null);
|
const [dragIdx, setDragIdx] = useState(null);
|
||||||
|
// 最新的图片列表:上一批还在上传时又选了一批,两批传完都要保留(不能用开始上传时的旧列表覆盖)
|
||||||
|
const latest = useRef({ id: draft.id, images });
|
||||||
|
latest.current = { id: draft.id, images };
|
||||||
|
|
||||||
async function handlePick(fileList) {
|
async function handlePick(fileList) {
|
||||||
const picked = Array.from(fileList || []);
|
const picked = Array.from(fileList || []);
|
||||||
|
|
@ -6756,7 +6759,9 @@ function WebImageList({ draft, set, onNotify, field, max, label, cover, tall, ac
|
||||||
if (onNotify) onNotify(`${f.name} 上传失败,请重试`);
|
if (onNotify) onNotify(`${f.name} 上传失败,请重试`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set({ [field]: [...images, ...added] });
|
// 上传期间切到了别的模板 / 产品:latest 已经是别的记录,用开始时的列表
|
||||||
|
const base = latest.current.id === draft.id ? latest.current.images : images;
|
||||||
|
set({ [field]: [...base, ...added.filter(f => !base.includes(f))] });
|
||||||
setUploading(false);
|
setUploading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue