Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

master
杨树明 5 years ago
commit ae79081ae0

@ -1027,7 +1027,10 @@ class CoursesController < ApplicationController
tip_exception(403,"无权限操作")
elsif @all_members.size == 0
normal_status(-1,"课堂暂时没有学生")
elsif params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
set_export_cookies
member_to_xlsx(@course, @all_members, @c_homeworks, @c_exercises, @c_tasks)
filename_ = "#{current_user.real_name}_#{@course.name}_全部成绩_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
render xlsx: "#{format_sheet_name filename_.strip}",template: "courses/export_member_scores_excel.xlsx.axlsx",

@ -1261,6 +1261,7 @@ class ExercisesController < ApplicationController
else
respond_to do |format|
format.xlsx{
set_export_cookies
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')}"
@ -1286,6 +1287,7 @@ class ExercisesController < ApplicationController
if params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
set_export_cookies
render pdf: 'exercise_export/blank_exercise', filename: filename_, stylesheets: stylesheets
end
end

@ -116,10 +116,11 @@ class GamesController < ApplicationController
@qrcode_str = Base64.encode64( qr.to_img.resize(400,400).to_s )
else
@type = "image"
#conv = Iconv.new("GBK", "utf-8")
@game_challenge = @game.challenge
type = @game_challenge.show_type
@type = shixun_show_type type
workspace_path = @game.try(:picture_path)
@answer_path = "#{Rails.root}/#{workspace_path}/#{@game_challenge.expect_picture_path}"
@user_path = "#{Rails.root}/#{workspace_path}/#{@game_challenge.picture_path}"

@ -132,6 +132,8 @@ class GraduationTasksController < ApplicationController
tip_exception(403, "无权限操作")
elsif complete_works == 0
normal_status(-1,"暂无用户提交")
elsif params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
respond_to do |format|
format.xlsx{
@ -148,13 +150,18 @@ class GraduationTasksController < ApplicationController
zip_works = @work_excel.where("work_status > 0")
status = checkfileSize(zip_works)
if status == 0
if params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
respond_to do |format|
format.zip{
set_export_cookies
zipfile = zip_homework_common @task, zip_works
file = decode64(zipfile[0][:base64file])
send_file "#{OUTPUT_FOLDER}/#{file}", filename: filename_for_content_disposition(file), type: 'application/zip'
}
end
end
else
normal_status(status,status == -2 ? "500M" : "无附件可下载")
end

@ -271,7 +271,12 @@ class GraduationTopicsController < ApplicationController
students = course.students.joins(user: :user_extension).order("user_extensions.student_id")
graduation_topic_to_xlsx(students,course)
topic_export_name_ = "#{current_user.real_name}_#{course.name}_毕设选题_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
if params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
set_export_cookies
render xlsx: "#{topic_export_name_.strip}",template: "graduation_topics/export.xlsx.axlsx",locals: {table_columns:@topic_head_cells,topic_users:@topic_body_cells}
end
rescue Exception => e
uid_logger(e.message)
missing_template

@ -24,7 +24,7 @@ class MyshixunsController < ApplicationController
ActiveRecord::Base.transaction do
begin
@shixun = Shixun.select(:id, :identifier).find(@myshixun.shixun_id)
@myshixun.destroy
@myshixun.destroy!
StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => 0, :work_status => 0)

@ -945,9 +945,12 @@ class PollsController < ApplicationController
tip_exception(403,"无权限操作")
elsif (@poll.polls_status == 1) || (@poll_export_questions.size == 0) || (@poll_commit_ids.size == 0)
normal_status(-1,"暂无用户提交")
elsif params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
respond_to do |format|
format.xlsx{
set_export_cookies
polls_export_name_ = "#{current_user.real_name}_#{@course.name}_#{@poll.polls_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
polls_user_commit = poll_commit_result(@poll,@poll_export_questions,@poll_users,@poll_commit_ids)
render xlsx: "#{polls_export_name_.strip}",template: "polls/commit_result.xlsx.axlsx",locals: {polls_user_commit:polls_user_commit}

@ -27,6 +27,7 @@ class ZipsController < ApplicationController
if params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
set_export_cookies
send_file exercises.ex_zip, filename: file_name_, type: 'application/zip'
end
rescue Exception => e

@ -6,7 +6,7 @@ module GamesHelper
end
# 获取目录下所有文件,返回一个文件名的数组 type是查看文件的类型image表示图片
# type [[1, "图片"], [2, "apk/exe"], [3, "txt"], [4, "html"]]
# type [[1, "图片"], [2, "apk/exe"], [3, "txt"], [4, "html"], [5, "mp3"], [6, "mp4"]]
def get_dir_filename(path, type, game_id)
answer_picture = []
return answer_picture unless File.directory?(path)
@ -39,6 +39,12 @@ module GamesHelper
end
f.close
@type = 'txt'
elsif extension == 'mp3' && type == 5
answer_picture << file
@type = 'mp3'
elsif extension == 'mp4' && type == 6
answer_picture << file
@type = 'mp4'
end
end
@ -51,4 +57,21 @@ module GamesHelper
"编译失败,请在测试结果中查看具体的错误信息" : test_set.try(:actual_output)
end
end
def shixun_show_type type
case type.to_i
when 1
"image"
when 2
"apk/exe"
when 3
"txt"
when 4
"html"
when 5
"mp3"
when 6
"mp4"
end
end
end

@ -1,5 +1,6 @@
class Challenge < ApplicationRecord
# difficulty: 关卡难度: 1.简单 2.中等 3.困难
# show_type: 效果展示:-1.无效果 1.图片 2.apk/exe 3.txt 4.html 5.mp3 6.mp4
default_scope { order("challenges.position asc") }
belongs_to :shixun, :touch => true, counter_cache: true

@ -24,5 +24,30 @@ elsif @type == "txt"
json.contents @contents.html_safe
elsif @type =="qrcode"
json.qrcode_str @qrcode_str
elsif @type == "mp3" || @type == "mp4"
if @type == "mp4"
json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378171/123.mp4"}]
json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378172/456.mp4"}]
json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378173/789.mp4"}]
else
json.orignal_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378174/58099.mp3"}]
json.user_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}]
json.answer_file [{"file_url": "http://120.27.231.56:48080/attachments/download/378175/654058514.mp3"}]
end
# json.orignal_file do
# json.array! @orignal_picture do |file|
# json.file_url attachment_show_users_path(:file_name => file, :path => @original_path)
# end
# end
# json.user_file do
# json.array! @user_picture do |file|
# json.file_url attachment_show_users_path(:file_name => file, :path => @user_path, :time => Time.now.to_i)
# end
# end
# json.answer_file do
# json.array! @answer_picture do |file|
# json.file_url attachment_show_users_path(:file_name => file, :path => @answer_path)
# end
# end
end

@ -44,7 +44,7 @@ class TabRightComponents extends Component{
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true' ).then((response) => {
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){

@ -170,7 +170,7 @@ class Testpapersettinghomepage extends Component{
}
console.log("170");
console.log(params);
axios.get(url+`?${queryString.stringify(params)}`).then((response) => {
axios.get(url+`?${queryString.stringify(params)}`+ '&export=true' ).then((response) => {
if(response===undefined){
return
}

@ -901,7 +901,7 @@ class GraduationTaskssettingapp extends Component{
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true' ).then((response) => {
if(response === undefined){
return
}

@ -645,7 +645,7 @@ class GraduationTaskssettinglist extends Component{
b_order:b_order,
search:search,
}
axios.get(url,{
axios.get(url + '?export=true',{
params
}).then((response) => {
if(response === undefined){

@ -199,7 +199,7 @@ class GraduationTasksquestions extends Component{
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true').then((response) => {
if(response === undefined){
return
}

@ -322,7 +322,7 @@ onBoardsNew=()=>{
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true').then((response) => {
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){

@ -127,7 +127,7 @@ class studentsList extends Component{
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '&export=true').then((response) => {
if(response === undefined){
return
}

@ -75,7 +75,7 @@ class PollDetailIndex extends Component{
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true' ).then((response) => {
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){

@ -2214,7 +2214,7 @@ class Listofworksstudentone extends Component {
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '&export=true').then((response) => {
if(response === undefined){
return
}

@ -539,7 +539,7 @@ class ShixunStudentWork extends Component {
}
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true').then((response) => {
if(response === undefined){
return
}

@ -1769,16 +1769,16 @@ class Trainingjobsetting extends Component {
daochushixunbaogao=()=>{
let url =`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`;
this.confirmysl(url);
this.confirmysl(url, url + '&export=true');
}
daochuzuoye =() =>{
let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`;
this.confirmysl(url);
this.confirmysl(url, url + '?export=true');
}
confirmysl(url){
axios.get(url).then((response) => {
confirmysl(url, urlWithExport){
axios.get(urlWithExport).then((response) => {
if(response === undefined){
return
}

@ -339,16 +339,16 @@ class Workquestionandanswer extends Component {
daochushixunbaogao=()=>{
let url =`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`;
this.confirmysl(url);
this.confirmysl(url, url + '&export=true');
}
daochuzuoye =() =>{
let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`;
this.confirmysl(url);
this.confirmysl(url, url + '?export=true');
}
confirmysl(url){
axios.get(url).then((response) => {
confirmysl(url, urlWithExport){
axios.get(urlWithExport).then((response) => {
if(response === undefined){
return
}

Loading…
Cancel
Save