From ce3d50cd068e6789d0b5b3a3a001dad628bbb582 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Tue, 29 Mar 2022 10:23:57 +0800 Subject: [PATCH] fix issue --- templates/repo/editor/upload.tmpl | 2 +- web_src/js/index.js | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/templates/repo/editor/upload.tmpl b/templates/repo/editor/upload.tmpl index 7794c2a2d..08727600c 100644 --- a/templates/repo/editor/upload.tmpl +++ b/templates/repo/editor/upload.tmpl @@ -27,7 +27,7 @@
-
+
{{template "repo/editor/commit_form" .}} diff --git a/web_src/js/index.js b/web_src/js/index.js index f245045db..a832c0b4b 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -2769,6 +2769,7 @@ $(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; @@ -2789,8 +2790,20 @@ $(document).ready(async () => { } }); this.on('addedfile',(file)=>{ - console.log("addfile",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').css('display','block') + } + + }); + this.on('maxfilesexceeded',(file)=>{ + this.removeFile(file) + $('.maxfilesize.ui.red.message').text('一次最多只能上传 5 个文件, 上传已达到上限,请勿再添加文件。') + $('.maxfilesize.ui.red.message').css('display','block') }) + } }); }