Merge branch 'dev_hs' into dev_aliyun

master
SylorHuang 6 years ago
commit 972a8ef8d1

@ -207,19 +207,23 @@ class HomeworkCommonsController < ApplicationController
tip_exception(403, "无权限操作")
elsif @work_excel.blank? || @work_excel.size == 0
normal_status(-1,"暂无用户提交!")
elsif params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
respond_to do |format|
format.xlsx{
student_work_to_xlsx(@work_excel,@homework)
exercise_export_name = "#{current_user.real_name}_#{@course.name}_#{@homework.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
render xlsx: "#{exercise_export_name.strip}",template: "homework_commons/works_list.xlsx.axlsx",locals:
{table_columns: @work_head_cells,task_users: @work_cells_column}
{table_columns: @work_head_cells,task_users: @work_cells_column},cookies:{fileDownload:true,HttpOnly:false}
}
end
end
elsif params[:format] == "zip"
if @user_course_identity >= Course::STUDENT
tip_exception(403, "无权限操作")
elsif params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
if @work_excel.present?
zip_works = @work_excel&.where("work_status > 0")
@ -233,7 +237,7 @@ class HomeworkCommonsController < ApplicationController
format.zip{
zipfile = zip_homework_common @homework, zip_works
file = decode64(zipfile[0][:base64file])
send_file "#{OUTPUT_FOLDER}/#{file}", filename: filename_for_content_disposition(file), type: 'application/zip'
send_file "#{OUTPUT_FOLDER}/#{file}", filename: filename_for_content_disposition(file), type: 'application/zip',cookies:{fileDownload:true,HttpOnly:false}
}
end
else

@ -8,7 +8,12 @@ class ZipsController < ApplicationController
def shixun_report
service = BatchExportShixunReportService.new(@homework, @all_student_works)
filename_ = filename_for_content_disposition(service.filename)
send_file service.zip, filename: filename_, type: 'application/zip'
if params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
send_file service.zip, filename: filename_, type: 'application/zip',cookies:{fileDownload:true,HttpOnly:false}
end
rescue BatchExportShixunReportService::Error => ex
normal_status(-1, ex.message)
end

Loading…
Cancel
Save