Compare commits

..

2 Commits

Author SHA1 Message Date
duxp 874c814188 Merge remote-tracking branch 'origin/master' 2023-10-08 17:07:36 +08:00
duxp 8e8a494798 增加预览图片的功能 2023-10-08 17:07:14 +08:00
1 changed files with 15 additions and 1 deletions

View File

@ -147,6 +147,20 @@
}) })
}); });
//图片预览
$(".pre_view_list").on("click",'.pre_img',function () {
let _url = $(this).attr('data-img');
layer.open({
title:'预览图片',
area:['80%','80%'],
type:1,
content:'<div style="width: 100%;height: 100%"><img style="width: 100%;height: 100%" src="'+window.location.origin+_url+'" /></div>',
success(res){
},
})
});
//文件下载 //文件下载
$(".pre_view_list").on("click",'.down_load_file',function () { $(".pre_view_list").on("click",'.down_load_file',function () {
let _url = $(this).attr('data-url'); let _url = $(this).attr('data-url');
@ -215,7 +229,7 @@
let _nameFile = item.name.substr(item.name.lastIndexOf('/')+1,item.name.length-1); let _nameFile = item.name.substr(item.name.lastIndexOf('/')+1,item.name.length-1);
if(item.name.indexOf('png') > -1 || item.name.indexOf('jpg')>-1){ if(item.name.indexOf('png') > -1 || item.name.indexOf('jpg')>-1){
_file_list_str += '<div class="pre_view_item">' + _file_list_str += '<div class="pre_view_item">' +
'<div class="item_left"><img src="'+window.location.origin+item.name+'" /><span>('+(index+1)+') '+_nameFile+'</span></div>' + '<div class="item_left pre_img" data-img="'+item.name+'" style="cursor: pointer"><img src="'+window.location.origin+item.name+'" /><span>('+(index+1)+') '+_nameFile+'</span></div>' +
'<div class="item_right"><span data-url="'+item.name+'" class="btn btn-primary btn-xs down_load_file">下载</span><span data-index="'+item.index+'" class="btn btn-danger btn-xs del_file">删除</span></div></div>'; '<div class="item_right"><span data-url="'+item.name+'" class="btn btn-primary btn-xs down_load_file">下载</span><span data-index="'+item.index+'" class="btn btn-danger btn-xs del_file">删除</span></div></div>';
}else if(item.name.indexOf('pdf') > -1){ }else if(item.name.indexOf('pdf') > -1){
_file_list_str += '<div class="pre_view_item">' + _file_list_str += '<div class="pre_view_item">' +