|
|
|
@ -1256,13 +1256,15 @@ class ExercisesController < ApplicationController
|
|
|
|
|
normal_status(-1,"试卷未发布")
|
|
|
|
|
elsif (@exercise_users_size == 0) || ( @export_ex_users&.exercise_user_committed.size == 0)
|
|
|
|
|
normal_status(-1,"暂无用户提交")
|
|
|
|
|
elsif params[:export].present? && params[:export]
|
|
|
|
|
normal_status(0,"正在下载中")
|
|
|
|
|
else
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.xlsx{
|
|
|
|
|
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}
|
|
|
|
|
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}
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -1281,7 +1283,11 @@ class ExercisesController < ApplicationController
|
|
|
|
|
@exercise_questions = @exercise.exercise_questions.includes(:exercise_choices).order("question_number ASC")
|
|
|
|
|
filename_ = "#{@exercise.user.real_name}_#{@course.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}.pdf"
|
|
|
|
|
stylesheets = "#{Rails.root}/app/templates/exercise_export/exercise_export.css"
|
|
|
|
|
render pdf: 'exercise_export/blank_exercise', filename: filename_, stylesheets: stylesheets
|
|
|
|
|
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}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#空白试卷预览页面,仅供测试使用,无其他任何用途
|
|
|
|
|