作业全部附件打包下周无法下载
This commit is contained in:
parent
ff4dae56d1
commit
b182feb988
|
@ -42,7 +42,7 @@
|
|||
<%= link_to "附件", "javascript:void(0)", class: "down_btn fr", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
|
||||
<% else%>
|
||||
<%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
|
||||
remote: true, class: "down_btn fr" %>
|
||||
remote: true, class: "down_btn fr", :id => "download_homework_attachments" %>
|
||||
<% end%>
|
||||
|
||||
<a class="down_btn fr" href="javascript:void(0);">列表</a>
|
||||
|
|
|
@ -897,8 +897,31 @@ $(function(){
|
|||
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#download_homework_attachments').bind('ajax:complete', function (event, data, status, xhr) {
|
||||
if(status == 'success'){
|
||||
var res = JSON.parse(data.responseText);
|
||||
if(res.length<1){
|
||||
return;
|
||||
}
|
||||
if(res.length==1){
|
||||
location.href = '/zipdown/download?file='+res[0].file;return;
|
||||
}
|
||||
document.getElementById('light').style.display='block';
|
||||
$container = $('#light .upload_box_ul');
|
||||
$container.empty();
|
||||
for(var i = 0; i <res.length; ++i){
|
||||
var des = '';
|
||||
if(res.count > 1){
|
||||
des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载';
|
||||
} else {
|
||||
des = '第'+res[i].index+'个学生的作品下载';
|
||||
}
|
||||
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="/zipdown/download?file='+res[i].file+'">'+des+'</a><span class="c_grey"> (共'+res[i].size+'M)</span> </li>').appendTo($container);
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue