').appendTo(tb).append(
`
${filename}
|
${filesize} |
QID:${filedata[i].ProtoQuestionID} | `
);
}
df.find('a#I,a#V').mouseenter(function(){
FilePreview(1,$(this).attr('href'));
}).mouseleave(()=>{
FilePreview(0);
});
}
}else{
df.append('登录失效!');
}
}else{
df.append('网络错误!');
}
DownloadButton0(df,surveyid);
},'json');
}
//预览附件图片
function FilePreview(show,src){
if(show){
const imgid=src.split('=')[2];
if($('img#'+imgid+'.filepreview').length===0){
$('').appendTo('body');
$('img#'+imgid+'.filepreview').attr('src',src+'&getThumbnail=1').css('height','200px')//视频附件预览图u&getThumbnail=1
.parent().css({position:'fixed',zIndex:1e4,height:'200px',background:'url(/images/icons/filtersv2/loading06.gif)'});
}
$('img#'+imgid+'.filepreview').parent().css({top:event.clientY-200,left:event.clientX+100});
$('img#'+imgid+'.filepreview').show();
}else{
$('img.filepreview').hide();
}
}
//按钮变为关闭
function DownloadButton0(df,surveyid){
df.find('b#loading').remove();
df.find('button#download').text('×').attr('title','关闭附件列表').show().one('click',()=>{
DownloadButton1(df,surveyid);
});
}
//按钮重置为初始
function DownloadButton1(df,surveyid){
const passid=[];
df.find('a#I,a#V').each(function(){
passid.push($(this).attr('href').split('=')[2]);
});
for(let id of passid) $('img#'+id).parent().remove();
df.find('ol,b').remove();
df.find('button#download').text('↓').attr('title','加载附件列表').one('click',()=>{
DownloadButton(df,surveyid);
});
}
//下载全部
function DownloadAll(df){
df.find('button#downloadAll').text('〇').hide();
const iframe=df.find('ol#filelist iframe');
const a=df.find('ol#filelist a');
if(iframe.length) iframe.remove();
setTimeout(()=>{
df.find('button#downloadAll').show();
},1e3*a.length);//有几个附件就隐藏按钮几秒
a.each(function(){
$('