solve merge confict

dev_jupyter
daiao 5 years ago
commit 984281bc0f

@ -23,7 +23,9 @@ class ApplicationController < ActionController::Base
# 所有请求必须合法签名 # 所有请求必须合法签名
def check_sign def check_sign
if !Rails.env.development? Rails.logger.info("#####################request: #{request.headers}")
#Rails.logger.info("#####################type: #{request.type}")
if !Rails.env.development? && EduSetting.get("host_name") != "https://test-newweb.educoder.net"
Rails.logger.info("66666 #{params}") Rails.logger.info("66666 #{params}")
# suffix = request.url.split(".").last.split("?").first # suffix = request.url.split(".").last.split("?").first
# suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释 # suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释

@ -21,7 +21,7 @@ class CourseSecondCategoriesController < ApplicationController
else else
@course_module.course_second_categories.where("position > #{@category.position} and position <= ?", params[:position]).update_all("position = position - 1") @course_module.course_second_categories.where("position > #{@category.position} and position <= ?", params[:position]).update_all("position = position - 1")
end end
@category.update_attributes(position: params[:position]) @category.update!(position: params[:position])
normal_status(0, "移动成功") normal_status(0, "移动成功")
else else
normal_status(-1, "位置没有变化") normal_status(-1, "位置没有变化")

@ -292,8 +292,8 @@ class CoursesController < ApplicationController
if next_inform.blank? if next_inform.blank?
render_error('已经到达最顶部') render_error('已经到达最顶部')
else else
inform.update_attribute(:position, (inform.position + 1)) inform.update!(position: (inform.position + 1))
next_inform.update_attribute(:position, inform.position - 1) next_inform.update!(position: inform.position - 1)
render_ok render_ok
end end
end end
@ -306,8 +306,8 @@ class CoursesController < ApplicationController
if last_inform.blank? if last_inform.blank?
render_error('已经到达最底部') render_error('已经到达最底部')
else else
inform.update_attribute(:position, (inform.position - 1)) inform.update!(position: (inform.position - 1))
last_inform.update_attribute(:position, inform.position + 1) last_inform.update!(position: inform.position + 1)
render_ok render_ok
end end
end end
@ -353,7 +353,7 @@ class CoursesController < ApplicationController
# 邀请码停用/启用 # 邀请码停用/启用
def set_invite_code_halt def set_invite_code_halt
begin begin
@course.update_attribute('invite_code_halt', @course.invite_code_halt == 0 ? 1 : 0) @course.update!(invite_code_halt: @course.invite_code_halt == 0 ? 1 : 0)
normal_status(0, "成功") normal_status(0, "成功")
rescue => e rescue => e
uid_logger_error(e.message) uid_logger_error(e.message)
@ -364,7 +364,7 @@ class CoursesController < ApplicationController
# 设置课堂私有/公有 # 设置课堂私有/公有
def set_public_or_private def set_public_or_private
begin begin
@course.update_attribute('is_public', @course.is_public == 1 ? 0 : 1) @course.update!(is_public: @course.is_public == 1 ? 0 : 1)
normal_status(0, "成功") normal_status(0, "成功")
rescue => e rescue => e
uid_logger_error(e.message) uid_logger_error(e.message)
@ -394,6 +394,7 @@ class CoursesController < ApplicationController
# 教师列表以及教师搜索 # 教师列表以及教师搜索
def teachers def teachers
tip_exception(403, "无权限访问") if @course.excellent && @user_course_identity > Course::ASSISTANT_PROFESSOR
@search_str = params[:search].present? ? params[:search].strip : "" @search_str = params[:search].present? ? params[:search].strip : ""
if @course.try(:id) != 1309 || current_user.admin_or_business? || current_user.try(:id) == 15582 if @course.try(:id) != 1309 || current_user.admin_or_business? || current_user.try(:id) == 15582
@ -551,7 +552,7 @@ class CoursesController < ApplicationController
graduation_group_id = GraduationGroup.find(params[:graduation_group_id].to_i).id graduation_group_id = GraduationGroup.find(params[:graduation_group_id].to_i).id
@course_member_list.each do |course_member| @course_member_list.each do |course_member|
course_member = CourseMember.find(course_member[:course_member_id].to_i) course_member = CourseMember.find(course_member[:course_member_id].to_i)
course_member.update_attributes(graduation_group_id: graduation_group_id) course_member.update!(graduation_group_id: graduation_group_id)
end end
normal_status(0, "成功") normal_status(0, "成功")
rescue => e rescue => e
@ -711,7 +712,7 @@ class CoursesController < ApplicationController
CourseDeleteStudentNotifyJob.perform_later(@course.id, [course_member.user_id], current_user.id) CourseDeleteStudentNotifyJob.perform_later(@course.id, [course_member.user_id], current_user.id)
course_member.destroy! course_member.destroy!
course_student.update_attributes(is_active: 1) if course_student.present? && !course_student.is_active course_student.update!(is_active: 1) if course_student.present? && !course_student.is_active
normal_status(0, "删除成功") normal_status(0, "删除成功")
rescue => e rescue => e
uid_logger_error(e.message) uid_logger_error(e.message)
@ -726,8 +727,8 @@ class CoursesController < ApplicationController
tip_exception("切换失败") unless course_member.STUDENT? tip_exception("切换失败") unless course_member.STUDENT?
course_teacher = CourseMember.find_by!(user_id: current_user.id, role: %i[CREATOR PROFESSOR], course_id: @course.id) course_teacher = CourseMember.find_by!(user_id: current_user.id, role: %i[CREATOR PROFESSOR], course_id: @course.id)
course_member.update_attributes(is_active: 0) course_member.update!(is_active: 0)
course_teacher.update_attributes(is_active: 1) course_teacher.update!(is_active: 1)
normal_status(0, "切换成功") normal_status(0, "切换成功")
rescue => e rescue => e
uid_logger_error(e.message) uid_logger_error(e.message)
@ -742,8 +743,8 @@ class CoursesController < ApplicationController
tip_exception("切换失败") unless course_member.STUDENT? tip_exception("切换失败") unless course_member.STUDENT?
course_teacher = CourseMember.find_by!(user_id: current_user.id, role: %i[ASSISTANT_PROFESSOR], course_id: @course.id) course_teacher = CourseMember.find_by!(user_id: current_user.id, role: %i[ASSISTANT_PROFESSOR], course_id: @course.id)
course_member.update_attributes(is_active: 0) course_member.update!(is_active: 0)
course_teacher.update_attributes(is_active: 1) course_teacher.update!(is_active: 1)
normal_status(0, "切换成功") normal_status(0, "切换成功")
rescue => e rescue => e
uid_logger_error(e.message) uid_logger_error(e.message)
@ -782,7 +783,7 @@ class CoursesController < ApplicationController
# 课堂如果还有其他身份的用户则更新is_active # 课堂如果还有其他身份的用户则更新is_active
course_teacher = CourseMember.find_by(user_id: current_user.id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR], course_id: @course.id) course_teacher = CourseMember.find_by(user_id: current_user.id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR], course_id: @course.id)
course_student.destroy! course_student.destroy!
course_teacher.update_attributes(is_active: 1) if course_teacher.present? && !course_teacher.is_active course_teacher.update!(is_active: 1) if course_teacher.present? && !course_teacher.is_active
CourseDeleteStudentDeleteWorksJob.perform_later(@course.id, [current_user.id]) CourseDeleteStudentDeleteWorksJob.perform_later(@course.id, [current_user.id])
normal_status(0, "退出成功") normal_status(0, "退出成功")
end end
@ -850,6 +851,8 @@ class CoursesController < ApplicationController
# 学生列表(包括各个子分班的学生列表)及搜索 # 学生列表(包括各个子分班的学生列表)及搜索
def students def students
tip_exception(403, "无权限访问") if @course.excellent && @user_course_identity > Course::ASSISTANT_PROFESSOR
search = params[:search].present? ? params[:search].strip : nil search = params[:search].present? ? params[:search].strip : nil
order = params[:order].present? ? params[:order].to_i : 1 order = params[:order].present? ? params[:order].to_i : 1
sort = params[:sort].present? ? params[:sort] : "asc" sort = params[:sort].present? ? params[:sort] : "asc"
@ -959,7 +962,7 @@ class CoursesController < ApplicationController
member_teacher = CourseMember.find_by(user_id: course_member.user_id, course_id: @course.id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR]) member_teacher = CourseMember.find_by(user_id: course_member.user_id, course_id: @course.id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR])
student_ids << course_member.user_id student_ids << course_member.user_id
course_member.destroy! course_member.destroy!
member_teacher.update_attributes(is_active: 1) if member_teacher.present? member_teacher.update!(is_active: 1) if member_teacher.present?
end end
end end
CourseDeleteStudentDeleteWorksJob.perform_later(@course.id, student_ids) if student_ids.present? CourseDeleteStudentDeleteWorksJob.perform_later(@course.id, student_ids) if student_ids.present?
@ -990,7 +993,7 @@ class CoursesController < ApplicationController
if existing_course_member.present? if existing_course_member.present?
if existing_course_member.STUDENT? if existing_course_member.STUDENT?
existing_course_member.update_attributes(course_group_id: course_group_id) existing_course_member.update!(course_group_id: course_group_id)
else else
new_student.is_active = 0 if existing_course_member.is_active new_student.is_active = 0 if existing_course_member.is_active
new_student.save! new_student.save!
@ -1142,7 +1145,7 @@ class CoursesController < ApplicationController
existing_student = CourseMember.find_by(course_id: course.id, role: %i[STUDENT], user_id: current_user.id) existing_student = CourseMember.find_by(course_id: course.id, role: %i[STUDENT], user_id: current_user.id)
if existing_student.present? if existing_student.present?
# 如果在该课堂已经存在学生身份,且邀请码为分班邀请码,则将其直接加入分班 # 如果在该课堂已经存在学生身份,且邀请码为分班邀请码,则将其直接加入分班
existing_student.update_attributes(course_group_id: course_group.id) if course_group.present? existing_student.update!(course_group_id: course_group.id) if course_group.present?
else else
correspond_teacher_exist = current_user.none_admin_teacher_of_course? course correspond_teacher_exist = current_user.none_admin_teacher_of_course? course
new_student = CourseMember.new(user_id: current_user.id, course_id: course.id, role: 4) new_student = CourseMember.new(user_id: current_user.id, course_id: course.id, role: 4)

@ -4,83 +4,77 @@ class ExerciseAnswersController < ApplicationController
include ExercisesHelper include ExercisesHelper
def create #每一次答案的点击,请求一次,实训题不在这里回答 def create #每一次答案的点击,请求一次,实训题不在这里回答
begin q_type = @exercise_question.question_type #试卷的类型
q_type = @exercise_question.question_type #试卷的类型 choice_id = params[:exercise_choice_id].present? ? params[:exercise_choice_id] : ""
choice_id = params[:exercise_choice_id].present? ? params[:exercise_choice_id] : "" answer_text = params[:answer_text].present? ? params[:answer_text].strip : "" #为字符串
answer_text = params[:answer_text].present? ? params[:answer_text].strip : "" #为字符串 if q_type < Exercise::SUBJECTIVE && (q_type != Exercise::MULTIPLE) && choice_id.blank?
if q_type < Exercise::SUBJECTIVE && (q_type != Exercise::MULTIPLE) && choice_id.blank? normal_status(-1,"请选择序号")
normal_status(-1,"请选择序号") else
else ea = @exercise_question.exercise_answers.search_answer_users("user_id",current_user.id) #试卷的当前用户的答案
ea = @exercise_question.exercise_answers.search_answer_users("user_id",current_user.id) #试卷的当前用户的答案 if q_type == Exercise::SINGLE || q_type == Exercise::JUDGMENT #选择题(单选)/判断题
if q_type == Exercise::SINGLE || q_type == Exercise::JUDGMENT #选择题(单选)/判断题 if ea.exists?
if ea.exists? ea.first.update!(exercise_choice_id: choice_id )
ea.first.update_attribute(:exercise_choice_id,choice_id ) else
else
answer_option = {
:user_id => current_user.id,
:exercise_question_id => @exercise_question.id,
:exercise_choice_id => choice_id,
:answer_text => ""
}
ex_a = ExerciseAnswer.new(answer_option)
ex_a.save!
end
elsif q_type == Exercise::MULTIPLE #多选题的
choice_ids = params[:exercise_choice_id].present? ? params[:exercise_choice_id] : []
ea_ids = ea.pluck(:exercise_choice_id)
common_answer_ids = choice_ids & ea_ids #已经存在的试卷选项id
new_ids = (choice_ids - common_answer_ids).uniq # 新增的id
old_ids = (ea_ids - common_answer_ids).uniq #没有选择的,则删掉
if new_ids.size > 0
new_ids.each do |e|
answer_option = {
:user_id => current_user.id,
:exercise_question_id => @exercise_question.id,
:exercise_choice_id => e,
:answer_text => ""
}
ex_a = ExerciseAnswer.new(answer_option)
ex_a.save!
end
end
if old_ids.size > 0
ea_answer = ea.search_answer_users("exercise_choice_id",old_ids)
ea_answer.destroy_all
end
elsif q_type == Exercise::COMPLETION #填空题
answer_option = {
:user_id => current_user.id,
:exercise_question_id => @exercise_question.id,
:exercise_choice_id => choice_id,
:answer_text => answer_text
}
ea_answer = ea.search_answer_users("exercise_choice_id",choice_id)
if ea.present? && ea_answer.present?
ea_answer.update(answer_option)
else
ex_new = ExerciseAnswer.new(answer_option)
ex_new.save!
end
elsif q_type == Exercise::SUBJECTIVE #简答题
answer_option = { answer_option = {
:user_id => current_user.id, :user_id => current_user.id,
:exercise_question_id => @exercise_question.id :exercise_question_id => @exercise_question.id,
:exercise_choice_id => choice_id,
:answer_text => ""
} }
if ea.present? #已经回答了的, ex_a = ExerciseAnswer.new(answer_option)
ea.first.update_attribute("answer_text",answer_text) ex_a.save!
else end
answer_option.merge!(answer_text:answer_text) elsif q_type == Exercise::MULTIPLE #多选题的
choice_ids = params[:exercise_choice_id].present? ? params[:exercise_choice_id] : []
ea_ids = ea.pluck(:exercise_choice_id)
common_answer_ids = choice_ids & ea_ids #已经存在的试卷选项id
new_ids = (choice_ids - common_answer_ids).uniq # 新增的id
old_ids = (ea_ids - common_answer_ids).uniq #没有选择的,则删掉
if new_ids.size > 0
new_ids.each do |e|
answer_option = {
:user_id => current_user.id,
:exercise_question_id => @exercise_question.id,
:exercise_choice_id => e,
:answer_text => ""
}
ex_a = ExerciseAnswer.new(answer_option) ex_a = ExerciseAnswer.new(answer_option)
ex_a.save! ex_a.save!
end end
end end
normal_status(0,"回答成功") if old_ids.size > 0
ea_answer = ea.search_answer_users("exercise_choice_id",old_ids)
ea_answer.destroy_all
end
elsif q_type == Exercise::COMPLETION #填空题
answer_option = {
:user_id => current_user.id,
:exercise_question_id => @exercise_question.id,
:exercise_choice_id => choice_id,
:answer_text => answer_text
}
ea_answer = ea.search_answer_users("exercise_choice_id",choice_id)
if ea.present? && ea_answer.present?
ea_answer.first.update!(answer_option)
else
ex_new = ExerciseAnswer.new(answer_option)
ex_new.save!
end
elsif q_type == Exercise::SUBJECTIVE #简答题
answer_option = {
:user_id => current_user.id,
:exercise_question_id => @exercise_question.id
}
if ea.present? #已经回答了的,
ea.first.update!(answer_text: answer_text)
else
answer_option.merge!(answer_text:answer_text)
ex_a = ExerciseAnswer.new(answer_option)
ex_a.save!
end
end end
rescue Exception => e normal_status(0,"回答成功")
uid_logger_error(e.message)
tip_exception("页面调用失败!")
raise ActiveRecord::Rollback
end end
end end
@ -116,7 +110,7 @@ class ExerciseAnswersController < ApplicationController
:score => total_score, :score => total_score,
:subjective_score => subjective_score :subjective_score => subjective_score
} }
@exercise_user.update_attributes(commit_option) @exercise_user.update!(commit_option)
normal_status(-1,"试卷提交时间已截止!") normal_status(-1,"试卷提交时间已截止!")
end end
end end

@ -44,7 +44,7 @@ class ExerciseQuestionsController < ApplicationController
end end
end end
if @exercise_question.save if @exercise_question.save!
#为选择题(包括单选和多选)的时候,创建问题选项 #为选择题(包括单选和多选)的时候,创建问题选项
ques_type = @exercise_question.question_type ques_type = @exercise_question.question_type
if ques_type <= Exercise::MULTIPLE if ques_type <= Exercise::MULTIPLE
@ -59,7 +59,7 @@ class ExerciseQuestionsController < ApplicationController
:choice_text => choice.strip :choice_text => choice.strip
} }
question_choices = @exercise_question.exercise_choices.new(choice_option) question_choices = @exercise_question.exercise_choices.new(choice_option)
question_choices.save question_choices.save!
end end
#标准答案的存储,如:["1","2","3"..]等1对应A2对应B3对应C。。。 #标准答案的存储,如:["1","2","3"..]等1对应A2对应B3对应C。。。
standard_answer.each do |a| standard_answer.each do |a|
@ -69,7 +69,7 @@ class ExerciseQuestionsController < ApplicationController
:exercise_choice_id => choice_id #即为选择的位置参数 :exercise_choice_id => choice_id #即为选择的位置参数
} }
question_standard_answer = ExerciseStandardAnswer.new(standard_option) question_standard_answer = ExerciseStandardAnswer.new(standard_option)
question_standard_answer.save question_standard_answer.save!
if standard_answer.count > 1 && ques_type == Exercise::SINGLE #当标准答案数大于1且不为多选时修改为多选 if standard_answer.count > 1 && ques_type == Exercise::SINGLE #当标准答案数大于1且不为多选时修改为多选
@exercise_question.update_attribute("question_type",Exercise::MULTIPLE) @exercise_question.update_attribute("question_type",Exercise::MULTIPLE)
elsif standard_answer.count == 1 && ques_type == Exercise::MULTIPLE elsif standard_answer.count == 1 && ques_type == Exercise::MULTIPLE
@ -85,8 +85,8 @@ class ExerciseQuestionsController < ApplicationController
:choice_position => c, :choice_position => c,
:choice_text => choice.strip :choice_text => choice.strip
} }
question_choices = @exercise_question.exercise_choices.create(choice_option) question_choices = @exercise_question.exercise_choices.create!(choice_option)
question_choices.save question_choices.save!
end end
standard_answer = params[:standard_answers] #对应选项的id standard_answer = params[:standard_answers] #对应选项的id
standard_option = { standard_option = {
@ -94,7 +94,7 @@ class ExerciseQuestionsController < ApplicationController
:exercise_choice_id => standard_answer.first.to_i :exercise_choice_id => standard_answer.first.to_i
} }
question_standard_answer = ExerciseStandardAnswer.new(standard_option) question_standard_answer = ExerciseStandardAnswer.new(standard_option)
question_standard_answer.save question_standard_answer.save!
elsif ques_type == Exercise::COMPLETION #填空题,每空的参考答案有多个,那么以位置对应 elsif ques_type == Exercise::COMPLETION #填空题,每空的参考答案有多个,那么以位置对应
standard_answer = params[:standard_answers] standard_answer = params[:standard_answers]
standard_answer.each do |a| standard_answer.each do |a|
@ -107,7 +107,7 @@ class ExerciseQuestionsController < ApplicationController
:answer_text => n :answer_text => n
} }
question_standard_answer = ExerciseStandardAnswer.new(standard_option) question_standard_answer = ExerciseStandardAnswer.new(standard_option)
question_standard_answer.save question_standard_answer.save!
end end
end end
elsif ques_type == Exercise::SUBJECTIVE #简答题 elsif ques_type == Exercise::SUBJECTIVE #简答题
@ -119,7 +119,7 @@ class ExerciseQuestionsController < ApplicationController
:answer_text => a, :answer_text => a,
} }
question_standard_answer = ExerciseStandardAnswer.new(standard_option) question_standard_answer = ExerciseStandardAnswer.new(standard_option)
question_standard_answer.save question_standard_answer.save!
end end
end end
elsif ques_type == Exercise::PRACTICAL #实训题 elsif ques_type == Exercise::PRACTICAL #实训题
@ -135,10 +135,10 @@ class ExerciseQuestionsController < ApplicationController
:position => (index + 1), :position => (index + 1),
:question_score => shixun_scores[index].present? ? shixun_scores[index].to_f.round(1) : 5 :question_score => shixun_scores[index].present? ? shixun_scores[index].to_f.round(1) : 5
} }
ex_shixun_challenge = ExerciseShixunChallenge.create(shixun_option) ex_shixun_challenge = ExerciseShixunChallenge.create!(shixun_option)
question_score += ex_shixun_challenge.question_score # 问题的分数,为各个关卡分数的总和 question_score += ex_shixun_challenge.question_score # 问题的分数,为各个关卡分数的总和
end end
@exercise_question.update_attributes(:question_score => question_score,:shixun_name=> shixun_name) @exercise_question.update!(:question_score => question_score,:shixun_name=> shixun_name)
end end
end end
rescue Exception => e rescue Exception => e
@ -188,7 +188,7 @@ class ExerciseQuestionsController < ApplicationController
choices_array = params[:question_choices] choices_array = params[:question_choices]
stan_answer_params = params[:standard_answers] stan_answer_params = params[:standard_answers]
standard_answer = stan_answer_params.present? ? stan_answer_params.uniq.reject(&:blank?) : [] standard_answer = stan_answer_params.present? ? stan_answer_params.uniq.reject(&:blank?) : []
@exercise_question.update_attributes(question_options) @exercise_question.update!(question_options)
#当选项存在时,可修改选项内容,但是不能更改选项的位置(即不能增删选项) #当选项存在时,可修改选项内容,但是不能更改选项的位置(即不能增删选项)
if choices_array.present? if choices_array.present?
ex_choices = @exercise_question.exercise_choices ex_choices = @exercise_question.exercise_choices
@ -218,7 +218,7 @@ class ExerciseQuestionsController < ApplicationController
:choice_text => choices_array[i-1].strip :choice_text => choices_array[i-1].strip
} }
question_choices = @exercise_question.exercise_choices.new(choice_option) question_choices = @exercise_question.exercise_choices.new(choice_option)
question_choices.save question_choices.save!
end end
end end
end end
@ -243,7 +243,7 @@ class ExerciseQuestionsController < ApplicationController
:exercise_choice_id => s.to_i #即为选择的位置参数 :exercise_choice_id => s.to_i #即为选择的位置参数
} }
question_standard_answer = ExerciseStandardAnswer.new(standard_option) question_standard_answer = ExerciseStandardAnswer.new(standard_option)
question_standard_answer.save question_standard_answer.save!
end end
end end
@ -296,7 +296,7 @@ class ExerciseQuestionsController < ApplicationController
:answer_text => null_choice_text[i-1] :answer_text => null_choice_text[i-1]
} }
question_standard_answer = ExerciseStandardAnswer.new(standard_option) question_standard_answer = ExerciseStandardAnswer.new(standard_option)
question_standard_answer.save question_standard_answer.save!
end end
end end
else else
@ -323,7 +323,7 @@ class ExerciseQuestionsController < ApplicationController
:answer_text => n :answer_text => n
} }
question_standard_answer = ExerciseStandardAnswer.new(standard_option) question_standard_answer = ExerciseStandardAnswer.new(standard_option)
question_standard_answer.save question_standard_answer.save!
end end
end end
end end
@ -340,19 +340,19 @@ class ExerciseQuestionsController < ApplicationController
:answer_text => main_standard_answer, :answer_text => main_standard_answer,
} }
question_standard_answer = ExerciseStandardAnswer.new(standard_option) question_standard_answer = ExerciseStandardAnswer.new(standard_option)
question_standard_answer.save question_standard_answer.save!
end end
elsif @exercise_question.question_type == Exercise::PRACTICAL elsif @exercise_question.question_type == Exercise::PRACTICAL
question_score = 0 question_score = 0
shixun_name = params[:shixun_name] || @exercise_question.shixun_name shixun_name = params[:shixun_name] || @exercise_question.shixun_name
@exercise_question.exercise_shixun_challenges.each_with_index do |challenge, index| @exercise_question.exercise_shixun_challenges.each_with_index do |challenge, index|
challenge.question_score = params[:question_scores][index].to_f.round(1) challenge.question_score = params[:question_scores][index].to_f.round(1)
challenge.save challenge.save!
question_score += params[:question_scores][index].to_f.round(1) question_score += params[:question_scores][index].to_f.round(1)
end end
@exercise_question.question_score = question_score @exercise_question.question_score = question_score
@exercise_question.shixun_name = shixun_name @exercise_question.shixun_name = shixun_name
@exercise_question.save @exercise_question.save!
end end
#当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数. #当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数.
@ -397,7 +397,7 @@ class ExerciseQuestionsController < ApplicationController
new_objective_score = objective_score + update_objective_score new_objective_score = objective_score + update_objective_score
total_score = ex_user.score + update_objective_score total_score = ex_user.score + update_objective_score
total_score = total_score < 0.0 ? 0.0 : total_score total_score = total_score < 0.0 ? 0.0 : total_score
ex_user.update_attributes(objective_score:new_objective_score,score:total_score) ex_user.update!(objective_score:new_objective_score,score:total_score)
end end
end end
end end
@ -526,7 +526,7 @@ class ExerciseQuestionsController < ApplicationController
:score => @c_score, :score => @c_score,
:answer_text => "" :answer_text => ""
} }
ExerciseAnswer.create(answer_option) ExerciseAnswer.create!(answer_option)
ex_answer_old = 0 ex_answer_old = 0
end end
if ex_obj_score <= 0.0 if ex_obj_score <= 0.0
@ -545,7 +545,7 @@ class ExerciseQuestionsController < ApplicationController
:objective_score => new_obj_score, :objective_score => new_obj_score,
:score => total_scores :score => total_scores
} }
@exercise_current_user.update_attributes(ex_scores) @exercise_current_user.update!(ex_scores)
elsif @exercise_question.question_type == Exercise::COMPLETION #当为填空题,更新问题的总分, elsif @exercise_question.question_type == Exercise::COMPLETION #当为填空题,更新问题的总分,
@ -561,7 +561,7 @@ class ExerciseQuestionsController < ApplicationController
:score => @c_score, :score => @c_score,
:answer_text => "" :answer_text => ""
} }
ExerciseAnswer.create(answer_option) ExerciseAnswer.create!(answer_option)
new_obj_score = ex_obj_score + @c_score new_obj_score = ex_obj_score + @c_score
end end
@ -575,7 +575,7 @@ class ExerciseQuestionsController < ApplicationController
:objective_score => new_obj_score, :objective_score => new_obj_score,
:score => total_scores :score => total_scores
} }
@exercise_current_user.update_attributes(ex_scores) @exercise_current_user.update!(ex_scores)
elsif @exercise_question.question_type == Exercise::SUBJECTIVE #当为主观题时 elsif @exercise_question.question_type == Exercise::SUBJECTIVE #当为主观题时
if ex_answers.exists? if ex_answers.exists?
ex_answers_old_score = ex_answers.first.score > 0.0 ? ex_answers.first.score : 0.0 #原分数小于0取0 ex_answers_old_score = ex_answers.first.score > 0.0 ? ex_answers.first.score : 0.0 #原分数小于0取0
@ -588,7 +588,7 @@ class ExerciseQuestionsController < ApplicationController
:score => @c_score, :score => @c_score,
:answer_text => "" :answer_text => ""
} }
ExerciseAnswer.create(answer_option) ExerciseAnswer.create!(answer_option)
new_sub_score = ex_subj_score + @c_score new_sub_score = ex_subj_score + @c_score
end end
total_scores = ex_obj_score + new_sub_score total_scores = ex_obj_score + new_sub_score
@ -601,7 +601,7 @@ class ExerciseQuestionsController < ApplicationController
:subjective_score => new_sub_score, :subjective_score => new_sub_score,
:score => total_scores :score => total_scores
} }
@exercise_current_user.update_attributes(ex_scores) @exercise_current_user.update!(ex_scores)
elsif @exercise_question.question_type == Exercise::PRACTICAL elsif @exercise_question.question_type == Exercise::PRACTICAL
ex_answers = @exercise_question.exercise_shixun_answers.where(user_id:@user_id,exercise_shixun_challenge_id:@shixun_a_id) ex_answers = @exercise_question.exercise_shixun_answers.where(user_id:@user_id,exercise_shixun_challenge_id:@shixun_a_id)
@ -618,7 +618,7 @@ class ExerciseQuestionsController < ApplicationController
:score => @c_score, :score => @c_score,
:status => 0 :status => 0
} }
ExerciseShixunAnswer.create(ex_shixun_option) ExerciseShixunAnswer.create!(ex_shixun_option)
new_obj_score = ex_obj_score + @c_score new_obj_score = ex_obj_score + @c_score
end end
total_scores = new_obj_score + ex_subj_score total_scores = new_obj_score + ex_subj_score
@ -631,7 +631,7 @@ class ExerciseQuestionsController < ApplicationController
:objective_score => new_obj_score, :objective_score => new_obj_score,
:score => total_scores :score => total_scores
} }
@exercise_current_user.update_attributes(ex_scores) @exercise_current_user.update!(ex_scores)
end end
comments = params[:comment] comments = params[:comment]
question_comment = @exercise_question.exercise_answer_comments&.first question_comment = @exercise_question.exercise_answer_comments&.first
@ -643,7 +643,7 @@ class ExerciseQuestionsController < ApplicationController
:exercise_answer_id => ex_answers.present? ? ex_answers.first.id : nil, :exercise_answer_id => ex_answers.present? ? ex_answers.first.id : nil,
:user_id => current_user.id :user_id => current_user.id
} }
question_comment.update_attributes(comment_option) question_comment.update!(comment_option)
@exercise_comments = question_comment @exercise_comments = question_comment
else else
ex_answer_comment_id = @exercise_question.exercise_answers.find_by(user_id: @user_id).try(:id) ex_answer_comment_id = @exercise_question.exercise_answers.find_by(user_id: @user_id).try(:id)

File diff suppressed because it is too large Load Diff

@ -52,7 +52,7 @@ class GraduationWorksController < ApplicationController
begin begin
work = @task.graduation_works.find_by!(user_id: params[:user_id]) work = @task.graduation_works.find_by!(user_id: params[:user_id])
tip_exception("只有组长才能删除组员") if work.commit_user_id != current_user.id tip_exception("只有组长才能删除组员") if work.commit_user_id != current_user.id
work.update_attributes(description: nil, project_id: 0, late_penalty: 0, work_status: 0, commit_time: nil, work.update!(description: nil, project_id: 0, late_penalty: 0, work_status: 0, commit_time: nil,
update_time: nil, group_id: 0, commit_user_id: nil, final_score: nil, work_score: nil, update_time: nil, group_id: 0, commit_user_id: nil, final_score: nil, work_score: nil,
teacher_score: nil, teaching_asistant_score: nil, update_user_id: nil) teacher_score: nil, teaching_asistant_score: nil, update_user_id: nil)
work.attachments.destroy_all work.attachments.destroy_all
@ -89,12 +89,12 @@ class GraduationWorksController < ApplicationController
GraduationWork.create(user_id: current_user.id, graduation_task_id: @task.id, course_id: @task.course_id) GraduationWork.create(user_id: current_user.id, graduation_task_id: @task.id, course_id: @task.course_id)
if work.work_status == 0 && work.project_id == 0 if work.work_status == 0 && work.project_id == 0
work.update_attributes(project_id: project.id, update_time: Time.now) work.update!(project_id: project.id, update_time: Time.now)
# 将老师加入项目 # 将老师加入项目
project_member = project.members.where(user_id: @task.user_id).first project_member = project.members.where(user_id: @task.user_id).first
if project_member.present? if project_member.present?
project_member.member_roles.first.update_attributes(role_id: 3) if project_member.member_roles.first.present? project_member.member_roles.first.update!(role_id: 3) if project_member.member_roles.first.present?
else else
member = Member.create(user_id: @task.user_id, project_id: project.id) member = Member.create(user_id: @task.user_id, project_id: project.id)
member.member_roles << MemberRole.new(role_id: 3) member.member_roles << MemberRole.new(role_id: 3)
@ -127,7 +127,7 @@ class GraduationWorksController < ApplicationController
Tiding.where(user_id: @task.user_id, trigger_user_id: current_user.id, container_id: work.project.id, Tiding.where(user_id: @task.user_id, trigger_user_id: current_user.id, container_id: work.project.id,
container_type: 'ManagerJoinProject').destroy_all container_type: 'ManagerJoinProject').destroy_all
work.update_attributes(project_id: 0) work.update!(project_id: 0)
normal_status("取消关联成功") normal_status("取消关联成功")
rescue Exception => e rescue Exception => e
@ -177,7 +177,7 @@ class GraduationWorksController < ApplicationController
student_ids += members student_ids += members
for i in 0 .. members.count-1 for i in 0 .. members.count-1
stu_work = @task.graduation_works.where(user_id: members[i].to_i).first || GraduationWork.new stu_work = @task.graduation_works.where(user_id: members[i].to_i).first || GraduationWork.new
stu_work.update_attributes(user_id: members[i].to_i, description: graduation_work.description, stu_work.update!(user_id: members[i].to_i, description: graduation_work.description,
graduation_task_id: @task.id, project_id: graduation_work.project_id, graduation_task_id: @task.id, project_id: graduation_work.project_id,
late_penalty: graduation_work.late_penalty, work_status: graduation_work.work_status, late_penalty: graduation_work.late_penalty, work_status: graduation_work.work_status,
commit_time: Time.now, update_time: Time.now, group_id: graduation_work.group_id, commit_time: Time.now, update_time: Time.now, group_id: graduation_work.group_id,
@ -238,7 +238,7 @@ class GraduationWorksController < ApplicationController
# 原成员更新描述、更新时间以及附件 # 原成员更新描述、更新时间以及附件
@task.graduation_works.where(group_id: @work.group_id, user_id: (work_user_ids & params_user_ids)).each do |work| @task.graduation_works.where(group_id: @work.group_id, user_id: (work_user_ids & params_user_ids)).each do |work|
work.update_attributes(update_time: Time.now, description: @work.description, update_user_id: current_user.id) work.update!(update_time: Time.now, description: @work.description, update_user_id: current_user.id)
work.attachments.destroy_all work.attachments.destroy_all
@work.attachments.each do |attachment| @work.attachments.each do |attachment|
att = attachment.copy att = attachment.copy
@ -264,7 +264,7 @@ class GraduationWorksController < ApplicationController
(params_user_ids - work_user_ids).each do |user_id| (params_user_ids - work_user_ids).each do |user_id|
stu_work = @task.graduation_works.where(user_id: user_id).empty? ? GraduationWork.new : stu_work = @task.graduation_works.where(user_id: user_id).empty? ? GraduationWork.new :
@task.graduation_works.where(user_id: user_id).first @task.graduation_works.where(user_id: user_id).first
stu_work.update_attributes(user_id: user_id, description: @work.description, graduation_task_id: @task.id, stu_work.update!(user_id: user_id, description: @work.description, graduation_task_id: @task.id,
project_id: @work.project_id, late_penalty: @work.late_penalty, project_id: @work.project_id, late_penalty: @work.late_penalty,
work_status: @work.work_status, commit_time: Time.now, update_time: Time.now, work_status: @work.work_status, commit_time: Time.now, update_time: Time.now,
group_id: @work.group_id, commit_user_id: @work.commit_user_id, update_user_id: current_user.id) group_id: @work.group_id, commit_user_id: @work.commit_user_id, update_user_id: current_user.id)
@ -323,9 +323,9 @@ class GraduationWorksController < ApplicationController
# 如果作品是未提交的状态则更新为已提交 # 如果作品是未提交的状态则更新为已提交
if !new_score.score.nil? && @work.work_status == 0 if !new_score.score.nil? && @work.work_status == 0
@work.update_attributes(work_status: 1, commit_time: Time.now) @work.update!(work_status: 1, commit_time: Time.now)
if @task.task_type == 2 if @task.task_type == 2
@work.update_attributes(group_id: @task.graduation_works.where("work_status != 0").select("distinct group_id").count + 1) @work.update!(group_id: @task.graduation_works.where("work_status != 0").select("distinct group_id").count + 1)
end end
end end
@ -392,7 +392,7 @@ class GraduationWorksController < ApplicationController
graduation_task_id: @task.id, comment: "使用调分功能调整了作业最终成绩:#{params[:comment]}", graduation_task_id: @task.id, comment: "使用调分功能调整了作业最终成绩:#{params[:comment]}",
user_id: User.current.id, reviewer_role: 1, is_ultimate: 1) user_id: User.current.id, reviewer_role: 1, is_ultimate: 1)
new_score.save! new_score.save!
@work.update_attributes(ultimate_score: 1, work_score: params[:score].to_f) @work.update!(ultimate_score: 1, work_score: params[:score].to_f)
Tiding.create!(user_id: @work.user_id, trigger_user_id: current_user.id, container_id: new_score.id, Tiding.create!(user_id: @work.user_id, trigger_user_id: current_user.id, container_id: new_score.id,
container_type: "AdjustScore", parent_container_id: @task.id, container_type: "AdjustScore", parent_container_id: @task.id,
@ -445,9 +445,9 @@ class GraduationWorksController < ApplicationController
end end
Attachment.associate_container(params[:attachment_ids], @work.id, @work.class, 7) Attachment.associate_container(params[:attachment_ids], @work.id, @work.class, 7)
revise_attachment = Attachment.where(attachtype: 7, container_id: @work.id, container_type: "GraduationWork").last revise_attachment = Attachment.where(attachtype: 7, container_id: @work.id, container_type: "GraduationWork").last
revise_attachment.update_attributes(description: params[:description]) if revise_attachment.present? revise_attachment.update!(description: params[:description]) if revise_attachment.present?
@work.update_attributes(update_time: Time.now) @work.update!(update_time: Time.now)
normal_status("提交成功") normal_status("提交成功")
rescue Exception => e rescue Exception => e
@ -465,7 +465,7 @@ class GraduationWorksController < ApplicationController
if @work_assign_teacher.present? if @work_assign_teacher.present?
# graduation_group_id: 已经是答辩组的需要 将答辩组清空 # graduation_group_id: 已经是答辩组的需要 将答辩组清空
@work_assign_teacher.update_attributes(graduation_group_id: 0) @work_assign_teacher.update!(graduation_group_id: 0)
else else
@work.graduation_work_comment_assignations << GraduationWorkCommentAssignation.new(graduation_task_id: @task.id, @work.graduation_work_comment_assignations << GraduationWorkCommentAssignation.new(graduation_task_id: @task.id,
user_id: params[:user_id], user_id: params[:user_id],

@ -232,7 +232,11 @@ class HacksController < ApplicationController
hacks = Hack.select(select_sql).mine(current_user.id) hacks = Hack.select(select_sql).mine(current_user.id)
else else
# 全部包括已经发布的,和我的未发布的 # 全部包括已经发布的,和我的未发布的
hacks = Hack.select(select_sql).published.opening.or(Hack.select(select_sql).unpublish.mine(current_user.id)) if current_user.admin_or_business?
hacks = Hack.select(select_sql)
else
hacks = Hack.select(select_sql).published.opening.or(Hack.select(select_sql).unpublish.mine(current_user.id))
end
end end
# 搜索 # 搜索
if params[:search] if params[:search]

@ -976,7 +976,7 @@ class HomeworkCommonsController < ApplicationController
elsif homework.max_group_end_time elsif homework.max_group_end_time
homework.end_time = homework.max_group_end_time homework.end_time = homework.max_group_end_time
end end
homework.homework_detail_manual.update_attribute('comment_status', 1) homework.homework_detail_manual.update_attributes!(comment_status: 1)
if homework.course_acts.size == 0 if homework.course_acts.size == 0
homework.course_acts << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id) homework.course_acts << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id)
@ -1004,7 +1004,7 @@ class HomeworkCommonsController < ApplicationController
if homework.end_time > Time.now && homework.homework_detail_manual.try(:comment_status) > 1 if homework.end_time > Time.now && homework.homework_detail_manual.try(:comment_status) > 1
homework.homework_detail_manual.update_attribute("comment_status", 1) homework.homework_detail_manual.update_attributes!(comment_status: 1)
end end
# 补交结束时间 # 补交结束时间
@ -1071,7 +1071,7 @@ class HomeworkCommonsController < ApplicationController
homework.end_time = homework.max_group_end_time homework.end_time = homework.max_group_end_time
if homework.end_time > time && homework_detail_manual.try(:comment_status) > 1 if homework.end_time > time && homework_detail_manual.try(:comment_status) > 1
homework_detail_manual.update_attribute("comment_status", 1) homework_detail_manual.update_attributes!(comment_status: 1)
end end
# 统一设置 # 统一设置
@ -1080,7 +1080,7 @@ class HomeworkCommonsController < ApplicationController
homework.end_time = time homework.end_time = time
end end
homework_detail_manual.update_attribute("comment_status", 2) if homework.end_time <= time homework_detail_manual.update_attributes!(comment_status: 2) if homework.end_time <= time
# 实训作业的作品需要计算是否迟交 # 实训作业的作品需要计算是否迟交
if homework.homework_type == "practice" if homework.homework_type == "practice"
@ -1451,7 +1451,7 @@ class HomeworkCommonsController < ApplicationController
if user_review.present? if user_review.present?
user_review.update_attributes!(:code_rate => user_rate) user_review.update_attributes!(:code_rate => user_rate)
else else
homework.homework_review_results.create(:user_id => user, :code_rate => user_rate) homework.homework_review_results.create!(:user_id => user, :code_rate => user_rate)
end end
end end
nuser_ids = results.user_lists.map(&:user_id).uniq nuser_ids = results.user_lists.map(&:user_id).uniq

@ -1,6 +1,6 @@
class MemosController < ApplicationController class MemosController < ApplicationController
before_action :require_login, except: [:show, :index] before_action :require_login, except: [:show, :index]
before_action :check_account, only: [:new, :create] before_action :check_account, only: [:new, :create, :reply]
before_action :set_memo, only: [:show, :edit, :update, :destroy, :sticky_or_cancel, :hidden, :more_reply] before_action :set_memo, only: [:show, :edit, :update, :destroy, :sticky_or_cancel, :hidden, :more_reply]
before_action :validate_memo_params, only: [:create, :update] before_action :validate_memo_params, only: [:create, :update]
before_action :owner_or_admin, only: [:edit, :update, :destroy] before_action :owner_or_admin, only: [:edit, :update, :destroy]
@ -144,7 +144,7 @@ class MemosController < ApplicationController
def reply def reply
tip_exception("parent_id不能为空") if params[:parent_id].blank? tip_exception("parent_id不能为空") if params[:parent_id].blank?
tip_exception("content不能为空") if params[:content].blank? tip_exception("content不能为空") if params[:content].blank?
tip_exception("内容不能超过1000字符") if params[:content].length > 1000 tip_exception("内容不能超过2000字符") if params[:content].length > 2000
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin

@ -62,8 +62,8 @@ class MessagesController < ApplicationController
end end
def reply def reply
return normal_status(2, "回复内容不能为空") if params[:content].blank? return normal_status(-1, "回复内容不能为空") if params[:content].blank?
return normal_status(2, "回复内容不能超过1000字符") if params[:content].length > 1000 return normal_status(-1, "回复内容不能超过2000字符") if params[:content].length > 2000
@reply = Message.create!(board: @message.board, root_id: @message.root_id || @message.id, @reply = Message.create!(board: @message.board, root_id: @message.root_id || @message.id,
author: current_user, parent: @message, author: current_user, parent: @message,
message_detail_attributes: { message_detail_attributes: {

@ -44,7 +44,7 @@ class PollQuestionsController < ApplicationController
@poll.poll_questions.insert_question(ques_num).update_all("question_number = question_number + 1") @poll.poll_questions.insert_question(ques_num).update_all("question_number = question_number + 1")
end end
end end
if @poll_question.save if @poll_question.save!
if params[:question_type] != 3 if params[:question_type] != 3
p_answer = params[:question_answers] p_answer = params[:question_answers]
p_other_answer = params[:question_other_answer] p_other_answer = params[:question_other_answer]
@ -56,7 +56,7 @@ class PollQuestionsController < ApplicationController
:answer_text => answer :answer_text => answer
} }
poll_answers = @poll_question.poll_answers.new question_option poll_answers = @poll_question.poll_answers.new question_option
poll_answers.save poll_answers.save!
end end
# 新增答案的其他选项 # 新增答案的其他选项
if p_other_answer if p_other_answer
@ -65,7 +65,7 @@ class PollQuestionsController < ApplicationController
:answer_text => '' :answer_text => ''
} }
poll_answers = @poll_question.poll_answers.new question_option poll_answers = @poll_question.poll_answers.new question_option
poll_answers.save poll_answers.save!
end end
end end
end end
@ -118,7 +118,7 @@ class PollQuestionsController < ApplicationController
if answer # 判断该位置的answer是否存在存在则更新.不存在则跳到下一步 if answer # 判断该位置的answer是否存在存在则更新.不存在则跳到下一步
answer.answer_text = p_answer[i-1] answer.answer_text = p_answer[i-1]
answer.answer_position = i answer.answer_position = i
answer.save answer.save!
else else
answer_options = { answer_options = {
:answer_position => i, :answer_position => i,
@ -137,12 +137,12 @@ class PollQuestionsController < ApplicationController
@poll_question.poll_answers.new question_option @poll_question.poll_answers.new question_option
else else
other_answer.answer_position = p_answer_count + 1 other_answer.answer_position = p_answer_count + 1
other_answer.save other_answer.save!
end end
end end
end end
@poll_question.update_attributes(poll_questions_params) @poll_question.update!(poll_questions_params)
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("更新失败") tip_exception("更新失败")
@ -198,8 +198,8 @@ class PollQuestionsController < ApplicationController
if opr.to_s == "up" if opr.to_s == "up"
last_q_p = @poll.poll_questions.find_by(question_number: (current_q_p-1)) #当前问题的前一个问题 last_q_p = @poll.poll_questions.find_by(question_number: (current_q_p-1)) #当前问题的前一个问题
if last_q_p.present? if last_q_p.present?
@poll_question.update_attribute("question_number", (current_q_p - 1)) @poll_question.update!(question_number: (current_q_p - 1))
last_q_p.update_attribute("question_number", current_q_p) # 重新获取当前问题的位置 last_q_p.update!(question_number: current_q_p) # 重新获取当前问题的位置
normal_status(0, "问题上移成功!") normal_status(0, "问题上移成功!")
else else
normal_status(-1, "移动失败,已经是第一个问题了!") normal_status(-1, "移动失败,已经是第一个问题了!")
@ -207,8 +207,8 @@ class PollQuestionsController < ApplicationController
elsif opr.to_s == "down" elsif opr.to_s == "down"
next_q_p = @poll.poll_questions.find_by(question_number: (current_q_p+1)) #当前问题的后一个问题 next_q_p = @poll.poll_questions.find_by(question_number: (current_q_p+1)) #当前问题的后一个问题
if next_q_p.present? if next_q_p.present?
@poll_question.update_attribute("question_number", (current_q_p + 1)) @poll_question.update!(question_number: (current_q_p + 1))
next_q_p.update_attribute("question_number", current_q_p) next_q_p.update!(question_number: current_q_p)
normal_status(0, "问题下移成功!") normal_status(0, "问题下移成功!")
else else

@ -31,24 +31,24 @@ class PollVotesController < ApplicationController
current_user_answer = user_votes.first current_user_answer = user_votes.first
if current_user_answer&.poll_answer_id != question_answer_id #如果说更换了答案,则以前的答案删除,并新建记录 if current_user_answer&.poll_answer_id != question_answer_id #如果说更换了答案,则以前的答案删除,并新建记录
current_user_answer.destroy current_user_answer.destroy
PollVote.create(vote_answer_params) PollVote.create!(vote_answer_params)
else else
if question_answer_text.present? if question_answer_text.present?
current_user_answer.update_attribute("vote_text", question_answer_text) current_user_answer.update!(vote_text: question_answer_text)
end end
end end
else else
PollVote.create(vote_answer_params) PollVote.create!(vote_answer_params)
end end
elsif question_type == 2 #多选题的话答案应该是1个以上 elsif question_type == 2 #多选题的话答案应该是1个以上
question_answer_ids = params[:poll_answer_id] ? params[:poll_answer_id] : [] #该答案的id question_answer_ids = params[:poll_answer_id] ? params[:poll_answer_id] : [] #该答案的id
if question_answer_ids.present? if question_answer_ids.present?
if question_answer_text.present? #有文字输入,但是不存在其他选项的 if question_answer_text.present? #有文字输入,但是不存在其他选项的
ques_vote_id = question_answer_ids.map(&:to_i).max ques_vote_id = question_answer_ids.map(&:to_i).max
if user_votes.find_vote_text.present? ques_vote = user_votes.find_by(poll_answer_id: ques_vote_id)
current_vote_text = user_votes.find_vote_text.first if ques_vote.present?
current_vote_text.update_attribute("vote_text", question_answer_text) ques_vote.update!(vote_text: question_answer_text)
else else
answer_option = { answer_option = {
:user_id => current_user.id, :user_id => current_user.id,
@ -56,7 +56,7 @@ class PollVotesController < ApplicationController
:poll_answer_id => ques_vote_id, :poll_answer_id => ques_vote_id,
:vote_text => question_answer_text :vote_text => question_answer_text
} }
PollVote.create(answer_option) PollVote.create!(answer_option)
# 重新取一次poll_votes # 重新取一次poll_votes
user_votes = @poll_question.poll_votes.find_current_vote("user_id",current_user.id) user_votes = @poll_question.poll_votes.find_current_vote("user_id",current_user.id)
end end
@ -93,14 +93,14 @@ class PollVotesController < ApplicationController
else #主观题的输入 else #主观题的输入
# current_vote_text = user_votes.find_vote_text # current_vote_text = user_votes.find_vote_text
if user_votes.present? if user_votes.present?
user_votes.first.update_attribute("vote_text", question_answer_text) user_votes.first.update!(vote_text: question_answer_text)
# if question_answer_text.present? # if question_answer_text.present?
# user_votes.first.update_attribute("vote_text", question_answer_text) # user_votes.first.update_attribute("vote_text", question_answer_text)
# else # else
# user_votes.destroy_all # user_votes.destroy_all
# end # end
else else
PollVote.create(vote_answer_params) PollVote.create!(vote_answer_params)
end end
end end
@current_question_number = @poll_question.question_number @current_question_number = @poll_question.question_number

@ -137,7 +137,7 @@ class PollsController < ApplicationController
:polls_status => 1, :polls_status => 1,
:polls_type => "Course", :polls_type => "Course",
} }
@poll = Poll.create(poll_options) @poll = Poll.create!(poll_options)
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("问卷创建失败!") tip_exception("问卷创建失败!")
@ -167,7 +167,7 @@ class PollsController < ApplicationController
:polls_name => poll_name, :polls_name => poll_name,
:polls_description => poll_des :polls_description => poll_des
} }
@poll.update_attributes(poll_params) @poll.update!(poll_params)
normal_status(0,"问卷更新成功!") normal_status(0,"问卷更新成功!")
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
@ -297,7 +297,7 @@ class PollsController < ApplicationController
poll_group_setting = poll.poll_group_settings.find_in_poll_group("course_group_id",i).first #根据课堂分班的id寻找问卷所在的班级 poll_group_setting = poll.poll_group_settings.find_in_poll_group("course_group_id",i).first #根据课堂分班的id寻找问卷所在的班级
group_end_time = params[:detail] ? group_end_times[index] : ex_end_time group_end_time = params[:detail] ? group_end_times[index] : ex_end_time
if poll_group_setting.present? #如果该问卷分组存在,则更新,否则新建 if poll_group_setting.present? #如果该问卷分组存在,则更新,否则新建
poll_group_setting.update_attributes!(publish_time: Time.now, end_time: group_end_time) poll_group_setting.update!(publish_time: Time.now, end_time: group_end_time)
else else
p_course_group = { p_course_group = {
:poll_id => poll.id, :poll_id => poll.id,
@ -326,7 +326,7 @@ class PollsController < ApplicationController
:polls_status => poll_status, :polls_status => poll_status,
:unified_setting => poll_unified :unified_setting => poll_unified
} }
poll.update_attributes(poll_params) poll.update!(poll_params)
if poll.course_acts.size == 0 if poll.course_acts.size == 0
poll.course_acts << CourseActivity.new(:user_id => poll.user_id,:course_id => poll.course_id) poll.course_acts << CourseActivity.new(:user_id => poll.user_id,:course_id => poll.course_id)
end end
@ -390,10 +390,10 @@ class PollsController < ApplicationController
new_end_time = poll_group_setting.end_time_present.map(&:end_time) # 问卷结束时间不为空的 new_end_time = poll_group_setting.end_time_present.map(&:end_time) # 问卷结束时间不为空的
new_end_time_s = new_end_time.size > 0 ? new_end_time.max : Time.now new_end_time_s = new_end_time.size > 0 ? new_end_time.max : Time.now
new_poll_status = set_poll_status(poll.publish_time,new_end_time_s) new_poll_status = set_poll_status(poll.publish_time,new_end_time_s)
poll.update_attributes(:end_time => new_end_time_s,:polls_status => new_poll_status,:unified_setting => poll_unified) poll.update!(:end_time => new_end_time_s,:polls_status => new_poll_status,:unified_setting => poll_unified)
elsif poll.unified_setting elsif poll.unified_setting
poll_users = poll.poll_users poll_users = poll.poll_users
poll.update_attributes(:polls_status => 3, :end_time => Time.now) poll.update!(:polls_status => 3, :end_time => Time.now)
end end
poll_users = poll_users.where("commit_status = 0 and start_at is not null") poll_users = poll_users.where("commit_status = 0 and start_at is not null")
poll_users.update_all(:commit_status => 1, :end_at => Time.now) poll_users.update_all(:commit_status => 1, :end_at => Time.now)
@ -470,7 +470,7 @@ class PollsController < ApplicationController
:publish_time => p_time, :publish_time => p_time,
:end_time => e_time :end_time => e_time
} }
@poll.update_attributes(poll_options) @poll.update!(poll_options)
normal_status(0,"分班问卷撤销发布成功!") normal_status(0,"分班问卷撤销发布成功!")
else else
normal_status(-1,"请选择撤销发布班级!") normal_status(-1,"请选择撤销发布班级!")
@ -490,7 +490,7 @@ class PollsController < ApplicationController
:end_time => nil, :end_time => nil,
:unified_setting => true :unified_setting => true
} }
@poll.update_attributes(poll_new_params) @poll.update!(poll_new_params)
@poll.poll_group_settings.destroy_all @poll.poll_group_settings.destroy_all
normal_status(0,"问卷撤销发布成功!") normal_status(0,"问卷撤销发布成功!")
@ -531,7 +531,7 @@ class PollsController < ApplicationController
begin begin
check_ids = Poll.where(id:params[:check_ids]) check_ids = Poll.where(id:params[:check_ids])
check_ids.each do |poll| check_ids.each do |poll|
poll.update_attribute('is_public', true) poll.update!(is_public: true)
end end
normal_status(0, "问卷已设为公开!") normal_status(0, "问卷已设为公开!")
rescue Exception => e rescue Exception => e
@ -555,13 +555,13 @@ class PollsController < ApplicationController
:description => poll.polls_description, :description => poll.polls_description,
:course_list_id => poll.course.try(:course_list_id) :course_list_id => poll.course.try(:course_list_id)
} }
current_ex_bank.update_attributes(ex_params) current_ex_bank.update!(ex_params)
question_bank = QuestionBank.ques_by_container(current_ex_bank.id,current_ex_bank.container_type) #该习题库是否存在于问题库里 question_bank = QuestionBank.ques_by_container(current_ex_bank.id,current_ex_bank.container_type) #该习题库是否存在于问题库里
ques_params = { ques_params = {
:name => current_ex_bank.name, :name => current_ex_bank.name,
:course_list_id => current_ex_bank.course_list_id :course_list_id => current_ex_bank.course_list_id
} }
question_bank.first.update_attributes(ques_params) if question_bank.present? question_bank.first.update!(ques_params) if question_bank.present?
current_ex_bank.exercise_bank_questions.destroy_all # 更新后,习题库的问题全部删除,后续重新再建 current_ex_bank.exercise_bank_questions.destroy_all # 更新后,习题库的问题全部删除,后续重新再建
else else
ex_params = { ex_params = {
@ -575,7 +575,7 @@ class PollsController < ApplicationController
:quotes => 1 :quotes => 1
} }
current_ex_bank= ExerciseBank.new ex_params current_ex_bank= ExerciseBank.new ex_params
if current_ex_bank.save #如果习题库保存成功则会创建问题库question_bank if current_ex_bank.save! #如果习题库保存成功则会创建问题库question_bank
ques_params = { ques_params = {
:name => current_ex_bank.name, :name => current_ex_bank.name,
:container_id => current_ex_bank.id, :container_id => current_ex_bank.id,
@ -586,9 +586,9 @@ class PollsController < ApplicationController
:course_list_id => current_ex_bank.course_list_id :course_list_id => current_ex_bank.course_list_id
} }
question_bank = QuestionBank.new ques_params question_bank = QuestionBank.new ques_params
question_bank.save question_bank.save!
end end
poll.update_attributes!(exercise_bank_id: current_ex_bank.id) poll.update!(exercise_bank_id: current_ex_bank.id)
end end
# 问卷的问题的输入 # 问卷的问题的输入
poll.poll_questions.each do |f| poll.poll_questions.each do |f|
@ -601,7 +601,7 @@ class PollsController < ApplicationController
:min_choices => f.min_choices :min_choices => f.min_choices
} }
exercise_bank_question = current_ex_bank.exercise_bank_questions.new option exercise_bank_question = current_ex_bank.exercise_bank_questions.new option
exercise_bank_question.save exercise_bank_question.save!
## 问卷答案的输入 ## 问卷答案的输入
f.poll_answers.each do |a| f.poll_answers.each do |a|
choice_option = { choice_option = {
@ -609,7 +609,7 @@ class PollsController < ApplicationController
:choice_text => a.answer_text :choice_text => a.answer_text
} }
exercise_bank_c = exercise_bank_question.exercise_bank_choices.new choice_option exercise_bank_c = exercise_bank_question.exercise_bank_choices.new choice_option
exercise_bank_c.save exercise_bank_c.save!
end end
end end
end end
@ -746,7 +746,7 @@ class PollsController < ApplicationController
:publish_time => params_publish_time, :publish_time => params_publish_time,
:end_time => params_end_time :end_time => params_end_time
} }
@poll.update_attributes(poll_params) @poll.update!(poll_params)
@poll.poll_group_settings.destroy_all @poll.poll_group_settings.destroy_all
normal_status(0, "问卷设置成功!") normal_status(0, "问卷设置成功!")
end end
@ -800,7 +800,7 @@ class PollsController < ApplicationController
:end_time => poll_end_time :end_time => poll_end_time
} }
end end
the_group_setting.update_attributes(poll_group_params) the_group_setting.update!(poll_group_params)
end end
end end
if new_group_ids.size > 0 if new_group_ids.size > 0
@ -813,7 +813,7 @@ class PollsController < ApplicationController
:end_time => poll_end_time :end_time => poll_end_time
} }
new_poll_group = PollGroupSetting.new(poll_group_params) new_poll_group = PollGroupSetting.new(poll_group_params)
new_poll_group.save new_poll_group.save!
end end
end end
end end
@ -848,7 +848,7 @@ class PollsController < ApplicationController
:publish_time => p_time, :publish_time => p_time,
:end_time => e_time :end_time => e_time
} }
@poll.update_attributes(poll_params) @poll.update!(poll_params)
if @poll.polls_status == 2 if @poll.polls_status == 2
if @poll.course_acts.size == 0 if @poll.course_acts.size == 0
@poll.course_acts << CourseActivity.new(:user_id => @poll.user_id,:course_id => @poll.course_id) @poll.course_acts << CourseActivity.new(:user_id => @poll.user_id,:course_id => @poll.course_id)
@ -880,10 +880,10 @@ class PollsController < ApplicationController
:start_at => Time.now, :start_at => Time.now,
:commit_status => 0 :commit_status => 0
} }
PollUser.create(poll_user_params) PollUser.create!(poll_user_params)
end end
elsif poll_user_current.start_at.nil? elsif poll_user_current.start_at.nil?
poll_user_current.update_attributes(:start_at => Time.now) poll_user_current.update!(:start_at => Time.now)
end end
if @user_course_identity < Course::STUDENT || (@poll_status == 3) || (poll_user_current.present? && poll_user_current.commit_status == 1) if @user_course_identity < Course::STUDENT || (@poll_status == 3) || (poll_user_current.present? && poll_user_current.commit_status == 1)
@ -963,7 +963,7 @@ class PollsController < ApplicationController
:commit_status => 1, :commit_status => 1,
:end_at => Time.now :end_at => Time.now
} }
poll_user_current.update_attributes(poll_user_params) poll_user_current.update!(poll_user_params)
CommitPollNotifyJobJob.perform_later(@poll.id, current_user.id) CommitPollNotifyJobJob.perform_later(@poll.id, current_user.id)
normal_status(0, "问卷提交成功!") normal_status(0, "问卷提交成功!")
end end

@ -68,7 +68,7 @@ class StudentWorksController < ApplicationController
begin begin
work = @homework.student_works.find_by!(user_id: params[:user_id]) work = @homework.student_works.find_by!(user_id: params[:user_id])
tip_exception("只有组长才能删除组员") if work.commit_user_id != current_user.id tip_exception("只有组长才能删除组员") if work.commit_user_id != current_user.id
work.update_attributes(description: nil, project_id: 0, work.update_attributes!(description: nil, project_id: 0,
late_penalty: 0, work_status: 0, late_penalty: 0, work_status: 0,
commit_time: nil, update_time: nil, group_id: 0, commit_time: nil, update_time: nil, group_id: 0,
commit_user_id: nil, final_score: nil, work_score: nil, teacher_score: nil, teaching_asistant_score: nil) commit_user_id: nil, final_score: nil, work_score: nil, teacher_score: nil, teaching_asistant_score: nil)
@ -112,7 +112,7 @@ class StudentWorksController < ApplicationController
student_ids += members student_ids += members
for i in 0 .. members.count-1 for i in 0 .. members.count-1
stu_work = @homework.student_works.find_or_initialize_by(user_id: members[i].to_i) stu_work = @homework.student_works.find_or_initialize_by(user_id: members[i].to_i)
stu_work.update_attributes(user_id: members[i].to_i, description: student_work.description, stu_work.update_attributes!(user_id: members[i].to_i, description: student_work.description,
homework_common_id: @homework.id, project_id: student_work.project_id, homework_common_id: @homework.id, project_id: student_work.project_id,
late_penalty: student_work.late_penalty, work_status: student_work.work_status, late_penalty: student_work.late_penalty, work_status: student_work.work_status,
commit_time: Time.now, update_time: Time.now, group_id: student_work.group_id, commit_time: Time.now, update_time: Time.now, group_id: student_work.group_id,
@ -177,7 +177,7 @@ class StudentWorksController < ApplicationController
# 原成员更新描述、更新时间以及附件 # 原成员更新描述、更新时间以及附件
@homework.student_works.where(group_id: @work.group_id, user_id: (work_user_ids & params_user_ids)).each do |work| @homework.student_works.where(group_id: @work.group_id, user_id: (work_user_ids & params_user_ids)).each do |work|
# work.update_attributes(update_time: Time.now, description: @work.description, commit_user_id: current_user.id) # work.update_attributes(update_time: Time.now, description: @work.description, commit_user_id: current_user.id)
work.update_attributes(update_time: Time.now, description: @work.description, update_user_id: current_user.id) work.update_attributes!(update_time: Time.now, description: @work.description, update_user_id: current_user.id)
work.attachments.destroy_all work.attachments.destroy_all
@work.attachments.each do |attachment| @work.attachments.each do |attachment|
att = attachment.copy att = attachment.copy
@ -202,7 +202,7 @@ class StudentWorksController < ApplicationController
# 新增加的成员 # 新增加的成员
(params_user_ids - work_user_ids).each do |user_id| (params_user_ids - work_user_ids).each do |user_id|
stu_work = @homework.student_works.find_or_initialize_by(user_id: user_id) stu_work = @homework.student_works.find_or_initialize_by(user_id: user_id)
stu_work.update_attributes(user_id: user_id, description: @work.description, homework_common_id: @homework.id, stu_work.update_attributes!(user_id: user_id, description: @work.description, homework_common_id: @homework.id,
project_id: @work.project_id, late_penalty: @work.late_penalty, project_id: @work.project_id, late_penalty: @work.late_penalty,
work_status: @work.work_status, commit_time: Time.now, update_time: Time.now, work_status: @work.work_status, commit_time: Time.now, update_time: Time.now,
group_id: @work.group_id, commit_user_id: @work.commit_user_id, update_user_id: current_user.id) group_id: @work.group_id, commit_user_id: @work.commit_user_id, update_user_id: current_user.id)
@ -257,14 +257,14 @@ class StudentWorksController < ApplicationController
work = @homework.student_works.find_or_create_by(user_id: current_user.id) work = @homework.student_works.find_or_create_by(user_id: current_user.id)
if work.work_status == 0 && work.project_id == 0 if work.work_status == 0 && work.project_id == 0
work.update_attributes(project_id: project.id, update_time: Time.now) work.update_attributes!(project_id: project.id, update_time: Time.now)
# 将老师加入项目 # 将老师加入项目
project_member = project.members.find_by_user_id(@homework.user_id) project_member = project.members.find_by_user_id(@homework.user_id)
if project_member.present? if project_member.present?
project_member.member_roles.take.update_attributes(role_id: 3) if project_member.member_roles.take.present? project_member.member_roles.take.update_attributes!(role_id: 3) if project_member.member_roles.take.present?
else else
member = Member.create(user_id: @homework.user_id, project_id: project.id) member = Member.create!(user_id: @homework.user_id, project_id: project.id)
member.member_roles << MemberRole.new(role_id: 3) member.member_roles << MemberRole.new(role_id: 3)
Tiding.create(user_id: @homework.user_id, trigger_user_id: current_user.id, container_id: project.id, Tiding.create(user_id: @homework.user_id, trigger_user_id: current_user.id, container_id: project.id,
container_type: 'ManagerJoinProject', belong_container_id: project.id, container_type: 'ManagerJoinProject', belong_container_id: project.id,
@ -295,7 +295,7 @@ class StudentWorksController < ApplicationController
Tiding.where(user_id: @homework.user_id, trigger_user_id: current_user.id, container_id: work.project.id, Tiding.where(user_id: @homework.user_id, trigger_user_id: current_user.id, container_id: work.project.id,
container_type: 'ManagerJoinProject').destroy_all container_type: 'ManagerJoinProject').destroy_all
work.update_attributes(project_id: 0) work.update_attributes!(project_id: 0)
normal_status(0,"取消关联成功") normal_status(0,"取消关联成功")
rescue Exception => e rescue Exception => e
@ -329,9 +329,9 @@ class StudentWorksController < ApplicationController
# end # end
Attachment.associate_container(params[:attachment_ids], @work.id, @work.class, 7) Attachment.associate_container(params[:attachment_ids], @work.id, @work.class, 7)
revise_attachment = Attachment.where(attachtype: 7, container_id: @work.id, container_type: "StudentWork").last revise_attachment = Attachment.where(attachtype: 7, container_id: @work.id, container_type: "StudentWork").last
revise_attachment.update_attributes(description: params[:description]) if revise_attachment.present? revise_attachment.update_attributes!(description: params[:description]) if revise_attachment.present?
@work.update_attributes(update_time: Time.now) @work.update_attributes!(update_time: Time.now)
# 补交附件时给评阅过作品的教师、助教发消息 # 补交附件时给评阅过作品的教师、助教发消息
unless @work.student_works_scores.where.not(score: nil).where(reviewer_role: [1, 2]).pluck(:user_id).uniq.blank? unless @work.student_works_scores.where.not(score: nil).where(reviewer_role: [1, 2]).pluck(:user_id).uniq.blank?
@ -376,9 +376,9 @@ class StudentWorksController < ApplicationController
# 如果作品是未提交的状态则更新为已提交 # 如果作品是未提交的状态则更新为已提交
if @user_course_identity < Course::STUDENT && !new_score.score.nil? && @work.work_status == 0 if @user_course_identity < Course::STUDENT && !new_score.score.nil? && @work.work_status == 0
@work.update_attributes(work_status: 1, commit_time: Time.now) @work.update_attributes!(work_status: 1, commit_time: Time.now)
# 分组作业更新分组id # 分组作业更新分组id
@work.update_attributes(group_id: @homework.max_group_id) if @homework.homework_type == "group" @work.update_attributes!(group_id: @homework.max_group_id) if @homework.homework_type == "group"
end end
new_score.reviewer_role = reviewer_role new_score.reviewer_role = reviewer_role
@ -442,7 +442,7 @@ class StudentWorksController < ApplicationController
# 实训作品的总结 # 实训作品的总结
def update_des def update_des
@work.update_attributes(des_params) @work.update_attributes!(des_params)
tip_exception(0, "提交成功") tip_exception(0, "提交成功")
end end
@ -590,7 +590,7 @@ class StudentWorksController < ApplicationController
begin begin
score = @work.student_works_scores.find_by!(id: params[:score_id]) score = @work.student_works_scores.find_by!(id: params[:score_id])
jour = score.journals_for_messages.new(user_id: current_user.id, notes: params[:comment], reply_id: score.user_id) jour = score.journals_for_messages.new(user_id: current_user.id, notes: params[:comment], reply_id: score.user_id)
jour.save jour.save!
normal_status(0,"回复成功") normal_status(0,"回复成功")
rescue Exception => e rescue Exception => e
uid_logger(e.message) uid_logger(e.message)
@ -624,7 +624,7 @@ class StudentWorksController < ApplicationController
score_appeal = nil score_appeal = nil
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
score.update_attributes(appeal_status: 1) score.update_attributes!(appeal_status: 1)
score_appeal = StudentWorksScoresAppeal.create!(user_id: current_user.id, student_works_score_id: score.id, score_appeal = StudentWorksScoresAppeal.create!(user_id: current_user.id, student_works_score_id: score.id,
comment: params[:comment], appeal_status: 1) comment: params[:comment], appeal_status: 1)
@ -645,9 +645,9 @@ class StudentWorksController < ApplicationController
if score.present? && score.appeal_status == 1 if score.present? && score.appeal_status == 1
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
score.update_attributes(appeal_status: 2) score.update_attributes!(appeal_status: 2)
score_appeal = score.student_works_scores_appeal score_appeal = score.student_works_scores_appeal
score_appeal.update_attributes(appeal_status: 2) score_appeal.update_attributes!(appeal_status: 2)
score_appeal.tidings.destroy_all score_appeal.tidings.destroy_all
normal_status(0,"撤销成功") normal_status(0,"撤销成功")
rescue Exception => e rescue Exception => e
@ -670,18 +670,18 @@ class StudentWorksController < ApplicationController
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
# 更新appeal_status的值 # 更新appeal_status的值
score.update_attributes(appeal_status: params[:status].to_i) score.update_attributes!(appeal_status: params[:status].to_i)
score_appeal = score.student_works_scores_appeal score_appeal = score.student_works_scores_appeal
score_appeal.update_attributes(appeal_status: params[:status].to_i) score_appeal.update_attributes!(appeal_status: params[:status].to_i)
score_appeal.tidings.update_all(status: 1) score_appeal.tidings.update_all(status: 1)
if params[:status].to_i == 3 if params[:status].to_i == 3
# 申诉成功后该评分失效 # 申诉成功后该评分失效
score.update_attributes(is_invalid: 1) score.update_attributes!(is_invalid: 1)
# 申诉成功后 扣匿评学生的违规匿评扣分 # 申诉成功后 扣匿评学生的违规匿评扣分
sw = @homework.student_works.find_by(user_id: score.user_id) sw = @homework.student_works.find_by(user_id: score.user_id)
sw.update_attribute("appeal_penalty", @homework.homework_detail_manual.appeal_penalty + sw.appeal_penalty) if sw.present? sw.update_attributes!(appeal_penalty: @homework.homework_detail_manual.appeal_penalty + sw.appeal_penalty) if sw.present?
# 申诉成功 重新计算申诉者的匿评分 # 申诉成功 重新计算申诉者的匿评分
if @work.student_works_scores.where("reviewer_role = 3 AND appeal_status != 3").count > 0 if @work.student_works_scores.where("reviewer_role = 3 AND appeal_status != 3").count > 0
@ -689,7 +689,7 @@ class StudentWorksController < ApplicationController
else else
@work.student_score = nil @work.student_score = nil
end end
@work.save @work.save!
end end
# todo tiding # todo tiding
@ -737,7 +737,7 @@ class StudentWorksController < ApplicationController
else else
comment = "根据实训报告中最终提交的代码调整第#{challenge.position}关分数" comment = "根据实训报告中最终提交的代码调整第#{challenge.position}关分数"
end end
challenge_score = @work.challenge_work_scores.create(challenge_id: params[:challenge_id], user_id: current_user.id, score: params[:score], challenge_score = @work.challenge_work_scores.create!(challenge_id: params[:challenge_id], user_id: current_user.id, score: params[:score],
comment: comment) comment: comment)
challenge_score.create_tiding current_user.id challenge_score.create_tiding current_user.id
if @work.work_status != 0 && @work.myshixun if @work.work_status != 0 && @work.myshixun
@ -862,7 +862,7 @@ class StudentWorksController < ApplicationController
else else
st_work.student_score = student_work.student_score st_work.student_score = student_work.student_score
end end
st_work.save st_work.save!
Tiding.create(user_id: st_work.user_id, trigger_user_id: current_user.id, container_id: st_score.id, Tiding.create(user_id: st_work.user_id, trigger_user_id: current_user.id, container_id: st_score.id,
container_type: "StudentWorksScore", parent_container_id: st_work.id, parent_container_type: "StudentWork", container_type: "StudentWorksScore", parent_container_id: st_work.id, parent_container_type: "StudentWork",

@ -5,7 +5,7 @@ class SubjectsController < ApplicationController
before_action :find_subject, except: [:index, :create, :new, :append_to_stage, :add_shixun_to_stage] before_action :find_subject, except: [:index, :create, :new, :append_to_stage, :add_shixun_to_stage]
before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish, before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish,
:search_members, :add_subject_members, :statistics, :shixun_report, :school_report, :search_members, :add_subject_members, :statistics, :shixun_report, :school_report,
:up_member_position, :down_member_position, :update_team_title] :up_member_position, :down_member_position, :update_team_title, :statistics_info]
before_action :require_admin, only: [:copy_subject] before_action :require_admin, only: [:copy_subject]
before_action :shixun_marker, only: [:add_shixun_to_stage] before_action :shixun_marker, only: [:add_shixun_to_stage]
@ -13,6 +13,7 @@ class SubjectsController < ApplicationController
include ApplicationHelper include ApplicationHelper
include SubjectsHelper include SubjectsHelper
include GitCommon include GitCommon
include CustomSortable
def index def index
@tech_system = current_laboratory.subject_repertoires @tech_system = current_laboratory.subject_repertoires
@ -92,7 +93,7 @@ class SubjectsController < ApplicationController
@is_creator = current_user.creator_of_subject?(@subject) @is_creator = current_user.creator_of_subject?(@subject)
@is_manager = @user.manager_of_subject?(@subject) @is_manager = @user.manager_of_subject?(@subject)
# 合作团队 # 合作团队
@shixuns = @subject.shixuns.published.pluck(:id) # @shixuns = @subject.shixuns.published.pluck(:id)
@courses = @subject.courses if @subject.excellent @courses = @subject.courses if @subject.excellent
@members = @subject.subject_members.includes(:user) @members = @subject.subject_members.includes(:user)
@ -456,7 +457,7 @@ class SubjectsController < ApplicationController
end end
end end
def statistics_new def statistics_info
# data = Subjects::DataStatisticService.new(@subject) # data = Subjects::DataStatisticService.new(@subject)
# Rails.logger.info("study_count: #{data.study_count}") # Rails.logger.info("study_count: #{data.study_count}")
# Rails.logger.info("course_study_count: #{ data.course_study_count}") # Rails.logger.info("course_study_count: #{ data.course_study_count}")
@ -470,9 +471,19 @@ class SubjectsController < ApplicationController
# data_2 = Subjects::ShixunUsedInfoService.call(@subject) # data_2 = Subjects::ShixunUsedInfoService.call(@subject)
# Rails.logger.info("study_count: #{data_2}") # Rails.logger.info("study_count: #{data_2}")
data_3 = Subjects::UserUsedInfoService.call(@subject) # data_3 = Subjects::UserUsedInfoService.call(@subject)
Rails.logger.info("study_count: #{data_3}") # Rails.logger.info("study_count: #{data_3}")
render_ok()
@data =
if params[:type] == "shixun_info"
@subject.subject_shixun_infos
elsif params[:type] == "user_info"
@subject.subject_user_infos
else
@subject.subject_course_records
end
@data = paginate custom_sort(@data, params[:sort_by], params[:sort_direction])
end end
def shixun_report def shixun_report

@ -9,18 +9,18 @@ class Users::InterestsController < Users::BaseController
extension = current_user.user_extension || current_user.build_user_extension extension = current_user.user_extension || current_user.build_user_extension
return render_error('请选择职业') unless %w(teacher student professional).include?(identity) return render_error('请选择职业') unless %w(teacher student professional).include?(identity)
interest_ids = Array.wrap(params[:interest_ids]).map(&:to_i) # interest_ids = Array.wrap(params[:interest_ids]).map(&:to_i)
return render_error('请选择兴趣') if interest_ids.blank? # return render_error('请选择兴趣') if interest_ids.blank?
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
extension.update_column(:identity, identity) extension.update_column(:identity, identity)
# 兴趣 # 兴趣
UserInterest.bulk_insert(:user_id, :repertoire_id) do |worker| # UserInterest.bulk_insert(:user_id, :repertoire_id) do |worker|
(Repertoire.pluck(:id) & interest_ids).each do |repertoire_id| # (Repertoire.pluck(:id) & interest_ids).each do |repertoire_id|
worker.add(user_id: current_user.id, repertoire_id: repertoire_id) # worker.add(user_id: current_user.id, repertoire_id: repertoire_id)
end # end
end # end
end end
render_ok render_ok

@ -7,8 +7,8 @@ class ItemBanks::SaveItemForm
validates :sub_discipline_id, presence: true validates :sub_discipline_id, presence: true
validates :item_type, presence: true, inclusion: {in: %W(SINGLE MULTIPLE JUDGMENT COMPLETION SUBJECTIVE PRACTICAL PROGRAM)} validates :item_type, presence: true, inclusion: {in: %W(SINGLE MULTIPLE JUDGMENT COMPLETION SUBJECTIVE PRACTICAL PROGRAM)}
validates :difficulty, presence: true, inclusion: {in: 1..3}, numericality: { only_integer: true } validates :difficulty, presence: true, inclusion: {in: 1..3}, numericality: { only_integer: true }
validates :name, presence: true, length: { maximum: 1000 } validates :name, presence: true, length: { maximum: 1000, too_long: "不能超过1000个字符" }
validates :analysis, length: { maximum: 5000 } validates :analysis, length: { maximum: 1000, too_long: "不能超过1000个字符" }
def validate! def validate!
super super
@ -27,7 +27,7 @@ class ItemBanks::SaveItemForm
attr_accessor :choice_text, :is_answer attr_accessor :choice_text, :is_answer
validates :choice_text, presence: true, length: { maximum: 500 } validates :choice_text, presence: true, length: { maximum: 500, too_long: "不能超过500个字符" }
validates :is_answer, presence: true, inclusion: {in: 0..1}, numericality: { only_integer: true } validates :is_answer, presence: true, inclusion: {in: 0..1}, numericality: { only_integer: true }
end end
end end

@ -530,7 +530,7 @@ module ExercisesHelper
exercise_cha_score = 0.0 exercise_cha_score = 0.0
answer_status = 0 answer_status = 0
# if game.status == 2 && game.final_score >= 0 # if game.status == 2 && game.final_score >= 0
if game.final_score > 0 && game.end_time && game.end_time < exercise_end_time if game.final_score > 0 && (game.end_time.nil? || game.end_time < exercise_end_time)
exercise_cha_score = game.real_score(exercise_cha.question_score) exercise_cha_score = game.real_score(exercise_cha.question_score)
# exercise_cha_score = exercise_cha.question_score #每一关卡的得分 # exercise_cha_score = exercise_cha.question_score #每一关卡的得分
answer_status = 1 answer_status = 1

@ -851,7 +851,8 @@ module ExportHelper
def make_zip_name(work, file_name="") def make_zip_name(work, file_name="")
Rails.logger.info("######################file_name: #{file_name}") Rails.logger.info("######################file_name: #{file_name}")
# name = file_name === "" ? "" : (file_name[0, file_name.rindex('.')]+"_") # name = file_name === "" ? "" : (file_name[0, file_name.rindex('.')]+"_")
"#{work&.homework_common.course&.user_group_name(work.user_id)}_#{work&.user&.student_id}_#{work&.user&.real_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}" course = work.is_a?(StudentWork) ? work&.homework_common&.course : work&.graduation_task&.course
"#{course&.user_group_name(work.user_id)}_#{work&.user&.student_id}_#{work&.user&.real_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
end end
def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[]) def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[])

@ -1,10 +1,10 @@
module SubjectsHelper module SubjectsHelper
# 实训路径的发布状态 # 实训路径的发布状态
def publish_status subject, is_manager, user, shixuns def publish_status subject, is_manager, user
status = -1 status = -1
if is_manager if is_manager
status = 0 if subject.status == 0 && shixuns.count > 0 status = 0 if subject.status == 0
status = 1 if subject.status == 1 status = 1 if subject.status == 1
status = 2 if subject.status == 2 && user.admin? status = 2 if subject.status == 2 && user.admin?
end end

@ -13,7 +13,7 @@ class Discuss < ApplicationRecord
belongs_to :challenge, optional: true belongs_to :challenge, optional: true
validate :validate_sensitive_string validate :validate_sensitive_string
validates :content, length: { maximum: 1000, too_long: "不能超过1000个字符" } validates :content, length: { maximum: 2000, too_long: "不能超过2000个字符" }
after_create :send_tiding after_create :send_tiding

@ -5,5 +5,5 @@ class GraduationWorkScore < ApplicationRecord
belongs_to :graduation_task belongs_to :graduation_task
has_many :attachments, as: :container, dependent: :destroy has_many :attachments, as: :container, dependent: :destroy
validates :comment, length: { maximum: 1000, too_long: "不能超过1000个字符" } validates :comment, length: { maximum: 2000, too_long: "不能超过2000个字符" }
end end

@ -1,6 +1,6 @@
class HackSet < ApplicationRecord class HackSet < ApplicationRecord
validates_length_of :input, maximum: 1000, message: "不能超过5000个字符" validates_length_of :input, maximum: 1000, message: "不能超过1000个字符"
validates_length_of :output, maximum: 1000, message: "不能超过5000个字符" validates_length_of :output, maximum: 1000, message: "不能超过1000个字符"
validates :input, presence: { message: "测试集输入不能为空" } validates :input, presence: { message: "测试集输入不能为空" }
validates :output, presence: { message: "测试集输出不能为空" } validates :output, presence: { message: "测试集输出不能为空" }
validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个测试集的输入不能相同" validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个测试集的输入不能相同"

@ -26,7 +26,7 @@ class JournalsForMessage < ApplicationRecord
# "is_comprehensive_evaluation", # 1 教师评论、2 匿评、3 留言 # "is_comprehensive_evaluation", # 1 教师评论、2 匿评、3 留言
# "hidden", 隐藏、 # "hidden", 隐藏、
validates :notes, length: { maximum: 1000, too_long: "不能超过1000个字符" } validates :notes, length: { maximum: 2000, too_long: "不能超过2000个字符" }
after_create :send_tiding after_create :send_tiding

@ -1,5 +1,5 @@
class MessageDetail < ApplicationRecord class MessageDetail < ApplicationRecord
belongs_to :message, :touch => true belongs_to :message, :touch => true
validates :content, length: { maximum: 5000, too_long: "内容不能超过5000个字符" } validates :content, length: { maximum: 10000, too_long: "内容不能超过10000个字符" }
end end

@ -7,7 +7,7 @@ class StudentWorksScore < ApplicationRecord
has_many :tidings, as: :container, dependent: :destroy has_many :tidings, as: :container, dependent: :destroy
has_many :attachments, as: :container, dependent: :destroy has_many :attachments, as: :container, dependent: :destroy
validates :comment, length: { maximum: 1000, too_long: "不能超过1000个字符" } validates :comment, length: { maximum: 2000, too_long: "不能超过2000个字符" }
scope :shixun_comment, lambda { where(is_ultimate: 0) } scope :shixun_comment, lambda { where(is_ultimate: 0) }

@ -6,7 +6,7 @@ json.subject_score @subject.all_score
json.member_count @subject.member_count json.member_count @subject.member_count
json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin? json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin?
json.publish_status publish_status(@subject, @is_manager, @user, @shixuns) json.publish_status publish_status(@subject, @is_manager, @user)
json.allow_statistics @is_manager json.allow_statistics @is_manager
json.allow_send @user.logged? json.allow_send @user.logged?
json.allow_visit @subject.status > 1 || @is_manager json.allow_visit @subject.status > 1 || @is_manager

@ -0,0 +1,6 @@
json.status 0
json.message "success"
json.data do
json.subject_info @subject.subject_record
json.other_info @data
end

@ -75,7 +75,7 @@ zh-CN:
reference_answer: '参考答案' reference_answer: '参考答案'
student_work: student_work:
description: '内容' description: '内容'
student_work_score: student_works_score:
comment: '评语' comment: '评语'
challenge_work_score: challenge_work_score:
comment: '评语' comment: '评语'

@ -407,7 +407,7 @@ Rails.application.routes.draw do
get 'cancel_publish' get 'cancel_publish'
get 'cancel_has_publish' get 'cancel_has_publish'
get 'statistics' get 'statistics'
get 'statistics_new' get 'statistics_info'
get 'shixun_report' get 'shixun_report'
get 'school_report' get 'school_report'
post 'update_attr' post 'update_attr'

@ -1,6 +1,6 @@
class AddIndexForSubjectRecords < ActiveRecord::Migration[5.2] class AddIndexForSubjectRecords < ActiveRecord::Migration[5.2]
def change def change
remove_index :subject_records, :subject_id # remove_index :subject_records, :subject_id
add_index :subject_records, :subject_id, unique: true add_index :subject_records, :subject_id, unique: true
end end
end end

@ -0,0 +1,50 @@
class Migrate3176ExerciseScore < ActiveRecord::Migration[5.2]
def calculate_student_score(exercise,user)
score5 = 0.0 #实训题
exercise_end_time = exercise.end_time
exercise_questions = exercise.exercise_questions.includes(:exercise_standard_answers,:exercise_shixun_challenges)
exercise_questions.each do |q|
if q.question_type == 5
q.exercise_shixun_challenges.each do |exercise_cha|
game = Game.user_games(user.id,exercise_cha.challenge_id)&.first #当前用户的关卡
if game.present?
exercise_cha_score = 0.0
answer_status = 0
# if game.status == 2 && game.final_score >= 0
if game.final_score > 0 && (game.end_time.nil? || game.end_time < exercise_end_time)
exercise_cha_score = game.real_score(exercise_cha.question_score)
# exercise_cha_score = exercise_cha.question_score #每一关卡的得分
answer_status = 1
end
ex_shixun_answer_content = exercise_cha.exercise_shixun_answers.find_by(user_id:user.id,exercise_question_id:q.id)
if ex_shixun_answer_content.present? && !(ex_shixun_answer_content.score >0) #把关卡的答案存入试卷的实训里
ex_shixun_answer_content.update_attributes!(score:exercise_cha_score.round(1),status:answer_status)
end
score5 += exercise_cha_score
else
score5 += 0.0
end
end
end
end
score5
end
def change
exercise = Exercise.find_by(id: 3176)
if exercise
exercise_users = exercise.exercise_users.where("start_at is not null")
exercise_users.each do |exercise_user|
calculate_score = calculate_student_score(exercise, exercise_user.user)
subjective_score = exercise_user.subjective_score
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
total_score = calculate_score + total_score_subjective_score
if exercise_user.end_at.present?
exercise_user.update_attributes!(score:total_score,objective_score:calculate_score)
end
puts exercise_user.id
end
end
end
end

@ -0,0 +1,49 @@
class Migrate3517ExerciseScore < ActiveRecord::Migration[5.2]
def calculate_student_score(exercise,user)
score5 = 0.0 #实训题
exercise_end_time = exercise.end_time
exercise_questions = exercise.exercise_questions.includes(:exercise_standard_answers,:exercise_shixun_challenges)
exercise_questions.each do |q|
if q.question_type == 5
q.exercise_shixun_challenges.each do |exercise_cha|
game = Game.user_games(user.id,exercise_cha.challenge_id)&.first #当前用户的关卡
if game.present?
exercise_cha_score = 0.0
answer_status = 0
# if game.status == 2 && game.final_score >= 0
if game.final_score > 0 && (game.end_time.nil? || game.end_time < exercise_end_time)
exercise_cha_score = game.real_score(exercise_cha.question_score)
# exercise_cha_score = exercise_cha.question_score #每一关卡的得分
answer_status = 1
end
ex_shixun_answer_content = exercise_cha.exercise_shixun_answers.find_by(user_id:user.id,exercise_question_id:q.id)
if ex_shixun_answer_content.present? && !(ex_shixun_answer_content.score >0) #把关卡的答案存入试卷的实训里
ex_shixun_answer_content.update_attributes!(score:exercise_cha_score.round(1),status:answer_status)
end
score5 += exercise_cha_score
else
score5 += 0.0
end
end
end
end
score5
end
def change
exercise = Exercise.find_by(id: 3517)
if exercise
exercise_users = exercise.exercise_users.where("start_at is not null")
exercise_users.each do |exercise_user|
calculate_score = calculate_student_score(exercise, exercise_user.user)
subjective_score = exercise_user.subjective_score
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
total_score = calculate_score + total_score_subjective_score
if exercise_user.end_at.present?
exercise_user.update_attributes!(score:total_score,objective_score:calculate_score)
end
puts exercise_user.id
end
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

@ -1269,7 +1269,7 @@ input.knowledge_frame{height:28px;line-height:28px;border:none;background:#f3f5f
.-relative { position: relative;} .-relative { position: relative;}
.-bg-white { background-color: #eee;} .-bg-white { background-color: #eee;}
.split-panel.-handle .split-panel--second { padding-left: 2px;} .split-panel.-handle .split-panel--second { padding-left: 2px;}
.split-panel--second { overflow: hidden;} /* .split-panel--second { overflow: hidden;} */
.task-answer-view { position: absolute; top: 0; right: 0; bottom: 0;left: 0; display: flex; .task-answer-view { position: absolute; top: 0; right: 0; bottom: 0;left: 0; display: flex;
flex-direction: column; border-top: 1px solid #515151;} flex-direction: column; border-top: 1px solid #515151;}
.-vertical { flex-direction: column;box-flex-direction: column;-webkit-flex-direction: column;} .-vertical { flex-direction: column;box-flex-direction: column;-webkit-flex-direction: column;}

@ -145,7 +145,7 @@ input.knowledge_frame{height:28px;line-height:28px;border:none;background:#f3f5f
.-relative { position: relative;} .-relative { position: relative;}
.-bg-white { background-color: #eee;} .-bg-white { background-color: #eee;}
.split-panel.-handle .split-panel--second { padding-left: 2px;} .split-panel.-handle .split-panel--second { padding-left: 2px;}
.split-panel--second { overflow: hidden;} /* .split-panel--second { overflow: hidden;} */
.task-answer-view { position: absolute; top: 0; right: 0; bottom: 0;left: 0; display: flex; .task-answer-view { position: absolute; top: 0; right: 0; bottom: 0;left: 0; display: flex;
flex-direction: column; border-top: 1px solid #515151;} flex-direction: column; border-top: 1px solid #515151;}
.-vertical { flex-direction: column;box-flex-direction: column;-webkit-flex-direction: column;} .-vertical { flex-direction: column;box-flex-direction: column;-webkit-flex-direction: column;}

@ -42,14 +42,14 @@ if (isDev) {
// 老师 // 老师
//debugType="teacher"; //debugType="teacher";
// 学生 // 学生
debugType="student"; //debugType="student";
function railsgettimes(proxy) { function railsgettimes(proxy) {
if(timestamp&&checkSubmitFlg===false){ if(timestamp&&checkSubmitFlg===false){
$.ajax({url:proxy,async:false,success:function(data){ $.ajax({url:proxy,async:false,success:function(data){
if(data.status===0){ if(data.status===0){
timestamp=data.data.t; timestamp=data.message;
} }
}}) }})
checkSubmitFlg=true checkSubmitFlg=true
@ -59,7 +59,7 @@ debugType="student";
}else if(checkSubmitFlg===false){ }else if(checkSubmitFlg===false){
$.ajax({url:proxy,async:false,success:function(data){ $.ajax({url:proxy,async:false,success:function(data){
if(data.status===0){ if(data.status===0){
timestamp=data.data.t; timestamp=data.message;
} }
}}) }})
checkSubmitFlg=true checkSubmitFlg=true
@ -127,7 +127,8 @@ export function initAxiosInterceptors(props) {
if (window.location.port === "3007") { if (window.location.port === "3007") {
// let timestamp=railsgettimes(proxy); // let timestamp=railsgettimes(proxy);
// console.log(timestamp) // console.log(timestamp)
railsgettimes(`http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`); // `https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`
railsgettimes( `${proxy}/api/main/first_stamp.json`);
let newopens=md5(opens+timestamp) let newopens=md5(opens+timestamp)
config.url = `${proxy}${url}`; config.url = `${proxy}${url}`;
if (config.url.indexOf('?') == -1) { if (config.url.indexOf('?') == -1) {
@ -137,7 +138,9 @@ export function initAxiosInterceptors(props) {
} }
} else { } else {
// 加api前缀 // 加api前缀
railsgettimes(`http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`); // railsgettimes(`http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`);
railsgettimes( `/api/main/first_stamp.json`);
let newopens=md5(opens+timestamp) let newopens=md5(opens+timestamp)
config.url = url; config.url = url;
if (config.url.indexOf('?') == -1) { if (config.url.indexOf('?') == -1) {

@ -79,20 +79,26 @@ let newtimestamp;
let checkSubmitFlgs = false; let checkSubmitFlgs = false;
function railsgettimess(proxy) { function railsgettimess(proxy) {
if(checkSubmitFlgs===false){ if(checkSubmitFlgs===false){
$.ajax({url:proxy,async:false,success:function(data){ $.ajax({url:proxy,
async:false,success:function(data){
if(data.status===0){ if(data.status===0){
newtimestamp=data.data.t; newtimestamp=data.message;
checkSubmitFlgs = true;
} }
}}) }})
checkSubmitFlgs=true
window.setTimeout(function () { window.setTimeout(function () {
checkSubmitFlgs=false; checkSubmitFlgs=false;
}, 2500); }, 2500);
} }
} }
export function Railsgettimes() { export function Railsgettimes() {
railsgettimess(`http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`); railsgettimess(`${getUrl()}/api/main/first_stamp.json`);
// railsgettimess(`https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`);
} }
export function getUploadActionUrl(path, goTest) { export function getUploadActionUrl(path, goTest) {
@ -120,7 +126,7 @@ export function getUploadActionUrlOfAuth(id) {
} }
export function getRandomNumber(type) { export function getRandomNumber(type) {
Railsgettimes() Railsgettimes()
let anewopens=md5(newopens+newtimestamp); let anewopens=md5(newopens+newtimestamp);
return type===true?`randomcode=${newtimestamp}&client_key=${anewopens}`:`?randomcode=${newtimestamp}&client_key=${anewopens}` return type===true?`randomcode=${newtimestamp}&client_key=${anewopens}`:`?randomcode=${newtimestamp}&client_key=${anewopens}`
} }

@ -1,5 +1,5 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import { ConditionToolTip } from 'educoder' import { ConditionToolTip,getRandomNumber } from 'educoder'
class AttachmentsList extends Component{ class AttachmentsList extends Component{
constructor(props){ constructor(props){
@ -15,9 +15,9 @@ class AttachmentsList extends Component{
<p key={key} className="clearfix mb3"> <p key={key} className="clearfix mb3">
<a className="color-grey fl"> <a className="color-grey fl">
<i className="font-14 color-green iconfont icon-fujian mr8"></i> <i className="font-14 color-green iconfont icon-fujian mr8"></i>
</a> </a>
<ConditionToolTip title={item.title} condition={item.title && item.title.length > 30 }> <ConditionToolTip title={item.title} condition={item.title && item.title.length > 30 }>
<a href={item.url} className="mr12 fl task-hide" length="58" target={ item.is_pdf && item.is_pdf == true ? "_blank" : "_self" } style={{"maxWidth":"432px"}}>{item.title}</a> <a href={item.url+getRandomNumber()} className="mr12 fl task-hide" length="58" target={ item.is_pdf && item.is_pdf == true ? "_blank" : "_self" } style={{"maxWidth":"432px"}}>{item.title}</a>
</ConditionToolTip> </ConditionToolTip>
<span className="color-grey mt2 color-grey-6 font-12">{item.filesize}</span> <span className="color-grey mt2 color-grey-6 font-12">{item.filesize}</span>
</p> </p>

@ -3,22 +3,23 @@
// export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil'; // export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil';
export { getImageUrl as getImageUrl, getRandomNumber as getRandomNumber,getUrl as getUrl, publicSearchs as publicSearchs,getRandomcode as getRandomcode,getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl export { getImageUrl as getImageUrl, getRandomNumber as getRandomNumber,getUrl as getUrl, publicSearchs as publicSearchs,getRandomcode as getRandomcode,getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl
, getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo ,getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth , getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo ,getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
, getTaskUrlById as getTaskUrlById, TEST_HOST ,htmlEncode as htmlEncode ,getupload_git_file as getupload_git_file} from './UrlTool'; , getTaskUrlById as getTaskUrlById, TEST_HOST ,htmlEncode as htmlEncode ,getupload_git_file as getupload_git_file} from './UrlTool';
export {setmiyah as setmiyah} from './Component'; export {setmiyah as setmiyah} from './Component';
export { default as queryString } from './UrlTool2'; export { default as queryString } from './UrlTool2';
export { SnackbarHOC as SnackbarHOC } from './SnackbarHOC'; export { SnackbarHOC as SnackbarHOC } from './SnackbarHOC';
export { trigger as trigger, on as on, off as off export { trigger as trigger, on as on, off as off
, broadcastChannelPostMessage, broadcastChannelOnmessage } from './EventUtil'; , broadcastChannelPostMessage, broadcastChannelOnmessage } from './EventUtil';
export { updatePageParams as updatePageParams } from './RouterUtil'; export { updatePageParams as updatePageParams } from './RouterUtil';
export { bytesToSize as bytesToSize } from './UnitUtil'; export { bytesToSize as bytesToSize } from './UnitUtil';
export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension, export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension,
downloadFile, sortDirections } from './TextUtil' downloadFile, sortDirections } from './TextUtil'
export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil' export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil'
export { configShareForIndex, configShareForPaths, configShareForShixuns, configShareForCourses, configShareForCustom } from './util/ShareUtil' export { configShareForIndex, configShareForPaths, configShareForShixuns, configShareForCourses, configShareForCustom } from './util/ShareUtil'
@ -30,7 +31,7 @@ export { toStore as toStore, fromStore as fromStore } from './Store'
export { trace_collapse, trace, debug, info, warn, error, trace_c, debug_c, info_c, warn_c, error_c } from './LogUtil' export { trace_collapse, trace, debug, info, warn, error, trace_c, debug_c, info_c, warn_c, error_c } from './LogUtil'
export { EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER export { EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER
, EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const' , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const'
export { default as AttachmentList } from './components/attachment/AttachmentList' export { default as AttachmentList } from './components/attachment/AttachmentList'

@ -1,7 +1,7 @@
/* /*
* @Description: quill 编辑器 * @Description: quill 编辑器
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2019-12-18 08:49:30 * @Date: 2019-12-18 08:49:30
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-11 13:43:31 * @LastEditTime : 2020-01-11 13:43:31
@ -57,7 +57,7 @@ function QuillForEditor ({
{size: ['12px', '14px', '16px', '18px', '20px']}, {size: ['12px', '14px', '16px', '18px', '20px']},
{align: []}, {list: 'ordered'}, {list: 'bullet'}, // 列表 {align: []}, {list: 'ordered'}, {list: 'bullet'}, // 列表
{script: 'sub'}, {script: 'super'}, {script: 'sub'}, {script: 'super'},
{ 'color': [] }, { 'background': [] }, { 'color': [] }, { 'background': [] },
{header: [1,2,3,4,5,false]}, {header: [1,2,3,4,5,false]},
'blockquote', 'code-block', 'blockquote', 'code-block',
'link', 'image', 'video', 'link', 'image', 'video',
@ -67,7 +67,7 @@ function QuillForEditor ({
const editorRef = useRef(null); const editorRef = useRef(null);
// quill 实例 // quill 实例
const [quill, setQuill] = useState(null); const [quill, setQuill] = useState(null);
const [selection, setSelection] = useState(null); const [selection, setSelection] = useState(null);
const [fillCount, setFillCount] = useState(0); const [fillCount, setFillCount] = useState(0);
const [quillCtx, setQuillCtx] = useState({}); const [quillCtx, setQuillCtx] = useState({});
@ -77,7 +77,7 @@ function QuillForEditor ({
// getQuillContent && getQuillContent(quill); // getQuillContent && getQuillContent(quill);
onContentChange && onContentChange(content, quill); onContentChange && onContentChange(content, quill);
}; };
const renderOptions = options || defaultConfig; const renderOptions = options || defaultConfig;
const bindings = { const bindings = {
@ -90,10 +90,10 @@ function QuillForEditor ({
backspace: { backspace: {
key: 'Backspace', key: 'Backspace',
/** /**
* @param {*} range * @param {*} range
* { index, // 删除元素的位置 * { index, // 删除元素的位置
* length // 删除元素的个数, 当删除一个时, length=0 其它等于删除的元素的个数 * length // 删除元素的个数, 当删除一个时, length=0 其它等于删除的元素的个数
* } * }
* @param {*} context 上下文 * @param {*} context 上下文
*/ */
handler: function (range, context) { handler: function (range, context) {
@ -120,7 +120,7 @@ function QuillForEditor ({
// } else { // } else {
// return false; // return false;
// } // }
return true; return true;
} }
} }
}; };
@ -178,7 +178,7 @@ function QuillForEditor ({
onClick: showUploadImage, onClick: showUploadImage,
width, width,
height height
}); });
} }
} }
}); });
@ -196,19 +196,19 @@ function QuillForEditor ({
// 1. 获取编辑器内容 // 1. 获取编辑器内容
}); });
// TODO // TODO
/** /**
* 1.获取键盘删除事件 * 1.获取键盘删除事件
* 2.点击时获取删除的叶子节点 getLeaf(range.index) * 2.点击时获取删除的叶子节点 getLeaf(range.index)
*/ */
}, []); }, []);
// 设置值 // 设置值
useEffect(() => { useEffect(() => {
if (!quill) return if (!quill) return
const previous = quill.getContents() const previous = quill.getContents()
if (value && value.hasOwnProperty('ops')) { if (value && value.hasOwnProperty('ops')) {
// console.log(value.ops); // console.log(value.ops);
const ops = value.ops || []; const ops = value.ops || [];
@ -222,7 +222,8 @@ function QuillForEditor ({
const current = value const current = value
if (!deepEqual(previous, current)) { if (!deepEqual(previous, current)) {
setSelection(quill.getSelection()) setSelection(quill.getSelection())
if (typeof value === 'string') { if (typeof value === 'string' && value) {
// debugger
quill.clipboard.dangerouslyPasteHTML(value, 'api'); quill.clipboard.dangerouslyPasteHTML(value, 'api');
if (autoFocus) { if (autoFocus) {
quill.focus(); quill.focus();
@ -256,7 +257,7 @@ function QuillForEditor ({
if (typeof handleOnChange !== 'function') return; if (typeof handleOnChange !== 'function') return;
let handler; let handler;
quill.on( quill.on(
'text-change', 'text-change',
(handler = (delta, oldDelta, source) => { (handler = (delta, oldDelta, source) => {
const _ctx = quill.getContents(); const _ctx = quill.getContents();
setQuillCtx(_ctx); setQuillCtx(_ctx);

@ -32,7 +32,7 @@ import _ from 'lodash'
import TPIContext from './TPIContext' import TPIContext from './TPIContext'
import { EDU_ADMIN, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER import { EDU_ADMIN, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER
, EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL, EDU_BUSINESS, CNotificationHOC } from 'educoder' , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL, EDU_BUSINESS, CNotificationHOC ,getRandomNumber} from 'educoder'
import { MuiThemeProvider, createMuiTheme, withStyles } from 'material-ui/styles'; import { MuiThemeProvider, createMuiTheme, withStyles } from 'material-ui/styles';
import MUIDialogStyleUtil from '../modules/page/component/MUIDialogStyleUtil' import MUIDialogStyleUtil from '../modules/page/component/MUIDialogStyleUtil'
@ -176,7 +176,7 @@ class TPIContextProvider extends Component {
testPath = 'http://test-newweb.educoder.net' testPath = 'http://test-newweb.educoder.net'
} }
// var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time` // var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time`
var url = `${testPath}/api/tasks/${ game.identifier }/cost_time` var url = `${testPath}/api/tasks/${ game.identifier }/cost_time${getRandomNumber()}`
window.$.ajax({ window.$.ajax({
type: 'get', type: 'get',
url: url, url: url,

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table,Badge} from 'antd'; import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table,Badge} from 'antd';
import {markdownToHTML,getImageUrl} from 'educoder'; import {markdownToHTML,getImageUrl,getRandomNumber} from 'educoder';
import axios from 'axios'; import axios from 'axios';
const { Content } = Layout; const { Content } = Layout;
@ -69,7 +69,7 @@ class CompetitionContents extends Component{
const operations = <div> const operations = <div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button> <Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost> <Button className={"fr mr20"} type="primary" ghost>
<a onClick={()=>this.derivefun(`/competitions/${this.props.match.params.identifier}/charts.xlsx`)}>导出</a> <a onClick={()=>this.derivefun(`/competitions/${this.props.match.params.identifier}/charts.xlsx?${getRandomNumber(true)}`)}>导出</a>
</Button> </Button>
</div> </div>
const columns = [ const columns = [

@ -1,10 +1,10 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { SnackbarHOC } from 'educoder'; import { getRandomNumber } from 'educoder';
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
import Loadable from 'react-loadable'; import Loadable from 'react-loadable';
import Loading from '../../../Loading'; import Loading from '../../../Loading';
import { WordsBtn, MarkdownToHtml, trigger, queryString, downloadFile } from 'educoder'; import { WordsBtn, MarkdownToHtml, trigger, queryString, getRandomcode } from 'educoder';
import axios from 'axios'; import axios from 'axios';
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import AccessoryModal from "../coursesPublic/AccessoryModal"; import AccessoryModal from "../coursesPublic/AccessoryModal";
@ -125,7 +125,7 @@ class CommonWorkDetailIndex extends Component{
}) })
} }
}else { }else {
this.props.slowDownload(url) this.props.slowDownload(getRandomcode(url))
// this.props.showNotification(`正在下载中`); // this.props.showNotification(`正在下载中`);
// this.setState({ donwloading: true }) // this.setState({ donwloading: true })
@ -206,7 +206,7 @@ class CommonWorkDetailIndex extends Component{
} }
const isAdmin = this.props.isAdmin() const isAdmin = this.props.isAdmin()
let exportParams = {} let exportParams = {}
const isListModule = childModuleName == '作品列表'; const isListModule = childModuleName == '作品列表';
// 是列表页 // 是列表页
@ -221,10 +221,10 @@ class CommonWorkDetailIndex extends Component{
// console.log(params); // console.log(params);
let exportUrl = `/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}` let exportUrl = `/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}`
let exportResultUrl = `/homework_commons/${workId}/works_list.xlsx?${queryString.stringify(params)}` let exportResultUrl = `/homework_commons/${workId}/works_list.xlsx?${queryString.stringify(params)}`
document.title=course_name === undefined ? "" : course_name; document.title=course_name === undefined ? "" : course_name;
return ( return (
<div> <div>
<PublishRightnow ref={this.publishModal} showActionButton={false} {...this.props} checkBoxValues={[workId]} <PublishRightnow ref={this.publishModal} showActionButton={false} {...this.props} checkBoxValues={[workId]}
isPublish={true} doWhenSuccess={this.doWhenSuccess} checkBeforePost={this.saveWorkSetting} isPublish={true} doWhenSuccess={this.doWhenSuccess} checkBeforePost={this.saveWorkSetting}
onToPublishClick={this.onToPublishClick} onToPublishClick={this.onToPublishClick}
></PublishRightnow> ></PublishRightnow>
@ -234,8 +234,8 @@ class CommonWorkDetailIndex extends Component{
modalCancel={this.Downloadcal} modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType} modalsType={this.state.DownloadType}
/> />
<PublishRightnow ref={this.endModal} showActionButton={false} {...this.props} checkBoxValues={[workId]} <PublishRightnow ref={this.endModal} showActionButton={false} {...this.props} checkBoxValues={[workId]}
isPublish={false} doWhenSuccess={this.doWhenSuccess}></PublishRightnow> isPublish={false} doWhenSuccess={this.doWhenSuccess}></PublishRightnow>
<div className="newMain clearfix worklist1"> <div className="newMain clearfix worklist1">
@ -266,7 +266,7 @@ class CommonWorkDetailIndex extends Component{
typelist={homework_status} typelist={homework_status}
typesylename={"mt12"} typesylename={"mt12"}
/> />
{category && <a className="color-grey-6 fr font-16 ml30 mt5 mr20" onClick={this.goback} style={{ marginRight: '26px'}}>返回</a>} {category && <a className="color-grey-6 fr font-16 ml30 mt5 mr20" onClick={this.goback} style={{ marginRight: '26px'}}>返回</a>}
@ -293,24 +293,24 @@ class CommonWorkDetailIndex extends Component{
{ noTab !== true && <div className="stud-class-set bor-bottom-greyE floatSpinParent"> { noTab !== true && <div className="stud-class-set bor-bottom-greyE floatSpinParent">
<div className="mt10 clearfix edu-back-white poll_list pl5"> <div className="mt10 clearfix edu-back-white poll_list pl5">
<Link <Link
onClick={() => this.setState({moduleName: '作品列表'})} onClick={() => this.setState({moduleName: '作品列表'})}
className={`${isListModule ? 'active' : '' } `} className={`${isListModule ? 'active' : '' } `}
to={`/courses/${courseId}/${moduleEngName}/${workId}/list`}>作品列表</Link> to={`/courses/${courseId}/${moduleEngName}/${workId}/list`}>作品列表</Link>
<Link <Link
onClick={() => this.setState({moduleName: '作业描述'})} onClick={() => this.setState({moduleName: '作业描述'})}
className={`${childModuleName == '作业描述' ? 'active' : '' } `} className={`${childModuleName == '作业描述' ? 'active' : '' } `}
to={`/courses/${courseId}/${moduleEngName}/${workId}/question`}>作业描述</Link> to={`/courses/${courseId}/${moduleEngName}/${workId}/question`}>作业描述</Link>
{view_answer == true && <Link {view_answer == true && <Link
onClick={() => this.setState({moduleName: '参考答案'})} onClick={() => this.setState({moduleName: '参考答案'})}
className={`${childModuleName == '参考答案' ? 'active' : '' } `} className={`${childModuleName == '参考答案' ? 'active' : '' } `}
to={`/courses/${courseId}/${moduleEngName}/${workId}/answer`}>参考答案</Link>} to={`/courses/${courseId}/${moduleEngName}/${workId}/answer`}>参考答案</Link>}
<Link <Link
onClick={() => this.setState({moduleName: '设置'})} onClick={() => this.setState({moduleName: '设置'})}
className={`${childModuleName == '设置' ? 'active' : '' } `} className={`${childModuleName == '设置' ? 'active' : '' } `}
style={{paddingLeft:this.props.isAdmin()?'38px':'20px'}} style={{paddingLeft:this.props.isAdmin()?'38px':'20px'}}
to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"}</Link> to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"}</Link>
{/* { this.props.tabRightComponents } */} {/* { this.props.tabRightComponents } */}
<React.Fragment> <React.Fragment>
@ -365,16 +365,16 @@ class CommonWorkDetailIndex extends Component{
{isAdmin && <a className={"fr color-blue font-16"} onClick={() => this.props.toEditPage(this.props.match.params, workId)}>编辑作业</a>} {isAdmin && <a className={"fr color-blue font-16"} onClick={() => this.props.toEditPage(this.props.match.params, workId)}>编辑作业</a>}
{ // { //
work_statuses && work_statuses.indexOf('关联项目') != -1 && work_statuses && work_statuses.indexOf('关联项目') != -1 &&
<React.Fragment> <React.Fragment>
<ConnectProject ref="connectProject" {...this.props} connectSuccess={this.connectSuccess}></ConnectProject> <ConnectProject ref="connectProject" {...this.props} connectSuccess={this.connectSuccess}></ConnectProject>
<WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.openConnectionProject({ homework_id: workId })}>关联项目</WordsBtn> <WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.openConnectionProject({ homework_id: workId })}>关联项目</WordsBtn>
<WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.props.toCreateProject()}>创建项目</WordsBtn> <WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.props.toCreateProject()}>创建项目</WordsBtn>
</React.Fragment> </React.Fragment>
} }
{ // { //
work_statuses && work_statuses.indexOf('取消关联') != -1 && work_statuses && work_statuses.indexOf('取消关联') != -1 &&
<WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.cancelConnectionProject( {homework_id: workId} )}>取消关联</WordsBtn> <WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.cancelConnectionProject( {homework_id: workId} )}>取消关联</WordsBtn>
} }
@ -390,7 +390,7 @@ class CommonWorkDetailIndex extends Component{
{work_statuses && work_statuses.indexOf('修改作品') != -1 && <a className={"fr color-blue font-16"} href={"javascript:void(0)"} {work_statuses && work_statuses.indexOf('修改作品') != -1 && <a className={"fr color-blue font-16"} href={"javascript:void(0)"}
onClick={() => { this.props.toWorkPostPage(this.props.match.params, null, true, work_id)}} onClick={() => { this.props.toWorkPostPage(this.props.match.params, null, true, work_id)}}
>修改作品</a>} >修改作品</a>}
{work_statuses && work_statuses.indexOf('补交附件') != -1 && {work_statuses && work_statuses.indexOf('补交附件') != -1 &&
<React.Fragment> <React.Fragment>
<AccessoryModal <AccessoryModal
{...this.props} {...this.props}
@ -406,7 +406,7 @@ class CommonWorkDetailIndex extends Component{
onClick={this.addAccessory} onClick={this.addAccessory}
>补交附件</a> >补交附件</a>
</React.Fragment> </React.Fragment>
} }
</React.Fragment> </React.Fragment>
@ -415,7 +415,7 @@ class CommonWorkDetailIndex extends Component{
{/* 内容区 */} {/* 内容区 */}
<Switch {...this.props}> <Switch {...this.props}>
{/* --------------------------------------------------------------------- */} {/* --------------------------------------------------------------------- */}
{/* 作业设置 */} {/* 作业设置 */}
@ -474,7 +474,7 @@ class CommonWorkDetailIndex extends Component{
</div> </div>
</div> </div>
</div> </div>
) )
} }
} }

@ -978,10 +978,8 @@ class CommonWorkSetting extends Component{
let exportUrl = `/api/homework_commons/${workId}/works_list.zip` let exportUrl = `/api/homework_commons/${workId}/works_list.zip`
const exportResultUrl = `/api/homework_commons/${workId}/works_list.xlsx` const exportResultUrl = `/api/homework_commons/${workId}/works_list.xlsx`
const noAuth = !isAdmin || !startEditFlag; const noAuth = !isAdmin || !startEditFlag;
return(
return(
<React.Fragment> <React.Fragment>
<Modals <Modals
modalsType={Modalstype} modalsType={Modalstype}
@ -1222,7 +1220,7 @@ class CommonWorkSetting extends Component{
<Checkbox className="ml30" checked={anonymous_comment} onChange={this.anonymous_comment_change} <Checkbox className="ml30" checked={anonymous_comment} onChange={this.anonymous_comment_change}
disabled={noAuth || moment(init_evaluation_start) < moment()} disabled={noAuth || moment(init_evaluation_start) < moment()}
>启用匿评</Checkbox> >启用匿评</Checkbox>
<span className={"font-14 color-grey-9"}>作品数量2可以开启匿评</span> <span className={"font-14 color-grey-9"}>{this.state.category&&this.state.category.category_name==="普通作业"?"作品数量≥2个可以开启匿评":"提交作品的分组数量≥2个可以开启匿评"}</span>
</div> </div>
{/* 开启时间 */} {/* 开启时间 */}
<div className={"h20 mb30 ml60"}> <div className={"h20 mb30 ml60"}>

@ -1,7 +1,7 @@
import React,{Component} from "react"; import React,{Component} from "react";
import { Form, Select, Input, Button,Checkbox,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip} from "antd"; import { Form, Select, Input, Button,Checkbox,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip} from "antd";
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import { WordsBtn, MarkdownToHtml } from 'educoder'; import { WordsBtn, getRandomcode } from 'educoder';
import axios from 'axios'; import axios from 'axios';
import PublishRightnow from '../PublishRightnow' import PublishRightnow from '../PublishRightnow'
import AccessoryModal from "../../coursesPublic/AccessoryModal"; import AccessoryModal from "../../coursesPublic/AccessoryModal";
@ -44,7 +44,7 @@ class TabRightComponents extends Component{
} }
/// 确认是否下载 /// 确认是否下载
confirmysl(url){ confirmysl(url){
axios.get(url + '?export=true' ).then((response) => { axios.get(url + '&export=true' ).then((response) => {
if(response.data.status&&response.data.status===-1){ if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.data.status&&response.data.status===-2){
@ -63,7 +63,7 @@ class TabRightComponents extends Component{
}) })
} }
}else { }else {
this.props.slowDownload(url); this.props.slowDownload(getRandomcode(url));
// this.props.showNotification(`正在下载中`); // this.props.showNotification(`正在下载中`);
// window.open("/api"+url, '_blank'); // window.open("/api"+url, '_blank');
} }
@ -108,9 +108,8 @@ class TabRightComponents extends Component{
const isAdmin = this.props.isAdmin() const isAdmin = this.props.isAdmin()
const isSuperAdmin = this.props.isSuperAdmin() const isSuperAdmin = this.props.isSuperAdmin()
let exportUrl = `/api/homework_commons/${workId}/works_list.zip` let exportUrls = `/api/homework_commons/${workId}/works_list.zip`
const exportResultUrl = `/api/homework_commons/${workId}/works_list.xlsx` const exportResultUrls = `/api/homework_commons/${workId}/works_list.xlsx`
return( return(
<React.Fragment> <React.Fragment>
{isAdmin ? {isAdmin ?
@ -150,8 +149,8 @@ class TabRightComponents extends Component{
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mt20" style={{"padding":"0 20px"}}> {this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mt20" style={{"padding":"0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}> <ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a onClick={(url)=>this.confirmysl(exportResultUrl)} className="color-dark">导出成绩</a></li> <li><a onClick={(url)=>this.confirmysl(exportResultUrls)} className="color-dark">导出成绩</a></li>
<li><a onClick={(url)=>this.confirmysl(exportUrl)} className="color-dark">导出作品附件</a></li> <li><a onClick={(url)=>this.confirmysl(exportUrls)} className="color-dark">导出作品附件</a></li>
</ul> </ul>
</li>:""} </li>:""}

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table,Badge} from 'antd'; import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table,Badge} from 'antd';
import {markdownToHTML,getImageUrl} from 'educoder'; import {markdownToHTML,getImageUrl,getRandomNumber} from 'educoder';
import axios from 'axios'; import axios from 'axios';
const { Content } = Layout; const { Content } = Layout;
@ -69,7 +69,7 @@ class CompetitionContents extends Component{
const operations = <div> const operations = <div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button> <Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost> <Button className={"fr mr20"} type="primary" ghost>
<a onClick={()=>this.derivefun(`/competitions/${this.props.match.params.identifier}/charts.xlsx`)}>导出</a> <a onClick={()=>this.derivefun(`/competitions/${this.props.match.params.identifier}/charts.xlsx?${getRandomNumber(true)}`)}>导出</a>
</Button> </Button>
</div> </div>
const columns = [ const columns = [

@ -549,6 +549,10 @@ class Coursesleftnav extends Component{
window.location.href=`/courses/${coursesId}/boards/${result.data.category_id}`; window.location.href=`/courses/${coursesId}/boards/${result.data.category_id}`;
} }
if(positiontype!="course_groups"){
this.updasaveNavmoda()
}
if(positiontype==="course_groups"){ if(positiontype==="course_groups"){
window.location.href=`/courses/${coursesId}/course_groups/${result.data.group_id}`; window.location.href=`/courses/${coursesId}/course_groups/${result.data.group_id}`;
} }

@ -1,7 +1,7 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import {Checkbox,Input,Table, Pagination,Menu,Spin} from "antd"; import {Checkbox,Input,Table, Pagination,Menu,Spin} from "antd";
import {Link,NavLink} from 'react-router-dom'; import {Link,NavLink} from 'react-router-dom';
import { WordsBtn ,ActionBtn,queryString,getRandomcode} from 'educoder'; import { WordsBtn ,getRandomNumber,queryString,getRandomcode} from 'educoder';
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import '../css/members.css'; import '../css/members.css';
import '../css/busyWork.css'; import '../css/busyWork.css';
@ -175,9 +175,9 @@ class Testpapersettinghomepage extends Component{
if(child!=undefined){ if(child!=undefined){
params =child._getRequestParams()!==undefined?child._getRequestParams():{}; params =child._getRequestParams()!==undefined?child._getRequestParams():{};
} }
console.log("170");
console.log(params); const urll=url+`?${queryString.stringify(params)}`;
const urll=url+`?${queryString.stringify(params)}`;
axios.get(urll+ '&export=true').then((response) => { axios.get(urll+ '&export=true').then((response) => {
if(response===undefined){ if(response===undefined){
return return
@ -200,7 +200,7 @@ class Testpapersettinghomepage extends Component{
}) })
} }
}else { }else {
this.props.slowDownload(urll) this.props.slowDownload(getRandomcode(urll))
// this.setState({ donwloading: true }) // this.setState({ donwloading: true })
// downloadFile({ // downloadFile({
// url: urll, // url: urll,

@ -32,8 +32,8 @@ class Bullsubdirectory extends Component{
} }
componentDidMount() { componentDidMount() {
console.log("获取到数据"); // console.log("获取到数据");
console.log(this.props); // console.log(this.props);
let{id,myname,mydescription,index,item} =this.props let{id,myname,mydescription,index,item} =this.props
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
id:id, id:id,

@ -30,8 +30,8 @@ class Eduinforms extends Component{
} }
componentDidMount() { componentDidMount() {
console.log("Eduinformss"); // console.log("Eduinformss");
console.log("获取到数据"); // console.log("获取到数据");
// console.log(this.props); // console.log(this.props);
const query = this.props.location.search; const query = this.props.location.search;
// const type = query.split('?chinaoocTimestamp='); // const type = query.split('?chinaoocTimestamp=');

@ -1,5 +1,5 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {getRandomNumber,queryString} from 'educoder'; import {getRandomNumber} from 'educoder';
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import {Tooltip,Menu} from 'antd'; import {Tooltip,Menu} from 'antd';
import Loadable from 'react-loadable'; import Loadable from 'react-loadable';
@ -313,15 +313,18 @@ class GraduationTaskDetail extends Component{
} }
CodeReview=()=>{ CodeReview=()=>{
let newgetRandomNumber=getRandomNumber(true);
console.log(newgetRandomNumber)
this.props.showNotification("正在导出中..."); this.props.showNotification("正在导出中...");
if(newgetRandomNumber){
const task_Id = this.props.match.params.task_Id; const task_Id = this.props.match.params.task_Id;
window.open(`/api/graduation_tasks/${task_Id}/sonar? window.open(`/api/graduation_tasks/${task_Id}/sonar?
${this.state.taskdatas.teacher_comment===undefined||this.state.taskdatas.teacher_comment===null?"":"teacher_comment="+this.state.taskdatas.teacher_comment} ${this.state.taskdatas.teacher_comment===undefined||this.state.taskdatas.teacher_comment===null?"":"teacher_comment="+this.state.taskdatas.teacher_comment+"&"}
${this.state.taskdatas.task_status===undefined||this.state.taskdatas.task_status===null?"":"&task_status="+this.state.taskdatas.task_status} ${this.state.taskdatas.task_status===undefined||this.state.taskdatas.task_status===null?"":"task_status="+this.state.taskdatas.task_status+"&"}
${this.state.taskdatas.course_group===undefined||this.state.taskdatas.course_group===null?"":"&course_group="+this.state.taskdatas.course_group} ${this.state.taskdatas.course_group===undefined||this.state.taskdatas.course_group===null?"":"course_group="+this.state.taskdatas.course_group+"&"}
${this.state.taskdatas.cross_comment===undefined||this.state.taskdatas.cross_comment===null?"":"&cross_comment="+this.state.taskdatas.cross_comment} ${this.state.taskdatas.cross_comment===undefined||this.state.taskdatas.cross_comment===null?"":"cross_comment="+this.state.taskdatas.cross_comment+"&"}
${this.state.taskdatas.search===undefined||this.state.taskdatas.search===null?"":"&search="+this.state.taskdatas.search+"&"}${getRandomNumber(true)}`) ${this.state.taskdatas.search===undefined||this.state.taskdatas.search===null?"":"search="+this.state.taskdatas.search+"&"}${newgetRandomNumber}`)
}
} }
getsonars=(teacher_comment,task_status,course_group,cross_comment,search)=>{ getsonars=(teacher_comment,task_status,course_group,cross_comment,search)=>{
@ -519,8 +522,8 @@ class GraduationTaskDetail extends Component{
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mt20" style={{"paddingLeft":"0px"}}> {this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mt20" style={{"paddingLeft":"0px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}> <ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a onClick={()=>this.child.confirmysl("/graduation_tasks/"+task_Id+"/tasks_list.xlsx")} className="color-dark">导出成绩</a></li> <li><a onClick={()=>this.child.confirmysl(`/graduation_tasks/${task_Id}/tasks_list.xlsx`)} className="color-dark">导出成绩</a></li>
<li><a onClick={()=>this.child.confirmysl("/graduation_tasks/"+task_Id+"/tasks_list.zip")} className="color-dark">导出作品附件</a></li> <li><a onClick={()=>this.child.confirmysl(`/graduation_tasks/${task_Id}/tasks_list.zip`)} className="color-dark">导出作品附件</a></li>
</ul> </ul>
</li>:""} </li>:""}
{questionslist.work_status===undefined||questionslist.work_status===null||questionslist.work_status.length===0?"":questionslist.work_status.map((item,key)=>{ {questionslist.work_status===undefined||questionslist.work_status===null||questionslist.work_status.length===0?"":questionslist.work_status.map((item,key)=>{

@ -7,7 +7,7 @@ import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import { getUrl, getUploadActionUrl } from 'educoder' import { getUrl, getUploadActionUrl } from 'educoder'
const $ = window.$; const $ = window.$;
/* /*
*/ */
class GraduationTasksappraiseMainEditor extends Component{ class GraduationTasksappraiseMainEditor extends Component{
@ -20,22 +20,32 @@ class GraduationTasksappraiseMainEditor extends Component{
score: undefined, score: undefined,
same_score: false, same_score: false,
errorMessage: '', errorMessage: '',
numberErrorMessage: '' numberErrorMessage: '',
errorMessagetype:false
} }
} }
onSubmit = () => { onSubmit = () => {
const { score, same_score } = this.state const { score, same_score } = this.state
let category_id= this.props.match.params.category_id; let category_id= this.props.match.params.category_id;
const url = `/graduation_works/${category_id}/add_score.json` const url = `/graduation_works/${category_id}/add_score.json`
const attachment_ids = this.state.fileList.map(item => { const attachment_ids = this.state.fileList.map(item => {
return item.response ? item.response.id : item.id return item.response ? item.response.id : item.id
}) })
const comment = this.mdRef.current.getValue() const comment = this.mdRef.current.getValue()
if ((!comment || comment.trim() == "") && !score) { if ((!comment || comment.trim() == "") && !score &&this.props.isAdmin()===true) {
this.setState( {errorMessage : '分数和评语不能同时为空' }) this.setState( {errorMessage : '分数和评语不能同时为空' })
// this.props.showNotification('请先输入评阅说明') // this.props.showNotification('请先输入评阅说明')
return; return;
} }
if (!score && this.props.isAdmin()===false) {
this.setState( {
errorMessage : '分数不能为空',
errorMessagetype:true
})
// this.props.showNotification('请先输入评阅说明')
return;
}
if (comment.length > 2000) { if (comment.length > 2000) {
this.setState( {errorMessage : '不能超过2000个字符' }) this.setState( {errorMessage : '不能超过2000个字符' })
// this.props.showNotification('评阅说明文本长度不能超过2000') // this.props.showNotification('评阅说明文本长度不能超过2000')
@ -63,12 +73,12 @@ class GraduationTasksappraiseMainEditor extends Component{
this.clearInputs() this.clearInputs()
this.props.addSuccess(); this.props.addSuccess();
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)
}) })
} }
} }
clearInputs = () => { clearInputs = () => {
this.setState({ this.setState({
@ -79,7 +89,7 @@ class GraduationTasksappraiseMainEditor extends Component{
this.mdRef.current.setValue('') this.mdRef.current.setValue('')
} }
onCancel = () => { onCancel = () => {
this.clearInputs() this.clearInputs()
} }
componentDidMount(){ componentDidMount(){
} }
@ -119,7 +129,7 @@ class GraduationTasksappraiseMainEditor extends Component{
const { status } = response.data; const { status } = response.data;
if (status == 0) { if (status == 0) {
console.log('--- success') console.log('--- success')
this.setState((state) => { this.setState((state) => {
const index = state[stateName].indexOf(file); const index = state[stateName].indexOf(file);
const newFileList = state[stateName].slice(); const newFileList = state[stateName].slice();
@ -136,6 +146,12 @@ class GraduationTasksappraiseMainEditor extends Component{
}); });
} }
onScoreChange = (val) => { onScoreChange = (val) => {
if(val){
this.setState( {
errorMessage: '',
errorMessagetype:false
})
}
if (val > 100 ) { if (val > 100 ) {
this.props.showNotification('不能大于100') this.props.showNotification('不能大于100')
this.setState({ score: 100 }) this.setState({ score: 100 })
@ -157,7 +173,7 @@ class GraduationTasksappraiseMainEditor extends Component{
this.setState({ same_score: e.target.checked }) //!this.state.same_score this.setState({ same_score: e.target.checked }) //!this.state.same_score
} }
render(){ render(){
let { total_count, comments, pageCount, fileList, score, same_score, errorMessage, numberErrorMessage } = this.state let { total_count, comments, errorMessagetype, fileList, score, same_score, errorMessage, numberErrorMessage } = this.state
const { current_user, memo, showSameScore, placeholder } = this.props const { current_user, memo, showSameScore, placeholder } = this.props
const isAdmin = this.props.isAdmin() const isAdmin = this.props.isAdmin()
const commentUploadProp = { const commentUploadProp = {
@ -209,7 +225,7 @@ class GraduationTasksappraiseMainEditor extends Component{
`}</style> `}</style>
{this.props.title && <span className="mainEditorTitle color-grey-6">{this.props.title}</span>} {this.props.title && <span className="mainEditorTitle color-grey-6">{this.props.title}</span>}
<TPMMDEditor ref={this.mdRef} mdID={'appraiseEditor'} placeholder={placeholder || "请在此输入对本作品的评语最大限制2000个字符"} <TPMMDEditor ref={this.mdRef} mdID={'appraiseEditor'} placeholder={placeholder || "请在此输入对本作品的评语最大限制2000个字符"}
watch={false} height={160} className={errorMessage ? 'editorInputError' : ''} imageExpand={true}></TPMMDEditor> watch={false} height={160} className={errorMessage&&errorMessagetype!=true ? 'editorInputError' : ''} imageExpand={true}></TPMMDEditor>
{ showSameScore == true && <div> { showSameScore == true && <div>
<Checkbox checked={same_score} onChange={this.same_score_change}>整组同评</Checkbox> <Checkbox checked={same_score} onChange={this.same_score_change}>整组同评</Checkbox>
<span className={"font-14 color-grey-9"}>(选中则本次评阅对象指小组全部成员否则仅评阅此成员1人 )</span> <span className={"font-14 color-grey-9"}>(选中则本次评阅对象指小组全部成员否则仅评阅此成员1人 )</span>
@ -235,7 +251,7 @@ class GraduationTasksappraiseMainEditor extends Component{
<a className="task-btn task-btn-orange fr mt4" style={{height: '30px', width: '100px'}} <a className="task-btn task-btn-orange fr mt4" style={{height: '30px', width: '100px'}}
onClick={this.onSubmit} onClick={this.onSubmit}
>提交</a> >提交</a>
<a onClick={this.onCancel} className="defalutCancelbtn fr mt4" <a onClick={this.onCancel} className="defalutCancelbtn fr mt4"
style={{height: '30px', width: '100px', fontSize: '14px', lineHeight: '30px', marginRight: '20px'}}>清空</a> style={{height: '30px', width: '100px', fontSize: '14px', lineHeight: '30px', marginRight: '20px'}}>清空</a>
</div> </div>

@ -2,7 +2,7 @@ import React,{Component} from "react";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip} from "antd"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip} from "antd";
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import locale from 'antd/lib/date-picker/locale/zh_CN'; import locale from 'antd/lib/date-picker/locale/zh_CN';
import { WordsBtn,getUrl ,handleDateString} from 'educoder'; import { WordsBtn,getRandomcode ,handleDateString} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import Modals from '../../../modals/Modals'; import Modals from '../../../modals/Modals';
import DownloadMessageysl from "../../../modals/DownloadMessageysl"; import DownloadMessageysl from "../../../modals/DownloadMessageysl";
@ -870,9 +870,8 @@ class GraduationTaskssettingapp extends Component{
} }
/// 确认是否下载 /// 确认是否下载
confirmysl(url){ confirmysl(url,urls){
debugger;
console.log(3);
axios.get(url + '?export=true' ).then((response) => { axios.get(url + '?export=true' ).then((response) => {
if(response === undefined){ if(response === undefined){
return return
@ -895,8 +894,10 @@ class GraduationTaskssettingapp extends Component{
}) })
} }
}else { }else {
this.props.slowDownload(url)
// this.props.showNotification(`正在下载中`);
this.props.slowDownload(getRandomcode(url))
// window.open(getRandomcode("/api" + url), '_blank');
// this.props.showNotification(`正在下载中`); // this.props.showNotification(`正在下载中`);
// window.open("/api"+url, '_blank'); // window.open("/api"+url, '_blank');
} }

@ -1,7 +1,7 @@
import React,{Component} from "react"; import React,{Component} from "react";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Pagination, Table, Divider, Tag,Tooltip} from "antd"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Pagination, Table, Divider, Tag,Tooltip} from "antd";
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import {getImageUrl, NoneData, sortDirections} from 'educoder'; import {getImageUrl, NoneData, sortDirections,getRandomcode} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import moment from 'moment'; import moment from 'moment';
import HomeworkModal from "../../coursesPublic/HomeworkModal"; import HomeworkModal from "../../coursesPublic/HomeworkModal";
@ -759,7 +759,7 @@ class GraduationTaskssettinglist extends Component{
}) })
} }
}else { }else {
this.props.slowDownload(url) this.props.slowDownload(getRandomcode(url))
// this.props.showNotification(`正在下载中`); // this.props.showNotification(`正在下载中`);
// window.open("/api"+url, '_blank'); // window.open("/api"+url, '_blank');

@ -1,7 +1,7 @@
import React,{Component} from "react"; import React,{Component} from "react";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag} from "antd"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag} from "antd";
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import { WordsBtn,markdownToHTML,AttachmentList} from 'educoder'; import { getRandomcode,markdownToHTML,AttachmentList} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import Modals from '../../../modals/Modals'; import Modals from '../../../modals/Modals';
import DownloadMessageysl from "../../../modals/DownloadMessageysl"; import DownloadMessageysl from "../../../modals/DownloadMessageysl";
@ -214,9 +214,8 @@ class GraduationTasksquestions extends Component{
} }
/// 确认是否下载 /// 确认是否下载
confirmysl(url){ confirmysl(url,urls){
debugger;
console.log(2);
axios.get(url + '?export=true').then((response) => { axios.get(url + '?export=true').then((response) => {
if(response === undefined){ if(response === undefined){
return return
@ -239,8 +238,10 @@ class GraduationTasksquestions extends Component{
}) })
} }
}else { }else {
this.props.slowDownload(url) // this.props.slowDownload(urls)
//this.props.showNotification(`正在下载中`);
this.props.slowDownload(getRandomcode(url))
// window.open(getRandomcode("/api" + url), '_blank');
// this.props.showNotification(`正在下载中`); // this.props.showNotification(`正在下载中`);
// window.open("/api"+url, '_blank'); // window.open("/api"+url, '_blank');
} }

@ -4,7 +4,7 @@ import {Checkbox, Menu, Pagination,Spin} from "antd";
import Titlesearchsection from '../../common/titleSearch/TitleSearchSection' import Titlesearchsection from '../../common/titleSearch/TitleSearchSection'
import DownloadMessageysl from "../../../modals/DownloadMessageysl"; import DownloadMessageysl from "../../../modals/DownloadMessageysl";
import { WordsBtn ,getRandomcode} from 'educoder' import { WordsBtn ,getRandomcode,getRandomNumber} from 'educoder'
import NoneData from '../../coursesPublic/NoneData' import NoneData from '../../coursesPublic/NoneData'
import Modals from "../../../modals/Modals" import Modals from "../../../modals/Modals"
import axios from 'axios' import axios from 'axios'
@ -55,7 +55,7 @@ class Boards extends Component{
let {pageSize}=this.state; let {pageSize}=this.state;
const cid = this.props.match.params.coursesId const cid = this.props.match.params.coursesId
let url = `/courses/${cid}/graduation_topics.json?limit=${pageSize}` let url = `/courses/${cid}/graduation_topics.json?limit=${pageSize}`
if(searchValue!=""){ if(searchValue!=""){
url+="&search="+searchValue url+="&search="+searchValue
@ -142,8 +142,8 @@ class Boards extends Component{
checkBoxValues: _.difference(this.state.checkBoxValues, values) checkBoxValues: _.difference(this.state.checkBoxValues, values)
}) })
} }
} }
onItemClick = (item) => { onItemClick = (item) => {
const checkBoxValues = this.state.checkBoxValues.slice(0); const checkBoxValues = this.state.checkBoxValues.slice(0);
const index = checkBoxValues.indexOf(item.id); const index = checkBoxValues.indexOf(item.id);
@ -198,7 +198,7 @@ class Boards extends Component{
}) })
} }
cancelOperateTopic=()=>{ cancelOperateTopic=()=>{
this.setState({ this.setState({
modalsType:false, modalsType:false,
modalsTopval:"", modalsTopval:"",
modalsBottomval:"", modalsBottomval:"",
@ -257,7 +257,7 @@ onDelete=(index)=>{
console.log(error) console.log(error)
}) })
} }
}else{ }else{
this.setState({ this.setState({
// delType:true, // delType:true,
@ -319,7 +319,7 @@ sureDelTopic=()=>{
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} }
}else{ }else{
this.setState({ this.setState({
delType:false, delType:false,
@ -335,7 +335,7 @@ onBoardsNew=()=>{
} }
/// 确认是否下载 /// 确认是否下载
confirmysl(url){ confirmysl(url){
axios.get(url + '?export=true').then((response) => { axios.get(url + '&export=true').then((response) => {
if(response.data.status&&response.data.status===-1){ if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.data.status&&response.data.status===-2){
@ -376,12 +376,12 @@ onBoardsNew=()=>{
this.fetchAll(searchValue,page,status); this.fetchAll(searchValue,page,status);
} }
render(){ render(){
let { let {
searchValue, searchValue,
topicList, topicList,
data, data,
course_public, course_public,
checkBoxValues, checkBoxValues,
checkAllValue, checkAllValue,
page, page,
totalCount, totalCount,
@ -507,9 +507,9 @@ onBoardsNew=()=>{
: :
<div></div> <div></div>
} }
<div> <div>
</div> </div>
</React.Fragment> </React.Fragment>
) )
} }

@ -1,6 +1,6 @@
import React, {Component} from "react"; import React, {Component} from "react";
import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; import { WordsBtn,on, off, trigger,markdownToHTML,getRandomNumber} from 'educoder';
import { import {
Button, Button,
Checkbox, Checkbox,
@ -23,7 +23,8 @@ class GroupPackage extends Component {
} }
} }
DownloadOpenPdf=(type,url)=>{ DownloadOpenPdf=(type,url)=>{
type===true?window.open(url):window.location.href=url; let newurl=url+getRandomNumber();
type===true?window.open(newurl):window.location.href=newurl;
} }
componentDidMount() { componentDidMount() {
console.log("Groupjobquesanswer"); console.log("Groupjobquesanswer");

@ -14,7 +14,7 @@ import CourseLayoutcomponent from '../common/CourseLayoutComponent'
import Titlesearchsection from '../common/titleSearch/TitleSearchSection' import Titlesearchsection from '../common/titleSearch/TitleSearchSection'
import ColorCountText from '../common/titleSearch/ColorCountText' import ColorCountText from '../common/titleSearch/ColorCountText'
import { WordsBtn, trigger, on, off, getUrl, downloadFile , sortDirections, NoneData } from 'educoder' import { WordsBtn, trigger, on, off, getUrl, downloadFile , getRandomcode, NoneData } from 'educoder'
import Modals from "../../modals/Modals"; import Modals from "../../modals/Modals";
import DownloadMessageysl from "../../modals/DownloadMessageysl"; import DownloadMessageysl from "../../modals/DownloadMessageysl";
@ -23,7 +23,7 @@ import ChangeRolePop from './ChangeRolePop'
import CourseGroupListTable from './CourseGroupListTable' import CourseGroupListTable from './CourseGroupListTable'
import './studentsList.css' import './studentsList.css'
/** /**
角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生 角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生
*/ */
function CourseGroupList(props) { function CourseGroupList(props) {
@ -36,7 +36,7 @@ function CourseGroupList(props) {
const [listRes, setListRes] = useState({}) const [listRes, setListRes] = useState({})
const createGroupModalEl = useRef(null); const createGroupModalEl = useRef(null);
const courseId = props.match.params.coursesId const courseId = props.match.params.coursesId
useEffect(() => { useEffect(() => {
fetchAll() fetchAll()
@ -63,7 +63,7 @@ function CourseGroupList(props) {
} }
const onConfirm = async () => { const onConfirm = async () => {
} }
function createGroupImportSuccess() { function createGroupImportSuccess() {
} }
@ -83,7 +83,7 @@ function CourseGroupList(props) {
} }
const confirmysl = (url) => { const confirmysl = (url) => {
axios.get(url + 'export=true').then((response) => { axios.get(url + '&export=true').then((response) => {
if(response === undefined){ if(response === undefined){
return return
} }
@ -100,13 +100,13 @@ function CourseGroupList(props) {
setDownloadMessageval(500) setDownloadMessageval(500)
} }
}else { }else {
props.slowDownload(url) props.slowDownload(getRandomcode(url))
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
const isAdmin = props.isAdmin(); const isAdmin = props.isAdmin();
const isSuperAdmin = props.isSuperAdmin(); const isSuperAdmin = props.isSuperAdmin();
const isParent = true; const isParent = true;
@ -121,9 +121,9 @@ function CourseGroupList(props) {
const course_groups = listRes.course_groups const course_groups = listRes.course_groups
const current_group_id = listRes.current_group_id const current_group_id = listRes.current_group_id
let exportUrl = `/courses/${courseId}/export_member_scores_excel.xlsx?`; //总成绩 let exportUrl = `/courses/${courseId}/export_member_scores_excel.xlsx`; //总成绩
let exportUrltwo = `/courses/${courseId}/export_couser_info.xlsx?`; //课堂信息 let exportUrltwo = `/courses/${courseId}/export_couser_info.xlsx`; //课堂信息
let exportUrlthree = `/courses/${courseId}/export_member_act_score.xlsx?`; //活跃度 let exportUrlthree = `/courses/${courseId}/export_member_act_score.xlsx`; //活跃度
return ( return (
<React.Fragment> <React.Fragment>
<DownloadMessageysl <DownloadMessageysl
@ -140,8 +140,8 @@ function CourseGroupList(props) {
showSearchInput={total_count >= 10} showSearchInput={total_count >= 10}
searchPlaceholder={ '请输入分班名称进行搜索' } searchPlaceholder={ '请输入分班名称进行搜索' }
firstRowRight={ firstRowRight={
<React.Fragment> <React.Fragment>
{ // pageType !== TYPE_STUDENTS && { // pageType !== TYPE_STUDENTS &&
isSuperAdmin && <React.Fragment> isSuperAdmin && <React.Fragment>
{/* ref="createGroupByImportModal" */} {/* ref="createGroupByImportModal" */}
<CreateGroupByImportModal {...props} <CreateGroupByImportModal {...props}
@ -151,12 +151,12 @@ function CourseGroupList(props) {
{/* this.refs['createGroupByImportModal'].setVisible(true) */} {/* this.refs['createGroupByImportModal'].setVisible(true) */}
<WordsBtn style="blue" className="mr30" onClick={()=> {createGroupModalEl.current.setVisible(true)}}>导入创建分班</WordsBtn> <WordsBtn style="blue" className="mr30" onClick={()=> {createGroupModalEl.current.setVisible(true)}}>导入创建分班</WordsBtn>
</React.Fragment> } </React.Fragment> }
{ {
// pageType !== TYPE_STUDENTS && // pageType !== TYPE_STUDENTS &&
!isCourseEnd && isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>addDir()}>新建分班</WordsBtn> } !isCourseEnd && isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>addDir()}>新建分班</WordsBtn> }
{/* { {/* {
isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>deleteDir()}>删除分班</WordsBtn> } */} isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>deleteDir()}>删除分班</WordsBtn> } */}
{/* { {/* {
isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> } */} isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> } */}
<style>{` <style>{`
.drop_down_menu li a { .drop_down_menu li a {
@ -210,7 +210,7 @@ function CourseGroupList(props) {
} }
onPressEnter={onPressEnter} onPressEnter={onPressEnter}
></Titlesearchsection> ></Titlesearchsection>
{!!none_group_member_count && <div className="mt20 E9F8FF padding20-30 pointer" onClick={() => {props.history.push(`/courses/${courseId}/course_groups/0`)}}> {!!none_group_member_count && <div className="mt20 E9F8FF padding20-30 pointer" onClick={() => {props.history.push(`/courses/${courseId}/course_groups/0`)}}>
<span>未分班</span> <span>未分班</span>
<span style={{color: '#999999'}}>{none_group_member_count}个学生</span> <span style={{color: '#999999'}}>{none_group_member_count}个学生</span>
@ -219,17 +219,17 @@ function CourseGroupList(props) {
</div>} </div>}
<Spin size="large" spinning={isSpin}> <Spin size="large" spinning={isSpin}>
{course_groups && !!course_groups.length ? {course_groups && !!course_groups.length ?
<div className="mt20 edu-back-white padding20 courseGroupList"> <div className="mt20 edu-back-white padding20 courseGroupList">
<CourseGroupListTable <CourseGroupListTable
course_groups={course_groups} course_groups={course_groups}
onOperationSuccess={onOperationSuccess} onOperationSuccess={onOperationSuccess}
current_group_id={current_group_id} current_group_id={current_group_id}
{...props} {...props}
></CourseGroupListTable> ></CourseGroupListTable>
</div>: </div>:
<NoneData></NoneData>} <NoneData></NoneData>}
</Spin> </Spin>
</React.Fragment> </React.Fragment>

@ -7,7 +7,7 @@ import CourseLayoutcomponent from '../common/CourseLayoutComponent'
import Titlesearchsection from '../common/titleSearch/TitleSearchSection' import Titlesearchsection from '../common/titleSearch/TitleSearchSection'
import ColorCountText from '../common/titleSearch/ColorCountText' import ColorCountText from '../common/titleSearch/ColorCountText'
import { WordsBtn, trigger, on, off, getUrl, downloadFile , sortDirections } from 'educoder' import { WordsBtn, trigger, on, off, getRandomcode, getRandomNumber , sortDirections } from 'educoder'
import Modals from "../../modals/Modals"; import Modals from "../../modals/Modals";
import axios from 'axios' import axios from 'axios'
import _ from 'lodash' import _ from 'lodash'
@ -24,7 +24,7 @@ const TYPE_COURSE_GOURP_CHILD = 3
const buildColumns = (that,isParent) => { const buildColumns = (that,isParent) => {
const { course_groups , sortedInfo } = that.state const { course_groups , sortedInfo } = that.state
let showSorter = isParent==true let showSorter = isParent==true
const courseId = that.props.match.params.coursesId const courseId = that.props.match.params.coursesId
const columns=[{ const columns=[{
title: '序号', title: '序号',
dataIndex: 'id', dataIndex: 'id',
@ -35,7 +35,7 @@ const buildColumns = (that,isParent) => {
render: (id, student, index) => { render: (id, student, index) => {
return (that.state.page - 1) * 20 + index + 1 return (that.state.page - 1) * 20 + index + 1
} }
}, },
// { // {
// title: '用户id', // title: '用户id',
// dataIndex: 'login', // dataIndex: 'login',
@ -48,7 +48,7 @@ const buildColumns = (that,isParent) => {
// title={login && login.length > 10 ? login : ''} // title={login && login.length > 10 ? login : ''}
// >{login}</span> // >{login}</span>
// } // }
// }, // },
{ {
title: '姓名', title: '姓名',
dataIndex: 'name', dataIndex: 'name',
@ -57,7 +57,7 @@ const buildColumns = (that,isParent) => {
width:"10%", width:"10%",
className:"color-grey-6", className:"color-grey-6",
render: (name, record) => { render: (name, record) => {
return <a className="color-dark overflowHidden1" target="_blank" return <a className="color-dark overflowHidden1" target="_blank"
style={{maxWidth: '120px'}} href={`/users/${record.login}`}>{name}</a> style={{maxWidth: '120px'}} href={`/users/${record.login}`}>{name}</a>
} }
}, { }, {
@ -106,7 +106,7 @@ const buildColumns = (that,isParent) => {
} }
} }
]; ];
if (that.hasGroupModule()) { if (that.hasGroupModule()) {
that.isStudentPage && columns.push({ that.isStudentPage && columns.push({
title: '分班', title: '分班',
@ -126,7 +126,7 @@ const buildColumns = (that,isParent) => {
if (item.title === "学号") { if (item.title === "学号") {
columns.splice(key, 1) columns.splice(key, 1)
return true return true
} }
}) })
} }
const isAdmin = that.props.isAdmin() const isAdmin = that.props.isAdmin()
@ -149,7 +149,7 @@ const buildColumns = (that,isParent) => {
render: (text, record) => { render: (text, record) => {
return ( return (
<React.Fragment> <React.Fragment>
<WordsBtn onClick={() => that.onDelete(record)} style={'grey'}>删除学生</WordsBtn> <WordsBtn onClick={() => that.onDelete(record)} style={'grey'}>删除学生</WordsBtn>
{record.member_roles && record.member_roles.length && <ChangeRolePop {record.member_roles && record.member_roles.length && <ChangeRolePop
style={{ marginLeft: '12px' }} style={{ marginLeft: '12px' }}
courseId={courseId} courseId={courseId}
@ -164,7 +164,7 @@ const buildColumns = (that,isParent) => {
) )
}, },
}) })
} }
return columns; return columns;
@ -199,7 +199,7 @@ class studentsList extends Component{
} }
} }
/// 确认是否下载 /// 确认是否下载
confirmysl(url){ confirmysl(url,urls){
// this.props.showGlobalLoading('正在生成文件,请稍后...') // this.props.showGlobalLoading('正在生成文件,请稍后...')
axios.get(url + 'export=true').then((response) => { axios.get(url + 'export=true').then((response) => {
if(response === undefined){ if(response === undefined){
@ -223,11 +223,11 @@ class studentsList extends Component{
}) })
} }
}else { }else {
// this.props.showNotification(`正在下载中`); // this.props.showNotification(`正在下载中`);
// window.open("/api"+url, '_blank'); // window.open("/api"+url, '_blank');
this.props.slowDownload(url) this.props.slowDownload(getRandomcode(url))
// getUrl() + "/api"+ // getUrl() + "/api"+
// const fileUrl = url; // const fileUrl = url;
@ -263,7 +263,7 @@ class studentsList extends Component{
DownloadMessageval:undefined DownloadMessageval:undefined
}) })
} }
inputStudent=(e)=>{ inputStudent=(e)=>{
this.setState({ this.setState({
StudentList_value:e.target.value StudentList_value:e.target.value
@ -307,7 +307,7 @@ class studentsList extends Component{
modalCancel:false modalCancel:false
}) })
} }
onChange=()=>{ onChange=()=>{
} }
@ -344,7 +344,7 @@ class studentsList extends Component{
this.fetchCourseGroups() this.fetchCourseGroups()
this.fetchAll() this.fetchAll()
} }
addStudentSuccessListener=(e, data)=>{ addStudentSuccessListener=(e, data)=>{
const params = JSON.parse(data) const params = JSON.parse(data)
this.props.updataleftNavfun() this.props.updataleftNavfun()
@ -358,10 +358,10 @@ class studentsList extends Component{
// console.log('addStudentSuccessListener', data) // console.log('addStudentSuccessListener', data)
} }
fetchCourseGroups = () => { fetchCourseGroups = () => {
const courseId = this.props.match.params.coursesId const courseId = this.props.match.params.coursesId
let url = `/courses/${courseId}/all_course_groups.json` let url = `/courses/${courseId}/all_course_groups.json`
axios.get(url, { axios.get(url, {
}) })
.then((response) => { .then((response) => {
@ -382,7 +382,7 @@ class studentsList extends Component{
this.setState({checkBoxValues: [], checkAllValue: false }) this.setState({checkBoxValues: [], checkAllValue: false })
this.fetchAll(1) this.fetchAll(1)
} }
// 加载了2次 // 加载了2次
// else if (prevProps.coursesids != this.props.coursesids) { // else if (prevProps.coursesids != this.props.coursesids) {
// this.fetchAll(1) // this.fetchAll(1)
@ -392,7 +392,7 @@ class studentsList extends Component{
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
let id = this.props.match.params.coursesId let id = this.props.match.params.coursesId
let course_group_id = this.props.match.params.course_group_id let course_group_id = this.props.match.params.course_group_id
const { coursesids } = this.props const { coursesids } = this.props
@ -424,7 +424,7 @@ class studentsList extends Component{
} }
axios.get(encodeURI(url)).then((result)=>{ axios.get(encodeURI(url)).then((result)=>{
if (result.data.students) { if (result.data.students) {
this.setState({ this.setState({
students: result.data.students, students: result.data.students,
total_count: result.data.students_count, total_count: result.data.students_count,
course_group_name: result.data.course_group_name, course_group_name: result.data.course_group_name,
@ -468,7 +468,7 @@ class studentsList extends Component{
}) })
} }
onPageChange = (page) => { onPageChange = (page) => {
this.fetchAll(page) this.fetchAll(page)
this.setState({ checkAllValue: false }) this.setState({ checkAllValue: false })
} }
@ -490,7 +490,7 @@ class studentsList extends Component{
return; return;
} }
let id = this.props.match.params.coursesId let id = this.props.match.params.coursesId
let { order, searchValue }=this.state let { order, searchValue }=this.state
let url=`/courses/${id}/transfer_to_course_group.json`; let url=`/courses/${id}/transfer_to_course_group.json`;
axios.post((url), { axios.post((url), {
@ -541,7 +541,7 @@ class studentsList extends Component{
// content: `确认要删除所选的${len}个学生吗?`, // content: `确认要删除所选的${len}个学生吗?`,
content: `是否确认删除?`, content: `是否确认删除?`,
onOk: () => { onOk: () => {
let id = this.props.match.params.coursesId let id = this.props.match.params.coursesId
let url=`/courses/${id}/delete_from_course.json`; let url=`/courses/${id}/delete_from_course.json`;
axios.post((url), { axios.post((url), {
students: [{course_member_id: record.course_member_id}] // this.state.checkBoxValues.map(item => {return {course_member_id: item} }), students: [{course_member_id: record.course_member_id}] // this.state.checkBoxValues.map(item => {return {course_member_id: item} }),
@ -563,7 +563,7 @@ class studentsList extends Component{
trigger('groupAdd', this.props.coursesids) trigger('groupAdd', this.props.coursesids)
} }
doAddToDir = async () => { doAddToDir = async () => {
const courseId = this.props.match.params.coursesId const courseId = this.props.match.params.coursesId
const url = `/courses/${courseId}/join_course_group.json` const url = `/courses/${courseId}/join_course_group.json`
const course_group_id = this.props.match.params.course_group_id const course_group_id = this.props.match.params.course_group_id
@ -578,12 +578,12 @@ class studentsList extends Component{
} }
addToDir = (record) => { addToDir = (record) => {
this.props.confirm({ this.props.confirm({
content: `是否确认加入分班: ${this.state.course_group_name}?`, content: `是否确认加入分班: ${this.state.course_group_name}?`,
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onOk: () => { onOk: () => {
this.doAddToDir() this.doAddToDir()
}, },
@ -604,7 +604,7 @@ class studentsList extends Component{
</div>, </div>,
onOk: () => { onOk: () => {
const course_group_id = this.props.match.params.course_group_id const course_group_id = this.props.match.params.course_group_id
const courseId = this.props.match.params.coursesId const courseId = this.props.match.params.coursesId
const url = `/course_groups/${course_group_id}.json` const url = `/course_groups/${course_group_id}.json`
axios.delete(url) axios.delete(url)
@ -616,7 +616,7 @@ class studentsList extends Component{
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
}); });
} }
}) })
} }
@ -643,7 +643,7 @@ class studentsList extends Component{
const isCourseEnd = this.props.isCourseEnd() const isCourseEnd = this.props.isCourseEnd()
let { let {
page, page,
order, order,
StudentList_value, StudentList_value,
stu_new_flag, stu_new_flag,
@ -662,17 +662,19 @@ class studentsList extends Component{
let currentOrderName = '学生学号排序' let currentOrderName = '学生学号排序'
if (order == ORDER_BY_GROUP) { if (order == ORDER_BY_GROUP) {
currentOrderName = '分班名称排序' currentOrderName = '分班名称排序'
} }
const { coursesids } = this.props const { coursesids } = this.props
const course_group_id = this.props.match.params.course_group_id const course_group_id = this.props.match.params.course_group_id
const isParent = !course_group_id || course_group_id == coursesids const isParent = !course_group_id || course_group_id == coursesids
const { course_group_name, invite_code } = this.state; const { course_group_name, invite_code } = this.state;
const courseId = this.props.match.params.coursesId const courseId = this.props.match.params.coursesId
let exportUrl = `/courses/${courseId}/export_member_scores_excel.xlsx?`; //总成绩 let exportUrl = `/courses/${courseId}/export_member_scores_excel.xlsx?`; //总成绩
let exportUrltwo = `/courses/${courseId}/export_couser_info.xlsx?`; //课堂信息 let exportUrltwo = `/courses/${courseId}/export_couser_info.xlsx?`; //课堂信息
let exportUrlthree = `/courses/${courseId}/export_member_act_score.xlsx?`; //活跃度 let exportUrlthree = `/courses/${courseId}/export_member_act_score.xlsx?`; //活跃度
const params = {} const params = {}
if (course_group_id) { if (course_group_id) {
params.group_id = course_group_id params.group_id = course_group_id
@ -685,11 +687,13 @@ class studentsList extends Component{
} }
let paramsString = '' let paramsString = ''
for (let key in params) { for (let key in params) {
paramsString += `${key}=${params[key]}&` paramsString += `&${key}=${params[key]}&`
} }
exportUrl += paramsString; exportUrl += paramsString;
exportUrltwo+=paramsString; exportUrltwo+=paramsString;
exportUrlthree+=paramsString; exportUrlthree += paramsString;
// console.log(paramsString); // console.log(paramsString);
// console.log(checkBoxValues); // console.log(checkBoxValues);
// console.log(searchValue); // console.log(searchValue);
@ -725,7 +729,7 @@ class studentsList extends Component{
} }
) )
} }
return( return(
<React.Fragment > <React.Fragment >
<DownloadMessageysl <DownloadMessageysl
@ -735,7 +739,7 @@ class studentsList extends Component{
modalsType={this.state.DownloadType} modalsType={this.state.DownloadType}
/> />
<Titlesearchsection <Titlesearchsection
title={isParent ? (pageType == TYPE_STUDENTS ? "全部学生" : "学生列表"): title={isParent ? (pageType == TYPE_STUDENTS ? "全部学生" : "学生列表"):
<React.Fragment> <React.Fragment>
<span> <span>
<Tooltip title="返回至分班列表"> <Tooltip title="返回至分班列表">
@ -756,9 +760,9 @@ class studentsList extends Component{
<i class="iconfont icon-fuzhi font-14 ml10 copybtn" style={{color: '#FF6800', cursor: 'pointer', verticalAlign: 'baseline'}} data-clipboard-text={invite_code} ></i> <i class="iconfont icon-fuzhi font-14 ml10 copybtn" style={{color: '#FF6800', cursor: 'pointer', verticalAlign: 'baseline'}} data-clipboard-text={invite_code} ></i>
</span> </span>
</Tooltip> </Tooltip>
</React.Fragment> </React.Fragment>
} }
</React.Fragment> </React.Fragment>
} }
searchValue={ searchValue } searchValue={ searchValue }
@ -766,24 +770,24 @@ class studentsList extends Component{
showSearchInput={total_count >= 10} showSearchInput={total_count >= 10}
searchPlaceholder={ '请输入姓名、学号进行搜索' } searchPlaceholder={ '请输入姓名、学号进行搜索' }
firstRowRight={ firstRowRight={
<React.Fragment> <React.Fragment>
{/* { {/* {
// pageType !== TYPE_STUDENTS && // pageType !== TYPE_STUDENTS &&
!isStudentPage && isSuperAdmin && <React.Fragment> !isStudentPage && isSuperAdmin && <React.Fragment>
<CreateGroupByImportModal ref="createGroupByImportModal" {...this.props} <CreateGroupByImportModal ref="createGroupByImportModal" {...this.props}
createGroupImportSuccess={this.createGroupImportSuccess} createGroupImportSuccess={this.createGroupImportSuccess}
></CreateGroupByImportModal> ></CreateGroupByImportModal>
<WordsBtn style="blue" className="mr30" onClick={()=> this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班</WordsBtn> <WordsBtn style="blue" className="mr30" onClick={()=> this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班</WordsBtn>
</React.Fragment> } */} </React.Fragment> } */}
{ {
!isStudentPage && isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> } !isStudentPage && isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> }
{ {
!isStudentPage && isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> } !isStudentPage && isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> }
{ {
!isStudentPage && !isCourseEnd && isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>新建分班</WordsBtn> } !isStudentPage && !isCourseEnd && isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>新建分班</WordsBtn> }
{ {
!isStudentPage && isStudent && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="" onClick={()=>this.addToDir()}>加入分班</WordsBtn> } !isStudentPage && isStudent && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="" onClick={()=>this.addToDir()}>加入分班</WordsBtn> }
<style>{` <style>{`
.drop_down_menu li a { .drop_down_menu li a {
@ -815,6 +819,7 @@ class studentsList extends Component{
<li className="li_line drop_down fr color-blue font-16"> <li className="li_line drop_down fr color-blue font-16">
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right": "-20px", "left": "unset", "height": "auto"}}> <ul className="drop_down_menu" style={{"right": "-20px", "left": "unset", "height": "auto"}}>
<li><a <li><a
onClick={(i) => this.confirmysl(exportUrltwo)}>课堂信息</a> onClick={(i) => this.confirmysl(exportUrltwo)}>课堂信息</a>
</li> </li>
@ -824,6 +829,7 @@ class studentsList extends Component{
<li><a <li><a
onClick={(i) => this.confirmysl(exportUrl)}>总成绩</a> onClick={(i) => this.confirmysl(exportUrl)}>总成绩</a>
</li> </li>
</ul> </ul>
</li> </li>
} }
@ -854,7 +860,7 @@ class studentsList extends Component{
'' ''
} }
{ {
course_group_id != 0 && course_groups && course_groups.length > 0 && course_group_id != 0 && course_groups && course_groups.length > 0 &&
<li key={0} onClick={() => this.moveToGroup({id: 0})}>未分班</li> <li key={0} onClick={() => this.moveToGroup({id: 0})}>未分班</li>
} }
{ course_groups.filter((item)=> { { course_groups.filter((item)=> {
@ -865,8 +871,8 @@ class studentsList extends Component{
) )
}) } }) }
{ course_groups && course_groups.length > 0 && <Divider className="dividerStyle"></Divider> } { course_groups && course_groups.length > 0 && <Divider className="dividerStyle"></Divider> }
{ isAdmin && !isCourseEnd && { isAdmin && !isCourseEnd &&
<p className="drop_down_btn"> <p className="drop_down_btn">
<a href="javascript:void(0)" className="color-grey-6" <a href="javascript:void(0)" className="color-grey-6"
onClick={()=>this.addDir()} onClick={()=>this.addDir()}
@ -876,10 +882,10 @@ class studentsList extends Component{
} }
</ul> </ul>
</li>} </li>}
{/* <li className="drop_down"> {/* <li className="drop_down">
{currentOrderName} {currentOrderName}
{ course_groups && !!course_groups.length && { course_groups && !!course_groups.length &&
<React.Fragment> <React.Fragment>
<i className="iconfont icon-xiajiantou font-12 ml2"></i> <i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_normal" style={{width: '124px'}}> <ul className="drop_down_normal" style={{width: '124px'}}>
@ -893,7 +899,7 @@ class studentsList extends Component{
</div> </div>
<Spin size="large" spinning={this.state.isSpin}> <Spin size="large" spinning={this.state.isSpin}>
<div className="clearfix stu_table"> <div className="clearfix stu_table">
{students && !!students.length && <Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}> {students && !!students.length && <Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
<Table columns={studentlist} dataSource={students} onChange={this.onTableChange} pagination={false}></Table> <Table columns={studentlist} dataSource={students} onChange={this.onTableChange} pagination={false}></Table>
</Checkbox.Group> } </Checkbox.Group> }
</div> </div>

@ -3,7 +3,7 @@ import {Menu} from "antd";
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import { WordsBtn } from 'educoder' import { WordsBtn,getRandomcode } from 'educoder'
import PollTabFirst from './PollDetailTabFirst' import PollTabFirst from './PollDetailTabFirst'
import PollTabSecond from './PollDetailTabSecond' import PollTabSecond from './PollDetailTabSecond'
import PollTabThird from './PollDetailTabThird' import PollTabThird from './PollDetailTabThird'
@ -112,7 +112,7 @@ class PollDetailIndex extends Component{
/// 确认是否下载 /// 确认是否下载
confirmysl(url){ confirmysl(url){
axios.get(url + '?export=true' ).then((response) => { axios.get(url + '&export=true' ).then((response) => {
if(response.data.status&&response.data.status===-1){ if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.data.status&&response.data.status===-2){
@ -131,7 +131,7 @@ class PollDetailIndex extends Component{
}) })
} }
}else { }else {
this.props.slowDownload(url) this.props.slowDownload(getRandomcode(url))
// this.props.showNotification(`正在下载中`); // this.props.showNotification(`正在下载中`);
// window.open("/api"+url, '_blank'); // window.open("/api"+url, '_blank');
@ -239,7 +239,7 @@ class PollDetailIndex extends Component{
</li> </li>
:"" :""
} */} } */}
<a className="fl color-blue font-16" onClick={(url)=>this.confirmysl("/polls/"+this.props.match.params.pollId+"/commit_result.xlsx")} href="javascript:void(0);">导出统计</a> <a className="fl color-blue font-16" onClick={(url)=>this.confirmysl(`/polls/${this.props.match.params.pollId}/commit_result.xlsx`)} href="javascript:void(0);">导出统计</a>
</span> </span>
} }
{ {

@ -1,6 +1,6 @@
import React, {Component} from "react"; import React, {Component} from "react";
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn, publicSearchs, sortDirections} from 'educoder'; import {getRandomcode, publicSearchs, sortDirections} from 'educoder';
import { import {
Form, Form,
Select, Select,
@ -3389,7 +3389,7 @@ class Listofworksstudentone extends Component {
daochuzuoye = () => { daochuzuoye = () => {
let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?course_group=${this.state.checkedValuesineinfo === undefined || this.state.checkedValuesineinfo === null ? "" : this.state.checkedValuesineinfo}&work_status=${this.state.course_groupyslstwo === undefined || this.state.course_groupyslstwo === null ? "" : this.state.course_groupyslstwo}&search=${this.state.searchtext === undefined || this.state.searchtext === null ? "" : this.state.searchtext}` let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?course_group=${this.state.checkedValuesineinfo === undefined || this.state.checkedValuesineinfo === null ? "" : this.state.checkedValuesineinfo}&work_status=${this.state.course_groupyslstwo === undefined || this.state.course_groupyslstwo === null ? "" : this.state.course_groupyslstwo}&search=${this.state.searchtext === undefined || this.state.searchtext === null ? "" : this.state.searchtext}`
this.confirmysl(url); this.confirmysl(url);
} }
@ -3418,7 +3418,7 @@ class Listofworksstudentone extends Component {
} else { } else {
// this.props.showNotification(`正在下载中`); // this.props.showNotification(`正在下载中`);
// window.open("/api"+url, '_blank'); // window.open("/api"+url, '_blank');
this.props.slowDownload(url); this.props.slowDownload(getRandomcode(url));
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -1,6 +1,6 @@
import React, {Component} from "react"; import React, {Component} from "react";
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn, getRandomcode, sortDirections} from 'educoder'; import {getRandomNumber, getRandomcode, sortDirections} from 'educoder';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import HomeworkModal from "../coursesPublic/HomeworkModal"; import HomeworkModal from "../coursesPublic/HomeworkModal";
import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal"; import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
@ -599,7 +599,7 @@ class ShixunStudentWork extends Component {
} }
confirmysl(url){ confirmysl(url){
axios.get(url + '?export=true').then((response) => { axios.get(url + '&export=true').then((response) => {
if(response === undefined){ if(response === undefined){
return return
} }

@ -1,7 +1,7 @@
import React, {Component} from "react"; import React, {Component} from "react";
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import HomeworkModal from "../coursesPublic/HomeworkModal"; import HomeworkModal from "../coursesPublic/HomeworkModal";
import {WordsBtn, getRandomcode, handleDateString, getImageUrl} from 'educoder'; import {getRandomNumber, getRandomcode, handleDateString, getImageUrl} from 'educoder';
import PollDetailTabForthRules from '../poll/PollDetailTabForthRules'; import PollDetailTabForthRules from '../poll/PollDetailTabForthRules';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import { import {
@ -2252,16 +2252,16 @@ class Trainingjobsetting extends Component {
daochushixunbaogao = () => { daochushixunbaogao = () => {
let url = `/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`; let url = `/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`;
this.confirmysl(url, url + '&export=true'); this.confirmysl(url,true) ;
} }
daochuzuoye = () => { daochuzuoye = () => {
let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`; let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`;
this.confirmysl(url, url + '?export=true'); this.confirmysl(url,true);
} }
confirmysl(url, urlWithExport) { confirmysl(url, urlWithExport) {
axios.get(urlWithExport).then((response) => { axios.get(url+`?export=true`).then((response) => {
if (response === undefined) { if (response === undefined) {
return return
} }
@ -2285,6 +2285,7 @@ class Trainingjobsetting extends Component {
} else { } else {
this.props.showNotification(`正在下载中`); this.props.showNotification(`正在下载中`);
window.open(getRandomcode("/api" + url), '_blank'); window.open(getRandomcode("/api" + url), '_blank');
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -1,6 +1,6 @@
import React, {Component} from "react"; import React, {Component} from "react";
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn, getRandomcode, markdownToHTML} from 'educoder'; import {getRandomNumber, getRandomcode, markdownToHTML} from 'educoder';
import { import {
Form, Form,
Select, Select,
@ -381,12 +381,12 @@ class Workquestionandanswer extends Component {
daochushixunbaogao=()=>{ daochushixunbaogao=()=>{
let url =`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`; let url =`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`;
this.confirmysl(url, url + '&export=true'); this.confirmysl(url, url + `&export=true`);
} }
daochuzuoye =() =>{ daochuzuoye =() =>{
let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`; let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`;
this.confirmysl(url, url + '?export=true'); this.confirmysl(url, url + `?export=true`);
} }
confirmysl(url, urlWithExport){ confirmysl(url, urlWithExport){

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import {getRandomNumber} from 'educoder';
import { Spin, Button, Input, Divider, Icon, Tooltip, Form, message, Modal } from 'antd'; import { Spin, Button, Input, Divider, Icon, Tooltip, Form, message, Modal } from 'antd';
import axios from 'axios'; import axios from 'axios';
import _ from 'lodash' import _ from 'lodash'
@ -233,7 +234,7 @@ class GraduationRequirement extends React.Component {
<Link to="/forums/3530" target="_blank" className="link ml10">查看详情</Link> <Link to="/forums/3530" target="_blank" className="link ml10">查看详情</Link>
</div> </div>
</div> </div>
<a href={`/api/ec_years/${this.props.yearId}/ec_graduation_requirements.xlsx`} target="_blank" className="ant-btn ant-btn-primary color-white">导出毕业要求</a> <a href={`/api/ec_years/${this.props.yearId}/ec_graduation_requirements.xlsx${getRandomNumber()}`} target="_blank" className="ant-btn ant-btn-primary color-white">导出毕业要求</a>
</div> </div>
<Divider/> <Divider/>

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import classNames from 'classnames' import classNames from 'classnames'
import {getRandomNumber} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import { Table, Divider, Tag, Checkbox, InputNumber, Spin, Icon } from 'antd'; import { Table, Divider, Tag, Checkbox, InputNumber, Spin, Icon } from 'antd';
@ -48,7 +48,7 @@ class RequirementVsObjective extends Component {
// ...testState // ...testState
} }
} }
componentDidMount(){ componentDidMount(){
// this.init() // this.init()
// return; // return;
@ -58,7 +58,7 @@ class RequirementVsObjective extends Component {
axios.get(url).then((response) => { axios.get(url).then((response) => {
if (response.data.graduation_requirements) { if (response.data.graduation_requirements) {
this.setState( {...response.data} , () => { this.setState( {...response.data} , () => {
this.init() this.init()
}) })
} }
}).catch((e) => { }).catch((e) => {
@ -92,7 +92,7 @@ class RequirementVsObjective extends Component {
const yearId = this.props.match.params.yearId const yearId = this.props.match.params.yearId
const url = `/ec_years/${yearId}/requirement_support_objectives.json` const url = `/ec_years/${yearId}/requirement_support_objectives.json`
const method = select ? axios.delete : axios.post const method = select ? axios.delete : axios.post
method(url, method(url,
select ? { select ? {
params: { params: {
ec_graduation_requirement_id, ec_graduation_requirement_id,
@ -105,7 +105,7 @@ class RequirementVsObjective extends Component {
).then((response) => { ).then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.setState( this.setState(
(prevState) => ({ (prevState) => ({
tableData : update(prevState.tableData, {[rowIndex]: {[colIndex]: {$set: select ? false : true}}}) tableData : update(prevState.tableData, {[rowIndex]: {[colIndex]: {$set: select ? false : true}}})
}) })
) )
@ -128,7 +128,7 @@ class RequirementVsObjective extends Component {
const columnIdIndexMap = {} const columnIdIndexMap = {}
console.log(columns, tableData) console.log(columns, tableData)
return ( return (
<div className="educontent requirementVsObjective" style={{ background: '#fff' }}> <div className="educontent requirementVsObjective" style={{ background: '#fff' }}>
<ul className="clearfix padding20-30 bor-bottom-greyE backgroundFFF" <ul className="clearfix padding20-30 bor-bottom-greyE backgroundFFF"
style={{ 'marginBottom': '0px' }} > style={{ 'marginBottom': '0px' }} >
@ -140,7 +140,7 @@ class RequirementVsObjective extends Component {
</p> </p>
</li> </li>
<a href={`/api/ec_years/${this.props.yearId}/requirement_support_objectives.xlsx`} target="_blank" <a href={`/api/ec_years/${this.props.yearId}/requirement_support_objectives.xlsx${getRandomNumber()}`} target="_blank"
className="ant-btn ant-btn-primary color-white fr mt20">导出矩阵</a> className="ant-btn ant-btn-primary color-white fr mt20">导出矩阵</a>
</ul> </ul>
<div className="padding20-30" style={{ background: '#fff' }}> <div className="padding20-30" style={{ background: '#fff' }}>
@ -155,7 +155,7 @@ class RequirementVsObjective extends Component {
></SelectTable> ></SelectTable>
</div> </div>
</div> </div>
); );
} }
} }

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import classNames from 'classnames' import classNames from 'classnames'
import {getRandomNumber} from 'educoder'
import axios from 'axios'; import axios from 'axios';
import { Table, Divider, Tag, Checkbox, InputNumber, Spin, Icon } from 'antd'; import { Table, Divider, Tag, Checkbox, InputNumber, Spin, Icon } from 'antd';
@ -12,10 +12,10 @@ class RequirementVsObjective extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state={ this.state={
} }
} }
componentDidMount(){ componentDidMount(){
// this.init() // this.init()
// return; // return;
@ -25,7 +25,7 @@ class RequirementVsObjective extends Component {
axios.get(url).then((response) => { axios.get(url).then((response) => {
if (response.data.graduation_subitems) { if (response.data.graduation_subitems) {
this.setState( {...response.data} , () => { this.setState( {...response.data} , () => {
this.init() this.init()
}) })
} }
}).catch((e) => { }).catch((e) => {
@ -61,7 +61,7 @@ class RequirementVsObjective extends Component {
const yearId = this.props.match.params.yearId const yearId = this.props.match.params.yearId
const url = `/ec_years/${yearId}/subitem_support_standards.json` const url = `/ec_years/${yearId}/subitem_support_standards.json`
const method = select ? axios.delete : axios.post const method = select ? axios.delete : axios.post
method(url, method(url,
select ? { select ? {
params: { params: {
ec_graduation_subitem_id, ec_graduation_subitem_id,
@ -74,7 +74,7 @@ class RequirementVsObjective extends Component {
).then((response) => { ).then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.setState( this.setState(
(prevState) => ({ (prevState) => ({
tableData : update(prevState.tableData, {[rowIndex]: {[colIndex]: {$set: select ? false : true}}}) tableData : update(prevState.tableData, {[rowIndex]: {[colIndex]: {$set: select ? false : true}}})
}) })
) )
@ -97,7 +97,7 @@ class RequirementVsObjective extends Component {
const columnIdIndexMap = {} const columnIdIndexMap = {}
console.log(columns, tableData) console.log(columns, tableData)
return ( return (
<div className="educontent requirementVsObjective" style={{ background: '#fff' }}> <div className="educontent requirementVsObjective" style={{ background: '#fff' }}>
<ul className="clearfix padding20-30 bor-bottom-greyE backgroundFFF" <ul className="clearfix padding20-30 bor-bottom-greyE backgroundFFF"
style={{ 'marginBottom': '0px' }} > style={{ 'marginBottom': '0px' }} >
@ -109,7 +109,7 @@ class RequirementVsObjective extends Component {
</p> </p>
</li> </li>
<a href={`/api/ec_years/${this.props.yearId}/subitem_support_standards.xlsx`} target="_blank" <a href={`/api/ec_years/${this.props.yearId}/subitem_support_standards.xlsx${getRandomNumber()}`} target="_blank"
className="ant-btn ant-btn-primary color-white fr mt20">导出矩阵</a> className="ant-btn ant-btn-primary color-white fr mt20">导出矩阵</a>
</ul> </ul>
<div className="padding20-30" style={{ background: '#fff' }}> <div className="padding20-30" style={{ background: '#fff' }}>
@ -126,7 +126,7 @@ class RequirementVsObjective extends Component {
></SelectTable> ></SelectTable>
</div> </div>
</div> </div>
); );
} }
} }

@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Spin, Button, Input, Divider, Icon, Tooltip, Form, message } from 'antd'; import { Spin, Button, Input, Divider, Icon, Tooltip, Form, message } from 'antd';
import {getRandomNumber} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import './index.scss'; import './index.scss';
@ -157,7 +158,7 @@ class TrainingObjective extends React.Component {
<Link to="/forums/3529" target="_blank" className="link ml10">查看详情</Link> <Link to="/forums/3529" target="_blank" className="link ml10">查看详情</Link>
</div> </div>
</div> </div>
<a href={`/api/ec_years/${this.props.yearId}/ec_training_objectives.xlsx`} target="_blank" className="ant-btn ant-btn-primary color-white">导出培养目标</a> <a href={`/api/ec_years/${this.props.yearId}/ec_training_objectives.xlsx${getRandomNumber()}`} target="_blank" className="ant-btn ant-btn-primary color-white">导出培养目标</a>
</div> </div>
<Divider/> <Divider/>
@ -191,7 +192,7 @@ class TrainingObjective extends React.Component {
</div> </div>
) )
} }
<div className="training-objective-items"> <div className="training-objective-items">
<div className="training-objective-items-head"> <div className="training-objective-items-head">
<div className="no-column">分项</div> <div className="no-column">分项</div>

@ -1,6 +1,8 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import classNames from 'classnames' import classNames from 'classnames';
import {getRandomNumber} from 'educoder';
import axios from 'axios'; import axios from 'axios';
@ -166,7 +168,7 @@ const buildColumns = (that) => {
const _i_remain = index % 3; const _i_remain = index % 3;
// 未达成 // 未达成
const obj = { const obj = {
children: row.status ? <span style={{color: '#29BD88'}}>达成</span> children: row.status ? <span style={{color: '#29BD88'}}>达成</span>
: <span style={{color: '#FF6800'}}>未达成</span>, : <span style={{color: '#FF6800'}}>未达成</span>,
props: {}, props: {},
}; };
@ -233,14 +235,14 @@ function getTableData(data_args) {
// 一个course数组的数据组合成三行table数据 // 一个course数组的数据组合成三行table数据
innerItem.course_data.forEach((course, courseIndex) => { innerItem.course_data.forEach((course, courseIndex) => {
nameRowData[`c${courseIndex + 1}`] = course.course_name; nameRowData[`c${courseIndex + 1}`] = course.course_name;
targetValueRowData[`c${courseIndex + 1}`] = course.target_value && course.target_value.toFixed targetValueRowData[`c${courseIndex + 1}`] = course.target_value && course.target_value.toFixed
? course.target_value.toFixed(3) : course.target_value ; ? course.target_value.toFixed(3) : course.target_value ;
if (course.target_value) { if (course.target_value) {
target_value_total = target_value_total + course.target_value target_value_total = target_value_total + course.target_value
} }
realValueRowData[`c${courseIndex + 1}`] = course.real_value && course.real_value.toFixed realValueRowData[`c${courseIndex + 1}`] = course.real_value && course.real_value.toFixed
? course.real_value.toFixed(3) : course.real_value ; ? course.real_value.toFixed(3) : course.real_value ;
if (course.real_value) { if (course.real_value) {
real_value_total = real_value_total + course.real_value real_value_total = real_value_total + course.real_value
@ -259,7 +261,7 @@ function getTableData(data_args) {
return tableData; return tableData;
} }
// new // new
function getTableData(data_args) { function getTableData(data_args) {
let tableData = [] let tableData = []
// 最大课程数量,根据这个值动态渲染课程列数 // 最大课程数量,根据这个值动态渲染课程列数
maxCouseCount = 0; maxCouseCount = 0;
@ -274,16 +276,16 @@ let tableData = []
// 一个course数组的数据组合成三行table数据 // 一个course数组的数据组合成三行table数据
innerItem.course_supports.forEach((course, courseIndex) => { innerItem.course_supports.forEach((course, courseIndex) => {
nameRowData[`c${courseIndex + 1}`] = course.course_name; nameRowData[`c${courseIndex + 1}`] = course.course_name;
targetValueRowData[`c${courseIndex + 1}`] = course.reach_criteria targetValueRowData[`c${courseIndex + 1}`] = course.reach_criteria
// course.target_value && course.target_value.toFixed // course.target_value && course.target_value.toFixed
// ? course.target_value.toFixed(3) : course.target_value ; // ? course.target_value.toFixed(3) : course.target_value ;
// if (course.target_value) { // if (course.target_value) {
// target_value_total = target_value_total + course.target_value // target_value_total = target_value_total + course.target_value
// } // }
realValueRowData[`c${courseIndex + 1}`] = course.actually_reach realValueRowData[`c${courseIndex + 1}`] = course.actually_reach
// course.real_value && course.real_value.toFixed // course.real_value && course.real_value.toFixed
// ? course.real_value.toFixed(3) : course.real_value ; // ? course.real_value.toFixed(3) : course.real_value ;
// if (course.real_value) { // if (course.real_value) {
// real_value_total = real_value_total + course.real_value // real_value_total = real_value_total + course.real_value
@ -496,7 +498,7 @@ class GraduatesRequirement extends Component {
} }
} }
onDaChengYuZhiChange = (value) => { onDaChengYuZhiChange = (value) => {
if ( (!window.event || window.event.type == 'blur') if ( (!window.event || window.event.type == 'blur')
&& this.state.daChengYuZhi > 1 && value == 1) { && this.state.daChengYuZhi > 1 && value == 1) {
this.props.showSingleButtonModal('提示', '达成阈值必须小于等于1') this.props.showSingleButtonModal('提示', '达成阈值必须小于等于1')
} }
@ -526,7 +528,7 @@ class GraduatesRequirement extends Component {
axios.post(url, { axios.post(url, {
reach_criteria : this.state.daChengYuZhi reach_criteria : this.state.daChengYuZhi
}).then((response) => { }).then((response) => {
if( response.data.status === 0 ) { if( response.data.status === 0 ) {
this.setState({ daChengYuZhiSaved: this.state.daChengYuZhi }) this.setState({ daChengYuZhiSaved: this.state.daChengYuZhi })
this.setDaChengYuZhiEditableMode(false) this.setDaChengYuZhiEditableMode(false)
@ -537,7 +539,7 @@ class GraduatesRequirement extends Component {
console.log(error) console.log(error)
}) })
} }
componentDidMount(){ componentDidMount(){
window.document.title = '达成度评价结果'; window.document.title = '达成度评价结果';
@ -569,7 +571,7 @@ class GraduatesRequirement extends Component {
// const url = `ec_courses/7/get_calculation_data` // const url = `ec_courses/7/get_calculation_data`
// const url = `/ec_courses/get_calculation_data?ec_year_id=${ec_year_id}` // const url = `/ec_courses/get_calculation_data?ec_year_id=${ec_year_id}`
const url = `/ec_years/${ec_year_id}/reach_evaluation.json` const url = `/ec_years/${ec_year_id}/reach_evaluation.json`
// num_array = getNumArray(testData.calculation_data); // num_array = getNumArray(testData.calculation_data);
// tableData = getTableData(testData.calculation_data) // tableData = getTableData(testData.calculation_data)
// return // return
@ -578,8 +580,8 @@ class GraduatesRequirement extends Component {
}) })
.then((response) => { .then((response) => {
if (response.data.graduation_requirements) { if (response.data.graduation_requirements) {
num_array = getNumArray(response.data.graduation_requirements); num_array = getNumArray(response.data.graduation_requirements);
tableData = getTableData(response.data.graduation_requirements) tableData = getTableData(response.data.graduation_requirements)
// 先计算再触发render // 先计算再触发render
this.setState({ this.setState({
calculationData: response.data.calculation_data, calculationData: response.data.calculation_data,
@ -590,7 +592,7 @@ class GraduatesRequirement extends Component {
calculating: false, calculating: false,
}) })
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -604,7 +606,7 @@ class GraduatesRequirement extends Component {
return; return;
} }
this.setState({ calculating: true }) this.setState({ calculating: true })
var Url = '/ec_courses/sync_all_course_data'; var Url = '/ec_courses/sync_all_course_data';
/** /**
@ -615,14 +617,14 @@ class GraduatesRequirement extends Component {
axios.post(Url, { axios.post(Url, {
course_ids: this.state.course_ids course_ids: this.state.course_ids
}).then((response) => { }).then((response) => {
// 计算需要一定的时间,让按钮转动 // 计算需要一定的时间,让按钮转动
if( response.data.status === 1 ) { if( response.data.status === 1 ) {
let ec_year_id = this.props.match.params.ec_year_id; let ec_year_id = this.props.match.params.ec_year_id;
this.fetchData(ec_year_id); this.fetchData(ec_year_id);
this.props.showSingleButtonModal('提示', '计算完毕') this.props.showSingleButtonModal('提示', '计算完毕')
} else { } else {
} }
}).catch((error) => { }).catch((error) => {
this.setState({ calculating: false }) this.setState({ calculating: false })
@ -641,7 +643,7 @@ class GraduatesRequirement extends Component {
// showCalculateButton = true; // showCalculateButton = true;
// } // }
return ( return (
<div className="educontent graduatesRequirement"> <div className="educontent graduatesRequirement">
<ul className="clearfix padding20-30 bor-bottom-greyE backgroundFFF" <ul className="clearfix padding20-30 bor-bottom-greyE backgroundFFF"
@ -659,62 +661,62 @@ class GraduatesRequirement extends Component {
<p class="clearfix padding20-30 bor-bottom-greyE backgroundFFF" <p class="clearfix padding20-30 bor-bottom-greyE backgroundFFF"
style={{ 'paddingBottom': '12px' }}> style={{ 'paddingBottom': '12px' }}>
<span class="fl font-14">达成阈值</span> <span class="fl font-14">达成阈值</span>
{ daChengYuZhiEditableMode ? { daChengYuZhiEditableMode ?
<React.Fragment> <React.Fragment>
<InputNumber value={daChengYuZhi} onChange={this.onDaChengYuZhiChange} <InputNumber value={daChengYuZhi} onChange={this.onDaChengYuZhiChange}
size="small" min={0} max={1} step={0.01} ></InputNumber> size="small" min={0} max={1} step={0.01} ></InputNumber>
<span onClick={this.saveDaChengYuZhi} <span onClick={this.saveDaChengYuZhi}
style={{color: '#4CACFF', marginLeft: '4px', cursor: 'pointer', fontSize: '13px'}}>确定 style={{color: '#4CACFF', marginLeft: '4px', cursor: 'pointer', fontSize: '13px'}}>确定
</span> </span>
<span onClick={ this.onDaChengYuZhiCancel } <span onClick={ this.onDaChengYuZhiCancel }
style={{color: '#d1d1d1', marginLeft: '4px', cursor: 'pointer', fontSize: '13px'}} >取消 style={{color: '#d1d1d1', marginLeft: '4px', cursor: 'pointer', fontSize: '13px'}} >取消
</span> </span>
</React.Fragment> </React.Fragment>
: :
<React.Fragment> <React.Fragment>
<span class="color-orange fl" id="ReachStandardNum">{daChengYuZhiSaved}</span> <span class="color-orange fl" id="ReachStandardNum">{daChengYuZhiSaved}</span>
{/* data-tip-down="编辑" */} {/* data-tip-down="编辑" */}
<i <i
onClick={() => { this.setDaChengYuZhiEditableMode(true) }} onClick={() => { this.setDaChengYuZhiEditableMode(true) }}
class="iconfont icon-bianjidaibeijing color-green" idkey="0" class="iconfont icon-bianjidaibeijing color-green" idkey="0"
style={{ float: 'left', marginTop: '-3px', marginLeft: '3px', cursor: 'pointer' }}></i> style={{ float: 'left', marginTop: '-3px', marginLeft: '3px', cursor: 'pointer' }}></i>
</React.Fragment> </React.Fragment>
} }
{/* <a class="mr20 editSubentry" style={{display: 'block'}}> {/* <a class="mr20 editSubentry" style={{display: 'block'}}>
</a> */} </a> */}
<a href="javascript:void(0)" <a href="javascript:void(0)"
class="white-btn edu-orangeback-btn fr mr10" class="white-btn edu-orangeback-btn fr mr10"
href={`/api/ec_years/${this.state.ec_year_id}/reach_evaluation.xlsx`} href={`/api/ec_years/${this.state.ec_year_id}/reach_evaluation.xlsx${getRandomNumber()}`}
>导出</a> >导出</a>
{/* /ec_major_schools/3/academic_years/5/export_reach_requirements_data.xls {/* /ec_major_schools/3/academic_years/5/export_reach_requirements_data.xls
let major_school_id =this.props.match.params.major_school_id; let major_school_id =this.props.match.params.major_school_id;
let ec_year_id =this.props.match.params.ec_year_id; let ec_year_id =this.props.match.params.ec_year_id;
*/} */}
{ showCalculateButton && ( this.state.calculating === true ? { showCalculateButton && ( this.state.calculating === true ?
<a href="javascript:void(0)" class="white-btn edu-grayback-btn mr20 fr"> <a href="javascript:void(0)" class="white-btn edu-grayback-btn mr20 fr">
计算中... 计算中...
</a> : </a> :
<a href="javascript:void(0)" class="white-btn edu-orangeline-btn mr20 fr" onClick={this.onCalculate}> <a href="javascript:void(0)" class="white-btn edu-orangeline-btn mr20 fr" onClick={this.onCalculate}>
计算 计算
</a> ) </a> )
} }
</p> </p>
{/* { this.state.calculating == true ? {/* { this.state.calculating == true ?
<Spin delay={500} className="Spinlarge" indicator={<Icon type="loading" style={{ fontSize: 30 }} spin />}></Spin> <Spin delay={500} className="Spinlarge" indicator={<Icon type="loading" style={{ fontSize: 30 }} spin />}></Spin>
: }   */} : }   */}
<Table bordered loading={ this.state.calculating } <Table bordered loading={ this.state.calculating }
columns={buildColumns(this)} dataSource={tableData} pagination={false} columns={buildColumns(this)} dataSource={tableData} pagination={false}
scroll={{ y: 530 }} scroll={{ y: 530 }}
></Table> ></Table>
</div> </div>
); );
} }
} }

@ -1,23 +1,13 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import classNames from 'classnames'
import axios from 'axios'; import {getRandomNumber} from 'educoder';
import { TPMIndexHOC } from '../../tpm/TPMIndexHOC';
import { SnackbarHOC } from 'educoder'
import { message,Modal,Spin,Icon} from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import EcTitleCourseEvaluations from '../ecTitle/ecTitle'
import '../css/ecCourseSupports.css'; import '../css/ecCourseSupports.css';
import '../css/ecCourseEvaluations.css'; import '../css/ecCourseEvaluations.css';
import { import {
BrowserRouter as Router,
Route, Route,
Switch Switch
} from 'react-router-dom'; } from 'react-router-dom';
@ -223,7 +213,7 @@ class Curriculum extends Component {
titine===5? titine===5?
<span> <span>
<span className={ismanager===false?"none":""} style={{top: "26px"}}> <span className={ismanager===false?"none":""} style={{top: "26px"}}>
<a className="white-btn edu-blueback-btn fr mb10 mr10 mt9" target="_blank" href={`/ec_courses/${ec_course_id}/course_targets.xlsx`}>导出评价详情</a> <a className="white-btn edu-blueback-btn fr mb10 mr10 mt9" target="_blank" href={`/ec_courses/${ec_course_id}/course_targets.xlsx${getRandomNumber()}`}>导出评价详情</a>
</span> </span>
<span className={ismanager===false?"none":"right newrightcalculatebuttons fr mb10 mr20 "} <span className={ismanager===false?"none":"right newrightcalculatebuttons fr mb10 mr20 "}
onClick={()=>this.newrightcalculatebuttonysl(this.child)}>计算</span> onClick={()=>this.newrightcalculatebuttonysl(this.child)}>计算</span>

@ -845,7 +845,7 @@ class MemoDetail extends Component {
</div> </div>
: :
<div className="memoMore"> <div className="memoMore">
<div className="writeCommentBtn" onClick={this.showCommentInput}>写评论1</div> <div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div>
</div>} </div>}
</div> </div>

@ -1,3 +1,4 @@
import './header.scss';
import React, { Component } from 'react'; import React, { Component } from 'react';
import Button from 'material-ui/Button'; import Button from 'material-ui/Button';
@ -120,9 +121,11 @@ class Header extends Component {
<div className="headerRight"> <div className="headerRight">
<div className="fr"> <div className="fr">
{shixun ? {shixun ?
<a href={`/shixuns/${shixun.identifier}/challenges`} className="mr20 mt8 exitBtn" > // className="mr20 mt8 exitBtn"
<a href={`/shixuns/${shixun.identifier}/challenges`} className="mr20 mt8 exit_btn">
<i className="fa fa-power-off font-16"></i> <i className="fa fa-power-off font-16"></i>
<span>{'退出闯关'}</span> {/* <span>{'退出闯关'}</span> */}
<span>{'退出实训'}</span>
</a> </a>
: ''} : ''}
</div> </div>

@ -338,6 +338,33 @@ class VNCContainer extends Component {
.float_button:hover .text { .float_button:hover .text {
color: #4CACFF; color: #4CACFF;
} }
.resetVNC1{
top: -50px;
writing-mode: initial;
left: calc(100% - 230px);
background-image: none;
width: auto;
// background: #081516;
height: 30px;
padding: 0 6px;
border-radius: 4px;
z-index: 10;
font-size: 16px;
transition: color .3s;
}
.resetVNC1 .text {
top: 0px;
writing-mode: initial;
left: unset;
}
.resetVNC1 .text span {
vertical-align: middle;
margin-left: 2px;
}
.float_button:hover .text {
transition: color .3s;
color: #4CACFF;
}
`}</style> `}</style>
<div style={{ 'padding': '16px', 'border-bottom': '1px solid #3A383A' }}> <div style={{ 'padding': '16px', 'border-bottom': '1px solid #3A383A' }}>
<div style={{ color: '#888888' }}>网址克隆</div> <div style={{ color: '#888888' }}>网址克隆</div>
@ -354,11 +381,15 @@ class VNCContainer extends Component {
></RepoTree> ></RepoTree>
</SecondDrawer> </SecondDrawer>
<FloatButton className="resetVNC" onClick={this.onResetVNC}> {/* <FloatButton className="resetVNC" onClick={this.onResetVNC}>
{/* <i className="iconfont icon-zhongzhi2 font-16 "></i> */}
{this.state.vnc_reseting ? <Icon type="loading" style={{verticalAlign: 'sub'}} /> {this.state.vnc_reseting ? <Icon type="loading" style={{verticalAlign: 'sub'}} />
: <i className="iconfont icon-zhongzhi2 font-16 "></i>} : <i className="iconfont icon-zhongzhi2 font-16 "></i>}
<span>重置桌面系统</span> <span>重置桌面系统</span>
</FloatButton> */}
<FloatButton className="resetVNC1" onClick={this.onResetVNC}>
{this.state.vnc_reseting ? <Icon type="loading" style={{verticalAlign: 'sub'}} />
: <i className="iconfont icon-zhongzhi2 font-24"></i>}
<span>重置实训</span>
</FloatButton> </FloatButton>
{/* <Spin tip="..." spinning={this.state.vnc_reseting}> {/* <Spin tip="..." spinning={this.state.vnc_reseting}>

@ -166,7 +166,8 @@ class VNCDisplay extends Component {
`}</style> `}</style>
<div id="top_bar"> <div id="top_bar">
<div id="status">Loading</div> <div id="status">Loading</div>
<div id="sendCtrlAltDelButton">Send CtrlAltDel</div> {/* <div id="sendCtrlAltDelButton">Send CtrlAltDel</div> */}
<div id="sendCtrlAltDelButton" style={{ opacity: 0, display: 'none' }}></div>
</div> </div>
<div id="screen" style={{ height: 'calc(100vh - 140px)' }}> <div id="screen" style={{ height: 'calc(100vh - 140px)' }}>

@ -0,0 +1,6 @@
.headerRight .exit_btn{
color: rgba(237,237,237,1);
&:hover{
// color: #fff;
}
}

@ -14,6 +14,7 @@ import passpartImg from '../../../images/tpi/passpart.png'
import empiricgreenImg from '../../../images/tpi/empiricgreen.png' import empiricgreenImg from '../../../images/tpi/empiricgreen.png'
import { trigger } from 'educoder'; import { trigger } from 'educoder';
import SecondTab from "../../paths/SchoolStatistics/SecondTab";
class TaskResultLayer extends Component { class TaskResultLayer extends Component {
@ -29,7 +30,7 @@ class TaskResultLayer extends Component {
} }
componentWillReceiveProps(newProps, newContext) { componentWillReceiveProps(newProps, newContext) {
if (newProps.currentGamePassed && (!this.props.currentGamePassed if (newProps.currentGamePassed && (!this.props.currentGamePassed
|| (newProps.currentGamePassed !== this.props.currentGamePassed ))) { || (newProps.currentGamePassed !== this.props.currentGamePassed ))) {
// this.fakeRanking = this._fakeRanking() // this.fakeRanking = this._fakeRanking()
const $ = window.$; const $ = window.$;
@ -51,10 +52,10 @@ class TaskResultLayer extends Component {
} }
} }
} }
onStarChange(challenge, index, value) { onStarChange(challenge, index, value) {
this.props.onStarChange(challenge, index, value); this.props.onStarChange(challenge, index, value);
this.setState({ this.setState({
stared: value ? true : false, stared: value ? true : false,
}) })
@ -87,11 +88,11 @@ class TaskResultLayer extends Component {
// this.context.router.push('/sample'); // this.context.router.push('/sample');
if (goNext === true) { if (goNext === true) {
if (next_game) { // https://www.trustie.net/issues/18573 if (next_game) { // https://www.trustie.net/issues/18573
this.goNext = true; this.goNext = true;
} }
// 隐藏掉效果查看页面 // 隐藏掉效果查看页面
window.$('#picture_display').hide() window.$('#picture_display').hide()
} }
this.props.onGamePassed(); this.props.onGamePassed();
this.setState({ this.setState({
stared: false stared: false
@ -110,9 +111,9 @@ class TaskResultLayer extends Component {
// return; // return;
// } // }
// const { showLanguagePictrue } = this.props.challenge; // const { showLanguagePictrue } = this.props.challenge;
// if ( prevProps.challenge.showLanguagePictrue != showLanguagePictrue && // if ( prevProps.challenge.showLanguagePictrue != showLanguagePictrue &&
// showLanguagePictrue == true ) { // showLanguagePictrue == true ) {
// } // }
// } // }
initEffectDisplayServerTimer = () => { initEffectDisplayServerTimer = () => {
@ -128,7 +129,7 @@ class TaskResultLayer extends Component {
this.setState({ timeRemain }) this.setState({ timeRemain })
}, 1000) }, 1000)
}) })
} }
componentWillUnmount() { componentWillUnmount() {
this.intervalHandler && clearInterval(this.intervalHandler); this.intervalHandler && clearInterval(this.intervalHandler);
@ -162,7 +163,7 @@ class TaskResultLayer extends Component {
// const fakeRanking = this.fakeRanking; // const fakeRanking = this.fakeRanking;
return ( return (
<div> <div>
{currentGamePassed ? {currentGamePassed ?
<div className="taskResultLayer"> <div className="taskResultLayer">
<div className="pr passTaskContent" style={{display:'none'}} > <div className="pr passTaskContent" style={{display:'none'}} >
<i className="far fa-times-circle closeIcon" onClick={closeTaskResultLayer} title="关闭"></i> <i className="far fa-times-circle closeIcon" onClick={closeTaskResultLayer} title="关闭"></i>
@ -174,52 +175,60 @@ class TaskResultLayer extends Component {
<p className="inline inlines exp"> <p className="inline inlines exp">
<img src={empiricgreenImg} className="mr8 mt5 fl"/> <img src={empiricgreenImg} className="mr8 mt5 fl"/>
{currentPassedGameGainExperience >= 0 ? `+${currentPassedGameGainExperience}` : '+0'} {currentPassedGameGainExperience >= 0 ? `+${currentPassedGameGainExperience}` : '+0'}
</p> </p>
</div> </div>
<div className="winPanel"> <div className="winPanel">
<style>
{
`
.page--body{
z-index: 0 !important;
}
`
}
</style>
<div className="cl"></div> <div className="cl"></div>
{ !game.star ? { !game.star ?
<React.Fragment> <React.Fragment>
<p className="rateLabel ">您的评价决定老师的江湖地位~</p> <p className="rateLabel ">您的评价决定老师的江湖地位~</p>
<Rate <Rate
defaultValue={0} defaultValue={0}
allowClear={false} allowClear={false}
onChange={(value) => this.onStarChange(this.props.game, this.props.challenge.position, value)} onChange={(value) => this.onStarChange(this.props.game, this.props.challenge.position, value)}
/> />
</React.Fragment> </React.Fragment>
: ''} : ''}
<p> <p>
{/*<a href="javascript:void(0)" className="passNext">下一关</a>*/} {/*<a href="javascript:void(0)" className="passNext">下一关</a>*/}
<a href="javascript:void(0)" className={`passed ${ stared || game.star ? 'stared' : '' }`} <a href="javascript:void(0)" className={`passed ${ stared || game.star ? 'stared' : '' }`}
{...titleObj} onClick={()=>this.onFinish(true)}>{ next_game ? '下一关' : '完成'}</a> {...titleObj} onClick={()=>this.onFinish(true)}>{ next_game ? '下一关' : '完成'}</a>
{ challenge.showLanguagePictrue && { challenge.showLanguagePictrue &&
<a href="javascript:void(0)" className={`passed ${ stared || game.star ? 'stared' : '' }`} <a href="javascript:void(0)" className={`passed ${ stared || game.star ? 'stared' : '' }`}
{...titleObj} onClick={()=>this.onFinish()}> {...titleObj} onClick={()=>this.onFinish()}>
{ `查看效果` } { `查看效果` }
{/* ${ moment(this.state.timeRemain * 1000).format('mm:ss') } */} {/* ${ moment(this.state.timeRemain * 1000).format('mm:ss') } */}
</a> </a>
} }
{/* {/*
(this.state.timeRemain ? (this.state.timeRemain ?
<Tooltip title={"注意效果查看服务只会保留5分钟"} disableFocusListener={true}> <Tooltip title={"注意效果查看服务只会保留5分钟"} disableFocusListener={true}>
</Tooltip> </Tooltip>
: :
<Tooltip title={"效果查看服务已被终止运行,需要重新评测后才能查看"} disableFocusListener={true}> <Tooltip title={"效果查看服务已被终止运行,需要重新评测后才能查看"} disableFocusListener={true}>
<a href="javascript:void(0)" className={`passed ${ stared || game.star ? 'stared' : '' }`} <a href="javascript:void(0)" className={`passed ${ stared || game.star ? 'stared' : '' }`}
{...titleObj} onClick={()=>{}} style={{ backgroundColor: 'gray'}}> {...titleObj} onClick={()=>{}} style={{ backgroundColor: 'gray'}}>
{ `查看效果` } { `查看效果` }
</a> </a>
</Tooltip> </Tooltip>
) )
*/} */}
{/* {/*
注意效果查看服务只会保留5分钟 注意效果查看服务只会保留5分钟
效果查看服务已被终止运行需要重新评测后才能查看 效果查看服务已被终止运行需要重新评测后才能查看
*/} */}

@ -120,8 +120,10 @@ button.buttonHoverColor:hover a {
#myshixun_top { #myshixun_top {
display: flex; display: flex;
height: 54px; position: fixed;
height: 54px;
z-index: 1 !important;
} }
.headerLeft { .headerLeft {
flex: 0 0 400px; flex: 0 0 400px;

@ -97,7 +97,7 @@ class NewMyShixunModel extends Component {
} }
setsub_discipline_id=(sub_discipline_id)=>{ setsub_discipline_id=(discipline_id,sub_discipline_id)=>{
this.setState({ this.setState({
sub_discipline_id:sub_discipline_id, sub_discipline_id:sub_discipline_id,
tag_discipline_id:null, tag_discipline_id:null,
@ -107,7 +107,7 @@ class NewMyShixunModel extends Component {
oj_status:null oj_status:null
}) })
var data = { var data = {
discipline_id:this.state.discipline_id, discipline_id:discipline_id,
sub_discipline_id:sub_discipline_id, sub_discipline_id:sub_discipline_id,
tag_discipline_id:null, tag_discipline_id:null,
public: this.state.defaultActiveKey, public: this.state.defaultActiveKey,
@ -161,8 +161,8 @@ class NewMyShixunModel extends Component {
this.callback(defaultActiveKeys); this.callback(defaultActiveKeys);
let url = `/users/get_navigation_info.json`; let url = `/users/get_navigation_info.json`;
axios.get(url, {}).then((response) => { axios.get(url, {}).then((response) => {
// ////console.log("开始请求/get_navigation_info.json"); // //////console.log("开始请求/get_navigation_info.json");
// ////console.log(response); // //////console.log(response);
if (response != undefined) { if (response != undefined) {
if (response.status === 200) { if (response.status === 200) {
this.setState({ this.setState({
@ -180,8 +180,8 @@ class NewMyShixunModel extends Component {
axios.get(urls, {params: { axios.get(urls, {params: {
source:"question" source:"question"
}}).then((response) => { }}).then((response) => {
console.log("Questiondisciplines"); //console.log("Questiondisciplines");
console.log(response.data); //console.log(response.data);
if (response) { if (response) {
this.setState({ this.setState({
disciplinesdata: response.data.disciplines, disciplinesdata: response.data.disciplines,
@ -254,15 +254,15 @@ class NewMyShixunModel extends Component {
} else { } else {
} }
////console.log("item_banks"); //////console.log("item_banks");
////console.log(response); //////console.log(response);
this.setState({ this.setState({
Contentdata: response.data, Contentdata: response.data,
items_count: response.data.items_count, items_count: response.data.items_count,
}) })
this.getdataslen(response.data.items); this.getdataslen(response.data.items);
}).catch((error) => { }).catch((error) => {
////console.log(error) //////console.log(error)
this.setState({ this.setState({
booljupyterurls:false, booljupyterurls:false,
}) })
@ -288,8 +288,8 @@ class NewMyShixunModel extends Component {
} else { } else {
} }
////console.log("item_banks"); //////console.log("item_banks");
////console.log(response); //////console.log(response);
this.setState({ this.setState({
Contentdata: response.data, Contentdata: response.data,
items_count: response.data.items_count, items_count: response.data.items_count,
@ -590,7 +590,7 @@ class NewMyShixunModel extends Component {
} }
}) })
.catch(function (error) { .catch(function (error) {
//console.log(error); ////console.log(error);
}); });
} }
publicopentimu = (id) => { publicopentimu = (id) => {
@ -616,7 +616,7 @@ class NewMyShixunModel extends Component {
this.getdata(data); this.getdata(data);
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} }
@ -625,8 +625,8 @@ class NewMyShixunModel extends Component {
// const url = "/item_baskets/basket_list.json"; // const url = "/item_baskets/basket_list.json";
// axios.get(url) // axios.get(url)
// .then((result) => { // .then((result) => {
// // //console.log("getbasket_listdata"); // // ////console.log("getbasket_listdata");
// // //console.log(result.data); // // ////console.log(result.data);
// this.setState({ // this.setState({
// completion_questions_count: result.data.completion_questions_count, // completion_questions_count: result.data.completion_questions_count,
// judgement_questions_count: result.data.judgement_questions_count, // judgement_questions_count: result.data.judgement_questions_count,
@ -638,7 +638,7 @@ class NewMyShixunModel extends Component {
// }) // })
// //
// }).catch((error) => { // }).catch((error) => {
// // //console.log(error); // // ////console.log(error);
// this.setState({ // this.setState({
// completion_questions_count: 0, // completion_questions_count: 0,
// judgement_questions_count: 0, // judgement_questions_count: 0,
@ -687,7 +687,7 @@ class NewMyShixunModel extends Component {
// }) // })
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} }
// 撤销 // 撤销
@ -715,7 +715,7 @@ class NewMyShixunModel extends Component {
this.getbasket_listdata(); this.getbasket_listdata();
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
}else{ }else{
url=`/examination_banks/${this.props.exam_id}/revoke_item.json`; url=`/examination_banks/${this.props.exam_id}/revoke_item.json`;
@ -741,7 +741,7 @@ class NewMyShixunModel extends Component {
this.getbasket_listdata(); this.getbasket_listdata();
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} }
@ -815,7 +815,7 @@ class NewMyShixunModel extends Component {
} }
}) })
.catch(function (error) { .catch(function (error) {
//console.log(error); ////console.log(error);
}); });
} }
@ -930,6 +930,7 @@ class NewMyShixunModel extends Component {
{/*头部*/} {/*头部*/}
<Contentpart {...this.state} {...this.props} <Contentpart {...this.state} {...this.props}
exam_id={this.props.exam_id} exam_id={this.props.exam_id}
Isitapopup={"true"}
getitem_basketss={(id)=>this.getitem_basketss(id)} getitem_basketss={(id)=>this.getitem_basketss(id)}
selectallquestionsonthispage={()=>this.selectallquestionsonthispage()} selectallquestionsonthispage={()=>this.selectallquestionsonthispage()}
getitem_baskets={(e)=>this.getitem_baskets(e)} getitem_baskets={(e)=>this.getitem_baskets(e)}

@ -67,8 +67,8 @@ class Paperreview extends Component {
//初始化 //初始化
componentDidMount() { componentDidMount() {
console.log("Paperreview.js"); //console.log("Paperreview.js");
console.log(this.props.match.params); //console.log(this.props.match.params);
this.setState({ this.setState({
artificialtype:this.props.match.params.type artificialtype:this.props.match.params.type
}) })
@ -185,7 +185,7 @@ class Paperreview extends Component {
} }
}).catch((error) => { }).catch((error) => {
////console.log(error) //////console.log(error)
this.setState({ this.setState({
booljupyterurls: false, booljupyterurls: false,
}) })
@ -238,7 +238,7 @@ class Paperreview extends Component {
this.props.history.replace('/paperlibrary'); this.props.history.replace('/paperlibrary');
} }
}).catch((error) => { }).catch((error) => {
console.log(error); //console.log(error);
}) })
}else{ }else{
@ -321,12 +321,12 @@ class Paperreview extends Component {
axios.post(url, data) axios.post(url, data)
.then((result) => { .then((result) => {
if (result.data.status == 0) { if (result.data.status == 0) {
console.log(result); //console.log(result);
var data = {} var data = {}
this.getdata(data); this.getdata(data);
} }
}).catch((error) => { }).catch((error) => {
console.log(error); //console.log(error);
}) })
} }
//换题 //换题
@ -338,12 +338,12 @@ class Paperreview extends Component {
axios.post(url, data) axios.post(url, data)
.then((result) => { .then((result) => {
if (result.data.status == 0) { if (result.data.status == 0) {
console.log(result); //console.log(result);
var data = {} var data = {}
this.getdata(data); this.getdata(data);
} }
}).catch((error) => { }).catch((error) => {
console.log(error); //console.log(error);
}) })
} }
@ -361,7 +361,7 @@ class Paperreview extends Component {
render() { render() {
let {page, limit, count, Headertop, visible, placement, modalsType, item_type,artificialtype,Cohetepaperbool,newmyshixunmodelbool,Intelligentformation} = this.state; let {page, limit, count, Headertop, visible, placement, modalsType, item_type,artificialtype,Cohetepaperbool,newmyshixunmodelbool,Intelligentformation} = this.state;
const params = this.props && this.props.match && this.props.match.params; const params = this.props && this.props.match && this.props.match.params;
// //console.log(params); // ////console.log(params);
return ( return (
<div> <div>
<div id={"Itembankstopid"} className="newMain clearfix intermediatecenter " <div id={"Itembankstopid"} className="newMain clearfix intermediatecenter "

@ -95,7 +95,7 @@ class Paperreview_item extends Component {
this.props.getdata({}); this.props.getdata({});
} }
}).catch((error) => { }).catch((error) => {
console.log(error); //console.log(error);
}) })
} }
@ -114,7 +114,7 @@ class Paperreview_item extends Component {
this.props.getdata({}); this.props.getdata({});
} }
}).catch((error) => { }).catch((error) => {
console.log(error); //console.log(error);
}) })
@ -135,7 +135,7 @@ class Paperreview_item extends Component {
this.props.getdata({}); this.props.getdata({});
} }
}).catch((error) => { }).catch((error) => {
console.log(error); //console.log(error);
}) })
} }
@ -155,7 +155,7 @@ class Paperreview_item extends Component {
this.props.getdata({}); this.props.getdata({});
} }
}).catch((error) => { }).catch((error) => {
console.log(error); //console.log(error);
}) })
} }
@ -190,7 +190,7 @@ class Paperreview_item extends Component {
this.Singlemagazine("", false); this.Singlemagazine("", false);
} }
}).catch((error) => { }).catch((error) => {
console.log(error); //console.log(error);
}) })
} }
@ -207,7 +207,7 @@ class Paperreview_item extends Component {
this.Singlemagazines(false); this.Singlemagazines(false);
} }
}).catch((error) => { }).catch((error) => {
console.log(error); //console.log(error);
}) })
} }
@ -255,7 +255,7 @@ class Paperreview_item extends Component {
} }
}) })
.catch(function (error) { .catch(function (error) {
//console.log(error); ////console.log(error);
}); });
@ -299,7 +299,7 @@ class Paperreview_item extends Component {
} }
hideparagraph = (name) => { hideparagraph = (name) => {
console.log("hideparagraph"); //console.log("hideparagraph");
} }
@ -312,7 +312,7 @@ class Paperreview_item extends Component {
}) })
} }
showparagraph = (name) => { showparagraph = (name) => {
console.log("showparagraph"); //console.log("showparagraph");
if (name === "SINGLE") { if (name === "SINGLE") {
this.setState({ this.setState({
singlebool: true, singlebool: true,
@ -364,8 +364,8 @@ class Paperreview_item extends Component {
} }
showparagraphs = (e,name) => { showparagraphs = (e,name) => {
// console.log("showparagraphs"); // //console.log("showparagraphs");
// console.log(e); // //console.log(e);
this.setState({ this.setState({
paperreviewsingleindex: e, paperreviewsingleindex: e,
paperreviewsinglename:name, paperreviewsinglename:name,

@ -58,9 +58,9 @@ class Paperreview_items extends Component {
render() { render() {
let {paperreviewsingleindex,paperreviewsinglename,typenames,indexs,object,typenamesn}=this.props; let {paperreviewsingleindex,paperreviewsinglename,typenames,indexs,object,typenamesn}=this.props;
// console.log(object); // //console.log(object);
// console.log("Paperreview_items"); // //console.log("Paperreview_items");
// console.log(object.item_id); // //console.log(object.item_id);
return ( return (
<div> <div>
{ {

@ -59,7 +59,7 @@ class Paperreview_judgment extends Component {
render() { render() {
let {questions,totalscore,total,items} = this.state; let {questions,totalscore,total,items} = this.state;
// //console.log(params); // ////console.log(params);
return ( return (
<div className="w100s borderwdswuh mt25 mb20 " style={{ <div className="w100s borderwdswuh mt25 mb20 " style={{
minHeight: "114px", minHeight: "114px",

@ -59,7 +59,7 @@ class Paperreview_multlple extends Component {
render() { render() {
let {questions,totalscore,total,items} = this.state; let {questions,totalscore,total,items} = this.state;
// //console.log(params); // ////console.log(params);
return ( return (
<div className="w100s borderwdswuh mt25 mb20 " style={{ <div className="w100s borderwdswuh mt25 mb20 " style={{
minHeight: "114px", minHeight: "114px",

@ -59,7 +59,7 @@ class Paperreview_program extends Component {
render() { render() {
let {questions,totalscore,total,items} = this.state; let {questions,totalscore,total,items} = this.state;
// //console.log(params); // ////console.log(params);
return ( return (
<div className="w100s borderwdswuh mt25 mb20 " style={{ <div className="w100s borderwdswuh mt25 mb20 " style={{
minHeight: "114px", minHeight: "114px",

@ -99,7 +99,8 @@ class Paperreview_single extends Component {
<style>{ <style>{
` `
.programquill .ql-editor{ .programquill .ql-editor{
padding: 0px; padding-left: 0px !important;
padding-top: 0px !important;
} }
.programquill .ql-editor p{ .programquill .ql-editor p{
@ -107,7 +108,8 @@ class Paperreview_single extends Component {
} }
.programquills .ql-editor{ .programquills .ql-editor{
padding: 0px; padding-left: 0px !important;
padding-top: 0px !important;
} }
.programquills .ql-editor p{ .programquills .ql-editor p{
@ -142,7 +144,9 @@ class Paperreview_single extends Component {
{ {
objectsingle.item_type==="PROGRAM"? objectsingle.item_type==="PROGRAM"?
<div className="w100s sortinxdirection"> <div className="w100s sortinxdirection">
<div className=" tites lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{wordBreak: "break-word"}} <div className=" tites lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{wordBreak: "break-word",
minWidth:"32px"
}}
> >
({objectsingle.score}) ({objectsingle.score})
</div> </div>
@ -153,7 +157,9 @@ class Paperreview_single extends Component {
</div> </div>
: :
<div className="w100s sortinxdirection"> <div className="w100s sortinxdirection">
<div className="tites lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{wordBreak: "break-word"}} <div className="tites lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{wordBreak: "break-word",
minWidth:"32px"
}}
> >
({objectsingle.score}) ({objectsingle.score})
</div> </div>
@ -180,7 +186,7 @@ class Paperreview_single extends Component {
objectsingle === undefined || objectsingle === null ? "" : objectsingle.choices.map((object, index) => { objectsingle === undefined || objectsingle === null ? "" : objectsingle.choices.map((object, index) => {
return ( return (
<p className={index === 1 ? "sortinxdirection ml10" : "sortinxdirection "}> <p className={index === 1 ? "sortinxdirection ml10" : "sortinxdirection "}>
<Radio disabled={false}> <Radio disabled={true}>
{object.choice_text} {object.choice_text}
</Radio> </Radio>
</p> </p>

@ -113,7 +113,7 @@ class Question extends Component {
} }
setsub_discipline_id=(sub_discipline_id)=>{ setsub_discipline_id=(discipline_id,sub_discipline_id)=>{
this.setState({ this.setState({
sub_discipline_id:sub_discipline_id, sub_discipline_id:sub_discipline_id,
tag_discipline_id:null, tag_discipline_id:null,
@ -123,7 +123,7 @@ class Question extends Component {
oj_status:null oj_status:null
}) })
var data = { var data = {
discipline_id:this.state.discipline_id, discipline_id:discipline_id,
sub_discipline_id:sub_discipline_id, sub_discipline_id:sub_discipline_id,
tag_discipline_id:null, tag_discipline_id:null,
public: this.state.defaultActiveKey, public: this.state.defaultActiveKey,
@ -179,8 +179,8 @@ class Question extends Component {
axios.get(urls, {params: { axios.get(urls, {params: {
source:"question" source:"question"
}}).then((response) => { }}).then((response) => {
console.log("Questiondisciplines"); //console.log("Questiondisciplines");
console.log(response.data); //console.log(response.data);
if (response) { if (response) {
this.setState({ this.setState({
disciplinesdata: response.data.disciplines, disciplinesdata: response.data.disciplines,
@ -234,15 +234,15 @@ class Question extends Component {
} else { } else {
} }
////console.log("item_banks"); //////console.log("item_banks");
////console.log(response); //////console.log(response);
this.setState({ this.setState({
Contentdata: response.data, Contentdata: response.data,
items_count: response.data.items_count, items_count: response.data.items_count,
}) })
this.getdataslen(response.data.items); this.getdataslen(response.data.items);
}).catch((error) => { }).catch((error) => {
////console.log(error) //////console.log(error)
this.setState({ this.setState({
booljupyterurls:false, booljupyterurls:false,
}) })
@ -268,8 +268,8 @@ class Question extends Component {
} else { } else {
} }
////console.log("item_banks"); //////console.log("item_banks");
////console.log(response); //////console.log(response);
this.setState({ this.setState({
Contentdata: response.data, Contentdata: response.data,
items_count: response.data.items_count, items_count: response.data.items_count,
@ -566,7 +566,7 @@ class Question extends Component {
} }
}) })
.catch(function (error) { .catch(function (error) {
//console.log(error); ////console.log(error);
}); });
} }
publicopentimu = (id) => { publicopentimu = (id) => {
@ -590,7 +590,7 @@ class Question extends Component {
this.getdata(data); this.getdata(data);
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} }
@ -599,8 +599,8 @@ class Question extends Component {
const url = "/item_baskets/basket_list.json"; const url = "/item_baskets/basket_list.json";
axios.get(url) axios.get(url)
.then((result) => { .then((result) => {
// //console.log("getbasket_listdata"); // ////console.log("getbasket_listdata");
// //console.log(result.data); // ////console.log(result.data);
this.setState({ this.setState({
completion_questions_count: result.data.completion_questions_count, completion_questions_count: result.data.completion_questions_count,
judgement_questions_count: result.data.judgement_questions_count, judgement_questions_count: result.data.judgement_questions_count,
@ -612,7 +612,7 @@ class Question extends Component {
}) })
}).catch((error) => { }).catch((error) => {
// //console.log(error); // ////console.log(error);
this.setState({ this.setState({
completion_questions_count: 0, completion_questions_count: 0,
judgement_questions_count: 0, judgement_questions_count: 0,
@ -654,7 +654,7 @@ class Question extends Component {
// }) // })
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} }
// 撤销 // 撤销
@ -681,7 +681,7 @@ class Question extends Component {
this.getbasket_listdata(); this.getbasket_listdata();
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} }
//全选试题库 //全选试题库
@ -750,7 +750,7 @@ class Question extends Component {
} }
}) })
.catch(function (error) { .catch(function (error) {
//console.log(error); ////console.log(error);
}); });
} }
@ -902,11 +902,12 @@ class Question extends Component {
setdifficulty={(e) => this.setdifficulty(e)} setdifficulty={(e) => this.setdifficulty(e)}
setitem_types={(e) => this.setitem_types(e)} setitem_types={(e) => this.setitem_types(e)}
setdiscipline_id={(e)=>this.setdiscipline_id(e)} setdiscipline_id={(e)=>this.setdiscipline_id(e)}
setsub_discipline_id={(e)=>this.setsub_discipline_id(e)} setsub_discipline_id={(e,id)=>this.setsub_discipline_id(e,id)}
settag_discipline_id={(e)=>this.settag_discipline_id(e)} settag_discipline_id={(e)=>this.settag_discipline_id(e)}
/> />
{/*头部*/} {/*头部*/}
<Contentpart {...this.state} {...this.props} <Contentpart {...this.state} {...this.props}
Isitapopup={"false"}
chakanjiexiboolindex={this.state.chakanjiexiboolindex} chakanjiexiboolindex={this.state.chakanjiexiboolindex}
chakanjiexibool={(e)=>this.chakanjiexibool(e)} chakanjiexibool={(e)=>this.chakanjiexibool(e)}
getitem_basketss={(id)=>this.getitem_basketss(id)} getitem_basketss={(id)=>this.getitem_basketss(id)}

@ -52,8 +52,8 @@ class Questionitem_banks extends Component {
// axios.get(url, { // axios.get(url, {
// //
// }).then((response) => { // }).then((response) => {
// // //////console.log("开始请求/get_navigation_info.json"); // // ////////console.log("开始请求/get_navigation_info.json");
// // //////console.log(response); // // ////////console.log(response);
// if(response!=undefined){ // if(response!=undefined){
// if(response.status===200){ // if(response.status===200){
// this.setState({ // this.setState({
@ -80,15 +80,15 @@ class Questionitem_banks extends Component {
} else { } else {
} }
//////console.log("item_banks"); ////////console.log("item_banks");
//console.log("Questionitem_banks"); ////console.log("Questionitem_banks");
//console.log(response.data); ////console.log(response.data);
this.setState({ this.setState({
item_banksedit: response.data, item_banksedit: response.data,
}) })
}).catch((error) => { }).catch((error) => {
//////console.log(error) ////////console.log(error)
}); });
@ -173,10 +173,10 @@ class Questionitem_banks extends Component {
// }else{ // }else{
// //
// } // }
// //////console.log("item_banks"); // ////////console.log("item_banks");
// //////console.log(response); // ////////console.log(response);
// }).catch((error) => { // }).catch((error) => {
// //////console.log(error) // ////////console.log(error)
// //
// }); // });
} }
@ -239,7 +239,7 @@ class Questionitem_banks extends Component {
if (this.state.item_type === "SINGLE") { if (this.state.item_type === "SINGLE") {
if (this.answerMdRef != null) { if (this.answerMdRef != null) {
//单选题 //单选题
// //console.log(this.answerMdRef.onSave()); // ////console.log(this.answerMdRef.onSave());
if (this.answerMdRef.onSave().length === 0) { if (this.answerMdRef.onSave().length === 0) {
return; return;
@ -287,7 +287,7 @@ class Questionitem_banks extends Component {
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} else { } else {
axios.put(url, data) axios.put(url, data)
@ -299,7 +299,7 @@ class Questionitem_banks extends Component {
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} }
@ -311,7 +311,7 @@ class Questionitem_banks extends Component {
if (this.state.item_type === "MULTIPLE") { if (this.state.item_type === "MULTIPLE") {
if (this.Choques != null) { if (this.Choques != null) {
//多选题 //多选题
// //console.log(this.Choques.onSave()); // ////console.log(this.Choques.onSave());
if (this.Choques.onSave().length === 0) { if (this.Choques.onSave().length === 0) {
return; return;
} }
@ -319,8 +319,8 @@ class Questionitem_banks extends Component {
const choices = []; const choices = [];
// 1: [3] // 1: [3]
// 2: (4) ["1", "2", "3", "4"] // 2: (4) ["1", "2", "3", "4"]
//console.log("MULTIPLE"); ////console.log("MULTIPLE");
//console.log(anserdata); ////console.log(anserdata);
for (var k = 0; k < anserdata[2].length; k++) { for (var k = 0; k < anserdata[2].length; k++) {
var bool = false var bool = false
@ -366,7 +366,7 @@ class Questionitem_banks extends Component {
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} else { } else {
@ -379,7 +379,7 @@ class Questionitem_banks extends Component {
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} }
@ -390,7 +390,7 @@ class Questionitem_banks extends Component {
if (this.state.item_type === "JUDGMENT") { if (this.state.item_type === "JUDGMENT") {
if (this.Judquestio != null) { if (this.Judquestio != null) {
//判断题 //判断题
// //console.log(this.Judquestio.onSave()); // ////console.log(this.Judquestio.onSave());
if (this.Judquestio.onSave().length === 0) { if (this.Judquestio.onSave().length === 0) {
return; return;
} }
@ -432,7 +432,7 @@ class Questionitem_banks extends Component {
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} else { } else {
@ -444,7 +444,7 @@ class Questionitem_banks extends Component {
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
} }
@ -476,13 +476,13 @@ class Questionitem_banks extends Component {
this.setState({ this.setState({
item_type: item_type item_type: item_type
}) })
this.scrollToAnchor("Itembankstopid");
} }
render() { render() {
let {page, limit, count, Headertop, visible, placement, modalsType, item_type} = this.state; let {page, limit, count, Headertop, visible, placement, modalsType, item_type} = this.state;
const params = this.props && this.props.match && this.props.match.params; const params = this.props && this.props.match && this.props.match.params;
// //console.log(params); // ////console.log(params);
return ( return (
<div> <div>
<div id={"Itembankstopid"} className="newMain clearfix intermediatecenter " <div id={"Itembankstopid"} className="newMain clearfix intermediatecenter "
@ -515,6 +515,7 @@ class Questionitem_banks extends Component {
> >
</Itembankstop> </Itembankstop>
<div >
{ {
item_type && item_type === "SINGLE" ? item_type && item_type === "SINGLE" ?
@ -555,9 +556,8 @@ class Questionitem_banks extends Component {
: item_type && item_type === "PROGRAM" ? : item_type && item_type === "PROGRAM" ?
"" ""
: "" : ""
} }
</div>
</div> </div>

@ -83,9 +83,9 @@ class ChoquesEditor extends Component{
addOption = () => { addOption = () => {
const { question_choices, standard_answers } = this.state; const { question_choices, standard_answers } = this.state;
// ////console.log("addOption"); // //////console.log("addOption");
// ////console.log(question_choices); // //////console.log(question_choices);
// ////console.log(standard_answers); // //////console.log(standard_answers);
question_choices.push('') question_choices.push('')
@ -95,8 +95,8 @@ class ChoquesEditor extends Component{
deleteOption = (index) => { deleteOption = (index) => {
let {question_choices}=this.state; let {question_choices}=this.state;
// ////console.log("deleteOption"); // //////console.log("deleteOption");
// ////console.log(question_choices); // //////console.log(question_choices);
if(question_choices[index]===""){ if(question_choices[index]===""){
// repeat code // repeat code
@ -199,9 +199,9 @@ class ChoquesEditor extends Component{
} }
} }
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
//console.log("componentDidUpdate"); ////console.log("componentDidUpdate");
// //console.log(prevProps); // ////console.log(prevProps);
// //console.log(this.props.item_banksedit); // ////console.log(this.props.item_banksedit);
if(prevProps.item_banksedit !== this.props.item_banksedit) { if(prevProps.item_banksedit !== this.props.item_banksedit) {
this.setState({ this.setState({
@ -244,7 +244,7 @@ class ChoquesEditor extends Component{
} }
let question_choices = this.state.question_choices.slice(0); let question_choices = this.state.question_choices.slice(0);
question_choices[index] = texts; question_choices[index] = texts;
console.log(question_choices); //console.log(question_choices);
this.setState({ question_choices }); this.setState({ question_choices });
} }
@ -333,9 +333,9 @@ class ChoquesEditor extends Component{
// [true, false, true] -> [0, 2] // [true, false, true] -> [0, 2]
const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1); const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
// ////console.log("xuanzheshijuan"); // //////console.log("xuanzheshijuan");
// ////console.log(answerTagArray); // //////console.log(answerTagArray);
// ////console.log(!exerciseIsPublish); // //////console.log(!exerciseIsPublish);
return( return(
<div className="padding20-30 signleEditor duoxuano" id={qNumber}> <div className="padding20-30 signleEditor duoxuano" id={qNumber}>
@ -383,7 +383,7 @@ class ChoquesEditor extends Component{
{question_choices.map( (item, index) => { {question_choices.map( (item, index) => {
const bg = standard_answers[index] ? 'check-option-bg' : '' const bg = standard_answers[index] ? 'check-option-bg' : ''
return <div className={index>0?"df optionRow mt15": "df optionRow"} > return <div key={index} className={index>0?"df optionRow mt15": "df optionRow"} >
{/* 点击设置答案 */} {/* 点击设置答案 */}
{/* TODO 加了tooltip后会丢失掉span的class */} {/* TODO 加了tooltip后会丢失掉span的class */}
{/* <Tooltip title={standard_answers[index] ? '点击取消标准答案设置' : '点击设置为标准答案'}> */} {/* <Tooltip title={standard_answers[index] ? '点击取消标准答案设置' : '点击设置为标准答案'}> */}
@ -399,7 +399,7 @@ class ChoquesEditor extends Component{
{ {
item===undefined||item===null||item===""? item===undefined||item===null||item===""?
<QuillForEditor <QuillForEditor
autoFocus={false} autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}} imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '166px'}} style={{ height: '166px'}}
placeholder="请您输入题干" placeholder="请您输入题干"

@ -135,8 +135,8 @@ class Contentpart extends Component {
); );
console.log("Contentpart.js"); //console.log("Contentpart.js");
console.log(this.props.defaultActiveKey); //console.log(this.props.defaultActiveKey);
return ( return (
<div className=" clearfix mt25"> <div className=" clearfix mt25">
@ -214,11 +214,14 @@ class Contentpart extends Component {
{ {
defaultActiveKey===0||defaultActiveKey==="0"? defaultActiveKey===0||defaultActiveKey==="0"?
isysladmins===true||(is_teacher===true&&professional_certification===true)? isysladmins===true||(is_teacher===true&&professional_certification===true)?
<a onClick={(e)=>this.xinzenw(e)}> this.props.Isitapopup&&this.props.Isitapopup==="true"?
<div className="newbutoon"> ""
<p className="newbutoontes" >新增</p> :
</div> <a onClick={(e)=>this.xinzenw(e)}>
</a> <div className="newbutoon">
<p className="newbutoontes" >新增</p>
</div>
</a>
:"" :""
:"" :""
} }
@ -241,6 +244,16 @@ class Contentpart extends Component {
{ {
defaultActiveKey===0||defaultActiveKey==="0"? defaultActiveKey===0||defaultActiveKey==="0"?
this.props.Isitapopup&&this.props.Isitapopup==="true"?
<Search
style={isysladmins===true||(is_teacher===true&&professional_certification)?{ marginRight:"0px"}:{marginRight:"0px"}}
className={"xaxisreverseorder searchwidth"}
placeholder="请输入题目名称、内容"
enterButton
size="large"
onInput={(e)=>this.props.setdatafunsval(e)}
onSearch={ (value)=>this.props.setdatafuns(value)} />
:
<Search <Search
style={isysladmins===true||(is_teacher===true&&professional_certification)?{ marginRight:"30px"}:{marginRight:"0px"}} style={isysladmins===true||(is_teacher===true&&professional_certification)?{ marginRight:"30px"}:{marginRight:"0px"}}
className={"xaxisreverseorder searchwidth"} className={"xaxisreverseorder searchwidth"}
@ -296,6 +309,7 @@ class Contentpart extends Component {
: this.props.Contentdata.items.map((object, index) => { : this.props.Contentdata.items.map((object, index) => {
return ( return (
<Listjihe {...this.state} {...this.props} <Listjihe {...this.state} {...this.props}
Isitapopup={this.props.Isitapopup}
chakanjiexiboolindex={this.props.chakanjiexiboolindex} chakanjiexiboolindex={this.props.chakanjiexiboolindex}
chakanjiexibool={(keindex)=>this.chakanjiexibool(keindex)} chakanjiexibool={(keindex)=>this.chakanjiexibool(keindex)}
listjihe={index+1} listjihe={index+1}

@ -20,9 +20,9 @@ class Contentquestionbank extends Component {
} }
//初始化 //初始化
componentDidMount(){ componentDidMount(){
////console.log("componentDidMount"); //////console.log("componentDidMount");
////console.log(this.state); //////console.log(this.state);
////console.log(this.props); //////console.log(this.props);
// let homeworkid = this.props.match.params.homeworkid; // let homeworkid = this.props.match.params.homeworkid;
// let url = "/homework_commons/" + homeworkid + "/end_groups.json"; // let url = "/homework_commons/" + homeworkid + "/end_groups.json";
// axios.get(url).then((response) => { // axios.get(url).then((response) => {
@ -30,12 +30,12 @@ class Contentquestionbank extends Component {
// this.setState({}) // this.setState({})
// } // }
// }).catch((error) => { // }).catch((error) => {
// ////console.log(error) // //////console.log(error)
// }); // });
} }
onChange=(e)=> { onChange=(e)=> {
////console.log(`checked = ${e.target.checked}`); //////console.log(`checked = ${e.target.checked}`);
} }
render() { render() {

@ -77,8 +77,8 @@ class Headplugselection extends Component {
} }
render() { render() {
let {page,titlestting,titlesttings,titlesttingss}=this.state; let {page,titlestting,titlesttings,titlesttingss}=this.state;
// console.log("Headplugselection"); // //console.log("Headplugselection");
// console.log(this.props.disciplinesdata); // //console.log(this.props.disciplinesdata);
// disciplinesdatakc:kc, // disciplinesdatakc:kc,
// disciplinesdatazsd:zsd, // disciplinesdatazsd:zsd,
var kc=0; var kc=0;

@ -48,10 +48,7 @@ class Headplugselections extends Component {
componentDidMount(){ componentDidMount(){
} }
//
// setdiscipline_id={(e)=>this.setdiscipline_id(e)}
// setsub_discipline_id={(e)=>this.setsub_discipline_id(e)}
// settag_discipline_id={(e)=>this.settag_discipline_id(e)}
settitlestting=(name,id)=>{ settitlestting=(name,id)=>{
//如果全部其他的选项重置 //如果全部其他的选项重置
this.setState({ this.setState({
@ -87,8 +84,8 @@ class Headplugselections extends Component {
//获取方向 //获取方向
shixunsearchAll = (id) => { shixunsearchAll = (id) => {
console.log("获取方向"); //console.log("获取方向");
console.log(id); //console.log(id);
if(id!=undefined){ if(id!=undefined){
this.setState({ this.setState({
shixunsearchAllvalue:id, shixunsearchAllvalue:id,
@ -130,16 +127,16 @@ class Headplugselections extends Component {
} }
getshixunchildValue = (id,ids) => { getshixunchildValue = (id,ids) => {
console.log("getshixunchildValue"); // //console.log("getshixunchildValue");
console.log(id); // //console.log(id);
debugger // debugger
if(id!=undefined ||ids!=undefined){ if(id!=undefined ||ids!=undefined){
this.setState({ this.setState({
shixunsearchAllvalue:ids shixunsearchAllvalue:ids
}) })
try { try {
this.props.setsub_discipline_id(id); this.props.setsub_discipline_id(ids,id);
}catch (e) { }catch (e) {
} }

@ -60,7 +60,7 @@ class IntelligentModel extends Component {
axios.post(url, data) axios.post(url, data)
.then((result) => { .then((result) => {
if (result.data.status == 0) { if (result.data.status == 0) {
console.log(result); //console.log(result);
this.props.history.push(`/paperlibrary`); this.props.history.push(`/paperlibrary`);
} }

@ -13,7 +13,7 @@ import {
Input, Input,
Select, Select,
Cascader, Cascader,
Col, Row, InputNumber, DatePicker, AutoComplete, Button, Tag Col, Row, InputNumber, DatePicker, AutoComplete, Button, Tag,Tooltip
} from "antd"; } from "antd";
import './../questioncss/questioncom.css'; import './../questioncss/questioncom.css';
import Newknledpots from './Newknledpots' import Newknledpots from './Newknledpots'
@ -57,6 +57,7 @@ class Itembankstop extends Component {
options: [], options: [],
NewknTypedel:false, NewknTypedel:false,
boolred:false, boolred:false,
boolnews:false,
} }
} }
@ -71,6 +72,23 @@ class Itembankstop extends Component {
//初始化 //初始化
componentDidMount() { componentDidMount() {
const params = this.props && this.props.match && this.props.match.params;
if (JSON.stringify(params) === "{}") {
// "新增"
this.setState({
boolnews:false,
})
} else {
if(params){
if( params.id){
this.setState({
boolnews:true,
})
}
}
}
try { try {
this.props.getcontentMdRef(this); this.props.getcontentMdRef(this);
@ -81,10 +99,10 @@ class Itembankstop extends Component {
options: this.props.disciplmy, options: this.props.disciplmy,
}) })
console.log("数据"); //console.log("数据");
console.log(this.props); //console.log(this.props);
const parsed = queryString.parse(this.props.location.search); const parsed = queryString.parse(this.props.location.search);
console.log(parsed); //console.log(parsed);
try { try {
if(JSON.stringify(parsed)==={}||JSON.stringify(parsed)==="{}"){ if(JSON.stringify(parsed)==={}||JSON.stringify(parsed)==="{}"){
@ -138,7 +156,7 @@ class Itembankstop extends Component {
}) })
} }
if(prevProps.disciplinesdata!== this.props.disciplinesdata){ if(prevProps.disciplinesdata!== this.props.disciplinesdata){
console.log("新增开始加载了") //console.log("新增开始加载了")
try { try {
if(this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline){ if(this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline){
const didata = this.props.disciplinesdata; const didata = this.props.disciplinesdata;
@ -333,8 +351,8 @@ class Itembankstop extends Component {
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
data = [] data = []
if (!err) { if (!err) {
// ////console.log("获取的form 数据"); // //////console.log("获取的form 数据");
// ////console.log(values); // //////console.log(values);
data.push({ data.push({
rbnd: parseInt(values.rbnd) rbnd: parseInt(values.rbnd)
}) })
@ -358,8 +376,8 @@ class Itembankstop extends Component {
e.preventDefault(); e.preventDefault();
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
if (!err) { if (!err) {
////console.log("获取的form 数据"); //////console.log("获取的form 数据");
////console.log(values); //////console.log(values);
} }
@ -368,8 +386,8 @@ class Itembankstop extends Component {
} }
handleFormLayoutChangeysl = (value) => { handleFormLayoutChangeysl = (value) => {
//难度塞选 //难度塞选
////console.log("难度塞选"); //////console.log("难度塞选");
////console.log(value); //////console.log(value);
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
rbnd: value+ "", rbnd: value+ "",
}); });
@ -380,8 +398,8 @@ class Itembankstop extends Component {
} }
handleFormLayoutChange = (e) => { handleFormLayoutChange = (e) => {
//难度塞选 //难度塞选
////console.log("难度塞选"); //////console.log("难度塞选");
////console.log(value); //////console.log(value);
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
rbnd: e.target.value + "", rbnd: e.target.value + "",
}); });
@ -392,8 +410,8 @@ class Itembankstop extends Component {
} }
handleFormkechen = (value) => { handleFormkechen = (value) => {
//课程 //课程
////console.log("课程"); //////console.log("课程");
////console.log(value); //////console.log(value);
if(this.state.Knowpoints.length>4){ if(this.state.Knowpoints.length>4){
this.props.showNotification(`知识点最多选择5个`); this.props.showNotification(`知识点最多选择5个`);
return return
@ -414,8 +432,8 @@ class Itembankstop extends Component {
const _result =[]; const _result =[];
this.state.knowledgepoints.filter(item => { this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) { if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
// console.log("guonue"); // //console.log("guonue");
// console.log(item); // //console.log(item);
_result.push(item); _result.push(item);
} }
}); });
@ -430,8 +448,8 @@ class Itembankstop extends Component {
} }
handleFormzhishidian = (value) => { handleFormzhishidian = (value) => {
console.log("handleFormzhishidian 课程"); //console.log("handleFormzhishidian 课程");
console.log(value); //console.log(value);
//课程 //课程
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
@ -440,8 +458,8 @@ class Itembankstop extends Component {
this.setState({ this.setState({
rbkc:value, rbkc:value,
}) })
// console.log("handleFormzhishidian"); // //console.log("handleFormzhishidian");
// console.log(this.props.disciplinesdata); // //console.log(this.props.disciplinesdata);
const didata = this.props.disciplinesdata; const didata = this.props.disciplinesdata;
const knowledgepointsdata = []; const knowledgepointsdata = [];
@ -485,8 +503,8 @@ class Itembankstop extends Component {
handleFormtixing = (value) => { handleFormtixing = (value) => {
//题型 //题型
//console.log("题型"); ////console.log("题型");
//console.log(value); ////console.log(value);
this.setState({ this.setState({
rbtx: value + "", rbtx: value + "",
}) })
@ -497,7 +515,7 @@ class Itembankstop extends Component {
} }
preventDefault = (e) => { preventDefault = (e) => {
e.preventDefault(); e.preventDefault();
////console.log('Clicked! But prevent default.'); //////console.log('Clicked! But prevent default.');
} }
deletesobject = (item, index) => { deletesobject = (item, index) => {
@ -626,7 +644,7 @@ class Itembankstop extends Component {
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); ////console.log(error);
}) })
this.setState({ this.setState({
@ -639,9 +657,9 @@ class Itembankstop extends Component {
let {page, options,NewknTypedel,knowledgepoints,knowledgepoints2,Knowpoints} = this.state; let {page, options,NewknTypedel,knowledgepoints,knowledgepoints2,Knowpoints} = this.state;
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
// console.log("this.state.rbkc"); // //console.log("this.state.rbkc");
// console.log(this.state.rbkc); // //console.log(this.state.rbkc);
// console.log(options); // //console.log(options);
return ( return (
@ -754,6 +772,8 @@ class Itembankstop extends Component {
} }
<Form.Item <Form.Item
label="题型" label="题型"
> >
@ -762,18 +782,16 @@ class Itembankstop extends Component {
rules: [{required: true, message: '请选择题型'}], rules: [{required: true, message: '请选择题型'}],
} }
)( )(
<Select style={{width: '270px'}} onChange={this.handleFormtixing} <Select style={{width: '270px'}} disabled={this.state.boolnews} onChange={this.handleFormtixing}
placeholder="请选择..."> placeholder="请选择...">
<Option value="PROGRAM">编程题</Option> <Option value="PROGRAM">编程题</Option>
<Option value="SINGLE">单选题</Option> <Option value="SINGLE">单选题</Option>
<Option value="MULTIPLE">多选题</Option> <Option value="MULTIPLE">多选题</Option>
<Option value="JUDGMENT">判断题</Option> <Option value="JUDGMENT">判断题</Option>
</Select> </Select>
)} )}
</Form.Item> </Form.Item>
<style> <style>
{ {
` `

@ -62,9 +62,9 @@ class JudquestionEditor extends Component{
addOption = () => { addOption = () => {
const { question_choices, standard_answers } = this.state; const { question_choices, standard_answers } = this.state;
// //////console.log("addOption"); // ////////console.log("addOption");
// //////console.log(question_choices); // ////////console.log(question_choices);
// //////console.log(standard_answers); // ////////console.log(standard_answers);
question_choices.push('') question_choices.push('')
@ -74,8 +74,8 @@ class JudquestionEditor extends Component{
deleteOption = (index) => { deleteOption = (index) => {
let {question_choices}=this.state; let {question_choices}=this.state;
// //////console.log("deleteOption"); // ////////console.log("deleteOption");
// //////console.log(question_choices); // ////////console.log(question_choices);
if(question_choices[index]===""){ if(question_choices[index]===""){
// repeat code // repeat code
@ -190,9 +190,9 @@ class JudquestionEditor extends Component{
} }
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
//console.log("componentDidUpdate"); ////console.log("componentDidUpdate");
//console.log(prevProps); ////console.log(prevProps);
//console.log(this.props.item_banksedit); ////console.log(this.props.item_banksedit);
if(prevProps.item_banksedit !== this.props.item_banksedit){ if(prevProps.item_banksedit !== this.props.item_banksedit){
this.setState({ this.setState({
@ -230,10 +230,10 @@ class JudquestionEditor extends Component{
onOptionClick = (index) => { onOptionClick = (index) => {
let standard_answers = this.state.standard_answers.slice(0); let standard_answers = this.state.standard_answers.slice(0);
// //////console.log("onOptionClick"); // ////////console.log("onOptionClick");
// //////console.log(standard_answers); // ////////console.log(standard_answers);
// //////console.log(standard_answers[index]); // ////////console.log(standard_answers[index]);
// //////console.log(!standard_answers[index]); // ////////console.log(!standard_answers[index]);
for (var i=0;i<standard_answers.length;i++){ for (var i=0;i<standard_answers.length;i++){
if(index===i){ if(index===i){
standard_answers[index] = true; standard_answers[index] = true;
@ -272,8 +272,8 @@ class JudquestionEditor extends Component{
handleFormLayoutChange=(e)=>{ handleFormLayoutChange=(e)=>{
//////console.log("难度塞选"); ////////console.log("难度塞选");
//////console.log(value); ////////console.log(value);
this.setState({ this.setState({
zqda:e.target.value, zqda:e.target.value,
@ -348,9 +348,9 @@ class JudquestionEditor extends Component{
// [true, false, true] -> [0, 2] // [true, false, true] -> [0, 2]
const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1); const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
// //////console.log("xuanzheshijuan"); // ////////console.log("xuanzheshijuan");
// //////console.log(answerTagArray); // ////////console.log(answerTagArray);
// //////console.log(!exerciseIsPublish); // ////////console.log(!exerciseIsPublish);
const params= this.props&&this.props.match&&this.props.match.params; const params= this.props&&this.props.match&&this.props.match.params;
return( return(
<div className="padding20-30 signleEditor danxuano" id={qNumber}> <div className="padding20-30 signleEditor danxuano" id={qNumber}>

@ -159,22 +159,16 @@ class Listjihe extends Component {
<style> <style>
{ {
` .markdown-body .ql-editor{ ` .markdown-body .ql-editor{
padding-left: 0px; padding-left: 0px !important;
} padding-top: 0px !important;
.markdown-body .ql-editor p{
line-height: 0px;
} }
.programquill .ql-editor{ .programquill .ql-editor{
padding-left: 0px; padding-left: 0px !important;
padding-top: 0px !important;
} }
.programquill .ql-editor p{
line-height: 0px;
}
` `
} }
</style> </style>
@ -182,18 +176,15 @@ class Listjihe extends Component {
<div className="listjihetixingstitsy"> <div className="listjihetixingstitsy">
{ {
this.props.listjihe this.props.listjihe
} }.
</div>
<div className="listjihetixingstitsy">
.
</div> </div>
{ {
items.item_type==="PROGRAM"? items.item_type==="PROGRAM"?
<a href={`/problems/${items.program_attr.identifier}/edit`}> <a href={`/problems/${items.program_attr.identifier}/edit`}>
<div className="ml10 w100s listjihetixingstit markdown-body" style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(items&&items.name).replace(/▁/g, "▁▁▁")}}></div> <div className="ml10 w100s " style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(items&&items.name).replace(/▁/g, "▁▁▁")}}></div>
</a> </a>
: :
<div className="ml10 w100s listjihetixingstit markdown-body" style={{wordBreak: "break-word"}}> <div className="ml10 w100s markdown-body" style={{wordBreak: "break-word"}}>
{ items===undefined||items===null||items===""?"": { items===undefined||items===null||items===""?"":
items.name === undefined || items.name === null || items.name === "" ? items.name === undefined || items.name === null || items.name === "" ?
"" ""
@ -217,7 +208,7 @@ class Listjihe extends Component {
items === undefined || items === null ? "" : items.choices.map((object, index) => { items === undefined || items === null ? "" : items.choices.map((object, index) => {
return ( return (
<p className={index === 1 ? "sortinxdirection ml10" : "sortinxdirection "}> <p className={index === 1 ? "sortinxdirection ml10" : "sortinxdirection "}>
<Radio disabled={false} disabled={true} > <Radio disabled={true} >
{object.choice_text} {object.choice_text}
</Radio> </Radio>
</p> </p>
@ -257,7 +248,7 @@ class Listjihe extends Component {
} }
return ( return (
<p className={index === 0 ? "sortinxdirection " : "sortinxdirection mt15 "}> <p className={index === 0 ? "sortinxdirection " : "sortinxdirection mt15 "}>
<p className="lh26">{tagArray[index]}</p> <p className="lh20s">{tagArray[index]}</p>
<p className="programquill" style={{wordBreak: "break-word"}}> <p className="programquill" style={{wordBreak: "break-word"}}>
{object ? {object ?
object.choice_text === undefined || object.choice_text=== null || object.choice_text === "" ? object.choice_text === undefined || object.choice_text=== null || object.choice_text === "" ?
@ -352,6 +343,9 @@ class Listjihe extends Component {
</p> </p>
{ {
items.item_type === "PROGRAM" ? items.item_type === "PROGRAM" ?
this.props.Isitapopup&&this.props.Isitapopup==="true"?
""
:
<a href={`/problems/${items.program_attr.identifier}/edit`}> <a href={`/problems/${items.program_attr.identifier}/edit`}>
<p className="viewparsings xiaoshou mr25"> <p className="viewparsings xiaoshou mr25">
<i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i> <i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
@ -359,6 +353,9 @@ class Listjihe extends Component {
</p> </p>
</a> </a>
: :
this.props.Isitapopup&&this.props.Isitapopup==="true"?
""
:
<a href={`/question/edit/${items.id}`}> <a href={`/question/edit/${items.id}`}>
<p className="viewparsings xiaoshou mr25"> <p className="viewparsings xiaoshou mr25">
<i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i> <i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>

@ -18,15 +18,15 @@ class PaperDeletModel extends Component {
// this.setState({ // this.setState({
// newkntypeinput: e.target.value // newkntypeinput: e.target.value
// }) // })
// console.log(e.target.value); // //console.log(e.target.value);
// console.log(e.target.value.length); // //console.log(e.target.value.length);
this.setState({ this.setState({
newkntypeinput: e.target.value newkntypeinput: e.target.value
}) })
this.props.setboolred(false); this.props.setboolred(false);
// //
// debugger // debugger
// console.log(e); // //console.log(e);
// //
// if(e.target.value.length>0){ // if(e.target.value.length>0){
// if(e.target.value.length>=16){ // if(e.target.value.length>=16){
@ -38,11 +38,11 @@ class PaperDeletModel extends Component {
// } // }
} }
mysinputOnBlur=(e)=>{ mysinputOnBlur=(e)=>{
console.log("失去焦点了"); //console.log("失去焦点了");
} }
inputOnFocus=(e)=>{ inputOnFocus=(e)=>{
console.log("获取焦点"); //console.log("获取焦点");
} }
render() { render() {

@ -13,8 +13,8 @@ class Paperreview_itemModel extends Component {
} }
onChange=(value)=>{ onChange=(value)=>{
console.log("设置批量得分"); //console.log("设置批量得分");
console.log(value); //console.log(value);
this.setState({ this.setState({
value:value, value:value,
}) })

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save