当作品中没有附件时,下载报错

redis_cache
sw 10 years ago
parent a881343db5
commit f7b3229065

@ -30,8 +30,7 @@ class ZipdownController < ApplicationController
if file_count > 0
zipfile = zip_bid bid
else
render file: 'public/no_file_found.html'
return
zipfile = {:message => "no file"}
end
elsif params[:obj_class] == "HomeworkCommon"
homework = HomeworkCommon.find params[:obj_id]
@ -41,8 +40,7 @@ class ZipdownController < ApplicationController
if file_count > 0
zipfile = zip_homework_common homework
else
render file: 'public/no_file_found.html'
return
zipfile = {:message => "no file"}
end
else
logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!"

@ -901,9 +901,14 @@ $(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){
if(res.length == null){
alert("该作业没有任何附件可下载");
}
else if(res.length<1){
return;
}
else
{
if(res.length==1){
location.href = '/zipdown/download?file='+res[0].file;return;
}
@ -921,6 +926,7 @@ $(function(){
}
}
}
});
});

Loading…
Cancel
Save