作业的excel导出测试

master
SylorHuang 6 years ago
parent 7f8e1acd9d
commit 49d4f3f9d7

@ -1264,7 +1264,7 @@ class ExercisesController < ApplicationController
get_export_users(@exercise,@course,@export_ex_users)
exercise_export_name_ =
"#{current_user.real_name}_#{@course.name}_#{@exercise.exercise_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
render xlsx: "#{exercise_export_name_.strip}",template: "exercises/exercise_lists.xlsx.axlsx",locals: {table_columns:@table_columns,exercise_users:@user_columns},cookies:{fileDownload:true,HttpOnly:false}
render xlsx: "#{exercise_export_name_.strip}",template: "exercises/exercise_lists.xlsx.axlsx",locals: {table_columns:@table_columns,exercise_users:@user_columns}
}
end
end
@ -1286,7 +1286,7 @@ class ExercisesController < ApplicationController
if params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
render pdf: 'exercise_export/blank_exercise', filename: filename_, stylesheets: stylesheets,cookies:{fileDownload:true,HttpOnly:false}
render pdf: 'exercise_export/blank_exercise', filename: filename_, stylesheets: stylesheets
end
end

@ -212,7 +212,8 @@ class HomeworkCommonsController < ApplicationController
else
respond_to do |format|
format.xlsx{
cookies.signed[:fileDownload] = { value: true, httponly: false }
cookies[:fileDownload] = true
cookies[:httponly] = false
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:

@ -11,7 +11,7 @@ class ZipsController < ApplicationController
if params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
send_file service.zip, filename: filename_, type: 'application/zip',cookies:{fileDownload:true,HttpOnly:false}
send_file service.zip, filename: filename_, type: 'application/zip'
end
rescue BatchExportShixunReportService::Error => ex
@ -26,7 +26,7 @@ class ZipsController < ApplicationController
if params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
send_file exercises.ex_zip, filename: file_name_, type: 'application/zip', cookies:{fileDownload:true,HttpOnly:false}
send_file exercises.ex_zip, filename: file_name_, type: 'application/zip'
end
rescue Exception => e
normal_status(-1, e.message)

Loading…
Cancel
Save