chore: set image raw size to form

This commit is contained in:
jialin
2025-01-18 16:03:48 +08:00
parent 47ced11e03
commit 82e8c01b95
5 changed files with 99 additions and 22 deletions
+20 -1
View File
@@ -629,7 +629,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
const handleUpdateImageList = useCallback((base64List: any) => {
console.log('updateimagelist=========', base64List);
const img = _.get(base64List, '[0].dataUrl', '');
const currentImg = _.get(base64List, '[0]', {});
const img = _.get(currentImg, 'dataUrl', '');
setUploadList(base64List);
setImage(img);
setActiveImgUid(_.get(base64List, '[0].uid', ''));
@@ -638,6 +639,24 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
isResetNeeded: true
});
setImageList([]);
form.current?.form?.setFieldsValue({
size: 'custom',
width: currentImg.rawWidth || 512,
height: currentImg.rawHeight || 512
});
setParams((pre: object) => {
return {
...pre,
size: 'custom',
width: currentImg.rawWidth || 512,
height: currentImg.rawHeight || 512
};
});
updateCacheFormData({
size: 'custom',
width: currentImg.rawWidth || 512,
height: currentImg.rawHeight || 512
});
}, []);
const handleOnSave = useCallback(