bug修复:分包合同管理页面附件上传缩略图显示失败

This commit is contained in:
gaowdong 2024-12-30 10:26:01 +08:00
parent 27541ae206
commit 568e132b71
1 changed files with 5 additions and 1 deletions

View File

@ -78,7 +78,11 @@ layui.use(['form', 'table', 'upload'], function () {
console.log(index); //得到文件索引
console.log(file.name); //得到文件对象
$("#preview1").css("display", "");
$('#demo1').append('<img src="' + result + '" id="' + index + '" alt="' + file.name + '" style="height: 80px;width: 80px;margin-right: 10px" class="layui-upload-img ">');
if(file.name.endsWith(".xls") || file.name.endsWith(".docx") || file.name.endsWith(".xlsx") || file.name.endsWith(".pdf")) {
$('#demo1').append('<span id="' + index + '" alt="' + file.name + '" style="height: 80px;width: 80px;margin-right: 10px" class="layui-upload-img ">' + file.name+ '</span>');
}else {
$('#demo1').append('<img src="' + result + '" id="' + index + '" alt="' + file.name + '" style="height: 80px;width: 80px;margin-right: 10px" class="layui-upload-img ">');
}
$('#' + index).bind('dblclick', function () {//双击删除指定预上传图片
delete files[index];//删除指定图片
$(this).remove();