mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-09-19 01:58:00 +08:00
fix:1、修复附件无法同时上传多个的BUG
2、新增客户端校验附件大小
This commit is contained in:
@@ -427,10 +427,10 @@
|
||||
formData : { "identify" : {{.Model.Identify}},"doc_id" : window.selectNode.id },
|
||||
pick: "#filePicker",
|
||||
fileVal : "editormd-file-file",
|
||||
fileNumLimit : 1,
|
||||
compress : false
|
||||
compress : false,
|
||||
fileSingleSizeLimit: {{.UploadFileSize}}
|
||||
}).on("beforeFileQueued",function (file) {
|
||||
uploader.reset();
|
||||
// uploader.reset();
|
||||
this.options.formData.doc_id = window.selectNode.id;
|
||||
}).on( 'fileQueued', function( file ) {
|
||||
var item = {
|
||||
@@ -440,14 +440,14 @@
|
||||
file_name : file.name,
|
||||
message : "正在上传"
|
||||
};
|
||||
window.vueApp.lists.splice(0,0,item);
|
||||
window.vueApp.lists.push(item);
|
||||
|
||||
}).on("uploadError",function (file,reason) {
|
||||
for(var i in window.vueApp.lists){
|
||||
var item = window.vueApp.lists[i];
|
||||
if(item.attachment_id == file.id){
|
||||
item.state = "error";
|
||||
item.message = "上传失败";
|
||||
item.message = "上传失败:" + reason;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -458,25 +458,23 @@
|
||||
var item = window.vueApp.lists[index];
|
||||
if(item.attachment_id === file.id){
|
||||
if(res.errcode === 0) {
|
||||
window.vueApp.lists.splice(index, 1, res.attach);
|
||||
|
||||
window.vueApp.lists.splice(index, 1, res.attach ? res.attach : res.data);
|
||||
}else{
|
||||
item.message = res.message;
|
||||
item.state = "error";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}).on("beforeFileQueued",function (file) {
|
||||
|
||||
}).on("uploadComplete",function () {
|
||||
|
||||
}).on("uploadProgress",function (file, percentage) {
|
||||
var $li = $( '#'+file.id ),
|
||||
$percent = $li.find('.progress .progress-bar');
|
||||
|
||||
$percent.css( 'width', percentage * 100 + '%' );
|
||||
}).on("error", function (type) {
|
||||
if(type === "F_EXCEED_SIZE"){
|
||||
layer.msg("文件超过了限定大小");
|
||||
}
|
||||
console.log(type);
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e);
|
||||
|
Reference in New Issue
Block a user