feat(系统): 文件大小限制文案

This commit is contained in:
baiqi 2024-09-06 10:23:50 +08:00 committed by Craftsman
parent 8da2ebc414
commit 1790bac49b
8 changed files with 19 additions and 8 deletions

View File

@ -108,6 +108,7 @@
isAllScreen: false, isAllScreen: false,
cutHeight: 110, cutHeight: 110,
allowRepeat: false, allowRepeat: false,
sizeUnit: 'MB',
}); });
const emit = defineEmits(['update:fileList', 'change']); const emit = defineEmits(['update:fileList', 'change']);
@ -141,7 +142,7 @@
const maxSize = props.maxSize || appStore.getFileMaxSize; const maxSize = props.maxSize || appStore.getFileMaxSize;
const _maxSize = props.sizeUnit === 'MB' ? maxSize * 1024 * 1024 : maxSize * 1024; const _maxSize = props.sizeUnit === 'MB' ? maxSize * 1024 * 1024 : maxSize * 1024;
if (props.isLimit && file.size > _maxSize) { if (props.isLimit && file.size > _maxSize) {
Message.warning(t('ms.upload.overSize')); Message.warning(t('ms.upload.overSize', { size: maxSize, unit: props.sizeUnit }));
return Promise.resolve(false); return Promise.resolve(false);
} }
if (!props.multiple) { if (!props.multiple) {

View File

@ -1,6 +1,6 @@
export default { export default {
'ms.upload.changeFile': 'Change file', 'ms.upload.changeFile': 'Change file',
'ms.upload.overSize': 'The file size exceeds the limit, please reselect the file', 'ms.upload.overSize': 'The file size limit is {size} {unit}, please reselect the file',
'ms.upload.importModalDragText': 'Drag or click this area to select a file', 'ms.upload.importModalDragText': 'Drag or click this area to select a file',
'ms.upload.importModalFileTip': 'Only {type} format files are supported, and the file size does not exceed {size} MB', 'ms.upload.importModalFileTip': 'Only {type} format files are supported, and the file size does not exceed {size} MB',
'ms.upload.waiting': 'Waiting', 'ms.upload.waiting': 'Waiting',

View File

@ -1,6 +1,6 @@
export default { export default {
'ms.upload.changeFile': '更改文件', 'ms.upload.changeFile': '更改文件',
'ms.upload.overSize': '文件大小超出限制,请重新选择文件', 'ms.upload.overSize': '文件大小限制为 {size} {unit},请重新选择文件',
'ms.upload.importModalDragText': '拖拽或点击此区域选择文件', 'ms.upload.importModalDragText': '拖拽或点击此区域选择文件',
'ms.upload.importModalFileTip': '只支持 {type} 格式文件,文件大小不超过 {size} MB', 'ms.upload.importModalFileTip': '只支持 {type} 格式文件,文件大小不超过 {size} MB',
'ms.upload.waiting': '等待上传', 'ms.upload.waiting': '等待上传',

View File

@ -180,7 +180,9 @@
v-model:file-list="fileList" v-model:file-list="fileList"
accept="none" accept="none"
:auto-upload="false" :auto-upload="false"
:sub-text="acceptType === 'jar' ? '' : t('project.fileManagement.normalFileSubText', { size: 50 })" :sub-text="
acceptType === 'jar' ? '' : t('project.fileManagement.normalFileSubText', { size: appStore.getFileMaxSize })
"
multiple multiple
draggable draggable
size-unit="MB" size-unit="MB"

View File

@ -161,7 +161,9 @@
v-model:file-list="fileList" v-model:file-list="fileList"
accept="none" accept="none"
:auto-upload="false" :auto-upload="false"
:sub-text="acceptType === 'jar' ? '' : t('project.fileManagement.normalFileSubText', { size: 50 })" :sub-text="
acceptType === 'jar' ? '' : t('project.fileManagement.normalFileSubText', { size: appStore.getFileMaxSize })
"
multiple multiple
draggable draggable
size-unit="MB" size-unit="MB"

View File

@ -208,7 +208,9 @@
v-model:file-list="fileList" v-model:file-list="fileList"
accept="none" accept="none"
:auto-upload="false" :auto-upload="false"
:sub-text="acceptType === 'jar' ? '' : t('project.fileManagement.normalFileSubText', { size: 50 })" :sub-text="
acceptType === 'jar' ? '' : t('project.fileManagement.normalFileSubText', { size: appStore.getFileMaxSize })
"
multiple multiple
draggable draggable
size-unit="MB" size-unit="MB"

View File

@ -203,7 +203,9 @@
v-model:file-list="fileList" v-model:file-list="fileList"
accept="none" accept="none"
:auto-upload="false" :auto-upload="false"
:sub-text="acceptType === 'jar' ? '' : t('project.fileManagement.normalFileSubText', { size: 50 })" :sub-text="
acceptType === 'jar' ? '' : t('project.fileManagement.normalFileSubText', { size: appStore.getFileMaxSize })
"
multiple multiple
draggable draggable
size-unit="MB" size-unit="MB"

View File

@ -198,7 +198,9 @@
v-model:file-list="fileList" v-model:file-list="fileList"
:accept="acceptType" :accept="acceptType"
:auto-upload="false" :auto-upload="false"
:sub-text="acceptType === 'jar' ? '' : t('project.fileManagement.normalFileSubText', { size: 50 })" :sub-text="
acceptType === 'jar' ? '' : t('project.fileManagement.normalFileSubText', { size: appStore.getFileMaxSize })
"
multiple multiple
draggable draggable
size-unit="MB" size-unit="MB"