|
|
@@ -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') |
|
|
|
}) |
|
|
|
|
|
|
|