fix(file-manager): improve default values for thumbnail rules

This commit is contained in:
chenos 2023-10-13 19:49:51 +08:00
parent 0279067d4c
commit 200138350b
3 changed files with 6 additions and 2 deletions

View File

@ -95,7 +95,7 @@ ReadPretty.File = function File(props: UploadProps) {
> >
{file.imageUrl && ( {file.imageUrl && (
<img <img
src={`${file.imageUrl}${file.thumbnailRule}`} src={`${file.imageUrl}${file.thumbnailRule || ''}`}
alt={file.title} alt={file.title}
className={`${prefixCls}-list-item-image`} className={`${prefixCls}-list-item-image`}
/> />

View File

@ -56,8 +56,9 @@ export default {
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-component': 'Input', 'x-component': 'Input',
'x-component-props': { 'x-component-props': {
placeholder: '?x-oss-process=image/auto-orient,1/resize,m_fill,w_40,h_40/quality,q_90', placeholder: '?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90',
}, },
default: '?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90',
description: '{{ xStyleProcessDesc }}', description: '{{ xStyleProcessDesc }}',
}, },
}, },

View File

@ -7,6 +7,9 @@ export class FileModel extends Model {
if (json.storageId && fileStorages && fileStorages.has(json.storageId)) { if (json.storageId && fileStorages && fileStorages.has(json.storageId)) {
const storage = fileStorages.get(json.storageId); const storage = fileStorages.get(json.storageId);
json['thumbnailRule'] = storage?.options?.thumbnailRule; json['thumbnailRule'] = storage?.options?.thumbnailRule;
if (!json['thumbnailRule'] && storage?.type === 'ali-oss') {
json['thumbnailRule'] = '?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90';
}
} }
return json; return json;
} }