diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index f9bebbb86..781d5634f 100755
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -2836,6 +2836,8 @@ uploading = Uploading
upload_complete = Uploading complete
failed = Upload Failed
enable_minio_support = Enable minio support to use the dataset service
+max_file_tooltips= Upload a maximum of ? files at a time, each file does not exceed ? MB.
+max_size-tooltips= You can only upload a maximum of ? files at a time. The upload limit has been reached, please do not add more files.
[notification]
notifications = Notifications
diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini
index 8679554c6..5a047ce9e 100755
--- a/options/locale/locale_zh-CN.ini
+++ b/options/locale/locale_zh-CN.ini
@@ -2842,6 +2842,8 @@ uploading=正在上传
upload_complete=上传完成
failed=上传失败
enable_minio_support=启用minio支持以使用数据集服务
+max_file_tooltips=单次最多上传?个文件,每个文件不超过? MB。
+max_size-tooltips=一次最多只能上传?个文件, 上传已达到上限,请勿再添加文件。
[notification]
notifications=通知
diff --git a/templates/repo/editor/upload.tmpl b/templates/repo/editor/upload.tmpl
index 08727600c..7eae567c2 100644
--- a/templates/repo/editor/upload.tmpl
+++ b/templates/repo/editor/upload.tmpl
@@ -27,10 +27,10 @@
{{template "repo/editor/commit_form" .}}
-{{template "base/footer" .}}
+{{template "base/footer" .}}
\ No newline at end of file
diff --git a/web_src/js/index.js b/web_src/js/index.js
index a04b76936..3127e2110 100755
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -2751,9 +2751,23 @@ $(document).ready(async () => {
$('td[data-href]').click(function () {
window.location = $(this).data('href');
});
+ // 在String原型对象上添加format方法
+ String.prototype.format = function(){
+ let str = this;
+ if(arguments.length == 0){
+ return str;
+ }else{
+ Object.keys(arguments).forEach((item,index)=>{
+ str = str.replace(/\?/,arguments[item])
+ })
+ return str
+ }
+ }
// Dropzone
const $dropzone = $('#dropzone');
+ let maxFileTooltips=$dropzone.data('max-file-tooltips').format($dropzone.data('max-file'),$dropzone.data('max-size'))
+ let maxSizeTooltips=$dropzone.data('max-size-tooltips').format($dropzone.data('max-file'))
if ($dropzone.length > 0) {
const filenameDict = {};
@@ -2769,7 +2783,6 @@ $(document).ready(async () => {
dictInvalidFileType: $dropzone.data('invalid-input-type'),
dictFileTooBig: $dropzone.data('file-too-big'),
dictRemoveFile: $dropzone.data('remove-file'),
- dictMaxFilesExceeded:'上次超过限制',
init() {
this.on('success', (file, data) => {
filenameDict[file.name] = data.uuid;
@@ -2790,17 +2803,18 @@ $(document).ready(async () => {
}
});
this.on('addedfile',(file)=>{
- console.log("addfile",file,filenameDict,this.files.length)
if(file.size/(1000*1000)>3){
this.removeFile(file)
- $('.maxfilesize.ui.red.message').text('单次最多上传XX个文件,每个文件不超过XXM。')
+ $('.maxfilesize.ui.red.message').text(maxFileTooltips)
$('.maxfilesize.ui.red.message').css('display','block')
+ }else{
+ $('.maxfilesize.ui.red.message').css('display','none')
}
});
this.on('maxfilesexceeded',(file)=>{
this.removeFile(file)
- $('.maxfilesize.ui.red.message').text('一次最多只能上传 5 个文件, 上传已达到上限,请勿再添加文件。')
+ $('.maxfilesize.ui.red.message').text(maxSizeTooltips)
$('.maxfilesize.ui.red.message').css('display','block')
})