Merge branch 'dev_item_bank' into dev_aliyun

dev_new_shixunsrepository
cxt 5 years ago
commit d96bdc8751

@ -46,6 +46,12 @@ module GitHelper
content: content, author_name: username, author_email: mail)
end
def update_file_base64_content(content, repo_path, path, mail, username, message)
content = Base64.encode64(content)
GitService.update_file_base64(repo_path: repo_path, file_path: path, message: message,
content: content, author_name: username, author_email: mail)
end
# 添加目录
def git_add_folder(folder_path, author_name, author_email, message)
GitService.add_tree(file_path: folder_path, message: message, author_name: author_name, author_email: author_email)

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

@ -182,7 +182,7 @@ class CoursesController < ApplicationController
CreateSubjectCourseStudentJob.perform_later(@course.id) if @course.subject && @course.subject.subject_appointments.count > 0
rescue => e
uid_logger_error(e.message)
tip_exception(e.message)
tip_exception("调用失败")
raise ActiveRecord::Rollback
end
end
@ -292,8 +292,8 @@ class CoursesController < ApplicationController
if next_inform.blank?
render_error('已经到达最顶部')
else
inform.update_attribute(:position, (inform.position + 1))
next_inform.update_attribute(:position, inform.position - 1)
inform.update!(position: (inform.position + 1))
next_inform.update!(position: inform.position - 1)
render_ok
end
end
@ -306,8 +306,8 @@ class CoursesController < ApplicationController
if last_inform.blank?
render_error('已经到达最底部')
else
inform.update_attribute(:position, (inform.position - 1))
last_inform.update_attribute(:position, inform.position + 1)
inform.update!(position: (inform.position - 1))
last_inform.update!(position: inform.position + 1)
render_ok
end
end
@ -353,7 +353,7 @@ class CoursesController < ApplicationController
# 邀请码停用/启用
def set_invite_code_halt
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, "成功")
rescue => e
uid_logger_error(e.message)
@ -364,7 +364,7 @@ class CoursesController < ApplicationController
# 设置课堂私有/公有
def set_public_or_private
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, "成功")
rescue => e
uid_logger_error(e.message)
@ -551,7 +551,7 @@ class CoursesController < ApplicationController
graduation_group_id = GraduationGroup.find(params[:graduation_group_id].to_i).id
@course_member_list.each do |course_member|
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
normal_status(0, "成功")
rescue => e
@ -711,7 +711,7 @@ class CoursesController < ApplicationController
CourseDeleteStudentNotifyJob.perform_later(@course.id, [course_member.user_id], current_user.id)
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, "删除成功")
rescue => e
uid_logger_error(e.message)
@ -726,8 +726,8 @@ class CoursesController < ApplicationController
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_member.update_attributes(is_active: 0)
course_teacher.update_attributes(is_active: 1)
course_member.update!(is_active: 0)
course_teacher.update!(is_active: 1)
normal_status(0, "切换成功")
rescue => e
uid_logger_error(e.message)
@ -742,8 +742,8 @@ class CoursesController < ApplicationController
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_member.update_attributes(is_active: 0)
course_teacher.update_attributes(is_active: 1)
course_member.update!(is_active: 0)
course_teacher.update!(is_active: 1)
normal_status(0, "切换成功")
rescue => e
uid_logger_error(e.message)
@ -782,7 +782,7 @@ class CoursesController < ApplicationController
# 课堂如果还有其他身份的用户则更新is_active
course_teacher = CourseMember.find_by(user_id: current_user.id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR], course_id: @course.id)
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])
normal_status(0, "退出成功")
end
@ -959,7 +959,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])
student_ids << course_member.user_id
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
CourseDeleteStudentDeleteWorksJob.perform_later(@course.id, student_ids) if student_ids.present?
@ -990,7 +990,7 @@ class CoursesController < ApplicationController
if existing_course_member.present?
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
new_student.is_active = 0 if existing_course_member.is_active
new_student.save!
@ -1142,7 +1142,7 @@ class CoursesController < ApplicationController
existing_student = CourseMember.find_by(course_id: course.id, role: %i[STUDENT], user_id: current_user.id)
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
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)

@ -2,7 +2,7 @@ class ExaminationBanksController < ApplicationController
include PaginateHelper
before_action :require_login
before_action :find_exam, except: [:index, :create]
before_action :edit_auth, only: [:update, :destroy, :set_public]
before_action :edit_auth, only: [:update, :destroy, :set_public, :revoke_item]
def index
exams = ExaminationBankQuery.call(params)
@ -65,6 +65,15 @@ class ExaminationBanksController < ApplicationController
render_ok
end
def revoke_item
item = @exam.examination_items.find_by!(item_bank_id: params[:item_id])
ActiveRecord::Base.transaction do
@exam.examination_items.where(item_type: item.item_type).where("position > #{item.position}").update_all("position = position -1")
item.destroy!
end
render_ok
end
private
def form_params

@ -0,0 +1,102 @@
class ExaminationIntelligentSettingsController < ApplicationController
before_action :require_login
before_action :find_exam, only: [:exchange_one_item, :exchange_items, :save_exam]
def optinal_items
sub_discipline_id = params[:sub_discipline_id]
tag_discipline_id = params[:tag_discipline_id]
difficulty = params[:difficulty]
source = params[:source]
items = OptionalItemQuery.call(sub_discipline_id, tag_discipline_id, difficulty, source)
@single_question_count = items.select{ |item| item.item_type == "SINGLE" }.size
@multiple_question_count = items.select{ |item| item.item_type == "MULTIPLE" }.size
@judgement_question_count = items.select{ |item| item.item_type == "JUDGMENT" }.size
@program_question_count = items.select{ |item| item.item_type == "PROGRAM" }.size
end
def create
ActiveRecord::Base.transaction do
exam = ExaminationIntelligentSetting.new(user: current_user)
# 保存试卷基础信息
exam = ExaminationIntelligentSettings::SaveSettingService.call(exam, form_params)
render_ok({exam_setting_id: exam.id})
end
rescue ApplicationService::Error => ex
render_error(ex.message)
end
def save_exam
new_exam = ExaminationBank.new(user: current_user)
# 保存试卷基础信息
ExaminationIntelligentSettings::SaveExaminationService.call(new_exam, save_params, @exam)
render_ok
rescue ApplicationService::Error => ex
render_error(ex.message)
end
def exchange_one_item
item = @exam.item_baskets.find_by!(id: params[:item_id])
exam_type_setting = @exam.examination_type_settings.find_by!(item_type: item.item_type)
# 获取可选的题
items = OptionalItemQuery.call(@exam.sub_discipline_id, @exam.tag_discipline_containers.pluck(:tag_discipline_id), @exam.difficulty, @exam.public)
type_items = items.select{ |t_item| t_item.item_type == item.item_type }
# 如果可选的题数小于等于设置的题数则提示无可换的题
tip_exception("无可换的题") if type_items.size <= exam_type_setting.count
# 可选题中去掉已组卷的同题型试题
optional_item_ids = type_items.pluck(:id) - @exam.item_baskets.where(item_type: item.item_type).pluck(:item_bank_id)
new_item = ItemBank.find optional_item_ids.sample(1).first
ActiveRecord::Base.transaction do
@exam.item_baskets << ItemBasket.new(item_bank_id: new_item.id, position: item.position, score: item.score, item_type: new_item.item_type)
item.destroy!
end
render_ok
end
def exchange_items
exam_type_setting = @exam.examination_type_settings.find_by!(item_type: params[:item_type])
choosed_items = @exam.item_baskets.where(item_type: params[:item_type])
# 获取可选的题
items = OptionalItemQuery.call(@exam.sub_discipline_id, @exam.tag_discipline_containers.pluck(:tag_discipline_id), @exam.difficulty, @exam.public)
type_items = items.select{ |t_item| t_item.item_type == params[:item_type] }
# 如果可选的题数小于等于设置的题数则提示无可换的题
tip_exception("无可换的题") if type_items.size <= exam_type_setting.count
# 可选题中去掉已组卷的同题型试题
choosed_item_ids = choosed_items.pluck(:item_bank_id)
optional_item_ids = type_items.pluck(:id) - choosed_item_ids
# 如果可选题数小于设置的题数n则在原来的选题中随机选n个确保换题时能选到新的题
if optional_item_ids.size < exam_type_setting.count
absence_count = exam_type_setting.count - optional_item_ids.size
optional_item_ids = optional_item_ids + choosed_item_ids.sample(absence_count)
end
ActiveRecord::Base.transaction do
# 取试题分数
score = choosed_items.first&.score || (params[:item_type] == "PROGRAM" ? 10 : 5)
choosed_items.destroy_all
optional_item_ids.sample(exam_type_setting.count).each_with_index do |item_id, index|
new_item = ItemBank.find item_id
@exam.item_baskets << ItemBasket.new(item_bank_id: new_item.id, position: index+1, score: score, item_type: new_item.item_type)
end
end
render_ok
end
private
def find_exam
@exam = ExaminationIntelligentSetting.find_by!(id: params[:id])
tip_exception(403,"无权限编辑") unless current_user.admin_or_business? || @exam.user_id == current_user.id
end
def form_params
params.permit(:discipline_id, :sub_discipline_id, :difficulty, :source, tag_discipline_id: [], question_settings: %i[item_type count])
end
def save_params
params.permit(:name, :duration)
end
end

@ -3,6 +3,15 @@ class ExerciseAnswersController < ApplicationController
before_action :get_exercise_question
include ExercisesHelper
# model validation error
rescue_from ActiveRecord::RecordInvalid do |ex|
render_error(ex.record.errors.full_messages.join(','))
end
# form validation error
rescue_from ActiveModel::ValidationError do |ex|
render_error(ex.model.errors.full_messages.join(','))
end
def create #每一次答案的点击,请求一次,实训题不在这里回答
begin
q_type = @exercise_question.question_type #试卷的类型
@ -14,7 +23,7 @@ class ExerciseAnswersController < ApplicationController
ea = @exercise_question.exercise_answers.search_answer_users("user_id",current_user.id) #试卷的当前用户的答案
if q_type == Exercise::SINGLE || q_type == Exercise::JUDGMENT #选择题(单选)/判断题
if ea.exists?
ea.first.update_attribute(:exercise_choice_id,choice_id )
ea.first.update!(exercise_choice_id: choice_id )
else
answer_option = {
:user_id => current_user.id,
@ -68,7 +77,7 @@ class ExerciseAnswersController < ApplicationController
:exercise_question_id => @exercise_question.id
}
if ea.present? #已经回答了的,
ea.first.update_attribute("answer_text",answer_text)
ea.first.update!(answer_text: answer_text)
else
answer_option.merge!(answer_text:answer_text)
ex_a = ExerciseAnswer.new(answer_option)
@ -116,7 +125,7 @@ class ExerciseAnswersController < ApplicationController
:score => total_score,
:subjective_score => subjective_score
}
@exercise_user.update_attributes(commit_option)
@exercise_user.update!(commit_option)
normal_status(-1,"试卷提交时间已截止!")
end
end

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

@ -24,6 +24,15 @@ class ExercisesController < ApplicationController
include ExportHelper
include ExercisesHelper
# model validation error
rescue_from ActiveRecord::RecordInvalid do |ex|
render_error(ex.record.errors.full_messages.join(','))
end
# form validation error
rescue_from ActiveModel::ValidationError do |ex|
render_error(ex.model.errors.full_messages.join(','))
end
def index
begin
# 按发布时间或创建时间排序
@ -130,7 +139,7 @@ class ExercisesController < ApplicationController
:time => -1,
:exercise_status => 1
}
@exercise = Exercise.create(exercise_options)
@exercise = Exercise.create!(exercise_options)
rescue Exception => e
uid_logger_error(e.message)
tip_exception("试卷创建失败!")
@ -161,7 +170,7 @@ class ExercisesController < ApplicationController
:exercise_name => ex_name,
:exercise_description => ex_desc,
}
@exercise.update_attributes(exercise_options)
@exercise.update!(exercise_options)
normal_status(0,"试卷更新成功!")
rescue Exception => e
uid_logger_error(e.message)
@ -294,7 +303,7 @@ class ExercisesController < ApplicationController
begin
check_ids = Exercise.where(id: params[:check_ids])
check_ids.each do |exercise|
exercise.update_attribute('is_public', true)
exercise.update!(is_public: true)
end
normal_status(0, "试卷已设为公开!")
rescue Exception => e
@ -318,7 +327,7 @@ class ExercisesController < ApplicationController
:description => exercise.exercise_description,
:course_list_id => exercise.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).first #该习题库是否存在于问题库里
# ques_params = {
# :name => current_ex_bank.name,
@ -352,7 +361,7 @@ class ExercisesController < ApplicationController
# question_bank = QuestionBank.new ques_params
# question_bank.save
# end
exercise.update_attributes!(exercise_bank_id: current_ex_bank.id)
exercise.update!(exercise_bank_id: current_ex_bank.id)
end
# 试卷的问题的输入
exercise.exercise_questions.each do |q|
@ -365,7 +374,7 @@ class ExercisesController < ApplicationController
:shixun_name => q.shixun_name
}
exercise_bank_question = current_ex_bank.exercise_bank_questions.new option
exercise_bank_question.save
exercise_bank_question.save!
## 试卷选项的输入
if q.question_type != Exercise::PRACTICAL #不为实训题时,试卷选项加入试题答案库
ex_choices = q.exercise_choices
@ -376,7 +385,7 @@ class ExercisesController < ApplicationController
:choice_text =>c.choice_text
}
ex_bank_choice = exercise_bank_question.exercise_bank_choices.new choice_option
ex_bank_choice.save
ex_bank_choice.save!
end
ex_standard.each do |s|
ex_stand = {
@ -384,7 +393,7 @@ class ExercisesController < ApplicationController
:answer_text => s.answer_text
}
ex_stand_bank = exercise_bank_question.exercise_bank_standard_answers.new ex_stand
ex_stand_bank.save
ex_stand_bank.save!
end
else #当为实训题时
shixun_challenges = q.exercise_shixun_challenges
@ -396,11 +405,11 @@ class ExercisesController < ApplicationController
:question_score => c.question_score
}
shixun_challenge_bank = exercise_bank_question.exercise_bank_shixun_challenges.new challenge_option
shixun_challenge_bank.save
shixun_challenge_bank.save!
end
end
end
current_ex_bank.save
current_ex_bank.save!
end
normal_status(0, "题库更新成功!")
rescue Exception => e
@ -486,7 +495,7 @@ class ExercisesController < ApplicationController
:publish_time => params_publish_time,
:end_time => params_end_time
}
@exercise.update_attributes(exercise_params)
@exercise.update!(exercise_params)
@exercise.exercise_group_settings.destroy_all
normal_status(0, "试卷设置成功!")
end
@ -539,7 +548,7 @@ class ExercisesController < ApplicationController
:end_time => exercise_end_time
}
end
the_group_setting.update_attributes!(ex_group_params)
the_group_setting.update!(ex_group_params)
end
end
if new_group_ids.size > 0
@ -590,7 +599,7 @@ class ExercisesController < ApplicationController
:publish_time => p_time,
:end_time => e_time
}
@exercise.update_attributes(exercise_params)
@exercise.update!(exercise_params)
if @exercise.exercise_status == Exercise::PUBLISHED
if @exercise.course_acts.size == 0
@exercise.course_acts << CourseActivity.new(:user_id => @exercise.user_id,:course_id => @exercise.course_id)
@ -629,9 +638,9 @@ class ExercisesController < ApplicationController
objective_score = @exercise.objective_score > 0 ? params[:objective_score].to_f.round(2) : 0
score = subjective_score + objective_score
if exercise_user.commit_status == 1
exercise_user.update_attributes!(score: score, subjective_score: subjective_score, objective_score: objective_score)
exercise_user.update!(score: score, subjective_score: subjective_score, objective_score: objective_score)
else
exercise_user.update_attributes!(start_at: start_at_time, end_at: Time.now, status: 1, commit_status: 1, score: score,
exercise_user.update!(start_at: start_at_time, end_at: Time.now, status: 1, commit_status: 1, score: score,
subjective_score: subjective_score, objective_score: objective_score, commit_method: 5)
end
@ -777,7 +786,7 @@ class ExercisesController < ApplicationController
exercise_group_setting = exercise.exercise_group_settings.find_in_exercise_group("course_group_id",i).first #根据课堂分班的id寻找试卷所在的班级
group_end_time = params[:detail] ? group_end_times[index] : ex_end_time
if exercise_group_setting.present? #如果该试卷分组存在,则更新,否则新建
exercise_group_setting.update_attributes!(publish_time: Time.now, end_time: group_end_time)
exercise_group_setting.update!(publish_time: Time.now, end_time: group_end_time)
else
p_course_group = {
:exercise_id => exercise.id,
@ -787,7 +796,7 @@ class ExercisesController < ApplicationController
:end_time => group_end_time,
}
new_exercise_group = exercise.exercise_group_settings.new p_course_group
new_exercise_group.save
new_exercise_group.save!
end
end
# group_ids = params[:group_ids]
@ -806,7 +815,7 @@ class ExercisesController < ApplicationController
:exercise_status => ex_status,
:unified_setting => ex_unified
}
exercise.update_attributes(exercise_params)
exercise.update!(exercise_params)
if exercise.course_acts.size == 0
exercise.course_acts << CourseActivity.new(:user_id => exercise.user_id,:course_id => exercise.course_id)
@ -859,7 +868,7 @@ class ExercisesController < ApplicationController
if exercise.unified_setting && g_course.map(&:to_i).sort == all_course_group_ids.sort #开始为统一设置
exercise.exercise_group_settings.destroy_all
new_ex_status = set_exercise_status(exercise.publish_time,Time.now)
exercise.update_attributes(:end_time => Time.now,:exercise_status => new_ex_status)
exercise.update!(:end_time => Time.now,:exercise_status => new_ex_status)
exercise_users = exercise.exercise_users
else
course_members_ids = course_students.course_find_by_ids("course_group_id",g_course).pluck(:user_id).uniq #该班级的全部学生
@ -878,7 +887,7 @@ class ExercisesController < ApplicationController
:publish_time => exercise.publish_time,
:end_time => exercise.end_time
}
ExerciseGroupSetting.create(ex_group_options)
ExerciseGroupSetting.create!(ex_group_options)
end
end
end
@ -893,17 +902,17 @@ class ExercisesController < ApplicationController
:publish_time => exercise.publish_time,
:end_time => Time.now
}
ExerciseGroupSetting.create(ex_group_options)
ExerciseGroupSetting.create!(ex_group_options)
end
end
new_end_time = exercise.exercise_group_settings.end_time_no_null.map(&:end_time) # 试卷结束时间不为空的
new_end_time_s = new_end_time.count > 0 ? new_end_time.max : Time.now
new_ex_status = set_exercise_status(exercise.publish_time,new_end_time_s)
exercise.update_attributes(:end_time => new_end_time_s,:exercise_status => new_ex_status,:unified_setting => false)
exercise.update!(:end_time => new_end_time_s,:exercise_status => new_ex_status,:unified_setting => false)
end
else
exercise_users = exercise.exercise_users
exercise.update_attributes(:exercise_status => 3, :end_time => Time.now,:unified_setting => true)
exercise.update!(:exercise_status => 3, :end_time => Time.now,:unified_setting => true)
end
ex_user_ids = exercise_users.pluck(:id)
@ -946,7 +955,7 @@ class ExercisesController < ApplicationController
if exercise_user.present?
if exercise_user.commit_status == 1 && @exercise.get_exercise_status(current_user) == Exercise::PUBLISHED #用户已提交且试卷提交中
if @exercise.time == -1 || ((Time.now.to_i - exercise_user.start_at.to_i) < @exercise.time.to_i * 60)
exercise_user.update_attributes(:score => nil, :end_at => nil, :status => nil, :commit_status => 0,
exercise_user.update!(:score => nil, :end_at => nil, :status => nil, :commit_status => 0,
:objective_score => 0.0, :subjective_score => -1.0)
exercise_user.user.exercise_shixun_answers.search_shixun_answers("exercise_question_id",ex_question_ids).destroy_all
exercise_answers = exercise_user.user.exercise_answers.search_answer_users("exercise_question_id",ex_question_ids)
@ -1046,7 +1055,7 @@ class ExercisesController < ApplicationController
@exercise_user_current = ex_users_current&.first
if ex_users_current.exists?
if @exercise_user_current.start_at.blank?
@exercise_user_current.update_attribute("start_at",Time.now)
@exercise_user_current.update!(start_at: Time.now)
end
else
if @user_course_identity > Course::ASSISTANT_PROFESSOR #当为老师的时候不创建exercise_user表理论上老师是不能进入答题的
@ -1056,7 +1065,7 @@ class ExercisesController < ApplicationController
:start_at => Time.now
}
exercise_user_current = ExerciseUser.new(exercise_user_params)
exercise_user_current.save
exercise_user_current.save!
end
end
@t_user_exercise_status = @exercise.get_exercise_status(current_user)
@ -1174,7 +1183,7 @@ class ExercisesController < ApplicationController
:subjective_score => subjective_score,
:commit_method => @answer_committed_user&.commit_method.to_i > 0 ? @answer_committed_user&.commit_method.to_i : params[:commit_method].to_i
}
@answer_committed_user.update_attributes!(commit_option)
@answer_committed_user.update!(commit_option)
CommitExercsieNotifyJobJob.perform_later(@exercise.id, current_user.id)
normal_status(0,"试卷提交成功!")
else

@ -52,7 +52,7 @@ class GraduationWorksController < ApplicationController
begin
work = @task.graduation_works.find_by!(user_id: params[: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,
teacher_score: nil, teaching_asistant_score: nil, update_user_id: nil)
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)
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
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
member = Member.create(user_id: @task.user_id, project_id: project.id)
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,
container_type: 'ManagerJoinProject').destroy_all
work.update_attributes(project_id: 0)
work.update!(project_id: 0)
normal_status("取消关联成功")
rescue Exception => e
@ -177,7 +177,7 @@ class GraduationWorksController < ApplicationController
student_ids += members
for i in 0 .. members.count-1
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,
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,
@ -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|
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.each do |attachment|
att = attachment.copy
@ -264,7 +264,7 @@ class GraduationWorksController < ApplicationController
(params_user_ids - work_user_ids).each do |user_id|
stu_work = @task.graduation_works.where(user_id: user_id).empty? ? GraduationWork.new :
@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,
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)
@ -323,9 +323,9 @@ class GraduationWorksController < ApplicationController
# 如果作品是未提交的状态则更新为已提交
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
@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
@ -392,7 +392,7 @@ class GraduationWorksController < ApplicationController
graduation_task_id: @task.id, comment: "使用调分功能调整了作业最终成绩:#{params[:comment]}",
user_id: User.current.id, reviewer_role: 1, is_ultimate: 1)
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,
container_type: "AdjustScore", parent_container_id: @task.id,
@ -445,9 +445,9 @@ class GraduationWorksController < ApplicationController
end
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.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("提交成功")
rescue Exception => e
@ -465,7 +465,7 @@ class GraduationWorksController < ApplicationController
if @work_assign_teacher.present?
# graduation_group_id: 已经是答辩组的需要 将答辩组清空
@work_assign_teacher.update_attributes(graduation_group_id: 0)
@work_assign_teacher.update!(graduation_group_id: 0)
else
@work.graduation_work_comment_assignations << GraduationWorkCommentAssignation.new(graduation_task_id: @task.id,
user_id: params[:user_id],

@ -1451,7 +1451,7 @@ class HomeworkCommonsController < ApplicationController
if user_review.present?
user_review.update_attributes!(:code_rate => user_rate)
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
nuser_ids = results.user_lists.map(&:user_id).uniq

@ -8,7 +8,15 @@ class ItemBanksController < ApplicationController
items = ItemBankQuery.call(params)
@items_count = items.size
@items = paginate items.includes(:item_analysis, :user, :container)
@item_basket_ids = current_user.item_baskets.pluck(:item_bank_id)
exam = ExaminationBank.find_by(id: params[:exam_id]) if params[:exam_id].present?
exam_setting = ExaminationIntelligentSetting.find_by(id: params[:exam_setting_id]) if params[:exam_setting_id].present?
@item_basket_ids = if exam
exam.examination_items.pluck(:item_bank_id)
elsif exam_setting
exam_setting.item_baskets.pluck(:item_bank_id)
else
current_user.item_baskets.pluck(:item_bank_id)
end
end
def create

@ -4,7 +4,7 @@ class ItemBasketsController < ApplicationController
helper_method :current_basket
def index
@item_baskets = current_user.item_baskets
@item_baskets = basket_items
@single_questions = @item_baskets.where(item_type: "SINGLE")
@multiple_questions = @item_baskets.where(item_type: "MULTIPLE")
@judgement_questions = @item_baskets.where(item_type: "JUDGMENT")
@ -22,41 +22,41 @@ class ItemBasketsController < ApplicationController
end
def create
ItemBaskets::SaveItemBasketService.call(current_user, create_params)
ItemBaskets::SaveItemBasketService.call(current_user, create_params, exam_setting)
render_ok
rescue ApplicationService::Error => ex
render_error(ex.message)
end
def destroy
item = current_user.item_baskets.find_by!(item_bank_id: params[:id])
item = basket_items.find_by!(item_bank_id: params[:id])
ActiveRecord::Base.transaction do
current_user.item_baskets.where(item_type: item.item_type).where("position > #{item.position}").update_all("position = position -1")
basket_items.where(item_type: item.item_type).where("position > #{item.position}").update_all("position = position -1")
item.destroy!
end
render_ok
end
def delete_item_type
baskets = ItemBasket.where(item_type: params[:item_type])
baskets = basket_items.where(item_type: params[:item_type])
baskets.destroy_all
render_ok
end
def set_score
current_basket.update_attributes!(score: params[:score])
@questions_score = current_user.item_baskets.where(item_type: current_basket.item_type).pluck(:score).sum
@all_score = current_user.item_baskets.pluck(:score).sum
@questions_score = basket_items.where(item_type: current_basket.item_type).pluck(:score).sum
@all_score = basket_items.pluck(:score).sum
end
def batch_set_score
current_user.item_baskets.where(item_type: params[:item_type]).update_all(score: params[:score])
@questions_score = current_user.item_baskets.where(item_type: params[:item_type]).pluck(:score).sum
@all_score = current_user.item_baskets.pluck(:score).sum
basket_items.where(item_type: params[:item_type]).update_all(score: params[:score])
@questions_score = basket_items.where(item_type: params[:item_type]).pluck(:score).sum
@all_score = basket_items.pluck(:score).sum
end
def adjust_position
same_items = current_user.item_baskets.where(item_type: current_basket.item_type)
same_items = basket_items.where(item_type: current_basket.item_type)
max_position = same_items.size
tip_exception("position超出范围") unless params[:position].present? && params[:position].to_i <= max_position && params[:position].to_i >= 1
ActiveRecord::Base.transaction do
@ -79,8 +79,19 @@ class ItemBasketsController < ApplicationController
params.permit(item_ids: [])
end
def exam_setting
@_exam_setting = ExaminationIntelligentSetting.find_by(id: params[:exam_setting_id])
end
def basket_items
@_items = params[:exam_setting_id] ? exam_setting.item_baskets : current_user.item_baskets
end
def current_basket
@_current_basket = current_user.item_baskets.find_by!(id: params[:id])
@_current_basket = ItemBasket.find_by!(id: params[:id])
tip_exception(403, "无权限编辑") unless current_user.admin_or_business? || @_current_basket.user_id.to_i == current_user.id ||
@_current_basket.examination_intelligent_setting&.user_id.to_i == current_user.id
@_current_basket
end
def validate_score

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

@ -31,15 +31,15 @@ class PollVotesController < ApplicationController
current_user_answer = user_votes.first
if current_user_answer&.poll_answer_id != question_answer_id #如果说更换了答案,则以前的答案删除,并新建记录
current_user_answer.destroy
PollVote.create(vote_answer_params)
PollVote.create!(vote_answer_params)
else
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
else
PollVote.create(vote_answer_params)
PollVote.create!(vote_answer_params)
end
elsif question_type == 2 #多选题的话答案应该是1个以上
question_answer_ids = params[:poll_answer_id] ? params[:poll_answer_id] : [] #该答案的id
@ -48,7 +48,7 @@ class PollVotesController < ApplicationController
ques_vote_id = question_answer_ids.map(&:to_i).max
ques_vote = user_votes.find_by(poll_answer_id: ques_vote_id)
if ques_vote.present?
ques_vote.update_attributes!(vote_text: question_answer_text)
ques_vote.update!(vote_text: question_answer_text)
else
answer_option = {
:user_id => current_user.id,
@ -93,14 +93,14 @@ class PollVotesController < ApplicationController
else #主观题的输入
# current_vote_text = user_votes.find_vote_text
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?
# user_votes.first.update_attribute("vote_text", question_answer_text)
# else
# user_votes.destroy_all
# end
else
PollVote.create(vote_answer_params)
PollVote.create!(vote_answer_params)
end
end
@current_question_number = @poll_question.question_number

@ -137,7 +137,7 @@ class PollsController < ApplicationController
:polls_status => 1,
:polls_type => "Course",
}
@poll = Poll.create(poll_options)
@poll = Poll.create!(poll_options)
rescue Exception => e
uid_logger_error(e.message)
tip_exception("问卷创建失败!")
@ -167,7 +167,7 @@ class PollsController < ApplicationController
:polls_name => poll_name,
:polls_description => poll_des
}
@poll.update_attributes(poll_params)
@poll.update!(poll_params)
normal_status(0,"问卷更新成功!")
rescue Exception => e
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寻找问卷所在的班级
group_end_time = params[:detail] ? group_end_times[index] : ex_end_time
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
p_course_group = {
:poll_id => poll.id,
@ -326,7 +326,7 @@ class PollsController < ApplicationController
:polls_status => poll_status,
:unified_setting => poll_unified
}
poll.update_attributes(poll_params)
poll.update!(poll_params)
if poll.course_acts.size == 0
poll.course_acts << CourseActivity.new(:user_id => poll.user_id,:course_id => poll.course_id)
end
@ -390,10 +390,10 @@ class PollsController < ApplicationController
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_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
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
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)
@ -470,7 +470,7 @@ class PollsController < ApplicationController
:publish_time => p_time,
:end_time => e_time
}
@poll.update_attributes(poll_options)
@poll.update!(poll_options)
normal_status(0,"分班问卷撤销发布成功!")
else
normal_status(-1,"请选择撤销发布班级!")
@ -490,7 +490,7 @@ class PollsController < ApplicationController
:end_time => nil,
:unified_setting => true
}
@poll.update_attributes(poll_new_params)
@poll.update!(poll_new_params)
@poll.poll_group_settings.destroy_all
normal_status(0,"问卷撤销发布成功!")
@ -531,7 +531,7 @@ class PollsController < ApplicationController
begin
check_ids = Poll.where(id:params[:check_ids])
check_ids.each do |poll|
poll.update_attribute('is_public', true)
poll.update!(is_public: true)
end
normal_status(0, "问卷已设为公开!")
rescue Exception => e
@ -555,13 +555,13 @@ class PollsController < ApplicationController
:description => poll.polls_description,
: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) #该习题库是否存在于问题库里
ques_params = {
:name => current_ex_bank.name,
: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 # 更新后,习题库的问题全部删除,后续重新再建
else
ex_params = {
@ -575,7 +575,7 @@ class PollsController < ApplicationController
:quotes => 1
}
current_ex_bank= ExerciseBank.new ex_params
if current_ex_bank.save #如果习题库保存成功则会创建问题库question_bank
if current_ex_bank.save! #如果习题库保存成功则会创建问题库question_bank
ques_params = {
:name => current_ex_bank.name,
:container_id => current_ex_bank.id,
@ -586,9 +586,9 @@ class PollsController < ApplicationController
:course_list_id => current_ex_bank.course_list_id
}
question_bank = QuestionBank.new ques_params
question_bank.save
question_bank.save!
end
poll.update_attributes!(exercise_bank_id: current_ex_bank.id)
poll.update!(exercise_bank_id: current_ex_bank.id)
end
# 问卷的问题的输入
poll.poll_questions.each do |f|
@ -601,7 +601,7 @@ class PollsController < ApplicationController
:min_choices => f.min_choices
}
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|
choice_option = {
@ -609,7 +609,7 @@ class PollsController < ApplicationController
:choice_text => a.answer_text
}
exercise_bank_c = exercise_bank_question.exercise_bank_choices.new choice_option
exercise_bank_c.save
exercise_bank_c.save!
end
end
end
@ -746,7 +746,7 @@ class PollsController < ApplicationController
:publish_time => params_publish_time,
:end_time => params_end_time
}
@poll.update_attributes(poll_params)
@poll.update!(poll_params)
@poll.poll_group_settings.destroy_all
normal_status(0, "问卷设置成功!")
end
@ -800,7 +800,7 @@ class PollsController < ApplicationController
:end_time => poll_end_time
}
end
the_group_setting.update_attributes(poll_group_params)
the_group_setting.update!(poll_group_params)
end
end
if new_group_ids.size > 0
@ -813,7 +813,7 @@ class PollsController < ApplicationController
:end_time => poll_end_time
}
new_poll_group = PollGroupSetting.new(poll_group_params)
new_poll_group.save
new_poll_group.save!
end
end
end
@ -848,7 +848,7 @@ class PollsController < ApplicationController
:publish_time => p_time,
:end_time => e_time
}
@poll.update_attributes(poll_params)
@poll.update!(poll_params)
if @poll.polls_status == 2
if @poll.course_acts.size == 0
@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,
:commit_status => 0
}
PollUser.create(poll_user_params)
PollUser.create!(poll_user_params)
end
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
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,
: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)
normal_status(0, "问卷提交成功!")
end

@ -888,13 +888,15 @@ class ShixunsController < ApplicationController
def upload_git_file
upload_file = params["file"]
uid_logger("#########################file_params####{params["#{params[:file]}"]}")
uid_logger("#########################file_params##: #{params["file"]}")
raise "未上传文件" unless upload_file
content = upload_file.tempfile.read
uid_logger("#########################content####{content}")
author_name = current_user.real_name
author_email = current_user.git_mail
message = params[:message] || "upload file by browser"
update_file_content(content, @repo_path, @path, author_email, author_name, message)
uid_logger("-----author_email: #{author_email}")
update_file_base64_content(content, @repo_path, @path, author_email, author_name, message)
render_ok
end

@ -264,7 +264,7 @@ class StudentWorksController < ApplicationController
if project_member.present?
project_member.member_roles.take.update_attributes!(role_id: 3) if project_member.member_roles.take.present?
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)
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,
@ -737,7 +737,7 @@ class StudentWorksController < ApplicationController
else
comment = "根据实训报告中最终提交的代码调整第#{challenge.position}关分数"
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)
challenge_score.create_tiding current_user.id
if @work.work_status != 0 && @work.myshixun

@ -2,7 +2,10 @@ class TagDisciplinesController < ApplicationController
before_action :require_login
def create
tip_exception("请输入知识点") if params[:name].blank?
tip_exception("输入字符长度限制在15个以内") if params[:name].length > 15
sub_discipline = SubDiscipline.find_by!(id: params[:sub_discipline_id])
tip_exception("重复的知识点") if sub_discipline.tag_disciplines.exists?(name: params[:name].to_s.strip)
tag_discipline = TagDiscipline.create!(name: params[:name].to_s.strip, sub_discipline: sub_discipline, user_id: current_user.id)
render_ok({tag_discipline_id: tag_discipline.id})
end

@ -0,0 +1,12 @@
class ExaminationIntelligentSettings::SaveExamForm
include ActiveModel::Model
attr_accessor :name, :duration
validates :name, presence: true, length: { maximum: 60 }
validate :validate_duration
def validate_duration
raise '时长应为大于0的整数' if duration.present? && duration.to_i < 1
end
end

@ -0,0 +1,11 @@
class ExaminationIntelligentSettings::SaveExamSettingForm
include ActiveModel::Model
attr_accessor :discipline_id, :sub_discipline_id, :source, :difficulty, :tag_discipline_id, :question_settings
validates :discipline_id, presence: true
validates :sub_discipline_id, presence: true
validates :source, presence: true
validates :difficulty, presence: true, inclusion: {in: 1..3}, numericality: { only_integer: true }
validates :question_settings, presence: true
end

@ -15,9 +15,9 @@ class ItemBanks::SaveItemForm
return unless errors.blank?
choices.each { |item| SubForm.new(item).validate! } if %W(SINGLE MULTIPLE JUDGMENT).include?(item_type)
return unless errors.blank?
if [0, 2].include?(item_type) && choices.pluck(:is_answer).select{|item| item == 1}.length > 1
if ["SINGLE", "JUDGMENT"].include?(item_type) && choices.pluck(:is_answer).select{|item| item == 1}.length > 1
raise("正确答案只能有一个")
elsif item_type == 1 && choices.pluck(:is_answer).select{|item| item == 1}.length <= 1
elsif item_type == "MULTIPLE" && choices.pluck(:is_answer).select{|item| item == 1}.length <= 1
raise("多选题至少有两个正确答案")
end
end

@ -7,6 +7,10 @@ class ExaminationBank < ApplicationRecord
has_many :examination_items, -> {order(position: :asc)}, dependent: :destroy
def apply?
!public && ApplyAction.where(container_type: "ExaminationBank", container_id: id, status: 0).exists?
end
def question_count
examination_items.size
end

@ -0,0 +1,7 @@
class ExaminationIntelligentSetting < ApplicationRecord
belongs_to :sub_discipline
belongs_to :user
has_many :examination_type_settings, dependent: :destroy
has_many :tag_discipline_containers, as: :container, dependent: :destroy
has_many :item_baskets, dependent: :destroy
end

@ -0,0 +1,4 @@
class ExaminationTypeSetting < ApplicationRecord
enum item_type: { SINGLE: 0, MULTIPLE: 1, JUDGMENT: 2, COMPLETION: 3, SUBJECTIVE: 4, PRACTICAL: 5, PROGRAM: 6 }
belongs_to :examination_intelligent_setting
end

@ -1,3 +1,3 @@
class ItemAnalysis < ApplicationRecord
belongs_to :item_bank
belongs_to :item_bank, touch: true
end

@ -18,6 +18,10 @@ class ItemBank < ApplicationRecord
item_analysis&.analysis
end
def apply?
!public && ApplyAction.where(container_type: "ItemBank", container_id: id, status: 0).exists?
end
def type_string
result = case item_type
when "SINGLE"

@ -2,13 +2,6 @@ class ItemBasket < ApplicationRecord
enum item_type: { SINGLE: 0, MULTIPLE: 1, JUDGMENT: 2, COMPLETION: 3, SUBJECTIVE: 4, PRACTICAL: 5, PROGRAM: 6 }
belongs_to :item_bank
belongs_to :user
def all_score
User.current.item_baskets.map(&:score).sum
end
def question_count
User.current.item_baskets.size
end
belongs_to :user, optional: true
belongs_to :examination_intelligent_setting, optional: true
end

@ -1,3 +1,3 @@
class ItemChoice < ApplicationRecord
belongs_to :item_bank
belongs_to :item_bank, touch: true
end

@ -1,5 +1,5 @@
class TagDisciplineContainer < ApplicationRecord
belongs_to :tag_discipline
belongs_to :container, polymorphic: true, optional: true
belongs_to :container, polymorphic: true, optional: true, touch: true
end

@ -157,6 +157,8 @@ class User < ApplicationRecord
# 题库
has_many :item_banks, dependent: :destroy
has_many :item_baskets, -> { order("item_baskets.position ASC") }, dependent: :destroy
has_many :examination_banks, dependent: :destroy
has_many :examination_intelligent_settings, dependent: :destroy
# Groups and active users
scope :active, lambda { where(status: STATUS_ACTIVE) }

@ -0,0 +1,35 @@
class OptionalItemQuery < ApplicationQuery
attr_reader :sub_discipline_id, :tag_discipline_id, :difficulty, :source
def initialize(sub_discipline_id, tag_discipline_id, difficulty, source)
@sub_discipline_id = sub_discipline_id
@tag_discipline_id = tag_discipline_id
@difficulty = difficulty
@source = source
end
def call
items = ItemBank.all
if tag_discipline_id.present? && sub_discipline_id.present?
items = items.joins(:tag_discipline_containers).where(tag_discipline_containers: {tag_discipline_id: tag_discipline_id})
hacks = Hack.joins(:tag_discipline_containers).where(tag_discipline_containers: {tag_discipline_id: tag_discipline_id})
elsif sub_discipline_id.present?
items = items.where(sub_discipline_id: sub_discipline_id)
hacks = Hack.where(sub_discipline_id: sub_discipline_id)
end
if hacks.present?
items = ItemBank.where(container_id: hacks.pluck(:id), container_type: "Hack").or(ItemBank.where(id: items.pluck(:id)))
end
# 来源
public = source.present? ? source.to_i : 1
public = public == 2 ? [0, 1] : public
items = items.where(public: public)
# 难度
difficulty = difficulty ? difficulty.to_i : 1
items = items.where(difficulty: difficulty)
items
end
end

@ -0,0 +1,38 @@
class ExaminationIntelligentSettings::SaveExaminationService < ApplicationService
attr_reader :exam, :params, :exam_setting
def initialize(exam, params, exam_setting)
@exam = exam
@params = params
@exam_setting = exam_setting
end
def call
ExaminationIntelligentSettings::SaveExamForm.new(params).validate!
ActiveRecord::Base.transaction do
exam.name = params[:name].to_s.strip
exam.difficulty = exam_setting.difficulty
exam.duration = params[:duration].present? ? params[:duration].to_i : nil
exam.sub_discipline_id = exam_setting.sub_discipline_id
exam.intelligent = 1
exam.save!
# 知识点的创建
exam_setting.tag_discipline_containers.each do |tag|
exam.tag_discipline_containers << TagDisciplineContainer.new(tag_discipline_id: tag.tag_discipline_id)
end
# 试题的复制
exam_setting.item_baskets.includes(:item_bank).each do |basket|
item = basket.item_bank
if item.present?
new_item = ExaminationItem.new
new_item.new_item(item, exam, basket.score, basket.position)
end
end
exam_setting.destroy!
end
end
end

@ -0,0 +1,63 @@
class ExaminationIntelligentSettings::SaveSettingService < ApplicationService
attr_reader :exam, :params
def initialize(exam, params)
@exam = exam
@params = params
end
def call
ExaminationIntelligentSettings::SaveExamSettingForm.new(params).validate!
items = OptionalItemQuery.call(params[:sub_discipline_id], params[:tag_discipline_id], params[:difficulty], params[:source])
params[:question_settings].each do |setting|
raise "超出可选题数范围" if items.select{ |item| item.item_type == setting[:item_type] }.size.to_i < setting[:count].to_i
end
exam.difficulty = params[:difficulty]
exam.sub_discipline_id = params[:sub_discipline_id]
exam.public = params[:source].present? ? params[:source].to_i : 1
exam.save!
# 知识点的创建
params[:tag_discipline_id].each do |tag_id|
exam.tag_discipline_containers << TagDisciplineContainer.new(tag_discipline_id: tag_id)
end
# 智能选题的设置
params[:question_settings].each do |setting|
if setting[:count].to_i > 0
exam.examination_type_settings << ExaminationTypeSetting.new(item_type: setting[:item_type], count: setting[:count].to_i)
end
end
# 选题
choose_question items
exam
end
private
def choose_question items
exam.examination_type_settings.each do |setting|
questions = items.select{ |item| item.item_type == setting.item_type }
questions.pluck(:id).sample(setting.count).each_with_index do |item_id, index|
item = ItemBank.find item_id
exam.item_baskets << ItemBasket.new(item_bank_id: item.id, position: index+1, score: item_score(item.item_type), item_type: item.item_type)
end
end
end
def item_score item_type
score =
case item_type
when "SINGLE", "MULTIPLE", "JUDGMENT"
5
when "PROGRAM"
10
else
5
end
score
end
end

@ -1,9 +1,10 @@
class ItemBaskets::SaveItemBasketService < ApplicationService
attr_reader :user, :params
attr_reader :user, :params, :exam_setting
def initialize(user, params)
def initialize(user, params, exam_setting)
@user = user
@params = params
@exam_setting = exam_setting
end
def call
@ -13,9 +14,14 @@ class ItemBaskets::SaveItemBasketService < ApplicationService
items = ItemBank.where(public: 1).or(ItemBank.where(user_id: user.id))
# 已选到过试题篮的不重复选用
item_ids = params[:item_ids] - user.item_baskets.pluck(:item_bank_id)
item_ids = params[:item_ids] - basket_items.pluck(:item_bank_id)
items.where(id: item_ids).each do |item|
new_item = ItemBasket.new(user_id: user.id, item_bank_id: item.id, item_type: item.item_type)
new_item = ItemBasket.new(item_bank_id: item.id, item_type: item.item_type)
if exam_setting.present?
new_item.examination_intelligent_setting_id = exam_setting.id
else
new_item.user_id = user.id
end
new_item.score = item_score item.item_type
new_item.position = item_position item.item_type
new_item.save!
@ -25,8 +31,8 @@ class ItemBaskets::SaveItemBasketService < ApplicationService
private
def item_score item_type
if user.item_baskets.where(item_type: item_type).last.present?
score = user.item_baskets.where(item_type: item_type).last.score
if basket_items.where(item_type: item_type).last.present?
score = basket_items.where(item_type: item_type).last.score
else
score =
case item_type
@ -42,6 +48,10 @@ class ItemBaskets::SaveItemBasketService < ApplicationService
end
def item_position item_type
user.item_baskets.where(item_type: item_type).last&.position.to_i + 1
basket_items.where(item_type: item_type).last&.position.to_i + 1
end
def basket_items
exam_setting.present? ? exam_setting.item_baskets : user.item_baskets
end
end

@ -1,8 +1,9 @@
json.exams @exams.each do |exam|
json.(exam, :id, :name, :difficulty, :quotes)
json.(exam, :id, :name, :difficulty, :quotes, :public)
json.question_count exam.question_count
json.total_score exam.total_score
json.update_time exam.updated_at&.strftime("%Y-%m-%d %H:%M")
json.apply exam.apply?
json.author do
json.login exam.user&.login
json.name exam.user&.full_name

@ -0,0 +1,4 @@
json.single_question_count @single_question_count
json.multiple_question_count @multiple_question_count
json.judgement_question_count @judgement_question_count
json.program_question_count @program_question_count

@ -3,6 +3,7 @@ json.items @items.each do |item|
json.partial! "item_banks/item", locals: {item: item}
json.update_time item.updated_at&.strftime("%Y-%m-%d %H:%M")
json.choosed @item_basket_ids.include?(item.id)
json.apply item.apply?
json.author do
json.login item.user&.login
json.name item.user&.full_name

@ -80,6 +80,7 @@ Rails.application.routes.draw do
resources :examination_banks do
member do
post :set_public
delete :revoke_item
end
end
@ -95,6 +96,18 @@ Rails.application.routes.draw do
end
end
resources :examination_intelligent_settings do
collection do
post :optinal_items
end
member do
post :save_exam
post :exchange_one_item
post :exchange_items
end
end
resources :hacks, path: :problems, param: :identifier do
collection do
get :unpulished_list

@ -0,0 +1,13 @@
class CreateExaminationIntelligentSettings < ActiveRecord::Migration[5.2]
def change
create_table :examination_intelligent_settings do |t|
t.references :sub_discipline
t.integer :public, default: 1
t.integer :difficulty, default: 1
t.timestamps
end
add_index :examination_intelligent_settings, :sub_discipline_id, name: "index_on_sub_discipline_id"
end
end

@ -0,0 +1,13 @@
class CreateExaminationTypeSettings < ActiveRecord::Migration[5.2]
def change
create_table :examination_type_settings do |t|
t.references :examination_intelligent_setting, index: false
t.integer :item_type
t.integer :count
t.timestamps
end
add_index :examination_type_settings, :examination_intelligent_setting_id, name: "index_on_examination_intelligent_setting"
end
end

@ -0,0 +1,5 @@
class AddUserIdToIntelligentSettings < ActiveRecord::Migration[5.2]
def change
add_column :examination_intelligent_settings, :user_id, :integer, index: true
end
end

@ -0,0 +1,5 @@
class AddIntelligentSettingIdToItemBaskets < ActiveRecord::Migration[5.2]
def change
add_column :item_baskets, :examination_intelligent_setting_id, :integer, index: true
end
end

@ -0,0 +1,5 @@
class AddIntelligentToExam < ActiveRecord::Migration[5.2]
def change
add_column :examination_banks, :intelligent, :boolean, default: false
end
end

@ -334,7 +334,11 @@ const Paperreview= Loadable({
loading: Loading
})
//智能组卷
const Integeneration= Loadable({
loader: () => import('./modules/testpaper/Intecomponents'),
loading: Loading
})
// 学院统计
const College = Loadable({
@ -754,6 +758,7 @@ class App extends Component {
}
}
/>
<Route path="/myproblems/record_detail/:id"
render={
(props) => (<RecordDetail {...this.props} {...props} {...this.state} />)
@ -764,7 +769,14 @@ class App extends Component {
render={
(props) => (<NewOrEditTask {...this.props} {...props} {...this.state} />)
} />
<Route path="/Integeneration/:type/:id"
render={
(props) => (<Paperreview {...this.props} {...props} {...this.state} />)
}/>
<Route path="/paperreview/:type"
render={
(props) => (<Paperreview {...this.props} {...props} {...this.state} />)
}/>
<Route path="/paperlibrary/edit/:id"
render={
(props) => (<Paperlibraryeditid {...this.props} {...props} {...this.state} />)
@ -774,6 +786,7 @@ class App extends Component {
render={
(props) => (<Paperlibraryseeid {...this.props} {...props} {...this.state} />)
}/>
<Route path="/myproblems/:id/:tab?"
render={
(props) => (<StudentStudy {...this.props} {...props} {...this.state} />)
@ -795,9 +808,10 @@ class App extends Component {
render={
(props) => (<Testpaperlibrary {...this.props} {...props} {...this.state} />)
}/>
<Route path="/paperreview"
<Route path="/Integeneration"
render={
(props) => (<Paperreview {...this.props} {...props} {...this.state} />)
(props) => (<Integeneration {...this.props} {...props} {...this.state} />)
}/>
<Route path="/problems"

@ -82,8 +82,8 @@ export function initAxiosInterceptors(props) {
// proxy = "https://testeduplus2.educoder.net"
//proxy="http://47.96.87.25:48080"
proxy="https://pre-newweb.educoder.net"
proxy="https://test-newweb.educoder.net"
//proxy="https://test-jupyterweb.educoder.net"
// proxy="https://test-newweb.educoder.net"
proxy="https://test-jupyterweb.educoder.net"
//proxy="http://192.168.2.63:3001"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求

@ -3,22 +3,27 @@
// 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
<<<<<<< HEAD
, 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';
=======
, 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';
>>>>>>> dev_aliyun
export {setmiyah as setmiyah} from './Component';
export { default as queryString } from './UrlTool2';
export { SnackbarHOC as SnackbarHOC } from './SnackbarHOC';
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 { bytesToSize as bytesToSize } from './UnitUtil';
export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension,
downloadFile, sortDirections } from './TextUtil'
downloadFile, sortDirections } from './TextUtil'
export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil'
export { configShareForIndex, configShareForPaths, configShareForShixuns, configShareForCourses, configShareForCustom } from './util/ShareUtil'
@ -30,7 +35,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 { 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'

@ -61,6 +61,7 @@
### 使用
````
编辑模式是放不大图片的
import QuillForEditor from 'xxx';
// 指定需要显示的工具栏信息, 不指定加载全部

@ -222,7 +222,8 @@ function QuillForEditor ({
const current = value
if (!deepEqual(previous, current)) {
setSelection(quill.getSelection())
if (typeof value === 'string') {
if (typeof value === 'string' && value) {
// debugger
quill.clipboard.dangerouslyPasteHTML(value, 'api');
if (autoFocus) {
quill.focus();

@ -8,8 +8,9 @@ import {
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import axios from 'axios'
import update from 'immutability-helper'
import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder';
import QuillForEditor from "../../../../common/quillForEditor";
const { TextArea } = Input;
const confirm = Modal.confirm;
const $ = window.$
@ -47,6 +48,9 @@ class SingleEditor extends Component{
question_title: this.props.question_title || '',
question_type: this.props.question_type || 0,
question_score: this.props.question_score || this.props.init_question_score,
choice_editor: 'md',
quill_question_title: '',
quill_default_title: ''
}
}
addOption = () => {
@ -205,8 +209,33 @@ class SingleEditor extends Component{
toShowMode = () => {
}
// 切换编辑器
handleChangeEditor = (e) => {
const {quill_question_title} = this.state;
const value = e.target.value
if (value === 'quill') {
const _val = quill_question_title ? JSON.parse(quill_question_title) : '';
this.setState({
quill_default_title: _val
})
}
this.setState({
choice_editor: value
});
}
// quill编辑器内容变化时调用此接口
handleCtxChange = (ctx) => {
console.log('编辑器内容', ctx);
// 保存编辑器内容
this.setState({
quill_question_title: JSON.stringify(ctx)
});
}
render() {
let { question_title, question_score, question_type, question_choices, standard_answers } = this.state;
let { question_title, question_score, question_type, question_choices, standard_answers, choice_editor, quill_default_title } = this.state;
let { question_id, index, exerciseIsPublish,
// question_title,
// question_type,
@ -245,18 +274,51 @@ class SingleEditor extends Component{
max-width: 1056px;
word-break:break-all;
}
.editor_area{
display: inline-block;
float: right;
// line-height: 30px;
// height: 30px;
}
.editor_txt{
margin-right: 10px;
font-size: 12px;
color: #999;
}
.radio_style{
display: inline-block;
vertical: center;
}
`}</style>
<p className="mb10 clearfix">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="color-blue font-16 mr20 fl">选择题</span>
<span className="color-grey-9 font-12 fl">客观题由系统自动评分请设置标准答案</span>
{/* <Switch checkedChildren="MD" unCheckedChildren="Quill"></Switch> */}
{/* <div className="editor_area">
<span className="editor_txt">切换编辑器:</span>
<Radio.Group style={{ float: 'right' }} value={choice_editor} onChange={this.handleChangeEditor}>
<Radio className="radio_style" value={'md'}>MD</Radio>
<Radio className="radio_style" value={'quill'}>Quill</Radio>
</Radio.Group>
</div> */}
</p>
<TPMMDEditor mdID={qNumber} placeholder="请您输入题目" height={155} className="mb20"
initValue={question_title} onChange={(val) => this.setState({ question_title: val})}
ref="titleEditor"
{choice_editor === 'md'
? <TPMMDEditor mdID={qNumber} placeholder="请您输入题目" height={155} className="mb20"
initValue={question_title} onChange={(val) => this.setState({ question_title: val})}
ref="titleEditor"
></TPMMDEditor>
></TPMMDEditor>
: <QuillForEditor
wrapStyle={{ marginBottom: '35px' }}
style={{ height: '109px' }}
options={['code', 'image', 'formula']}
placeholder="请您输入题目"
value={quill_default_title}
onContentChange={this.handleCtxChange}
></QuillForEditor>
}
{question_choices.map( (item, index) => {
const bg = standard_answers[index] ? 'check-option-bg' : ''

@ -12,7 +12,6 @@ class Bottomsubmit extends Component {
cannelfun = () => {
// window.location.href=
debugger
if(this.props.Cohetepaperbool===true){
this.props.setCohetepaperbool(false);
}else {

@ -0,0 +1,970 @@
import React, {Component} from "react";
import {Link, NavLink} from 'react-router-dom';
import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder';
import axios from 'axios';
import {
notification,
Spin,
Table,
Pagination,
Drawer,
Input,
Tooltip
} from "antd";
import {parabola} from './animation/parabola'
import Headplugselections from "./component/Headplugselections";
import QuestionModal from "./component/QuestionModal";
import QuestionModals from "./component/QuestionModals";
import Contentpart from "./component/Contentpart";
import {TPMIndexHOC} from "../tpm/TPMIndexHOC";
import NoneData from './component/NoneData';
import './questioncss/questioncom.css';
import Bottomsubmit from "../modals/Bottomsubmit";
//exam_id 试卷的id
class NewMyShixunModel extends Component {
constructor(props) {
super(props);
this.state = {
count: 50,
defaultActiveKey:"1",
Headertop: "",
Footerdown: "",
visible: false,
placement: 'right',
modalsType: false,
modalsTypes:false,
titilesm: "在平台审核后,所有成员均可使用试题",
titiless: "是否设置为公开?",
titilesms:"单选题",
titbool: false,
Contentdata: [],
difficulty: null,
visiblemys: false,
visiblemyss: false,
item_type: null,
keyword: null,
timuid: null,
items_count: 0,
basket_list: [],
completion_questions_count: 0,
judgement_questions_count: 0,
multiple_questions_count: 0,
practical_questions_count: 0,
program_questions_count: 0,
single_questions_count: 0,
subjective_questions_count: 0,
page:1,
per_page:10,
disciplinesdata:[],
discipline_id:null,
sub_discipline_id:null,
tag_discipline_id:null,
booljupyterurls:false,
disciplinesdatakc:0,
disciplinesdatazsd:0,
selectallquestionsonthispages:false,
oj_status:null,
isVisible: false,
selectionbools:false,
}
}
setdiscipline_id=(discipline_id)=>{
this.setState({
discipline_id:discipline_id,
sub_discipline_id:null,
tag_discipline_id:null,
keywords:"",
page:1,
per_page:10,
oj_status:null
})
var data = {
discipline_id:discipline_id,
sub_discipline_id:null,
tag_discipline_id:null,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: null,
page: this.state.page,
per_page:10,
oj_status:null,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
}
setsub_discipline_id=(discipline_id,sub_discipline_id)=>{
this.setState({
sub_discipline_id:sub_discipline_id,
tag_discipline_id:null,
keywords:"",
page:1,
per_page:10,
oj_status:null
})
var data = {
discipline_id:discipline_id,
sub_discipline_id:sub_discipline_id,
tag_discipline_id:null,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords:null,
page: 1,
per_page:10,
oj_status:null,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
}
settag_discipline_id=(tag_discipline_id)=>{
this.setState({
tag_discipline_id:tag_discipline_id,
keywords:"",
page:1,
per_page:10,
oj_status:null
})
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: null,
page: 1,
per_page:10,
oj_status:null,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
}
//初始化
componentDidMount() {
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
let {defaultActiveKey} = this.props;
var defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
defaultActiveKeys="1"
}
this.callback(defaultActiveKeys);
let url = `/users/get_navigation_info.json`;
axios.get(url, {}).then((response) => {
// //////console.log("开始请求/get_navigation_info.json");
// //////console.log(response);
if (response != undefined) {
if (response.status === 200) {
this.setState({
Headertop: response.data.top,
Footerdown: response.data.down
})
}
}
});
this.getbasket_listdata();
//获取题库筛选资料
let urls = `/disciplines.json`;
axios.get(urls, {params: {
source:"question"
}}).then((response) => {
//console.log("Questiondisciplines");
//console.log(response.data);
if (response) {
this.setState({
disciplinesdata: response.data.disciplines,
})
}
});
}
componentDidUpdate(prevProps) {
if(prevProps.current_user !== this.props.current_user) {
debugger
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
let {defaultActiveKey} = this.props;
var defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
defaultActiveKeys="1"
}
this.callback(defaultActiveKeys);
}
}
//公共和我的
callback = (key) => {
this.setState({
defaultActiveKey: key,
selectallquestionsonthispages:false,
difficulty:null,
page:1,
oj_status:null
})
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: key,
item_type: this.state.item_type,
difficulty: null,
page: 1,
per_page:10,
oj_status:null,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
}
//刷新加载
getdata = (data) => {
const url = `/item_banks.json`;
this.setState({
booljupyterurls:true,
selectionbools:false,
})
axios.get((url), {params: data}).then((response) => {
setTimeout(()=>{
this.setState({
booljupyterurls:false,
})
},1000);
if (response === null || response === undefined) {
return
}
if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
} else {
}
//////console.log("item_banks");
//////console.log(response);
this.setState({
Contentdata: response.data,
items_count: response.data.items_count,
})
this.getdataslen(response.data.items);
}).catch((error) => {
//////console.log(error)
this.setState({
booljupyterurls:false,
})
});
}
//不刷新加载
getdatasy = (data) => {
const url = `/item_banks.json`;
this.setState({
selectionbools:false,
})
axios.get((url), {params: data}).then((response) => {
setTimeout(()=>{
},1000);
if (response === null || response === undefined) {
return
}
if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
} else {
}
//////console.log("item_banks");
//////console.log(response);
this.setState({
Contentdata: response.data,
items_count: response.data.items_count,
})
this.getdataslen(response.data.items);
}).catch((error) => {
});
}
//计算
getdataslen=(arr)=>{
var contes=0;
for(let data of arr) {
if(data.item_type==="PROGRAM"){
//编程题
if(data.choosed===true){
}else{
//未选用
if(data.program_attr.status===1){
//已发布
contes=contes+1;
}
}
}else{
//不是编程题
if(data.choosed===true){
}else{
//未选用
contes=contes+1;
}
}
}
if(contes>0){
this.setState({
selectionbools:false,
selectallquestionsonthispages:false,
})
}else {
this.setState({
selectionbools:true,
selectallquestionsonthispages:true,
})
}
}
paginationonChange = (pageNumber) => {
this.setState({
page: pageNumber,
})
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: this.state.keywords,
page: pageNumber,
per_page:10,
oj_status:this.state.oj_status,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
}
showDrawer = () => {
if(this.state.visible===true){
this.setState({
visible: false,
});
}else{
this.setState({
visible: true,
});
this.getbasket_listdata();
}
};
onClose = () => {
this.setState({
visible: false,
});
};
onChange = e => {
this.setState({
placement: e.target.value,
});
};
getContainer = () => {
return this.container;
};
saveContainer = container => {
this.container = container;
};
showmodels = (id) => {
this.setState({
modalsType: true,
titilesm: "在平台审核后,所有成员均可使用试题",
titiless: "是否设置为公开?",
titbool: true,
timuid: id
})
};
showmodelysl = (id) => {
this.setState({
modalsType: true,
titilesm: "确认删除后,无法撤销",
titiless: "是否确认删除?",
titbool: false,
timuid: id
})
};
modalCancel = () => {
this.setState({
modalsType: false
})
}
modalCancels=()=>{
this.setState({
modalsTypes: false
})
}
showQuestionModals =(item_type)=>{
this.setState({
modalsTypes: true,
titilesms:item_type,
})
}
setDownloads=(item_type)=>{
this.Deletebigquestiontype(item_type);
this.setState({
modalsTypes: false
})
}
setDownload = () => {
//确认
if (this.state.titbool === true) {
//公开
this.publicopentimu(this.state.timuid);
} else {
// 删除
this.deletetimu(this.state.timuid);
}
this.setState({
modalsType: false
})
}
setdifficulty = (difficulty) => {
this.setState({
difficulty: difficulty,
visiblemys: false,
page: 1,
per_page:10,
keywords:"",
oj_status:null
})
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: difficulty,
item_type: this.state.item_type,
keywords:null,
page:1,
per_page:10,
oj_status:null,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
}
setitem_types = (item_type) => {
this.setState({
item_type: item_type,
visiblemyss: false,
page: 1,
per_page:10,
keywords:"",
oj_status:null
})
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: item_type,
page: 1,
per_page:10,
keywords:null,
oj_status:null,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
}
handleVisibleChange = (boll) => {
if (this.state.visiblemyss === true) {
this.setState({
visiblemys: boll,
visiblemyss: false,
})
} else {
this.setState({
visiblemys: boll,
})
}
}
handleVisibleChanges = (boll) => {
if (this.state.visiblemys === true) {
this.setState({
visiblemyss: boll,
visiblemys: false,
})
} else {
this.setState({
visiblemyss: boll,
})
}
}
setdatafunsval = (e) => {
this.setState({
keywords: e.target.value
})
}
setdatafuns = (value) => {
this.setState({
keywords: value,
})
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: value,
page: this.state.page,
per_page:10,
oj_status:this.state.oj_status,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
}
deletetimu = (id) => {
const url = `/item_banks/${id}.json`;
axios.delete(url)
.then((response) => {
if (response.data.status == 0) {
// this.props.showNotification('删除试题成功')
// props.history.push(response.data.right_url)
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: this.state.keywords,
page: this.state.page,
per_page:10,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
}
})
.catch(function (error) {
////console.log(error);
});
}
publicopentimu = (id) => {
const url = `/item_banks/${id}/set_public.json`;
axios.post(url)
.then((result) => {
if (result.data.status == 0) {
// this.props.showNotification(`公开题目成功`);
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: this.state.keywords,
page: this.state.page,
per_page:10,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
}
}).catch((error) => {
////console.log(error);
})
}
getbasket_listdata = () => {
// 获取试题篮展开的数据
// const url = "/item_baskets/basket_list.json";
// axios.get(url)
// .then((result) => {
// // ////console.log("getbasket_listdata");
// // ////console.log(result.data);
// this.setState({
// completion_questions_count: result.data.completion_questions_count,
// judgement_questions_count: result.data.judgement_questions_count,
// multiple_questions_count: result.data.multiple_questions_count,
// practical_questions_count: result.data.practical_questions_count,
// program_questions_count: result.data.program_questions_count,
// single_questions_count: result.data.single_questions_count,
// subjective_questions_count: result.data.subjective_questions_count,
// })
//
// }).catch((error) => {
// // ////console.log(error);
// this.setState({
// completion_questions_count: 0,
// judgement_questions_count: 0,
// multiple_questions_count: 0,
// practical_questions_count: 0,
// program_questions_count: 0,
// single_questions_count: 0,
// subjective_questions_count: 0,
// })
// })
}
//选用
getitem_baskets=(data)=>{
//选用题型可以上传单个 或者多个题型
let url="";
if(this.props.exam_id===undefined){
url="/item_baskets.json";
}else{
url="/examination_items.json";
}
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
// this.props.showNotification(`选用成功`);
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: this.state.keywords,
page: this.state.page,
per_page:10,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdatasy(data);
this.getbasket_listdata();
// this.setState({
// visible:true
// })
}
}).catch((error) => {
////console.log(error);
})
}
// 撤销
getitem_basketss=(id)=>{
let url="";
if(this.props.exam_id===undefined){
url=`/item_baskets/${id}.json`;
axios.delete(url)
.then((result) => {
if (result.data.status == 0) {
// this.props.showNotification(`撤销成功`);
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: this.state.keywords,
page: this.state.page,
per_page:10,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdatasy(data);
this.getbasket_listdata();
}
}).catch((error) => {
////console.log(error);
})
}else{
url=`/examination_banks/${this.props.exam_id}/revoke_item.json`;
axios.delete(url,{ data: {
item_id:id===undefined?"":parseInt(id),
}})
.then((result) => {
if (result.data.status == 0) {
// this.props.showNotification(`撤销成功`);
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: this.state.keywords,
page: this.state.page,
per_page:10,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdatasy(data);
this.getbasket_listdata();
}
}).catch((error) => {
////console.log(error);
})
}
}
//全选试题库
selectallquestionsonthispage=()=>{
var item_idsdata=[];
var arr= this.state.Contentdata.items;
for(let data of arr) {
if(data.item_type==="PROGRAM"){
//编程题
if(data.choosed===true){
}else{
//未选用
if(data.program_attr.status===1){
//已发布
item_idsdata.push(data.id);
}
}
}else{
//不是编程题
if(data.choosed===true){
}else{
//未选用
item_idsdata.push(data.id);
}
}
}
const data={
item_ids:item_idsdata,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
}
this.getitem_baskets(data);
this.setState({
selectallquestionsonthispages:true,
})
}
//全选的状态
//删除大题型
Deletebigquestiontype =(item_type)=>{
const url=`/item_baskets/delete_item_type.json`;
axios.delete((url), { data: {
item_type:item_type
}})
.then((response) => {
if (response.data.status == 0) {
// this.props.showNotification('删除成功');
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: this.state.keywords,
page: this.state.page,
per_page:10,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
this.getbasket_listdata();
}
})
.catch(function (error) {
////console.log(error);
});
}
//跳转
gotopaperreview=()=>{
this.props.history.replace("/paperreview");
}
setoj_status=(oj_status)=>{
//编程题发布未发布
this.setState({
selectallquestionsonthispages:false,
difficulty:null,
oj_status:oj_status
})
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keywords: this.state.keywords,
page: this.state.page,
per_page:10,
oj_status:oj_status,
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
};
this.getdata(data);
}
render() {
let {
page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes,basket_list,
completion_questions_count, judgement_questions_count, multiple_questions_count, practical_questions_count,
program_questions_count, single_questions_count, subjective_questions_count,selectionbools
} = this.state;
const Datacount = completion_questions_count + judgement_questions_count
+ multiple_questions_count + practical_questions_count
+ program_questions_count
+ single_questions_count
+ subjective_questions_count;
return (
<div className="newMain clearfix " ref={this.saveContainer}>
{
visible===true?
<style>
{
`
.newHeaders{
position: fixed;
top: 0px;
z-index: 999 !important;
}
.ant-drawer {
z-index: 800 !important;
}
.ant-notification{
position: fixed;
z-index: 1500 !important;
}
.newFooter{
position: relative;
z-index: 9999999 ;
}
`
}
</style>
:""
}
{
visible===true?
<div
style={{
marginTop: "60px"
}}></div>
:""}
{
modalsTypes===true?
<QuestionModals {...this.props}{...this.state} modalsTypes={modalsTypes} modalCancels={() => this.modalCancels()}
setDownloads={(e) => this.setDownloads(e)}></QuestionModals>
:""
}
{
modalsType===true?
<QuestionModal {...this.props}{...this.state} modalsType={modalsType} modalCancel={() => this.modalCancel()}
setDownload={() => this.setDownload()}></QuestionModal>
:""
}
{/*顶部*/}
<Headplugselections
disciplinesdata={this.state.disciplinesdata}
{...this.props}
{...this.state}
setdifficulty={(e) => this.setdifficulty(e)}
setitem_types={(e) => this.setitem_types(e)}
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)}
/>
{/*头部*/}
<Contentpart {...this.state} {...this.props}
exam_id={this.props.exam_id}
Isitapopup={"true"}
getitem_basketss={(id)=>this.getitem_basketss(id)}
selectallquestionsonthispage={()=>this.selectallquestionsonthispage()}
getitem_baskets={(e)=>this.getitem_baskets(e)}
setdatafuns={(e) => this.setdatafuns(e)}
setdatafunsval={(e) => this.setdatafunsval(e)}
handleVisibleChanges={(e) => this.handleVisibleChanges(e)}
handleVisibleChange={(e) => this.handleVisibleChange(e)}
showmodels={(e) => this.showmodels(e)}
showmodelysl={(e) => this.showmodelysl(e)}
callback={(e) => this.callback(e)}
setoj_status={(e)=>this.setoj_status(e)}></Contentpart>
{
items_count&&items_count>10?
<div className="mb30 clearfix educontent mt40 intermediatecenter">
<Pagination showQuickJumper current={page} onChange={this.paginationonChange}
pageSize={per_page}
total={items_count}></Pagination>
</div>
:<div className="h30 clearfix educontent mt40 intermediatecenter">
</div>
}
<Bottomsubmit {...this.props} {...this.state} bottomvalue={"确定"}
Cohetepaperbool={true}
setCohetepaperbool={() => this.props.setnewmyshixunmodelbool(false)}
onSubmits={() => this.props.setnewmyshixunmodelbool(false)} url={'/paperlibrary'}></Bottomsubmit>
</div>
)
}
}
export default NewMyShixunModel;

@ -24,6 +24,8 @@ import JudquestionEditor from "./component/JudquestionEditor";
import Paperreview_item from "./Paperreview_item"
import Bottomsubmit from "../../modules/modals/Bottomsubmit";
import Comthetestpaperst from "./comthetestpaper/Comthetestpaperst";
import NewMyShixunModel from "../question/NewMyShixunModel";
import IntelligentModel from "../question/component/IntelligentModel"
//人工组卷预览
class Paperreview extends Component {
constructor(props) {
@ -49,7 +51,9 @@ class Paperreview extends Component {
difficulty:null,
name:null,
duration:null,
newmyshixunmodelbool:false,
artificialtype:"artificial",
Intelligentformation:false,
}
// single_questions:null, 单选题
@ -63,10 +67,13 @@ class Paperreview extends Component {
//初始化
componentDidMount() {
var data = {}
this.getdata(data);
//console.log("Paperreview.js");
//console.log(this.props.match.params);
this.setState({
artificialtype:this.props.match.params.type
})
var data = {};
this.getdata(data);
let urls = `/disciplines.json`;
axios.get(urls, {
params: {
@ -129,6 +136,18 @@ class Paperreview extends Component {
getdata = (data) => {
if(this.props.match.params.type==="artificial"){
//人工组卷
}else{
//智能组卷
//
data = {
exam_setting_id:this.props.match.params.id
}
}
const url = `/item_baskets.json`;
this.setState({
booljupyterurls: true,
@ -166,7 +185,7 @@ class Paperreview extends Component {
}
}).catch((error) => {
////console.log(error)
//////console.log(error)
this.setState({
booljupyterurls: false,
})
@ -192,43 +211,51 @@ class Paperreview extends Component {
}
preservation = () => {
//保存试卷
if(this.state.Cohetepaperbool===true){
if (this.contentMdRef.Getdatas().length === 0) {
this.scrollToAnchor("Itembankstopid");
return;
}
var myrbkc=[];
var Getdatasdatas=this.contentMdRef.Getdatas()[2].rbzsd;
for(let myda of Getdatasdatas) {
myrbkc.push(myda.id);
}
const url = `/examination_banks.json`;
var data={
difficulty:this.contentMdRef.Getdatas()[0].rbnd,
name:this.contentMdRef.Getdatas()[4].classroom,
duration:this.contentMdRef.Getdatas()[5].kssc,
discipline_id: this.contentMdRef.Getdatas()[3].rbkc[0],
sub_discipline_id: this.contentMdRef.Getdatas()[3].rbkc[1],
tag_discipline_id: myrbkc,
if(this.state.artificialtype==="artificial"){
if(this.state.Cohetepaperbool===true){
if (this.contentMdRef.Getdatas().length === 0) {
this.scrollToAnchor("Itembankstopid");
return;
}
var myrbkc=[];
var Getdatasdatas=this.contentMdRef.Getdatas()[2].rbzsd;
for(let myda of Getdatasdatas) {
myrbkc.push(myda.id);
}
const url = `/examination_banks.json`;
var data={
difficulty:this.contentMdRef.Getdatas()[0].rbnd,
name:this.contentMdRef.Getdatas()[4].classroom,
duration:this.contentMdRef.Getdatas()[5].kssc,
discipline_id: this.contentMdRef.Getdatas()[3].rbkc[0],
sub_discipline_id: this.contentMdRef.Getdatas()[3].rbkc[1],
tag_discipline_id: myrbkc,
}
axios.post(url, data)
.then((result) => {
if (result.data.status === 0) {
// this.props.showNotification(`组卷成功`);
this.props.history.replace('/paperlibrary');
}
}).catch((error) => {
//console.log(error);
})
}else{
this.setCohetepaperbool(true);
}
axios.post(url, data)
.then((result) => {
if (result.data.status === 0) {
this.props.showNotification(`组卷成功`);
this.props.history.replace('/paperlibrary');
}
}).catch((error) => {
console.log(error);
})
}else{
this.setCohetepaperbool(true);
//智能组卷
this.setIntelligentformation(true);
}
}
@ -245,14 +272,123 @@ class Paperreview extends Component {
getcontentMdRef = (Ref) => {
this.contentMdRef = Ref;
}
setnewmyshixunmodelbool=(bool)=>{
//人工组卷
if(bool===true){
let scrollToTop = window.setInterval(function() {
let pos = window.pageYOffset;
if ( pos > 0 ) {
window.scrollTo( 0, pos - 20 ); // how far to scroll on each step
} else {
window.clearInterval( scrollToTop );
}
}, 2);
}
this.setState({
newmyshixunmodelbool:bool
})
var data = {}
this.getdata(data);
}
//换题型
Replacementtype=(value)=>{
var item_types="";
if(value==="单选题"){
item_types="SINGLE";
}
else if(value==="多选题"){
item_types="MULTIPLE";
}
else if(value==="判断题"){
item_types="JUDGMENT";
}
else if(value==="编程题"){
item_types="PROGRAM";
}
const url=`/examination_intelligent_settings/${this.props.match.params.id}/exchange_items.json`;
let data={
item_type:item_types,
}
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
//console.log(result);
var data = {}
this.getdata(data);
}
}).catch((error) => {
//console.log(error);
})
}
//换题
Changingtopics=(id)=>{
const url=`/examination_intelligent_settings/${this.props.match.params.id}/exchange_one_item.json`;
let data={
item_id:id,
}
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
//console.log(result);
var data = {}
this.getdata(data);
}
}).catch((error) => {
//console.log(error);
})
}
setIntelligentformation=(bool)=>{
this.setState({
Intelligentformation:bool
})
}
Confirmationofvolumeformations=()=>{
this.setState({
Intelligentformation:false
})
}
render() {
let {page, limit, count, Headertop, visible, placement, modalsType, item_type,Cohetepaperbool} = 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;
// //console.log(params);
// ////console.log(params);
return (
<div>
<div id={"Itembankstopid"} className="newMain clearfix intermediatecenter "
>
{
Intelligentformation===true?
<IntelligentModel getdata={(data)=>this.getdata(data)} {...this.state} {...this.props} exam_id={this.props.match.params.id} Confirmationofvolumeformations={()=>this.Confirmationofvolumeformations()}></IntelligentModel>
:""
}
{
newmyshixunmodelbool===true?
<style>{
`
body{ overflow: hidden !important; }
`
}</style>
:""
}
{
newmyshixunmodelbool===true?
<div className="fangdatwo">
<NewMyShixunModel {...this.props} {...this.state} exam_id={this.props.match.params.id} setnewmyshixunmodelbool={(e)=>this.setnewmyshixunmodelbool(e)}></NewMyShixunModel>
</div>
:
""
}
<style>
{
@ -268,11 +404,18 @@ class Paperreview extends Component {
<div className="w100s mt30">
{
Cohetepaperbool===false?
<Breadcrumb separator=">">
<Breadcrumb.Item href="/question">试题库</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshou"}>人工组卷</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshout"}>试卷预览</Breadcrumb.Item>
</Breadcrumb>
artificialtype==="artificial"?
<Breadcrumb separator=">">
<Breadcrumb.Item href="/question">试题库</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshou"}>人工组卷</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshout"}>试卷预览</Breadcrumb.Item>
</Breadcrumb>
:
<Breadcrumb separator=">">
<Breadcrumb.Item href="/paperlibrary">试卷库</Breadcrumb.Item>
<Breadcrumb.Item className={"/Integeneration"}>智能组卷</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshout"}>试卷预览</Breadcrumb.Item>
</Breadcrumb>
:
<Breadcrumb separator=">">
<Breadcrumb.Item href="/question">试题库</Breadcrumb.Item>
@ -284,7 +427,7 @@ class Paperreview extends Component {
{
Cohetepaperbool===false?
<Paperreview_item {...this.state} {...this.props} getdata={(data)=>this.getdata(data)}>
<Paperreview_item {...this.state} {...this.props} Changingtopics={(e)=>this.Changingtopics(e)} Replacementtype={(e)=>this.Replacementtype(e)} getdata={(data)=>this.getdata(data)} setnewmyshixunmodelbool={(e)=>this.setnewmyshixunmodelbool(e)}>
</Paperreview_item>
:

@ -91,11 +91,11 @@ class Paperreview_item extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata({});
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -110,11 +110,11 @@ class Paperreview_item extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata({});
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
@ -131,11 +131,11 @@ class Paperreview_item extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata({});
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -151,11 +151,11 @@ class Paperreview_item extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata({});
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -185,12 +185,12 @@ class Paperreview_item extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`调分成功`);
// this.props.showNotification(`调分成功`);
this.props.getdata({});
this.Singlemagazine("", false);
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -202,12 +202,12 @@ class Paperreview_item extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`调分成功`);
// this.props.showNotification(`调分成功`);
this.props.getdata({});
this.Singlemagazines(false);
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -247,7 +247,7 @@ class Paperreview_item extends Component {
})
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification('大题删除成功');
// this.props.showNotification('大题删除成功');
this.props.getdata({});
this.setState({
titilesms: ""
@ -255,7 +255,7 @@ class Paperreview_item extends Component {
}
})
.catch(function (error) {
//console.log(error);
////console.log(error);
});
@ -275,7 +275,7 @@ class Paperreview_item extends Component {
axios.delete((url))
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification('试题删除成功');
// this.props.showNotification('试题删除成功');
this.props.getdata({});
}
})
@ -299,7 +299,7 @@ class Paperreview_item extends Component {
}
hideparagraph = (name) => {
console.log("hideparagraph");
//console.log("hideparagraph");
}
@ -312,7 +312,7 @@ class Paperreview_item extends Component {
})
}
showparagraph = (name) => {
console.log("showparagraph");
//console.log("showparagraph");
if (name === "SINGLE") {
this.setState({
singlebool: true,
@ -364,8 +364,8 @@ class Paperreview_item extends Component {
}
showparagraphs = (e,name) => {
// console.log("showparagraphs");
// console.log(e);
// //console.log("showparagraphs");
// //console.log(e);
this.setState({
paperreviewsingleindex: e,
paperreviewsinglename:name,
@ -426,13 +426,19 @@ class Paperreview_item extends Component {
}}>
<div className="w100s sortinxdirection">
<div className="w70s sortinxdirection">
<p className="questionstishu lh34">题数{this.props.all_score}</p>
<p className="ml58 questionstotal lh34">总分{this.props.all_questions_count}</p>
<p className="questionstishu lh34">题数{this.props.all_questions_count}</p>
<p className="ml58 questionstotal lh34">总分{this.props.all_score}</p>
</div>
<div className="w30s xaxisreverseorder">
<div className="jixuxuanti xiaoshou" onClick={() => this.jixuxuantioncli()}>
继续选题
</div>
{
this.props.match.params.type==="artificial"?
<div className="jixuxuanti xiaoshou" onClick={() => this.props.setnewmyshixunmodelbool(true)}>
继续选题
</div>
:
""
}
</div>
</div>
<div className="questiontypeheng w100s mt19 mb19"></div>
@ -460,6 +466,12 @@ class Paperreview_item extends Component {
singlebool === true ?
<div className="postitonrelatiss xaxisreverseorder">
<div className="scd xiaoshou" onClick={() => this.setmodalsTypedel(true, 1, "SINGLE")}>删除</div>
{
this.props.match.params.type==="Intelligence"?
<div className="szdfds xiaoshou" onClick={() => this.props.Replacementtype("单选题")}>换题型</div>
:
""
}
<div className="szdfd xiaoshou" onClick={() => this.Singlemagazine("单选题", true)}>批量设置得分</div>
</div> : ""
}
@ -490,6 +502,9 @@ class Paperreview_item extends Component {
>
<Paperreview_items
{...this.state}
{...this.props}
Changingtopics={(e)=>this.props.Changingtopics(e)}
key={index}
paperreviewsingleindex={this.state.paperreviewsingleindex}
paperreviewsinglename={this.state.paperreviewsinglename}
@ -547,6 +562,12 @@ class Paperreview_item extends Component {
<div className="postitonrelatisss xaxisreverseorder ">
<div className="scd xiaoshou" onClick={() => this.setmodalsTypedel(true, 1, "MULTIPLE")}>删除
</div>
{
this.props.match.params.type==="Intelligence"?
<div className="szdfds xiaoshou" onClick={() => this.props.Replacementtype("多选题")}>换题型</div>
:
""
}
<div className="szdfd xiaoshou" onClick={() => this.Singlemagazine("多选题", true)}>批量设置得分</div>
</div>
@ -582,6 +603,9 @@ class Paperreview_item extends Component {
<Paperreview_items
{...this.state}
{...this.props}
Changingtopics={(e)=>this.props.Changingtopics(e)}
key={index}
paperreviewsingleindex={this.state.paperreviewsingleindex}
paperreviewsinglename={this.state.paperreviewsinglename}
@ -637,6 +661,12 @@ class Paperreview_item extends Component {
<div className="postitonrelatiss xaxisreverseorder">
<div className="scd xiaoshou" onClick={() => this.setmodalsTypedel(true, 1, "JUDGMENT")}>删除
</div>
{
this.props.match.params.type==="Intelligence"?
<div className="szdfds xiaoshou" onClick={() => this.props.Replacementtype("判断题")}>换题型</div>
:
""
}
<div className="szdfd xiaoshou" onClick={() => this.Singlemagazine("判断题", true)}>批量设置得分</div>
</div>
: ""}
@ -669,6 +699,9 @@ class Paperreview_item extends Component {
<Paperreview_items
{...this.state}
{...this.props}
Changingtopics={(e)=>this.props.Changingtopics(e)}
key={index}
paperreviewsingleindex={this.state.paperreviewsingleindex}
paperreviewsinglename={this.state.paperreviewsinglename}
@ -728,6 +761,12 @@ class Paperreview_item extends Component {
programbool === true ?
<div className="postitonrelatiss xaxisreverseorder">
<div className="scd xiaoshou" onClick={() => this.setmodalsTypedel(true, 1, "PROGRAM")}>删除</div>
{
this.props.match.params.type==="Intelligence"?
<div className="szdfds xiaoshou" onClick={() => this.props.Replacementtype("编程题")}>换题型</div>
:
""
}
<div className="szdfd xiaoshou" onClick={() => this.Singlemagazine("编程题", true)}>批量设置得分</div>
</div>
: ""
@ -761,6 +800,9 @@ class Paperreview_item extends Component {
<Paperreview_items
{...this.state}
{...this.props}
Changingtopics={(e)=>this.props.Changingtopics(e)}
key={index}
paperreviewsingleindex={this.state.paperreviewsingleindex}
paperreviewsinglename={this.state.paperreviewsinglename}

@ -58,15 +58,21 @@ class Paperreview_items extends Component {
render() {
let {paperreviewsingleindex,paperreviewsinglename,typenames,indexs,object,typenamesn}=this.props;
// console.log(object);
console.log("Paperreview_items");
console.log(object.item_id);
// //console.log(object);
// //console.log("Paperreview_items");
// //console.log(object.item_id);
return (
<div>
{
paperreviewsingleindex===indexs&&paperreviewsinglename===typenames?
<div className="xaxisreverseorder mt25 mr2">
<div className="scd xiaoshou" onClick={()=>this.props.showsetmodalsTypedels(object.item_id,true,1)}>删除</div>
{
this.props.match.params.type==="Intelligence"?
<div className="szdfds xiaoshou" onClick={() =>this.props.Changingtopics(object.item_id)}>换题</div>
:
""
}
<div className="szdfd xiaoshou" onClick={()=>this.props.Singlemagazines(true,object.id,typenamesn)}>设置得分</div>
</div>
: <div className="xaxisreverseorder mt25 ">

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

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

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

@ -17,6 +17,7 @@ import Itembankstop from "./component/Itembankstop";
import NoneData from './component/NoneData';
import './questioncss/questioncom.css';
import '../tpm/newshixuns/css/Newshixuns.css';
import QuillForEditor from "../../common/quillForEditor";
const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
@ -69,13 +70,54 @@ class Paperreview_single extends Component {
render() {
let {questions, totalscore, total, items} = this.state;
let {objectsingle, indexx, paperreviewsingleindex, indexxy,name} = this.props;
var itemssname="";
try {
itemssname= JSON.parse(objectsingle.name);
}catch (e) {
itemssname=objectsingle.name;
}
if(itemssname===undefined){
itemssname=objectsingle.name
}
var itemsnamesy="";
try {
itemsnamesy= JSON.parse(objectsingle&&objectsingle.program_attr&&objectsingle.program_attr.description);
}catch (e) {
itemsnamesy=objectsingle&&objectsingle.program_attr&&objectsingle.program_attr.description;
}
return (
<div key={indexxy}
className={ "w100s borderwdswuh mb20 pd20 "}
onMouseEnter={() => this.props.showparagraphs(indexxy,name)} style={{
minHeight: "114px",
}}>
<style>{
`
.programquill .ql-editor{
padding-left: 0px !important;
padding-top: 0px !important;
}
.programquill .ql-editor p{
line-height: 28px;
}
.programquills .ql-editor{
padding-left: 0px !important;
padding-top: 0px !important;
}
.programquills .ql-editor p{
line-height: 20px;
}
`
}</style>
{/*顶部*/}
<div className="w100s sortinxdirection ">
<div className=" sortinxdirection ">
@ -99,9 +141,39 @@ class Paperreview_single extends Component {
`
}
</style>
<div className=" lh28 listjihetixingstit markdown-body cretitlecolrlist" style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML(`${objectsingle.score}分) ` + objectsingle.name).replace(/▁/g, "▁▁▁")}}>
</div>
{
objectsingle.item_type==="PROGRAM"?
<div className="w100s sortinxdirection">
<div className=" tites lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{wordBreak: "break-word",
minWidth:"32px"
}}
>
({objectsingle.score})
</div>
<div className="ml10 lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML(objectsingle.name).replace(/▁/g, "▁▁▁")}}>
</div>
</div>
:
<div className="w100s sortinxdirection">
<div className="tites lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{wordBreak: "break-word",
minWidth:"32px"
}}
>
({objectsingle.score})
</div>
<div className="ml10 lh28 listjihetixingstit cretitlecolrlist programquill" style={{wordBreak: "break-word"}}
>
<QuillForEditor
readOnly={true}
value={itemssname}
/>
</div>
</div>
}
</div>
{/*内容*/}
<div className="w100s sortinxdirection">
@ -114,7 +186,7 @@ class Paperreview_single extends Component {
objectsingle === undefined || objectsingle === null ? "" : objectsingle.choices.map((object, index) => {
return (
<p className={index === 1 ? "sortinxdirection ml10" : "sortinxdirection "}>
<Radio checked={object.is_answer}>
<Radio disabled={true}>
{object.choice_text}
</Radio>
</p>
@ -126,19 +198,48 @@ class Paperreview_single extends Component {
objectsingle.item_type === "PROGRAM" ?
<p className="w100s listjihetixingstitssy sortinxdirection ">
<p className={"sortinxdirection mt15"}>
<p style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML(objectsingle.program_attr.description).replace(/▁/g, "▁▁▁")}}></p>
{
objectsingle&&objectsingle.program_attr&&objectsingle.program_attr.description?
<p className="programquill" style={{wordBreak: "break-word"}}
>
<QuillForEditor
readOnly={true}
value={itemsnamesy}
/>
</p>
:
""}
</p>
</p>
:
<p className="w100s listjihetixingstits verticallayout ">
{
objectsingle === undefined || objectsingle === null ? "" : objectsingle.choices.map((object, index) => {
var string=""
try {
string=JSON.parse(object.choice_text);
}catch (e) {
string=object.choice_text;
}
return (
<p className={index === 0 ? "sortinxdirection" : "sortinxdirection mt15"}>
<p key={index} className={index === 0 ? "sortinxdirection" : "sortinxdirection mt15"}>
{tagArray[index]}
<p style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML(object.choice_text).replace(/▁/g, "▁▁▁")}}></p>
<p className="programquills" style={{wordBreak: "break-word"}}>
{object ?
object.choice_text === undefined || object.choice_text=== null || object.choice_text === "" ?
""
:
object.choice_text.length>0?
<QuillForEditor
readOnly={true}
value={string}
/>
:""
:
""
}
</p>
</p>
)
})

@ -11,6 +11,7 @@ import {
Input,
Tooltip
} from "antd";
import {parabola} from './animation/parabola'
import Headplugselections from "./component/Headplugselections";
import QuestionModal from "./component/QuestionModal";
import QuestionModals from "./component/QuestionModals";
@ -25,14 +26,14 @@ class Question extends Component {
super(props);
this.state = {
count: 50,
defaultActiveKey:"0",
defaultActiveKey:"1",
Headertop: "",
Footerdown: "",
visible: false,
placement: 'right',
modalsType: false,
modalsTypes:false,
titilesm: "设为公开后,所有成员均可使用试题",
titilesm: "在平台审核后,所有成员均可使用试题",
titiless: "是否设置为公开?",
titilesms:"单选题",
titbool: false,
@ -63,9 +64,29 @@ class Question extends Component {
disciplinesdatazsd:0,
selectallquestionsonthispages:false,
oj_status:null,
isVisible: false,
selectionbools:false,
chakanjiexiboolindex:"无",
}
}
chakanjiexibool=(index)=>{
if(this.state.chakanjiexiboolindex===index){
this.setState({
chakanjiexiboolindex:"无",
})
return
}
this.setState({
chakanjiexiboolindex:index,
})
}
setmychakanjiexibool=(str)=>{
this.setState({
chakanjiexiboolindex:str,
})
}
setdiscipline_id=(discipline_id)=>{
this.setState({
discipline_id:discipline_id,
@ -92,7 +113,7 @@ class Question extends Component {
}
setsub_discipline_id=(sub_discipline_id)=>{
setsub_discipline_id=(discipline_id,sub_discipline_id)=>{
this.setState({
sub_discipline_id:sub_discipline_id,
tag_discipline_id:null,
@ -102,7 +123,7 @@ class Question extends Component {
oj_status:null
})
var data = {
discipline_id:this.state.discipline_id,
discipline_id:discipline_id,
sub_discipline_id:sub_discipline_id,
tag_discipline_id:null,
public: this.state.defaultActiveKey,
@ -141,21 +162,8 @@ class Question extends Component {
//初始化
componentDidMount() {
let {defaultActiveKey} = this.state;
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: defaultActiveKey,
page:1,
per_page:10,
};
this.getdata(data);
let url = `/users/get_navigation_info.json`;
axios.get(url, {}).then((response) => {
// ////console.log("开始请求/get_navigation_info.json");
// ////console.log(response);
if (response != undefined) {
if (response.status === 200) {
this.setState({
@ -165,16 +173,14 @@ class Question extends Component {
}
}
});
this.getbasket_listdata();
//获取题库筛选资料
let urls = `/disciplines.json`;
axios.get(urls, {params: {
source:"question"
}}).then((response) => {
console.log("Questiondisciplines");
console.log(response.data);
//console.log("Questiondisciplines");
//console.log(response.data);
if (response) {
this.setState({
disciplinesdata: response.data.disciplines,
@ -206,10 +212,12 @@ class Question extends Component {
}
//刷新加载
getdata = (data) => {
const url = `/item_banks.json`;
this.setState({
booljupyterurls:true,
selectionbools:false,
})
axios.get((url), {params: data}).then((response) => {
setTimeout(()=>{
@ -226,20 +234,96 @@ class Question extends Component {
} else {
}
////console.log("item_banks");
////console.log(response);
//////console.log("item_banks");
//////console.log(response);
this.setState({
Contentdata: response.data,
items_count: response.data.items_count,
})
this.getdataslen(response.data.items);
}).catch((error) => {
////console.log(error)
//////console.log(error)
this.setState({
booljupyterurls:false,
})
});
}
//不刷新加载
getdatasy = (data) => {
const url = `/item_banks.json`;
this.setState({
selectionbools:false,
})
axios.get((url), {params: data}).then((response) => {
setTimeout(()=>{
},1000);
if (response === null || response === undefined) {
return
}
if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
} else {
}
//////console.log("item_banks");
//////console.log(response);
this.setState({
Contentdata: response.data,
items_count: response.data.items_count,
})
this.getdataslen(response.data.items);
}).catch((error) => {
});
}
//计算
getdataslen=(arr)=>{
var contes=0;
for(let data of arr) {
if(data.item_type==="PROGRAM"){
//编程题
if(data.choosed===true){
}else{
//未选用
if(data.program_attr.status===1){
//已发布
contes=contes+1;
}
}
}else{
//不是编程题
if(data.choosed===true){
}else{
//未选用
contes=contes+1;
}
}
}
if(contes>0){
this.setState({
selectionbools:false,
selectallquestionsonthispages:false,
})
}else {
this.setState({
selectionbools:true,
selectallquestionsonthispages:true,
})
}
}
paginationonChange = (pageNumber) => {
this.setState({
page: pageNumber,
@ -257,6 +341,8 @@ class Question extends Component {
oj_status:this.state.oj_status
};
this.getdata(data);
this.setmychakanjiexibool("无")
}
showDrawer = () => {
if(this.state.visible===true){
@ -297,7 +383,7 @@ class Question extends Component {
this.setState({
modalsType: true,
titilesm: "设为公开后,所有成员均可使用试题",
titilesm: "在平台审核后,所有成员均可使用试题",
titiless: "是否设置为公开?",
titbool: true,
timuid: id
@ -435,19 +521,6 @@ class Question extends Component {
this.setState({
keywords: e.target.value
})
// var data = {
// discipline_id:this.state.discipline_id,
// sub_discipline_id:this.state.sub_discipline_id,
// tag_discipline_id:this.state.tag_discipline_id,
// public: this.state.defaultActiveKey,
// difficulty: this.state.difficulty,
// item_type: this.state.item_type,
// keywords: e.target.value,
// page: this.state.page,
// per_page:10,
// };
//
// this.getdata(data);
}
setdatafuns = (value) => {
@ -476,7 +549,7 @@ class Question extends Component {
axios.delete(url)
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification('删除试题成功')
// this.props.showNotification('删除试题成功')
// props.history.push(response.data.right_url)
var data = {
discipline_id:this.state.discipline_id,
@ -493,7 +566,7 @@ class Question extends Component {
}
})
.catch(function (error) {
//console.log(error);
////console.log(error);
});
}
publicopentimu = (id) => {
@ -502,7 +575,7 @@ class Question extends Component {
axios.post(url)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`公开题目成功`);
// this.props.showNotification(`公开题目成功`);
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
@ -517,7 +590,7 @@ class Question extends Component {
this.getdata(data);
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
}
@ -526,8 +599,8 @@ class Question extends Component {
const url = "/item_baskets/basket_list.json";
axios.get(url)
.then((result) => {
// //console.log("getbasket_listdata");
// //console.log(result.data);
// ////console.log("getbasket_listdata");
// ////console.log(result.data);
this.setState({
completion_questions_count: result.data.completion_questions_count,
judgement_questions_count: result.data.judgement_questions_count,
@ -539,7 +612,7 @@ class Question extends Component {
})
}).catch((error) => {
// //console.log(error);
// ////console.log(error);
this.setState({
completion_questions_count: 0,
judgement_questions_count: 0,
@ -562,7 +635,7 @@ class Question extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`选用成功`);
// this.props.showNotification(`选用成功`);
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
@ -574,14 +647,14 @@ class Question extends Component {
page: this.state.page,
per_page:10,
};
this.getdata(data);
this.getdatasy(data);
this.getbasket_listdata();
this.setState({
visible:true
})
// this.setState({
// visible:true
// })
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
}
// 撤销
@ -592,7 +665,7 @@ class Question extends Component {
axios.delete(url)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`撤销成功`);
// this.props.showNotification(`撤销成功`);
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
@ -604,11 +677,11 @@ class Question extends Component {
page: this.state.page,
per_page:10,
};
this.getdata(data);
this.getdatasy(data);
this.getbasket_listdata();
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
}
//全选试题库
@ -617,7 +690,29 @@ class Question extends Component {
var arr= this.state.Contentdata.items;
for(let data of arr) {
item_idsdata.push(data.id);
if(data.item_type==="PROGRAM"){
//编程题
if(data.choosed===true){
}else{
//未选用
if(data.program_attr.status===1){
//已发布
item_idsdata.push(data.id);
}
}
}else{
//不是编程题
if(data.choosed===true){
}else{
//未选用
item_idsdata.push(data.id);
}
}
}
const data={
item_ids:item_idsdata
@ -638,7 +733,7 @@ class Question extends Component {
}})
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification('删除成功');
// this.props.showNotification('删除成功');
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
@ -655,7 +750,7 @@ class Question extends Component {
}
})
.catch(function (error) {
//console.log(error);
////console.log(error);
});
}
@ -664,7 +759,7 @@ class Question extends Component {
//跳转
gotopaperreview=()=>{
this.props.history.replace("/paperreview");
this.props.history.replace("/paperreview/artificial");
}
@ -689,11 +784,15 @@ class Question extends Component {
};
this.getdata(data);
}
render() {
let {
page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes,basket_list,
completion_questions_count, judgement_questions_count, multiple_questions_count, practical_questions_count,
program_questions_count, single_questions_count, subjective_questions_count
program_questions_count, single_questions_count, subjective_questions_count,selectionbools
} = this.state;
const Datacount = completion_questions_count + judgement_questions_count
@ -701,8 +800,13 @@ class Question extends Component {
+ program_questions_count
+ single_questions_count
+ subjective_questions_count;
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
return (
<div className="newMain clearfix" ref={this.saveContainer}>
<div className="newMain clearfix" ref={this.saveContainer}>
{
visible===true?
<style>
@ -760,27 +864,52 @@ class Question extends Component {
`
}
</style>
<SiderBars
myvisible={visible}
{...this.props}
{...this.state}
showDrawer={() => this.showDrawer()}
Headertop={Headertop}/>
{
isysladmins===true?
<SiderBars
Datacount={Datacount}
myvisible={visible}
{...this.props}
{...this.state}
showDrawer={() => this.showDrawer()}
Headertop={Headertop}
/>
:
is_teacher===true&&professional_certification===true?
<SiderBars
Datacount={Datacount}
myvisible={visible}
{...this.props}
{...this.state}
showDrawer={() => this.showDrawer()}
Headertop={Headertop}
/>
:
""
}
{/*顶部*/}
<Headplugselections
disciplinesdata={this.state.disciplinesdata}
{...this.props}
{...this.state}
setdifficulty={(e) => this.setdifficulty(e)}
setitem_types={(e) => this.setitem_types(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)}
/>
{/*头部*/}
<Contentpart {...this.state} {...this.props}
Isitapopup={"false"}
chakanjiexiboolindex={this.state.chakanjiexiboolindex}
chakanjiexibool={(e)=>this.chakanjiexibool(e)}
getitem_basketss={(id)=>this.getitem_basketss(id)}
selectallquestionsonthispage={()=>this.selectallquestionsonthispage()}
getitem_baskets={(e)=>this.getitem_baskets(e)}
@ -957,12 +1086,3 @@ class Question extends Component {
}
export default SnackbarHOC()(TPMIndexHOC(Question));
{/*<Drawer*/}
{/* className="drawercontainer"*/}
{/* placement={placement}*/}
{/* closable={false}*/}
{/* onClose={() => this.onClose()}*/}
{/* visible={visible}*/}
{/* mask={false}*/}
{/* closable={true}*/}
{/*>*/}

@ -52,8 +52,8 @@ class Questionitem_banks extends Component {
// axios.get(url, {
//
// }).then((response) => {
// // //////console.log("开始请求/get_navigation_info.json");
// // //////console.log(response);
// // ////////console.log("开始请求/get_navigation_info.json");
// // ////////console.log(response);
// if(response!=undefined){
// if(response.status===200){
// this.setState({
@ -80,15 +80,15 @@ class Questionitem_banks extends Component {
} else {
}
//////console.log("item_banks");
//console.log("Questionitem_banks");
//console.log(response.data);
////////console.log("item_banks");
////console.log("Questionitem_banks");
////console.log(response.data);
this.setState({
item_banksedit: response.data,
})
}).catch((error) => {
//////console.log(error)
////////console.log(error)
});
@ -173,10 +173,10 @@ class Questionitem_banks extends Component {
// }else{
//
// }
// //////console.log("item_banks");
// //////console.log(response);
// ////////console.log("item_banks");
// ////////console.log(response);
// }).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.answerMdRef != null) {
//单选题
// //console.log(this.answerMdRef.onSave());
// ////console.log(this.answerMdRef.onSave());
if (this.answerMdRef.onSave().length === 0) {
return;
@ -282,24 +282,24 @@ class Questionitem_banks extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`新增单选题成功`);
// this.props.showNotification(`新增单选题成功`);
this.props.history.replace('/question');
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
} else {
axios.put(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`编辑单选题成功`);
// this.props.showNotification(`编辑单选题成功`);
this.props.history.replace('/question');
}
}).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.Choques != null) {
//多选题
// //console.log(this.Choques.onSave());
// ////console.log(this.Choques.onSave());
if (this.Choques.onSave().length === 0) {
return;
}
@ -319,8 +319,8 @@ class Questionitem_banks extends Component {
const choices = [];
// 1: [3]
// 2: (4) ["1", "2", "3", "4"]
//console.log("MULTIPLE");
//console.log(anserdata);
////console.log("MULTIPLE");
////console.log(anserdata);
for (var k = 0; k < anserdata[2].length; k++) {
var bool = false
@ -360,26 +360,26 @@ class Questionitem_banks extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`新增多选题成功`);
// this.props.showNotification(`新增多选题成功`);
this.props.history.replace('/question');
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
} else {
axios.put(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`编辑多选题成功`);
// this.props.showNotification(`编辑多选题成功`);
this.props.history.replace('/question');
}
}).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.Judquestio != null) {
//判断题
// //console.log(this.Judquestio.onSave());
// ////console.log(this.Judquestio.onSave());
if (this.Judquestio.onSave().length === 0) {
return;
}
@ -427,24 +427,24 @@ class Questionitem_banks extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`新增判断题成功`);
// this.props.showNotification(`新增判断题成功`);
this.props.history.replace('/question');
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
} else {
axios.put(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`编辑判断题成功`);
// this.props.showNotification(`编辑判断题成功`);
this.props.history.replace('/question');
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
}
@ -476,13 +476,13 @@ class Questionitem_banks extends Component {
this.setState({
item_type: item_type
})
this.scrollToAnchor("Itembankstopid");
}
render() {
let {page, limit, count, Headertop, visible, placement, modalsType, item_type} = this.state;
const params = this.props && this.props.match && this.props.match.params;
// //console.log(params);
// ////console.log(params);
return (
<div>
<div id={"Itembankstopid"} className="newMain clearfix intermediatecenter "
@ -515,6 +515,7 @@ class Questionitem_banks extends Component {
>
</Itembankstop>
<div >
{
item_type && item_type === "SINGLE" ?
@ -555,9 +556,8 @@ class Questionitem_banks extends Component {
: item_type && item_type === "PROGRAM" ?
""
: ""
}
}
</div>
</div>

@ -0,0 +1,51 @@
/**
* 抛物线动画函数
* @param ballWrapper 小球的父容器
* @param origin 动画起点DOM
* @param target 动画目标DOM
* @param time 持续时间
* @param a 抛物线参数
* @param offset 动画尺寸
* @param callback 回调
*/
export function parabola(config) {
const {
ballWrapper,
origin,
target,
time = 1000,
a = 0.004,
callback,
finish,
offset = 0
} =
config || {};
const ballWrapperDimension = ballWrapper.getBoundingClientRect();
const originDimension = origin.getBoundingClientRect();
const targetDimension = target.getBoundingClientRect();
const x1 = originDimension.left + 0.5 * originDimension.width;
const y1 = originDimension.top + 0.5 * originDimension.height;
const x2 = targetDimension.left + 0.5 * targetDimension.width;
const y2 = targetDimension.top + 0.5 * targetDimension.height;
const diffx = x2 - x1;
const diffy = y2 - y1;
const speedx = diffx / time;
const b = (diffy - a * diffx * diffx) / diffx;
const refPoint_x = x1 - ballWrapperDimension.left - 0.5 * offset;
const refPoint_y = y1 - ballWrapperDimension.top - 0.5 * offset;
const start = Date.now();
const timer = setInterval(() => {
if (Date.now() - start > time) {
finish();
clearInterval(timer);
return;
}
const x = speedx * (Date.now() - start);
const y = a * x * x + b * x;
callback && callback(refPoint_x + x, refPoint_y + y);
}, 15);
}

@ -10,6 +10,7 @@ import axios from 'axios'
import update from 'immutability-helper'
import './../questioncss/questioncom.css';
import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder';
import QuillForEditor from '../../../common/quillForEditor';
const { TextArea } = Input;
const confirm = Modal.confirm;
const $ = window.$
@ -70,18 +71,21 @@ class ChoquesEditor extends Component{
this.state = {
question_choices: _question_choices || ['', '', '', ''],
standard_answers: _standard_answers || [false, false, false, false],
question_title: this.props.question_title || '',
question_title: this.props.question_title!==undefined?JSON.parse(this.props.question_title):"",
question_type: this.props.question_type || 0,
question_score: this.props.question_score || this.props.init_question_score,
question_titles:this.props.question_titles||'',
question_titles: this.props.question_titles!==undefined?JSON.parse(this.props.question_titles):"",
question_titlesysl:this.props.question_titlesysl||'',
question_titleysl:this.props.question_title || '',
item_banksedit:[],
}
}
addOption = () => {
const { question_choices, standard_answers } = this.state;
// ////console.log("addOption");
// ////console.log(question_choices);
// ////console.log(standard_answers);
// //////console.log("addOption");
// //////console.log(question_choices);
// //////console.log(standard_answers);
question_choices.push('')
@ -91,8 +95,8 @@ class ChoquesEditor extends Component{
deleteOption = (index) => {
let {question_choices}=this.state;
// ////console.log("deleteOption");
// ////console.log(question_choices);
// //////console.log("deleteOption");
// //////console.log(question_choices);
if(question_choices[index]===""){
// repeat code
@ -122,38 +126,33 @@ class ChoquesEditor extends Component{
}
onSave = () => {
var editordata=[];
const {question_title, question_score, question_type,question_titles, question_choices, standard_answers } = this.state;
const {question_title, question_score,question_titleysl,question_titlesysl, question_type,question_titles, question_choices, standard_answers } = this.state;
const { question_id_to_insert_after, question_id } = this.props
// TODO check
const answerArray = standard_answers.map((item, index) => { return item == true ? index+1 : -1 }).filter(item => item != -1);
if(!question_title) {
this.refs['titleEditor'].showError()
if(!question_titleysl) {
this.props.showNotification('请您输入题干');
return editordata;
}
if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项');
return editordata;
}
if(!answerArray || answerArray.length < 2) {
this.props.showNotification('多选题最小正确选项为2个');
return editordata;
}
for(let i = 0; i < question_choices.length; i++) {
if (!question_choices[i]) {
this.refs[`optionEditor${i}`].showError()
this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`);
return editordata;
}
}
if(!question_titles) {
this.refs['titleEditor2'].showError()
this.props.showNotification('请您输入题目解析');
if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项');
return editordata;
}
if(!answerArray || answerArray.length < 2) {
this.props.showNotification('多选题最小正确选项为2个');
return editordata;
}
// if(!question_titlesysl) {
// this.props.showNotification('请您输入题目解析');
// return editordata;
// }
/**
{
"question_title":"同学朋友间常用的沟通工具是什么?",
@ -162,7 +161,7 @@ class ChoquesEditor extends Component{
"question_choices":["a答案","b答案","c答案","d答案"],
"standard_answers":[1]
}*/
editordata=[question_title,answerArray,question_choices,question_titles];
editordata=[question_titleysl,answerArray,question_choices,question_titlesysl];
// question_title,
// question_type: answerArray.length > 1 ? 1 : 0,
// question_score,
@ -186,8 +185,10 @@ class ChoquesEditor extends Component{
try {
this.setState({
item_banksedit:this.props.item_banksedit,
question_title:this.props.item_banksedit.name,
question_titles:this.props.item_banksedit.analysis,
question_title: this.props.item_banksedit.name!==undefined?JSON.parse(this.props.item_banksedit.name):"",
question_titleysl:this.props.item_banksedit.name|| '',
question_titles: this.props.item_banksedit.analysis!==undefined?JSON.parse(this.props.item_banksedit.analysis):"",
question_titlesysl:this.props.item_banksedit.analysis||'',
mychoicess:this.props.item_banksedit.choices,
})
@ -198,15 +199,17 @@ class ChoquesEditor extends Component{
}
}
componentDidUpdate(prevProps) {
//console.log("componentDidUpdate");
// //console.log(prevProps);
// //console.log(this.props.item_banksedit);
////console.log("componentDidUpdate");
// ////console.log(prevProps);
// ////console.log(this.props.item_banksedit);
if(prevProps.item_banksedit !== this.props.item_banksedit) {
this.setState({
item_banksedit: this.props.item_banksedit,
question_title: this.props.item_banksedit.name,
question_titles: this.props.item_banksedit.analysis,
question_title: this.props.item_banksedit.name!==undefined?JSON.parse(this.props.item_banksedit.name):"",
question_titleysl:this.props.item_banksedit.name|| '',
question_titles: this.props.item_banksedit.analysis!==undefined?JSON.parse(this.props.item_banksedit.analysis):"",
question_titlesysl:this.props.item_banksedit.analysis||'',
mychoicess: this.props.item_banksedit.choices,
})
@ -217,15 +220,34 @@ class ChoquesEditor extends Component{
standard_answers[index] = !standard_answers[index]
this.setState({ standard_answers })
}
onOptionContentChange = (value, index) => {
onOptionContentChange = (value,quill,index) => {
if (index >= this.state.question_choices.length) {
// TODO 新建然后删除CD选项再输入题干会调用到这里且index是3
return;
}
var texts;
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
texts="";
} else {
if(_text.length>=301){
var result = _text.substring(0,300);
texts={"ops":[{"insert":result}]};
texts=JSON.stringify(texts);
}else {
// 提交到后台的内容需要处理一下;
value = JSON.stringify(value);
texts=value;
}
}
let question_choices = this.state.question_choices.slice(0);
question_choices[index] = value;
this.setState({ question_choices })
question_choices[index] = texts;
//console.log(question_choices);
this.setState({ question_choices });
}
on_question_score_change = (e) => {
this.setState({ question_score: e })
}
@ -241,6 +263,57 @@ class ChoquesEditor extends Component{
toShowMode = () => {
}
onContentChange=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titleysl:""
})
} else {
// 提交到后台的内容需要处理一下;
var texts="";
if(_text.length>=1001){
var result = _text.substring(0,1000);
texts={"ops":[{"insert":result}]};
texts=JSON.stringify(texts);
}else {
value = JSON.stringify(value)
texts=value;
}
this.setState({
question_titleysl:texts
})
}
}
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titlesysl:""
})
} else {
// 提交到后台的内容需要处理一下;
var texts="";
if(_text.length>=1001){
var result = _text.substring(0,1000);
texts={"ops":[{"insert":result}]};
texts=JSON.stringify(texts);
}else {
value = JSON.stringify(value)
texts=value;
}
this.setState({
question_titlesysl:texts
})
}
}
render() {
let { question_title, question_score, question_type, question_choices, standard_answers,question_titles} = this.state;
let { question_id, index, exerciseIsPublish,
@ -260,9 +333,9 @@ class ChoquesEditor extends Component{
// [true, false, true] -> [0, 2]
const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
// ////console.log("xuanzheshijuan");
// ////console.log(answerTagArray);
// ////console.log(!exerciseIsPublish);
// //////console.log("xuanzheshijuan");
// //////console.log(answerTagArray);
// //////console.log(!exerciseIsPublish);
return(
<div className="padding20-30 signleEditor duoxuano" id={qNumber}>
@ -271,7 +344,7 @@ class ChoquesEditor extends Component{
flex:1
}
.optionRow {
margin:0px!important;
/* margin:0px!important; */
/* margin-bottom: 20px!important; */
}
.signleEditor .content_editorMd_show{
@ -291,25 +364,30 @@ class ChoquesEditor extends Component{
<span className="xingtigan fl">题干</span>
</p>
<TPMMDEditor mdID={qNumber} placeholder="请您输入题干" height={155} className=" mt10"
initValue={question_title} onChange={(val) => this.setState({ question_title: val})}
ref="titleEditor"
<QuillForEditor
autoFocus={true}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '155px'}}
placeholder="请您输入题干"
options={['code-block', 'image', 'formula']}
value={question_title}
onContentChange={this.onContentChange}
></TPMMDEditor>
/>
<div className="mb10 sortinxdirection">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
</div>
{question_choices.map( (item, index) => {
const bg = standard_answers[index] ? 'check-option-bg' : ''
return <div className="df optionRow " >
return <div key={index} className={index>0?"df optionRow mt15": "df optionRow"} >
{/* 点击设置答案 */}
{/* TODO 加了tooltip后会丢失掉span的class */}
{/* <Tooltip title={standard_answers[index] ? '点击取消标准答案设置' : '点击设置为标准答案'}> */}
<span class={`option-item fr mr10 color-grey select-choice ${bg} `}
<span className={`option-item fr mr10 color-grey select-choice ${bg} `}
name="option_span" onClick={() => this.onOptionClick(index)} style={{flex: '0 0 38px'}}>
<ConditionToolTip title={standard_answers[index] ? '点击取消标准答案设置' : '点击设置为标准答案'} placement="left" condition={true}>
<div style={{width: '100%', height: '100%'}}>{tagArray[index]}</div>
@ -317,13 +395,30 @@ class ChoquesEditor extends Component{
</span>
{/* </Tooltip> */}
<div style={{ flex: '0 0 1038px'}}>
<DMDEditor
ref={`optionEditor${index}`}
toMDMode={this.toMDMode} toShowMode={this.toShowMode}
height={166} className={'optionMdEditor'} noStorage={true}
mdID={qNumber + index} placeholder="" onChange={(value) => this.onOptionContentChange(value, index)}
initValue={item}
></DMDEditor>
{
item===undefined||item===null||item===""?
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '166px'}}
placeholder="请您输入题干"
options={['code-block', 'image', 'formula']}
value={item}
onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)}
/>
:
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '166px'}}
placeholder="请您输入题干"
options={['code-block', 'image', 'formula']}
value={JSON.parse(item)}
onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)}
/>
}
</div>
{exerciseIsPublish || index<=2?
<i className=" font-18 ml15 mr20"></i>
@ -346,32 +441,21 @@ class ChoquesEditor extends Component{
<p className="mb10 clearfix">
<p className="mb10 mt10 clearfix">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingcolor font-16 fl mr4"></span>
<span className="xingtigan fl">题目解析</span>
</p>
<style>{`
.optionMdEditor {
flex:1
}
.optionRow {
margin:0px!important;
/* margin-bottom: 20px!important; */
}
.signleEditor .content_editorMd_show{
display: flex;
margin-top:0px!important;
border-radius:2px;
max-width: 1056px;
word-break:break-all;
}
`}</style>
<TPMMDEditor mdID={qNumber+question_choices.length} placeholder="请您输入题目解析" height={155} className=" mt10"
initValue={question_titles} onChange={(val) => this.setState({ question_titles: val})}
ref="titleEditor2"
></TPMMDEditor>
<div className="mt10"></div>
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{height: '166px' }}
placeholder="请您输入题目解析"
options={['code-block', 'image', 'formula']}
value={question_titles}
onContentChange={this.onContentChanges}
/>
</div>

@ -25,7 +25,6 @@ class Contentpart extends Component {
this.state = {
page:1,
chakanjiexibool:false,
chakanjiexiboolindex:"无",
}
}
//初始化
@ -35,21 +34,74 @@ class Contentpart extends Component {
}
chakanjiexibool=(index)=>{
debugger
if(this.state.chakanjiexiboolindex===index){
this.setState({
chakanjiexiboolindex:"无",
})
return
this.props.chakanjiexibool(index);
}
componentDidUpdate(prevProps) {
if(prevProps.current_user !== this.props.current_user) {
debugger
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
let {defaultActiveKey} = this.props;
var defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
defaultActiveKeys="1"
}
this.props.callback(defaultActiveKeys);
}
this.setState({
chakanjiexiboolindex:index,
})
}
xinzenw=(e)=>{
var urls="?";
if(this.props.discipline_id){
if(urls==="?"){
urls=urls+`discipline_id=${this.props.discipline_id}`
}else {
urls=urls+`&discipline_id=${this.props.discipline_id}`
}
}
if(this.props.sub_discipline_id){
if(urls==="?"){
urls=urls+`sub_discipline_id=${this.props.sub_discipline_id}`
}else {
urls=urls+`&sub_discipline_id=${this.props.sub_discipline_id}`
}
}
if(this.props.tag_discipline_id){
if(urls==="?"){
urls=urls+`sub_discipline_id=${this.props.tag_discipline_id}`
}else {
urls=urls+`&sub_discipline_id=${this.props.tag_discipline_id}`
}
}
if(this.props.difficulty){
if(urls==="?"){
urls=urls+`difficulty=${this.props.difficulty}&`
}else {
urls=urls+`&difficulty=${this.props.difficulty}`
}
}
if(this.props.item_type){
if(urls==="?"){
urls=urls+`item_type=${this.props.item_type}`
}else {
urls=urls+`&item_type=${this.props.item_type}`
}
}
this.props.history.push("/question/newitem"+urls);
}
render() {
let {page}=this.state;
let {defaultActiveKey}=this.props;
let {defaultActiveKey,item_type,booljupyterurls}=this.props;
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
const content = (
<div className="questiontypes" style={{
width:'93px',
@ -71,7 +123,7 @@ class Contentpart extends Component {
const contents = (
<div className="questiontypes" style={{
width:'93px',
height:'161px',
height:'120px',
}}>
<p className="questiontype " onClick={()=>this.props.setoj_status(null)}>全部</p>
<p className="questiontypeheng"></p>
@ -82,11 +134,12 @@ class Contentpart extends Component {
</div>
);
const buttonWidth = 70;
//console.log("Contentpart");
//console.log(this.props);
//console.log("Contentpart.js");
//console.log(this.props.defaultActiveKey);
return (
<div className=" clearfix mt40">
<div className=" clearfix mt25">
<div className="educontent mt10 pb20 w1200s">
<div className="w1200ms contentparttit" style={{
position: "relative",
@ -109,12 +162,23 @@ class Contentpart extends Component {
`
}
</style>
<Tabs defaultActiveKey={defaultActiveKey} onChange={(e)=>this.props.callback(e)}>
<TabPane tab="公共" key="1">
</TabPane>
<TabPane tab="我的" key="0">
</TabPane>
</Tabs>
{
isysladmins===true||(is_teacher===true&&professional_certification===true)?
<Tabs activeKey={defaultActiveKey} onChange={(e)=>this.props.callback(e)}>
<TabPane tab="公共" key="1">
</TabPane>
<TabPane tab="我的" key="0">
</TabPane>
</Tabs>
:
<Tabs activeKey={1} onChange={(e)=>this.props.callback(e)}>
<TabPane tab="公共" key="1">
</TabPane>
</Tabs>
}
<div className=" mt19" style={{
position:"absolute",
@ -132,7 +196,7 @@ class Contentpart extends Component {
}
.xaxisreverseorder .ant-input-lg {
height: 41px;}
height: 41px !important;}
.xaxisreverseorder .ant-popover{
top: 30px !important;
@ -149,15 +213,20 @@ class Contentpart extends Component {
<div className="xaxisreverseorder">
{
defaultActiveKey===0||defaultActiveKey==="0"?
<a href={'/question/newitem'}>
<div className="newbutoon">
<p className="newbutoontes" >新增</p>
</div>
</a>
isysladmins===true||(is_teacher===true&&professional_certification===true)?
this.props.Isitapopup&&this.props.Isitapopup==="true"?
""
:
<a onClick={(e)=>this.xinzenw(e)}>
<div className="newbutoon">
<p className="newbutoontes" >新增</p>
</div>
</a>
:""
:""
}
{
{item_type==="PROGRAM"?
defaultActiveKey===0||defaultActiveKey==="0"?
<Popover getPopupContainer={trigger => trigger.parentNode} placement="bottom" trigger="hover" content={contents} onVisibleChange={()=>this.props.handleVisibleChange(true)}>
<div className=" sortinxdirection mr30">
@ -169,26 +238,25 @@ class Contentpart extends Component {
</div>
</Popover>
:
""
"":""
}
{/*<Popover getPopupContainer={trigger => trigger.parentNode} placement="bottom" trigger="hover" content={content} onVisibleChange={()=>this.props.handleVisibleChanges(true)}>*/}
{/*<div className="sortinxdirection mr40">*/}
{/*<div className="subjecttit">*/}
{/* 题型*/}
{/*</div>*/}
{/* <i className="iconfont icon-sanjiaoxing-down font-12 lg ml7 icondowncolor"></i>*/}
{/*</div>*/}
{/*</Popover>*/}
{
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
style={{ width: "347px",marginRight:"30px"}}
style={isysladmins===true||(is_teacher===true&&professional_certification)?{ marginRight:"30px"}:{marginRight:"0px"}}
className={"xaxisreverseorder searchwidth"}
placeholder="请输入题目名称、内容"
enterButton
size="large"
@ -196,7 +264,7 @@ class Contentpart extends Component {
onSearch={ (value)=>this.props.setdatafuns(value)} />
:
<Search
style={{ width: "347px"}}
className={"xaxisreverseorder searchwidth"}
placeholder="请输入题目名称、内容"
enterButton
size="large"
@ -215,7 +283,7 @@ class Contentpart extends Component {
:
<div className=" w100s mb10">
{
defaultActiveKey===1||defaultActiveKey==="1"?
defaultActiveKey===1||defaultActiveKey==="1"?
<Contentquestionbank {...this.props} {...this.state} selectallquestionsonthispage={()=>this.props.selectallquestionsonthispage()} ></Contentquestionbank>
:""
}
@ -241,6 +309,8 @@ class Contentpart extends Component {
: this.props.Contentdata.items.map((object, index) => {
return (
<Listjihe {...this.state} {...this.props}
Isitapopup={this.props.Isitapopup}
chakanjiexiboolindex={this.props.chakanjiexiboolindex}
chakanjiexibool={(keindex)=>this.chakanjiexibool(keindex)}
listjihe={index+1}
keindex={index}

@ -20,9 +20,9 @@ class Contentquestionbank extends Component {
}
//初始化
componentDidMount(){
////console.log("componentDidMount");
////console.log(this.state);
////console.log(this.props);
//////console.log("componentDidMount");
//////console.log(this.state);
//////console.log(this.props);
// let homeworkid = this.props.match.params.homeworkid;
// let url = "/homework_commons/" + homeworkid + "/end_groups.json";
// axios.get(url).then((response) => {
@ -30,16 +30,17 @@ class Contentquestionbank extends Component {
// this.setState({})
// }
// }).catch((error) => {
// ////console.log(error)
// //////console.log(error)
// });
}
onChange=(e)=> {
////console.log(`checked = ${e.target.checked}`);
//////console.log(`checked = ${e.target.checked}`);
}
render() {
let {page}=this.state;
let {selectionbools}=this.props;
return (
@ -47,7 +48,13 @@ class Contentquestionbank extends Component {
<div className="educontent w100s">
<div className="sortinxdirection w100s" >
<div className="sortinxdirection w50s">
<Checkbox checked={this.props.selectallquestionsonthispages} onChange={()=>this.props.selectallquestionsonthispage()}></Checkbox>
{
selectionbools===true?
<Checkbox checked={this.props.selectallquestionsonthispages} onChange={()=>this.props.selectallquestionsonthispage()} disabled></Checkbox>
:
<Checkbox checked={this.props.selectallquestionsonthispages} onChange={()=>this.props.selectallquestionsonthispage()}></Checkbox>
}
<p className="setequesbank ml20">选用本页全部试题</p>
</div>
<div className="xaxisreverseorder testpaper w50s">

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

@ -48,10 +48,7 @@ class Headplugselections extends Component {
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)=>{
//如果全部其他的选项重置
this.setState({
@ -87,8 +84,8 @@ class Headplugselections extends Component {
//获取方向
shixunsearchAll = (id) => {
console.log("获取方向");
console.log(id);
//console.log("获取方向");
//console.log(id);
if(id!=undefined){
this.setState({
shixunsearchAllvalue:id,
@ -130,16 +127,16 @@ class Headplugselections extends Component {
}
getshixunchildValue = (id,ids) => {
console.log("getshixunchildValue");
console.log(id);
debugger
// //console.log("getshixunchildValue");
// //console.log(id);
// debugger
if(id!=undefined ||ids!=undefined){
this.setState({
shixunsearchAllvalue:ids
})
try {
this.props.setsub_discipline_id(id);
this.props.setsub_discipline_id(ids,id);
}catch (e) {
}
@ -153,7 +150,7 @@ class Headplugselections extends Component {
{
item&&item.map((list,k)=>{
return(
<Menu.Item >
<Menu.Item key={k}>
<div className="mt5 subshaicontent-part" key={k}>
<a style={{ height: '20px' }} className={ "mb15 shixun_repertoire color-dark intermediatecenterysls textcen "} name={list.id} id={list.id} onClick={()=>this.getshixunchildValue(list.id,id)}>{list.name}</a>
</div>

@ -0,0 +1,221 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import { Modal} from 'antd';
import axios from 'axios';
import {
notification,
Spin,
Table,
Pagination,
Radio,
Checkbox,
Form,
Input,
Select,
Cascader,
Col, Row, InputNumber, DatePicker, AutoComplete, Button, Tag,Icon
} from "antd";
import './../questioncss/questioncom.css';
const InputGroup = Input.Group;
const {Option} = Select;
//智能组卷化弹框
class IntelligentModel extends Component {
constructor(props) {
super(props);
this.state={
iconLoading:false,
}
}
handleSubmit=()=>{
}
handleSearch=(value)=>{
if(value!=""){
this.props.form.setFieldsValue({
classroom:value,
// course:value
});
// this.Searchvalue(value)
}
};
Confirmationofvolumeformation=()=>{
this.props.form.validateFields((err, values) => {
if (!err) {
this.setState({
iconLoading:true
})
const url=`/examination_intelligent_settings/${this.props.exam_id}/save_exam.json`;
let data={
name:values.classroom,
duration:values.kssc
}
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
//console.log(result);
this.props.history.push(`/paperlibrary`);
}
setTimeout(() => {
this.setState({
iconLoading:false
})
}, 1500)
}).catch((error) => {
setTimeout(() => {
this.setState({
iconLoading:false
})
}, 1500)
})
}
});
}
render() {
let {iconLoading}=this.state;
const {getFieldDecorator} = this.props.form;
const optionss = this.state.searchlist && this.state.searchlist.map(d => <Option key={d.name} value={d.name}>{d.name}</Option>);
var addonAfterthree=this.props.form&&this.props.form.getFieldValue('classroom');
var addonAfteronelens3=0;
if(addonAfterthree){
addonAfteronelens3=String(addonAfterthree).length;
}
return(
<Modal
keyboard={false}
closable={false}
footer={null}
destroyOnClose={true}
title=""
centered={true}
visible={this.props.Intelligentformation===undefined?false:this.props.Intelligentformation}
width="560px"
>
<div className=" mt10">
<Form onSubmit={this.handleSubmit}>
<style>
{
`
.ml19{
margin-left:19px;
}
`
}
</style>
<div className="stud-class-set ">
<style>{
`
.yslzxueshis .ant-input{
border-right: none !important;
height: 38px !important;
width: 100% !important;
}
.yslzxueshisy span .ant-input-group-addon{
width: 65px !important;
background-color: #fafafa!important;
}
.yslzxueshisy .ant-input-group-addon{
width: 65px !important;
background-color: #fafafa!important;
}
.sjmc .ant-form-item{
display: flex;
flex-direction:row;
}
.sjmc .ant-form-item-control-wrapper{
width:80%;
}
`
}</style>
<div className="sjmc">
<Form.Item label="试卷名称:">
{getFieldDecorator('classroom', {
rules: [{required: true, message: "不能为空"}],
})(
<AutoComplete
onSearch={this.handleSearch}
className={"fl construction yslzxueshis "}
dataSource={optionss}
>
<Input className="yslzxueshisy " placeholder="请输入名称最大限制60个字符" onInput={this.handleChange} addonAfter={String(addonAfteronelens3)+"/60"} maxLength={60} />
</AutoComplete>
)}
<div id='isclassroom'></div>
</Form.Item>
</div>
</div>
<style>
{
`
.kssc .ant-form-item-label{
line-height: 38px !important;
}
.kssc .ant-form-item{
display: flex;
flex-direction:row;
}
.kssc .ant-form-item-label{
margin-left: 10px;
}
`
}
</style>
<div className="kssc">
<Form.Item label="考试时长:">
{getFieldDecorator('kssc')(<InputNumber
min={0}
step={0.1}
></InputNumber>)}
<span className="ant-form-text"> 分钟</span>
</Form.Item>
</div>
</Form>
<div className="sortinxdirection">提示组卷完成后在试卷库<a className="tishiyuyans xiaoshou" href={"/paperlibrary"}>我的试卷库</a></div>
</div>
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30 h34 w100 lh34" onClick={()=>this.props.Confirmationofvolumeformations()}>取消</a>
<Button
className="task-btn task-btn-orange h34 w100 lh34"
type="primary"
loading={this.state.iconLoading}
onClick={()=>this.Confirmationofvolumeformation()}
>
确定
</Button>
</div>
</Modal>
)
}
}
const IntelligentModels = Form.create({name: 'IntelligentModel'})(IntelligentModel);
export default IntelligentModels;

@ -13,12 +13,14 @@ import {
Input,
Select,
Cascader,
Col, Row, InputNumber, DatePicker, AutoComplete, Button, Tag
Col, Row, InputNumber, DatePicker, AutoComplete, Button, Tag,Tooltip
} from "antd";
import './../questioncss/questioncom.css';
import Newknledpots from './Newknledpots'
const InputGroup = Input.Group;
const {Option} = Select;
const queryString = require('query-string');
const options = [
{
value: '方向',
@ -41,7 +43,7 @@ const options = [
],
},
];
//Comthetestpaperst试卷的
class Itembankstop extends Component {
constructor(props) {
super(props);
@ -53,12 +55,41 @@ class Itembankstop extends Component {
knowledgepoints: [],
knowledgepoints2:[],
options: [],
NewknTypedel:false
NewknTypedel:false,
boolred:false,
boolnews:false,
}
}
setboolred=(bool)=>{
this.setState({
boolred:bool
})
}
//初始化
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 {
this.props.getcontentMdRef(this);
} catch (e) {
@ -68,7 +99,53 @@ class Itembankstop extends Component {
options: this.props.disciplmy,
})
//console.log("数据");
//console.log(this.props);
const parsed = queryString.parse(this.props.location.search);
//console.log(parsed);
try {
if(JSON.stringify(parsed)==={}||JSON.stringify(parsed)==="{}"){
}else {
if(parsed.discipline_id){
if(parsed.sub_discipline_id){
this.setState({
rbkc:[parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)]
})
this.props.form.setFieldsValue({
rbkc: [parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)],
});
this.getdatasmyss(parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id));
}
}
if(parsed.item_type){
this.setState({
rbtx:parsed.item_type,
})
this.props.form.setFieldsValue({
rbtx:parsed.item_type,
});
this.props.setitem_type(parsed.item_type);
}
if(parsed.difficulty){
this.setState({
rbnd:parsed.difficulty,
})
this.props.form.setFieldsValue({
rbnd:parsed.difficulty,
});
}
}
}catch (e) {
}
}
componentDidUpdate(prevProps) {
@ -79,6 +156,7 @@ class Itembankstop extends Component {
})
}
if(prevProps.disciplinesdata!== this.props.disciplinesdata){
//console.log("新增开始加载了")
try {
if(this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline){
const didata = this.props.disciplinesdata;
@ -110,6 +188,27 @@ class Itembankstop extends Component {
knowledgepoints2: _result,
})
}
try {
const parsed = queryString.parse(this.props.location.search);
if(JSON.stringify(parsed)==={}||JSON.stringify(parsed)==="{}"){
}else {
if(parsed.discipline_id){
if(parsed.sub_discipline_id){
this.setState({
rbkc:[parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)]
})
this.props.form.setFieldsValue({
rbkc: [parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)],
});
this.getdatasmyss(parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id));
}
}
}
}catch (e) {
}
}catch (e) {
}
}
@ -119,12 +218,13 @@ class Itembankstop extends Component {
this.handleFormtixing(this.props.item_banksedit.item_type);
}
if (this.props.item_banksedit.difficulty) {
this.handleFormLayoutChange(this.props.item_banksedit.difficulty);
this.handleFormLayoutChangeysl(this.props.item_banksedit.difficulty);
}
if (this.props.item_banksedit.tag_disciplines) {
this.handletag_disciplinesChange(this.props.item_banksedit.tag_disciplines);
}
try {
//初始化课程
this.handdisciplinesChange(this.props.item_banksedit.discipline,this.props.item_banksedit.sub_discipline);
}catch (e) {
@ -175,7 +275,42 @@ class Itembankstop extends Component {
}
}
}
getdatasmyss=(id,ids)=>{
if(this.props.disciplinesdata){
try {
if(id &&ids){
var didata = this.props.disciplinesdata;
var knowledgepointsdata = [];
for (var i = 0; i < didata.length; i++) {
//方向
if (id === didata[i].id) {
const fxdidata = didata[i].sub_disciplines;
for (var j = 0; j < fxdidata.length; j++) {
//课程
if (ids === fxdidata[j].id) {
const zsddata = fxdidata[j].tag_disciplines;
for (var k = 0; k < zsddata.length; k++) {
//知识点
knowledgepointsdata.push(zsddata[k]);
}
}
}
}
}
this.setState({
knowledgepoints:knowledgepointsdata,
knowledgepoints2: knowledgepointsdata,
})
}else{
}
}catch (e) {
}
}
}
handdisciplinesChange =(name,title)=>{
this.setState({
rbkc:[name.id,title.id]
@ -216,8 +351,8 @@ class Itembankstop extends Component {
this.props.form.validateFields((err, values) => {
data = []
if (!err) {
// ////console.log("获取的form 数据");
// ////console.log(values);
// //////console.log("获取的form 数据");
// //////console.log(values);
data.push({
rbnd: parseInt(values.rbnd)
})
@ -241,31 +376,42 @@ class Itembankstop extends Component {
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
////console.log("获取的form 数据");
////console.log(values);
//////console.log("获取的form 数据");
//////console.log(values);
}
});
}
handleFormLayoutChange = (value) => {
handleFormLayoutChangeysl = (value) => {
//难度塞选
////console.log("难度塞选");
////console.log(value);
//////console.log("难度塞选");
//////console.log(value);
this.props.form.setFieldsValue({
rbnd: value + "",
rbnd: value+ "",
});
this.setState({
rbnd: value + "",
})
}
handleFormLayoutChange = (e) => {
//难度塞选
//////console.log("难度塞选");
//////console.log(value);
this.props.form.setFieldsValue({
rbnd: e.target.value + "",
});
this.setState({
rbnd: e.target.value + "",
})
}
handleFormkechen = (value) => {
//课程
////console.log("课程");
////console.log(value);
//////console.log("课程");
//////console.log(value);
if(this.state.Knowpoints.length>4){
this.props.showNotification(`知识点最多选择5个`);
return
@ -286,8 +432,8 @@ class Itembankstop extends Component {
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
console.log("guonue");
console.log(item);
// //console.log("guonue");
// //console.log(item);
_result.push(item);
}
});
@ -302,8 +448,8 @@ class Itembankstop extends Component {
}
handleFormzhishidian = (value) => {
console.log("handleFormzhishidian 课程");
console.log(value);
//console.log("handleFormzhishidian 课程");
//console.log(value);
//课程
this.props.form.setFieldsValue({
@ -312,8 +458,8 @@ class Itembankstop extends Component {
this.setState({
rbkc:value,
})
// console.log("handleFormzhishidian");
// console.log(this.props.disciplinesdata);
// //console.log("handleFormzhishidian");
// //console.log(this.props.disciplinesdata);
const didata = this.props.disciplinesdata;
const knowledgepointsdata = [];
@ -357,8 +503,8 @@ class Itembankstop extends Component {
handleFormtixing = (value) => {
//题型
//console.log("题型");
//console.log(value);
////console.log("题型");
////console.log(value);
this.setState({
rbtx: value + "",
})
@ -369,7 +515,7 @@ class Itembankstop extends Component {
}
preventDefault = (e) => {
e.preventDefault();
////console.log('Clicked! But prevent default.');
//////console.log('Clicked! But prevent default.');
}
deletesobject = (item, index) => {
@ -413,6 +559,10 @@ class Itembankstop extends Component {
}
NewknTypedeldel=(bool)=>{
if(this.state.rbkc===undefined || this.state.rbkc===null || this.state.rbkc===""){
this.props.showNotification(`请选择课程方向`);
return;
}
this.setState({
NewknTypedel:bool
})
@ -420,21 +570,34 @@ class Itembankstop extends Component {
}
NewknTypedeltyoedel=(value)=>{
var knowledgepointmys= this.state.knowledgepoints;
var konwbool=null;
for(let myda of knowledgepointmys) {
if(myda.name===value){
konwbool="yes"
break;
}
}
if(konwbool!=null){
this.props.showNotification(`重复的知识点`);
this.setboolred(true);
return
}
if(value===null||value===""){
this.props.showNotification(`请输入知识点`);
this.setboolred(true);
return
}
if(value.length===0){
this.props.showNotification(`请输入知识点`);
this.setboolred(true);
return
}
if(this.state.rbkc===undefined || this.state.rbkc===null || this.state.rbkc===""){
this.props.showNotification(`请选择课程方向`);
return;
}
var data={
name:value,
sub_discipline_id:this.state.rbkc[1]
@ -443,27 +606,45 @@ class Itembankstop extends Component {
axios.post(url,data)
.then((result) => {
if (result.data.status === 0) {
this.props.showNotification(`新增知识点成功!`);
// this.props.showNotification(`新增知识点成功!`);
var leydata={
id: result.data.tag_discipline_id,
name:value,
}
this.state.knowledgepoints.push(leydata);
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
Knowpoints: this.state.Knowpoints,
knowledgepoints: this.state.knowledgepoints,
knowledgepoints2: _result,
})
if(this.state.Knowpoints.length>=5){
this.state.knowledgepoints.push(leydata);
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
Knowpoints: this.state.Knowpoints,
knowledgepoints: this.state.knowledgepoints,
knowledgepoints2: _result,
})
}else{
this.state.Knowpoints.push(leydata);
this.state.knowledgepoints.push(leydata);
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
Knowpoints: this.state.Knowpoints,
knowledgepoints: this.state.knowledgepoints,
knowledgepoints2: _result,
})
}
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
this.setState({
@ -476,6 +657,11 @@ class Itembankstop extends Component {
let {page, options,NewknTypedel,knowledgepoints,knowledgepoints2,Knowpoints} = this.state;
const {getFieldDecorator} = this.props.form;
// //console.log("this.state.rbkc");
// //console.log(this.state.rbkc);
// //console.log(options);
return (
<div className=" clearfix educontent Contentquestionbankstyle w100s w1200fpx mt19">
@ -495,7 +681,7 @@ class Itembankstop extends Component {
height: 33px !important;
}
.ant-input-group{
width:258px !important;
width:270px !important;
}
.ant-input {
height: 33px !important;
@ -512,6 +698,8 @@ class Itembankstop extends Component {
{
NewknTypedel?
<Newknledpots {...this.state} {...this.props}
boolred={this.state.boolred}
setboolred={(bool)=>this.setboolred(bool)}
NewknTypedeldel={(bool)=>this.NewknTypedeldel(bool)}
NewknTypedeltyoedel={(value)=>this.NewknTypedeltyoedel(value)}
></Newknledpots>
@ -519,32 +707,29 @@ class Itembankstop extends Component {
}
<Form onSubmit={this.handleSubmit}>
<div className="sortinxdirection">
<Form.Item
label="课程"
>
{getFieldDecorator("rbkc",
{
{initialValue: this.state.rbkc,
rules: [{required: true, message: '请选择课程'}],
}
)(
<div className="sortinxdirection">
<InputGroup >
<Cascader style={{width: '258px'}} value={this.state.rbkc} options={options} onChange={this.handleFormzhishidian}
<Cascader style={{width: '270px'}} options={options} onChange={this.handleFormzhishidian}
placeholder="请选择..."/>
</InputGroup>
</div>
)}
</Form.Item>
</div>
<Form.Item
label="知识点"
>
{getFieldDecorator("rbzsd"
)(
<div className="sortinxdirection">
<InputGroup >
<Select style={{width: '258px'}} value={undefined} onChange={this.handleFormkechen}
<Select style={{width: '270px'}} value={undefined} onChange={this.handleFormkechen}
placeholder="请选择...">
{knowledgepoints2 && knowledgepoints2.map((object, index) => {
return (
@ -552,61 +737,61 @@ class Itembankstop extends Component {
)
})}
</Select>
</InputGroup>
<img className=" ml22 zjzsdian xiaoshou" src={getImageUrl("/images/educoder/zjzsd.png")} onClick={()=>this.NewknTypedeldel(true)}/>
<img className=" ml22 zjzsdian xiaoshou" src={getImageUrl("images/educoder/zjzsd.png")} onClick={()=>this.NewknTypedeldel(true)}/>
<div className="sortinxdirection" style={{
height: "33px",
lineHeight: "28px",
</div>
)}
</Form.Item>
{
this.state.Knowpoints===undefined||this.state.Knowpoints===null?"":
this.state.Knowpoints.length>0?
<div className="sortinxdirection huanhan w100s mt15" style={{
minHeight: "33px",
lineHeight: "28px",
}}>
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
return (
<div key={index} className="mytags" style={{
<div key={index} className={index===0?"mytags mb20":"mytags"} style={{
position: "relative",
}}>
<p className="w100s stestcen lh32">{object.name}</p>
<img className=" ml7 zjzsdian xiaoshou icondowncolorssy" onClick={() => this.deletesobject(object, index)} src={getImageUrl("/images/educoder/bzucha.png")}/>
<img className=" ml7 zjzsdian xiaoshou icondowncolorssy" onClick={() => this.deletesobject(object, index)} src={getImageUrl("images/educoder/bzucha.png")}/>
</div>
)
})}
</div>
:
""
}
</div>
</div>
)}
</Form.Item>
<Form.Item
label="题型"
>
{getFieldDecorator("rbtx",
{
{initialValue: this.state.rbtx,
rules: [{required: true, message: '请选择题型'}],
}
)(
<InputGroup >
<Select style={{width: '258px'}} value={this.state.rbtx} onChange={this.handleFormtixing}
<Select style={{width: '270px'}} disabled={this.state.boolnews} onChange={this.handleFormtixing}
placeholder="请选择...">
<Option value="PROGRAM">编程题</Option>
<Option value="SINGLE">单选题</Option>
<Option value="MULTIPLE">多选题</Option>
<Option value="JUDGMENT">判断题</Option>
<Option value="PROGRAM">编程题</Option>
</Select>
</InputGroup>
)}
</Form.Item>
<style>
{
`
@ -663,11 +848,11 @@ class Itembankstop extends Component {
<div className="rbndclass">
<Form.Item label="难度">
{getFieldDecorator('rbnd',
{
{initialValue: this.state.rbnd,
rules: [{required: true, message: '请选择难度'}],
}
)(
<Radio.Group initialValue={this.state.rbnd} onChange={this.handleFormLayoutChange}>
<Radio.Group onChange={this.handleFormLayoutChange}>
<Radio.Button value="1">简单</Radio.Button>
<Radio.Button value="2">适中</Radio.Button>
<Radio.Button value="3">困难</Radio.Button>

@ -10,6 +10,8 @@ import axios from 'axios'
import update from 'immutability-helper'
import './../questioncss/questioncom.css';
import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder';
import QuillForEditor from '../../../common/quillForEditor';
const { TextArea } = Input;
const confirm = Modal.confirm;
const $ = window.$
@ -46,10 +48,12 @@ class JudquestionEditor extends Component{
this.state = {
question_choices: _question_choices || ['', '', '', ''],
standard_answers: _standard_answers || [false, false, false, false],
question_title: this.props.question_title || '',
question_title: this.props.question_title!==undefined?JSON.parse(this.props.question_title):"",
question_type: this.props.question_type || 0,
question_score: this.props.question_score || this.props.init_question_score,
question_titles:this.props.question_titles||'',
question_titles: this.props.question_titles!==undefined?JSON.parse(this.props.question_titles):"",
question_titlesysl:this.props.question_titlesysl||'',
question_titleysl:this.props.question_title || '',
zqda:null,
item_banksedit:[],
mychoicess:[],
@ -58,9 +62,9 @@ class JudquestionEditor extends Component{
addOption = () => {
const { question_choices, standard_answers } = this.state;
// //////console.log("addOption");
// //////console.log(question_choices);
// //////console.log(standard_answers);
// ////////console.log("addOption");
// ////////console.log(question_choices);
// ////////console.log(standard_answers);
question_choices.push('')
@ -70,8 +74,8 @@ class JudquestionEditor extends Component{
deleteOption = (index) => {
let {question_choices}=this.state;
// //////console.log("deleteOption");
// //////console.log(question_choices);
// ////////console.log("deleteOption");
// ////////console.log(question_choices);
if(question_choices[index]===""){
// repeat code
@ -99,12 +103,11 @@ class JudquestionEditor extends Component{
}
onSave = () => {
var editordata=[];
const {question_title, question_score, question_type,question_titles, zqda,question_choices, standard_answers } = this.state;
const {question_title, question_score,question_titleysl,question_titlesysl, question_type,question_titles, zqda,question_choices, standard_answers } = this.state;
const { question_id_to_insert_after, question_id } = this.props
// TODO check
const answerArray = standard_answers.map((item, index) => { return item == true ? index+1 : -1 }).filter(item => item != -1);
if(!question_title) {
this.refs['titleEditor'].showError()
if(!question_titleysl) {
this.props.showNotification('请您输入题干');
return editordata;
}
@ -116,12 +119,11 @@ class JudquestionEditor extends Component{
if(!question_titles) {
this.refs['titleEditor2'].showError()
this.props.showNotification('请您输入题目解析');
return editordata;
}
//
// if(!question_titlesysl) {
// this.props.showNotification('请您输入题目解析');
// return editordata;
// }
/**
{
"question_title":"同学朋友间常用的沟通工具是什么?",
@ -132,7 +134,7 @@ class JudquestionEditor extends Component{
}*/
editordata=[question_title,zqda,question_titles];
editordata=[question_titleysl,zqda,question_titlesysl];
// question_title,
// question_type: answerArray.length > 1 ? 1 : 0,
// question_score,
@ -156,10 +158,11 @@ class JudquestionEditor extends Component{
try {
this.setState({
item_banksedit:this.props.item_banksedit,
question_title:this.props.item_banksedit.name,
question_titles:this.props.item_banksedit.analysis,
question_title: this.props.item_banksedit.name!==undefined?JSON.parse(this.props.item_banksedit.name):"",
question_titles: this.props.item_banksedit.analysis!==undefined?JSON.parse(this.props.item_banksedit.analysis):"",
mychoicess:this.props.item_banksedit.choices,
question_titleysl:this.props.item_banksedit.name|| '',
question_titlesysl:this.props.item_banksedit.analysis||'',
})
if(this.props.item_banksedit){
if(this.props.item_banksedit.choices){
@ -187,16 +190,18 @@ class JudquestionEditor extends Component{
}
componentDidUpdate(prevProps) {
//console.log("componentDidUpdate");
//console.log(prevProps);
//console.log(this.props.item_banksedit);
////console.log("componentDidUpdate");
////console.log(prevProps);
////console.log(this.props.item_banksedit);
if(prevProps.item_banksedit !== this.props.item_banksedit){
this.setState({
item_banksedit:this.props.item_banksedit,
question_title:this.props.item_banksedit.name,
question_titles:this.props.item_banksedit.analysis,
question_title: this.props.item_banksedit.name!==undefined?JSON.parse(this.props.item_banksedit.name):"",
question_titles: this.props.item_banksedit.analysis!==undefined?JSON.parse(this.props.item_banksedit.analysis):"",
mychoicess:this.props.item_banksedit.choices,
question_titleysl:this.props.item_banksedit.name|| '',
question_titlesysl:this.props.item_banksedit.analysis||'',
})
if(this.props.item_banksedit){
@ -225,10 +230,10 @@ class JudquestionEditor extends Component{
onOptionClick = (index) => {
let standard_answers = this.state.standard_answers.slice(0);
// //////console.log("onOptionClick");
// //////console.log(standard_answers);
// //////console.log(standard_answers[index]);
// //////console.log(!standard_answers[index]);
// ////////console.log("onOptionClick");
// ////////console.log(standard_answers);
// ////////console.log(standard_answers[index]);
// ////////console.log(!standard_answers[index]);
for (var i=0;i<standard_answers.length;i++){
if(index===i){
standard_answers[index] = true;
@ -267,14 +272,63 @@ class JudquestionEditor extends Component{
handleFormLayoutChange=(e)=>{
//////console.log("难度塞选");
//////console.log(value);
////////console.log("难度塞选");
////////console.log(value);
this.setState({
zqda:e.target.value,
})
}
onContentChange=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titleysl:""
})
} else {
// 提交到后台的内容需要处理一下;
var texts="";
if(_text.length>=1001){
var result = _text.substring(0,1000);
texts={"ops":[{"insert":result}]};
texts=JSON.stringify(texts);
}else {
value = JSON.stringify(value)
texts=value;
}
this.setState({
question_titleysl:texts
})
}
}
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titlesysl:""
})
} else {
// 提交到后台的内容需要处理一下;
var texts="";
if(_text.length>=1001){
var result = _text.substring(0,1000);
texts={"ops":[{"insert":result}]};
texts=JSON.stringify(texts);
}else {
value =JSON.stringify(value);
texts=value;
}
this.setState({
question_titlesysl:texts
})
}
}
render() {
let { question_title, question_score, question_type, question_choices, standard_answers,question_titles} = this.state;
let { question_id, index, exerciseIsPublish,
@ -294,9 +348,9 @@ class JudquestionEditor extends Component{
// [true, false, true] -> [0, 2]
const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
// //////console.log("xuanzheshijuan");
// //////console.log(answerTagArray);
// //////console.log(!exerciseIsPublish);
// ////////console.log("xuanzheshijuan");
// ////////console.log(answerTagArray);
// ////////console.log(!exerciseIsPublish);
const params= this.props&&this.props.match&&this.props.match.params;
return(
<div className="padding20-30 signleEditor danxuano" id={qNumber}>
@ -325,16 +379,21 @@ class JudquestionEditor extends Component{
<span className="xingtigan fl">题干</span>
</p>
<TPMMDEditor mdID={qNumber} placeholder="请您输入题干" height={155} className=" mt10"
initValue={question_title} onChange={(val) => this.setState({ question_title: val})}
ref="titleEditor"
<QuillForEditor
autoFocus={true}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '155px'}}
placeholder="请您输入题干"
options={['code-block', 'image', 'formula']}
value={question_title}
onContentChange={this.onContentChange}
></TPMMDEditor>
/>
<div className="mb10 sortinxdirection">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
</div>
<style>
@ -363,36 +422,25 @@ class JudquestionEditor extends Component{
<div>
<div className="mt10">
<p className="mb10 clearfix">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingcolor font-16 fl mr4"></span>
<span className="xingtigan fl">题目解析</span>
</p>
<style>{`
.optionMdEditor {
flex:1
}
.optionRow {
margin:0px!important;
/* margin-bottom: 20px!important; */
}
.signleEditor .content_editorMd_show{
display: flex;
margin-top:0px!important;
border-radius:2px;
max-width: 1056px;
word-break:break-all;
}
`}</style>
<TPMMDEditor mdID={qNumber+question_choices.length} placeholder="请您输入题目解析" height={155} className=" mt10"
initValue={question_titles} onChange={(val) => this.setState({ question_titles: val})}
ref="titleEditor2"
></TPMMDEditor>
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{height: '166px' }}
placeholder="请您输入题目解析"
options={['code-block', 'image', 'formula']}
value={question_titles}
onContentChange={this.onContentChanges}
/>
</div>
</div>
</div>
)

@ -1,71 +1,123 @@
import React, {Component} from "react";
import {Link, NavLink} from 'react-router-dom';
import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl,markdownToHTML} from 'educoder';
import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl, markdownToHTML} from 'educoder';
import axios from 'axios';
import {
notification,
Spin,
Table,
Pagination,
Radio
Radio,
Tooltip
} from "antd";
import './../questioncss/questioncom.css';
import QuillForEditor from "../../../common/quillForEditor";
const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]
const tagArrays = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]
class Listjihe extends Component {
constructor(props) {
super(props);
this.state = {
page:1,
name:"单选题",
nd:"简单",
page: 1,
name: "单选题",
nd: "简单",
}
}
//初始化
componentDidMount(){
componentDidMount() {
}
//选用
Selectingpracticaltraining=(id)=>{
let data={
item_ids:[id]
}
this.props.getitem_baskets(data);
Selectingpracticaltraining = (id) => {
let data = {}
if (this.props.exam_id === undefined) {
data = {
item_ids: [id]
}
} else {
data = {
item_ids: [id],
exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id),
}
}
this.props.getitem_baskets(data);
}
//撤销
Selectingpracticaltrainings=(id)=>{
Selectingpracticaltrainings = (id) => {
this.props.getitem_basketss(id);
}
render() {
let {page, name, nd} = this.state;
let {defaultActiveKey, items, listjihe, chakanjiexiboolindex, keindex} = this.props;
// 编程答案
var rightkey = null
var MULTIPLEkey = null;
if (items) {
if (items.item_type) {
if (items.item_type === "PROGRAM") {
} else {
if (items.item_type === "JUDGMENT") {
//多选题
if (items.choices) {
if (items.choices.length > 0) {
var arr = items.choices;
for (let data of arr) {
if (data.is_answer === true) {
rightkey = data.choice_text;
break;
}
}
}
}
} else {
// 单选题和判断题
if(items.item_type === "MULTIPLE"){
if (items.choices) {
if (items.choices.length > 0) {
var arr = items.choices;
for (var i = 0; i < arr.length; i++) {
if (arr[i].is_answer === true) {
if(MULTIPLEkey===null){
MULTIPLEkey = tagArrays[i];
render() {
let {page,name,nd}=this.state;
let {defaultActiveKey,items,listjihe,chakanjiexiboolindex,keindex}=this.props;
}else{
MULTIPLEkey =MULTIPLEkey+ tagArrays[i];
}
// 编程答案
var rightkey=null
if(items){
if(items.item_type){
if(items.item_type==="PROGRAM"){
}else{
if(items.choices){
if(items.choices.length>0){
var arr= items.choices;
for(let data of arr) {
if(data.is_answer===true){
rightkey=data.choice_text;
break;
}
}
}
}
}else{
if (items.choices) {
if (items.choices.length > 0) {
var arr = items.choices;
for (var i = 0; i < arr.length; i++) {
if (arr[i].is_answer === true) {
rightkey = i;
break;
}
}
}
}
}
@ -74,194 +126,335 @@ class Listjihe extends Component {
}
}
var itemssname="";
try {
itemssname= JSON.parse(items.name);
}catch (e) {
}
if(itemssname===undefined){
itemssname=items.name
}
var itemsnamesy="";
try {
itemsnamesy= JSON.parse(items&&items.program_attr&&items.program_attr.description);
}catch (e) {
itemsnamesy=items&&items.program_attr&&items.program_attr.description;
}
var analysisnames="";
try {
analysisnames= JSON.parse(items&&items.analysis);
}catch (e) {
analysisnames=items&&items.analysis;
}
return (
<div key={keindex} className={chakanjiexiboolindex===keindex?"w100s borderwds283 pd20 mb20 listjihecolors":"w100s borderwds pd20 mb20 listjihecolors"}>
<div key={keindex}
className={chakanjiexiboolindex === keindex ? "w100s borderwds283 pd20 mb20 listjihecolors" : "w100s borderwds pd20 mb20 listjihecolors"}>
{/*顶部*/}
<style>
{
` .markdown-body .ql-editor{
padding-left: 0px !important;
padding-top: 0px !important;
}
.programquill .ql-editor{
padding-left: 0px !important;
padding-top: 0px !important;
}
`
}
</style>
<div className="w100s sortinxdirection">
<div className="listjihetixingstitsy">
{
this.props.listjihe
}
</div>
<div className="listjihetixingstitsy">
.
</div>
<div className="ml10 w100s listjihetixingstit markdown-body" style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(items&&items.name).replace(/▁/g, "▁▁▁")}}>
}.
</div>
{
items.item_type==="PROGRAM"?
<a href={`/problems/${items.program_attr.identifier}/edit`}>
<div className="ml10 w100s " style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(items&&items.name).replace(/▁/g, "▁▁▁")}}></div>
</a>
:
<div className="ml10 w100s markdown-body" style={{wordBreak: "break-word"}}>
{ items===undefined||items===null||items===""?"":
items.name === undefined || items.name === null || items.name === "" ?
""
:
items.name.length>0?
<QuillForEditor
readOnly={true}
value={itemssname}
/>
:""
}
</div>
}
</div>
{/*内容*/}
<div className="w100s sortinxdirection ">
{items.item_type==="JUDGMENT"?
<p className="w100s listjihetixingstits sortinxdirection ">
{
items === undefined ||items === null? "" : items.choices.map((object, index) => {
return (
<p className={index===1? "sortinxdirection ml10":"sortinxdirection " } >
<Radio checked={object.is_answer}>
{object.choice_text}
</Radio>
</p>
)
})
}
</p>:
items.item_type==="PROGRAM"?
{items.item_type === "JUDGMENT" ?
<p className="w100s listjihetixingstitsp sortinxdirection ">
{
items === undefined || items === null ? "" : items.choices.map((object, index) => {
return (
<p className={index === 1 ? "sortinxdirection ml10" : "sortinxdirection "}>
<Radio disabled={true} >
{object.choice_text}
</Radio>
</p>
)
})
}
</p> :
items.item_type === "PROGRAM" ?
<p className="w100s listjihetixingstitssy sortinxdirection ">
<p className={"sortinxdirection mt15"} >
<p style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(items.program_attr.description).replace(/▁/g, "▁▁▁")}}></p>
<p className={"sortinxdirection mt15"}>
{
items&&items.program_attr&&items.program_attr.description?
<p className="programquill" style={{wordBreak: "break-word"}}
>
<QuillForEditor
readOnly={true}
value={itemsnamesy}
/>
</p>
:""
}
</p>
</p>
:
<p className="w100s listjihetixingstitsp verticallayout ">
{
items === undefined || items === null ? "" : items.choices.map((object, index) => {
var string=""
try {
string=JSON.parse(object.choice_text);
}catch (e) {
string=object.choice_text;
}
return (
<p className={index === 0 ? "sortinxdirection " : "sortinxdirection mt15 "}>
<p className="lh20s">{tagArray[index]}</p>
<p className="programquill" style={{wordBreak: "break-word"}}>
{object ?
object.choice_text === undefined || object.choice_text=== null || object.choice_text === "" ?
""
:
object.choice_text.length>0?
<QuillForEditor
readOnly={true}
value={string}
/>
:""
:
""
}
</p>
</p>
)
})
}
</p>
:
<p className="w100s listjihetixingstits verticallayout ">
{
items === undefined ||items === null? "" : items.choices.map((object, index) => {
return (
<p className={index===0?"sortinxdirection":"sortinxdirection mt15"} >
{tagArray[index]}
<p style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(object.choice_text).replace(/▁/g, "▁▁▁")}}></p>
</p>
)
})
}
</p>
}
</div>
<div className="w100s sortinxdirection mt10">
<p className="listjihetixing">难度<span >{items.difficulty===1?"简单":items.difficulty===2?"适中":items.difficulty===3?"困难":""}</span></p>
<p className="ml30 listjihetixing">题型<span >{items.item_type==="SINGLE"?"单选题":items.item_type==="MULTIPLE"?"多选题":items.item_type==="JUDGMENT"?"判断题":items.item_type==="PROGRAM"?"编程题":""}</span></p>
<p
className="listjihetixing">难度<span>{items.difficulty === 1 ? "简单" : items.difficulty === 2 ? "适中" : items.difficulty === 3 ? "困难" : ""}</span>
</p>
<p
className="ml30 listjihetixing">题型<span>{items.item_type === "SINGLE" ? "单选题" : items.item_type === "MULTIPLE" ? "多选题" : items.item_type === "JUDGMENT" ? "判断题" : items.item_type === "PROGRAM" ? "编程题" : ""}</span>
</p>
</div>
{/*更新时间*/}
<div className="w100s sortinxdirection">
<div className="w50s listjihetixingstit sortinxdirection">
<p className="updatetimes lh30">更新时间{items.update_time}</p>
<p className="updatetimes lh30">更新时间{items.update_time}</p>
{
this.props.defaultActiveKey==="0"||this.props.defaultActiveKey===0?
this.props.defaultActiveKey === "0" || this.props.defaultActiveKey === 0 ?
""
:
<p className="updatetimes lh30 ml45">创建者{items.author.name}</p>
}
{
items.item_type==="PROGRAM"?
<p className="updatetimes lh30 ml45">编程语言{items.program_attr.language}</p>
:""
}
{
items.item_type==="PROGRAM"?
items.program_attr.status===0?
items.item_type === "PROGRAM" ?
<p className="updatetimes lh30 ml45">编程语言{items.program_attr.language}</p>
: ""
}
{
items.item_type === "PROGRAM" ?
items.program_attr.status === 0 ?
<p className="updatetimes lh30 ml45 nofabu mt5">未发布</p>
:""
:""
: ""
: ""
}
</div>
<div className="w50s xaxisreverseorder">
{
items.choosed===true?
<p className="selectionss xiaoshou" onClick={()=>this.Selectingpracticaltrainings(items.id)}>
<i className="iconfont icon-jianhao font-12 lg ml7 lh30 icontianjiadaohangcolor mr10"></i>
<span>撤销</span></p>
items.choosed === true ?
<p className="selectionss xiaoshou" onClick={() => this.Selectingpracticaltrainings(items.id)}>
<i className="iconfont icon-jianhao font-12 lg ml7 lh30 icontianjiadaohangcolor mr5"></i>
<span className="mr15 lh30">撤销</span></p>
:
items.item_type==="PROGRAM"?
items.program_attr.status===0?
<p className="selectionys jinzhixiaoshou" >
<i className="iconfont icon-tianjiadaohang font-12 lg ml7 lh30 icontianjiadaohangcolor mr10"></i>
<span>选用</span>
items.item_type === "PROGRAM" ?
items.program_attr.status === 0 ?
<Tooltip placement="top" title={"编程题未发布,不能选用!"}>
<p className="selectionys jinzhixiaoshou">
<i className="iconfont icon-tianjiadaohang font-12 lg ml7 lh30 icontianjiadaohangcolor mr5"></i>
<span className="mr15 lh30">选用</span>
</p>
:
<p className="selection xiaoshou" onClick={()=>this.Selectingpracticaltraining(items.id)}>
<i className="iconfont icon-tianjiadaohang font-12 lg ml7 lh30 icontianjiadaohangcolor mr10"></i>
<span>选用</span>
</p>
</Tooltip>
:
<p className="selection xiaoshou" onClick={()=>this.Selectingpracticaltraining(items.id)}>
<i className="iconfont icon-tianjiadaohang font-12 lg ml7 lh30 icontianjiadaohangcolor mr10"></i>
<span>选用</span>
</p>
<p className="selection xiaoshou" onClick={() => this.Selectingpracticaltraining(items.id)}>
<i className="iconfont icon-tianjiadaohang font-12 lg ml7 lh30 icontianjiadaohangcolor mr5"></i>
<span className="mr15 lh30">选用</span>
</p>
:
<p className="selection xiaoshou" onClick={() => this.Selectingpracticaltraining(items.id)}>
<i className="iconfont icon-tianjiadaohang font-12 lg ml7 lh30 icontianjiadaohangcolor mr5"></i>
<span className="mr15 lh30">选用</span>
</p>
}
{
defaultActiveKey===0||defaultActiveKey==="0"?
defaultActiveKey === 0 || defaultActiveKey === "0" ?
<div className="xaxisreverseorder">
<p className="viewparsings xiaoshou mr25" onClick={()=>this.props.showmodelysl(items.id)}>
<p className="viewparsings xiaoshou mr25" onClick={() => this.props.showmodelysl(items.id)}>
<i className="iconfont icon-shanchu1 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>删除</span>
</p>
{
items.item_type==="PROGRAM"?
items.item_type === "PROGRAM" ?
this.props.Isitapopup&&this.props.Isitapopup==="true"?
""
:
<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>
<span>编辑</span>
</p>
</a>
:
this.props.Isitapopup&&this.props.Isitapopup==="true"?
""
:
<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>
<span>编辑</span>
</p>
</a>
}
{
items.public===false?
items.item_type==="PROGRAM"?
items.program_attr.status===0?
items.public === false ?
items.item_type === "PROGRAM" ?
items.program_attr.status === 0 ?
""
:
<p className="viewparsings xiaoshou mr25" onClick={()=>this.props.showmodels(items.id)}>
items.apply===false?
<p className="viewparsings xiaoshou mr25" onClick={() => this.props.showmodels(items.id)}>
<i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>公开</span>
</p>
:
""
:items.apply===false?
<p className="viewparsings xiaoshou mr25" onClick={() => this.props.showmodels(items.id)}>
<i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>公开</span>
</p>
:
<p className="viewparsings xiaoshou mr25" onClick={()=>this.props.showmodels(items.id)}>
<i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>公开</span>
</p>
""
:
""
""
}
</div>
:""
: ""
}
{
items.item_type==="PROGRAM"?
""
items.item_type === "PROGRAM" ?
""
:
<p className="viewparsings xiaoshou mr25" onClick={()=>this.props.chakanjiexibool(keindex)}>
<p className="viewparsings xiaoshou mr25" onClick={() => this.props.chakanjiexibool(keindex)}>
<i className="iconfont icon-jiexi font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
查看解析</p>
}
</div>
</div>
{
chakanjiexiboolindex===keindex?<div>
chakanjiexiboolindex === keindex ? <div>
<div className="w100s questiontypeheng mt23">
</div>
<div className=" sortinxdirection mt15 yldxtit" >
<p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML("答案:"+rightkey).replace(/▁/g, "▁▁▁")}}
>
</p>
<div className=" sortinxdirection mt15 yldxtit">
{
items.item_type === "SINGLE" ?
<p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML("答案:" + tagArrays[rightkey]).replace(/▁/g, "▁▁▁")}}
>
</p>
: items.item_type === "MULTIPLE"?
<p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML("答案:" + MULTIPLEkey).replace(/▁/g, "▁▁▁")}}
>
</p>
:
<p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML("答案:" + rightkey).replace(/▁/g, "▁▁▁")}}
>
</p>
}
</div>
{
items&&items.analysis?
""
:""
}
<div className=" sortinxdirection mt15 yldxtit" >
<p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML("解析:"+items.analysis).replace(/▁/g, "▁▁▁")}}
<div className=" sortinxdirection mt15 yldxtit">
<p className=" testfondex yldxtit programquill"
style={{wordBreak: "break-word"}}
>
{items ?
items.analysis=== undefined || items.analysis=== null || items.analysis === "" ?
""
:
items.analysis.length>0?
<QuillForEditor
imgAttrs={{width: '60px', height: '30px'}}
readOnly={true}
value={analysisnames}
/>
:
""
:
""
}
</p>
</div>
</div>:""
</div> : ""
}
@ -271,4 +464,5 @@ class Listjihe extends Component {
}
}
export default Listjihe;

@ -14,10 +14,35 @@ class PaperDeletModel extends Component {
}
handleChange=(e)=>{
this.setState({
newkntypeinput: e.target.value
})
// this.setState({
// newkntypeinput: e.target.value
// })
// //console.log(e.target.value);
// //console.log(e.target.value.length);
this.setState({
newkntypeinput: e.target.value
})
this.props.setboolred(false);
//
// debugger
// //console.log(e);
//
// if(e.target.value.length>0){
// if(e.target.value.length>=16){
// var result = e.target.value.substring(0,15);
// this.setState({
// newkntypeinput: result
// })
// }
// }
}
mysinputOnBlur=(e)=>{
//console.log("失去焦点了");
}
inputOnFocus=(e)=>{
//console.log("获取焦点");
}
render() {
@ -34,8 +59,8 @@ class PaperDeletModel extends Component {
width="442px"
>
<div className="educouddiv">
<div className={"tabeltext-alignleft mt10"}>
<Input onInput={this.handleChange} />
<div className={this.props.boolred===true?"tabeltext-alignleft mt10 inpustred":"tabeltext-alignleft mt10"}>
<Input onInput={this.handleChange} maxLength={16} onBlur={this.mysinputOnBlur } onFocus={this.inputOnFocus }/>
</div>
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30 w80" onClick={()=>this.props.NewknTypedeldel(false)}>取消</a>

@ -21,7 +21,7 @@ class NoneData extends Component{
margin: 40px auto 20px;
}
.zenwuxgsj{
font-size:17px;
font-size:14px;
font-family:MicrosoftYaHei;
color:rgba(136,136,136,1);
}

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

@ -14,8 +14,8 @@ class Paperreview_itemModels extends Component {
}
onChange=(value)=>{
console.log("Paperreview_itemModels");
console.log(value);
//console.log("Paperreview_itemModels");
//console.log(value);
this.setState({
value:value,
})

@ -25,7 +25,7 @@ $(window).scroll(function(){
function rightSlider(){
var poi=parseInt((parseInt($(window).width())- 1200 )/2)-81;
// console.log(parseInt($(window).width())+" "+poi);
// //console.log(parseInt($(window).width())+" "+poi);
if(poi>0){
$(".-task-sidebar").css("right",poi);
}else{
@ -82,28 +82,38 @@ class SiderBars extends Component {
}
componentDidMount() {
_initSider()
// _initSider()
}
render() {
// console.log("SiderBar");
// console.log(this.props);
// //console.log("SiderBar");
// //console.log(this.props);
var mypath= this.props&&this.props.match&&this.props.match.path;
let{myvisible}=this.props;
let{myvisible,Datacount,animateStyle}=this.props;
return (
<div className={myvisible===true?"-task-sidebar mystask-sidebar":"-task-sidebar mystask-sidebars"} >
<div className={myvisible===true?"-task-sidebar mystask-sidebar":Datacount&&Datacount>0?"-task-sidebar mystask-sidebars":"-task-sidebar mystask-sidebarss"} >
{this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?<div>
{
mypath&&mypath==="/question"?
<Tooltip placement="left" title={"试题库"}>
<div className="feedback feedbackdivcolor xiaoshou shitikus" onClick={()=>this.props.showDrawer()} >
<div className="feedback feedbackdivcolor xiaoshou shitikus" onClick={()=>this.props.showDrawer()} >
{
Datacount&&Datacount>0?
<div className="shitikussmys maxnamewidth30">
{Datacount}
</div>
:""
}
<a target="_blank" className="color_white xiaoshou" >
<i className="iconfont icon-shitilan color-white xiaoshou"></i>
</a>

@ -52,8 +52,8 @@ class SingleEditor extends Component{
if(this.props.item_banksedit.choices){
this.props.item_banksedit.choices.forEach((item, index) => {
//console.log("SingleEditor");
//console.log(item);
////console.log("SingleEditor");
////console.log(item);
choicescomy.push({
choice_text:item.choice_text,
standard_boolean:item.is_answer,
@ -75,19 +75,21 @@ class SingleEditor extends Component{
this.state = {
question_choices: _question_choices || ['', '', '', ''],
standard_answers: _standard_answers || [false, false, false, false],
question_title: this.props.question_title || '',
question_title: this.props.question_title!==undefined?JSON.parse(this.props.question_title):"",
question_type: this.props.question_type || 0,
question_score: this.props.question_score || this.props.init_question_score,
question_titles:this.props.question_titles||'',
question_titles: this.props.question_titles!==undefined?JSON.parse(this.props.question_titles):"",
question_titlesysl:this.props.question_titlesysl||'',
question_titleysl:this.props.question_title || '',
item_banksedit:[],
}
}
addOption = () => {
const { question_choices, standard_answers } = this.state;
// ////console.log("addOption");
// ////console.log(question_choices);
// ////console.log(standard_answers);
// //////console.log("addOption");
// //////console.log(question_choices);
// //////console.log(standard_answers);
question_choices.push('')
@ -97,8 +99,8 @@ class SingleEditor extends Component{
deleteOption = (index) => {
let {question_choices}=this.state;
// ////console.log("deleteOption");
// ////console.log(question_choices);
// //////console.log("deleteOption");
// //////console.log(question_choices);
if(question_choices[index]===""){
// repeat code
@ -121,35 +123,44 @@ class SingleEditor extends Component{
}
onSave = () => {
var editordata=[];
const {question_title, question_score, question_type,question_titles, question_choices, standard_answers } = this.state;
const {question_title, question_titleysl,question_score, question_type,question_titles,question_titlesysl, question_choices, standard_answers } = this.state;
const { question_id_to_insert_after, question_id } = this.props
// TODO check
const answerArray = standard_answers.map((item, index) => { return item == true ? index+1 : -1 }).filter(item => item != -1);
if(!question_title) {
this.refs['titleEditor'].showError()
this.props.showNotification('请您输入题干');
return editordata;
}
if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项');
// const _text = quill.getText();
// const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
// if (!reg.test(_text)) {
// // 处理编辑器内容为空
// } else {
// // 提交到后台的内容需要处理一下;
// value = JSON.stringify(value)
// }
if(!question_titleysl) {
// this.refs['titleEditor'].showError()
this.props.showNotification('请您输入题干');
return editordata;
}
for(let i = 0; i < question_choices.length; i++) {
if (!question_choices[i]) {
this.refs[`optionEditor${i}`].showError()
// this.refs[`optionEditor${i}`].showError()
this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`);
return editordata;
}
}
if(!question_titles) {
this.refs['titleEditor2'].showError()
this.props.showNotification('请您输入题目解析');
if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项');
return editordata;
}
// if(!question_titlesysl) {
// this.props.showNotification('请您输入题目解析');
// return editordata;
// }
/**
{
"question_title":"同学朋友间常用的沟通工具是什么?",
@ -158,7 +169,7 @@ class SingleEditor extends Component{
"question_choices":["a答案","b答案","c答案","d答案"],
"standard_answers":[1]
}*/
editordata=[question_title,answerArray,question_choices,question_titles];
editordata=[question_titleysl,answerArray,question_choices,question_titlesysl];
// question_title,
// question_type: answerArray.length > 1 ? 1 : 0,
// question_score,
@ -184,8 +195,10 @@ class SingleEditor extends Component{
try {
this.setState({
item_banksedit:this.props.item_banksedit,
question_title:this.props.item_banksedit.name,
question_titles:this.props.item_banksedit.analysis,
question_title: this.props.item_banksedit.name!==undefined?JSON.parse(this.props.item_banksedit.name):"",
question_titleysl:this.props.item_banksedit.name|| '',
question_titles: this.props.item_banksedit.analysis!==undefined?JSON.parse(this.props.item_banksedit.analysis):"",
question_titlesysl:this.props.item_banksedit.analysis||'',
mychoicess:this.props.item_banksedit.choices,
})
@ -194,18 +207,19 @@ class SingleEditor extends Component{
}catch (e) {
}
}
componentDidUpdate(prevProps) {
//console.log("componentDidUpdate");
// //console.log(prevProps);
// //console.log(this.props.item_banksedit);
////console.log("componentDidUpdate");
// ////console.log(prevProps);
// ////console.log(this.props.item_banksedit);
if(prevProps.item_banksedit !== this.props.item_banksedit) {
this.setState({
item_banksedit: this.props.item_banksedit,
question_title: this.props.item_banksedit.name,
question_titles: this.props.item_banksedit.analysis,
question_title: this.props.item_banksedit.name!==undefined?JSON.parse(this.props.item_banksedit.name):"",
question_titleysl:this.props.item_banksedit.name|| '',
question_titles: this.props.item_banksedit.analysis!==undefined?JSON.parse(this.props.item_banksedit.analysis):"",
question_titlesysl:this.props.item_banksedit.analysis||'',
mychoicess: this.props.item_banksedit.choices,
})
@ -214,10 +228,10 @@ class SingleEditor extends Component{
onOptionClick = (index) => {
let standard_answers = this.state.standard_answers.slice(0);
// ////console.log("onOptionClick");
// ////console.log(standard_answers);
// ////console.log(standard_answers[index]);
// ////console.log(!standard_answers[index]);
// //////console.log("onOptionClick");
// //////console.log(standard_answers);
// //////console.log(standard_answers[index]);
// //////console.log(!standard_answers[index]);
for (var i=0;i<standard_answers.length;i++){
if(index===i){
standard_answers[index] = true;
@ -229,14 +243,31 @@ class SingleEditor extends Component{
// standard_answers[index] = !standard_answers[index];
this.setState({ standard_answers })
}
onOptionContentChange = (value, index) => {
onOptionContentChange = (value,quill,index) => {
if (index >= this.state.question_choices.length) {
// TODO 新建然后删除CD选项再输入题干会调用到这里且index是3
return;
}
var texts;
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
texts="";
} else {
if(_text.length>=301){
var result = _text.substring(0,300);
texts={"ops":[{"insert":result}]};
texts=JSON.stringify(texts);
}else {
// 提交到后台的内容需要处理一下;
value = JSON.stringify(value)
texts=value;
}
}
let question_choices = this.state.question_choices.slice(0);
question_choices[index] = value;
this.setState({ question_choices })
question_choices[index] = texts;
this.setState({ question_choices });
}
on_question_score_change = (e) => {
this.setState({ question_score: e })
@ -254,11 +285,69 @@ class SingleEditor extends Component{
}
onContentChange=(e)=>{
console.log(e);
onContentChange=(value,quill)=>{
var _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titleysl:""
})
} else {
// 提交到后台的内容需要处理一下;
var texts="";
if(_text.length>=1001){
var result = _text.substring(0,1000);
texts={"ops":[{"insert":result}]};
texts=JSON.stringify(texts);
}else {
value = JSON.stringify(value)
texts=value;
}
this.setState({
question_titleysl:texts
})
try {
//console.log("onContentChange");
//console.log(quill.getText().length);
}catch (e) {
}
}
}
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titlesysl:""
})
} else {
var texts="";
if(_text.length>=1001){
var result = _text.substring(0,1000);
texts={"ops":[{"insert":result}]};
texts=JSON.stringify(texts);
}else {
value = JSON.stringify(value)
texts=value;
}
this.setState({
question_titlesysl:texts
})
}
}
handleShowImage = (url) => {
//console.log("点击了图片放大");
//console.log(url);
alert(url);
}
render() {
let { question_title, question_score, question_type, question_choices, standard_answers,question_titles} = this.state;
let { question_title, question_score, question_type, question_choices, standard_answers,question_titles,question_titlesysl} = this.state;
let { question_id, index, exerciseIsPublish,
// question_title,
// question_type,
@ -276,18 +365,18 @@ class SingleEditor extends Component{
// [true, false, true] -> [0, 2]
const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
// ////console.log("xuanzheshijuan");
// ////console.log(answerTagArray);
// ////console.log(!exerciseIsPublish);
// //////console.log("xuanzheshijuan");
// //////console.log(answerTagArray);
// //////console.log(!exerciseIsPublish);
return(
<div className="padding20-30 signleEditor danxuano" id={qNumber}>
<style>{`
.optionMdEditor {
flex:1
}
.optionRow {
margin:0px!important;
/* margin:0px!important; */
/* margin-bottom: 20px!important; */
}
.signleEditor .content_editorMd_show{
@ -307,47 +396,64 @@ class SingleEditor extends Component{
<span className="xingtigan fl">题干</span>
</p>
<TPMMDEditor mdID={qNumber} placeholder="请您输入题干" height={155} className=" mt10"
initValue={question_title} onChange={(val) => this.setState({ question_title: val})}
ref="titleEditor"
></TPMMDEditor>
{/*<QuillForEditor*/}
{/* style={{ height: '155px'}}*/}
{/* placeholder="请您输入题干"*/}
{/* value={question_title}*/}
{/* options={['code-block', 'image', 'formula']}*/}
{/* onContentChange={this.onContentChange}*/}
{/*/>*/}
<div className="mb10 sortinxdirection">
<QuillForEditor
autoFocus={true}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '155px'}}
placeholder="请您输入题干"
options={['code-block', 'image', 'formula']}
value={question_title}
onContentChange={this.onContentChange}
/>
<div className="mb10 mt10 sortinxdirection">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
</div>
{question_choices.map( (item, index) => {
const bg = standard_answers[index] ? 'check-option-bg' : ''
return <div className="df optionRow " >
return <div className={index>0?"df optionRow mt15": "df optionRow"} key={index} >
{/* 点击设置答案 */}
{/* TODO 加了tooltip后会丢失掉span的class */}
{/* <Tooltip title={standard_answers[index] ? '点击取消标准答案设置' : '点击设置为标准答案'}> */}
<span class={`option-item fr mr10 color-grey select-choice ${bg} `}
<span className={`option-item fr mr10 color-grey select-choice ${bg} `}
name="option_span" onClick={() => this.onOptionClick(index)} style={{flex: '0 0 38px'}}>
<ConditionToolTip title={standard_answers[index] ? '' : '点击设置为标准答案'} placement="left" condition={true}>
<ConditionToolTip key={index} title={'点击设置为标准答案'} placement="left" condition={true}>
<div style={{width: '100%', height: '100%'}}>{tagArray[index]}</div>
</ConditionToolTip>
</span>
{/* </Tooltip> */}
<div style={{ flex: '0 0 1038px'}}>
<DMDEditor
ref={`optionEditor${index}`}
toMDMode={this.toMDMode} toShowMode={this.toShowMode}
height={166} className={'optionMdEditor'} noStorage={true}
mdID={qNumber + index} placeholder="" onChange={(value) => this.onOptionContentChange(value, index)}
initValue={item}
></DMDEditor>
{
item===undefined||item===null||item===""?
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '166px'}}
placeholder="请您输入题干"
options={['code-block', 'image', 'formula']}
value={item}
onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)}
/>
:
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '166px'}}
placeholder="请您输入题干"
options={['code-block', 'image', 'formula']}
value={JSON.parse(item)}
onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)}
/>
}
</div>
{exerciseIsPublish || index<=1?
<i className=" font-18 ml15 mr20"></i>
@ -366,36 +472,22 @@ class SingleEditor extends Component{
<div>
<p className="mb10 clearfix">
<div className="mt10">
<p className="mb10 clearfix">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingcolor font-16 fl mr4"></span>
<span className="xingtigan fl">题目解析</span>
</p>
<style>{`
.optionMdEditor {
flex:1
}
.optionRow {
margin:0px!important;
/* margin-bottom: 20px!important; */
}
.signleEditor .content_editorMd_show{
display: flex;
margin-top:0px!important;
border-radius:2px;
max-width: 1056px;
word-break:break-all;
}
`}</style>
<TPMMDEditor mdID={qNumber+question_choices.length} placeholder="请您输入题目解析" height={155} className=" mt10"
initValue={question_titles} onChange={(val) => this.setState({ question_titles: val})}
ref="titleEditor2"
></TPMMDEditor>
<div className="mt10"></div>
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{height: '166px' }}
placeholder="请您输入题目解析"
options={['code-block', 'image', 'formula']}
value={question_titles}
onContentChange={this.onContentChanges}
/>
</div>

@ -1,640 +0,0 @@
import React, {Component} from "react";
import {Link, NavLink} from 'react-router-dom';
import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder';
import axios from 'axios';
import {
notification,
Spin,
Table,
Pagination,
Radio,
Checkbox,
Form,
Input,
Select,
Cascader,
AutoComplete,
Col, Row, InputNumber, DatePicker, Button, Tag
} from "antd";
import './../questioncss/questioncom.css';
const InputGroup = Input.Group;
const {Option} = Select;
class Comthetestpapers extends Component {
constructor(props) {
super(props);
this.contentMdRef = React.createRef()
this.state = {
page: 1,
Knowpoints: [],
rbtx: undefined,
rbkc: undefined,
knowledgepoints: [],
options: [],
}
}
//初始化
componentDidMount() {
try {
this.props.getcontentMdRef(this);
} catch (e) {
}
this.setState({
options: this.props.disciplmy,
knowledgepoints: this.props.knowledgepoints,
})
}
handdisciplinesChange =(name,title)=>{
this.setState({
rbkc:[name.id,title.id]
})
this.props.form.setFieldsValue({
rbkc: [name.id,title.id],
});
if(this.props.item_banksedit.tag_disciplines.length===0){
const didata = this.props.disciplinesdata;
const knowledgepointsdata = [];
for (var i = 0; i < didata.length; i++) {
//方向
if (name.id === didata[i].id) {
const fxdidata = didata[i].sub_disciplines;
for (var j = 0; j < fxdidata.length; j++) {
//课程
if (title.id === fxdidata[j].id) {
const zsddata = fxdidata[j].tag_disciplines;
for (var k = 0; k < zsddata.length; k++) {
//知识点
knowledgepointsdata.push(zsddata[k]);
}
}
}
}
}
this.setState({
Knowpoints: [],
knowledgepoints: knowledgepointsdata,
})
}
}
handletag_disciplinesChange = (data) => {
try {
var sju=data[data.length-1].name;
this.setState({
rbzsd:sju,
Knowpoints:data,
})
this.props.form.setFieldsValue({
rbzsd: sju,
});
}catch (e) {
}
}
onChange = (e) => {
}
Getdatas = () => {
return this.handleSubmits();
}
handleSubmits = () => {
var data = [];
this.props.form.validateFields((err, values) => {
data = [];
if (!err) {
data.push({
rbnd: parseInt(values.rbnd)
})
data.push({
rbtx: values.rbtx
})
data.push({
rbzsd: this.state.Knowpoints
})
data.push({
rbkc: values.rbkc
})
data.push({
classroom:values.classroom
})
data.push({
kssc:values.kssc
})
}
});
return data;
}
handleSubmit = (e) => {
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
////console.log("获取的form 数据");
////console.log(values);
}
});
}
handleFormLayoutChange = (value) => {
//难度塞选
////console.log("难度塞选");
////console.log(value);
this.props.form.setFieldsValue({
rbnd: value + "",
});
this.setState({
rbnd: value + "",
})
}
handleFormkechen = (value) => {
//课程
////console.log("课程");
////console.log(value);
var valuename = undefined;
this.props.form.setFieldsValue({
rbzsd: value,
});
var arr = this.state.knowledgepoints;
for (let data of arr) {
if (data.id === value) {
this.state.Knowpoints.push(data);
valuename = data.name;
}
}
var tmp = JSON.parse(JSON.stringify(this.state.knowledgepoints));
for (var i = 0; i < tmp.length; i++) {
if (tmp[i].id === value) {
this.state.knowledgepoints.splice(i, 1);
}
}
this.setState({
rbzsd: valuename,
Knowpoints: this.state.Knowpoints,
knowledgepoints: this.state.knowledgepoints,
})
}
handleFormzhishidian = (value) => {
console.log("handleFormzhishidian 课程");
console.log(value);
//课程
this.props.form.setFieldsValue({
rbkc: value,
});
this.setState({
rbkc:value,
})
// console.log("handleFormzhishidian");
// console.log(this.props.disciplinesdata);
const didata = this.props.disciplinesdata;
const knowledgepointsdata = [];
for (var i = 0; i < didata.length; i++) {
//方向
if (value[0] === didata[i].id) {
const fxdidata = didata[i].sub_disciplines;
for (var j = 0; j < fxdidata.length; j++) {
//课程
if (value[1] === fxdidata[j].id) {
const zsddata = fxdidata[j].tag_disciplines;
for (var k = 0; k < zsddata.length; k++) {
//知识点
knowledgepointsdata.push(zsddata[k]);
}
}
}
}
}
this.setState({
Knowpoints: [],
knowledgepoints: knowledgepointsdata,
})
this.props.form.setFieldsValue({
rbzsd: undefined,
});
this.setState({
rbzsd: undefined,
})
}
handleFormtixing = (value) => {
//题型
//console.log("题型");
//console.log(value);
this.setState({
rbtx: value + "",
})
this.props.form.setFieldsValue({
rbtx: value + "",
});
this.props.setitem_type(value);
}
preventDefault = (e) => {
e.preventDefault();
////console.log('Clicked! But prevent default.');
}
deletesobject = (item, index) => {
var arr = this.state.Knowpoints;
for (let data of arr) {
if (data.id === item.id) {
this.state.knowledgepoints.push(data);
}
}
var tmp = JSON.parse(JSON.stringify(this.state.Knowpoints));
for (var i = 0; i < tmp.length; i++) {
if (i >= index) {
var pos = this.state.Knowpoints.indexOf(tmp[i]);
this.state.Knowpoints.splice(pos, 1);
}
}
this.props.form.setFieldsValue({
rbzsd: this.state.Knowpoints,
});
this.setState({
Knowpoints: this.state.Knowpoints,
})
if (this.state.Knowpoints.length === 0) {
this.setState({
rbzsd: undefined,
})
} else if (this.state.Knowpoints.length > 0) {
try {
const myknowda = this.state.Knowpoints;
this.setState({
rbzsd: myknowda[this.state.Knowpoints.length - 1].name,
})
} catch (e) {
}
}
}
handleSearch=(value)=>{
if(value!=""){
this.props.form.setFieldsValue({
classroom:value,
// course:value
});
// this.Searchvalue(value)
}
};
handleChange=(e)=>{
console.log(e);
this.props.form.setFieldsValue({
// course:value,
classroom:e.target.value,
})
if(e.target.value){
if(e.target.value.length>60){
this.setState({
bordebool:true,
})
}else if(e.target.value.length===0){
this.setState({
bordebool:true,
})
}else{
this.setState({
bordebool:false,
})
}
}else{
this.setState({
bordebool:true
})
}
};
render() {
let {page,options} = this.state;
const {getFieldDecorator} = this.props.form;
const optionss = this.state.searchlist && this.state.searchlist.map(d => <Option key={d.name} value={d.name}>{d.name}</Option>);
var addonAfterthree=this.props.form&&this.props.form.getFieldValue('classroom');
var addonAfteronelens3=0;
if(addonAfterthree){
addonAfteronelens3=String(addonAfterthree).length;
}
return (
<div className=" clearfix educontent Contentquestionbankstyle w100s w1200fpx mt19">
<style>
{
`
.ant-form-item{
margin-bottom: 0px !important;
}
.ant-form-explain{
padding-left:0px !important;
margin-top: 3px !important;
}
.ant-select-selection{
height: 33px !important;
}
.ant-input-group{
width:258px !important;
}
.ant-input {
height: 33px !important;
}
.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):focus-within {
outline: 0px solid rgba(24, 144, 255, 0.06) !important;
}
`
}
</style>
<div className="h12"></div>
<Form onSubmit={this.handleSubmit}>
<div className="kechen">
<Form.Item
label="课程:"
>
{getFieldDecorator("rbkc",
{
rules: [{required: true, message: '请选择课程'}],
}
)(
<div className="sortinxdirection">
<InputGroup compact>
<Cascader style={{width: '258px'}} value={this.state.rbkc} options={options} onChange={this.handleFormzhishidian}
placeholder="请选择..."/>
</InputGroup>
</div>
)}
</Form.Item>
</div>
<div className="zsdd">
<Form.Item
label="知识点:"
>
{getFieldDecorator("rbzsd"
)(
<div className="sortinxdirection">
<InputGroup compact>
<Select style={{width: '258px'}} value={this.state.rbzsd} onChange={this.handleFormkechen}
placeholder="请选择...">
{this.state.knowledgepoints && this.state.knowledgepoints.map((object, index) => {
return (
<Option value={object.id}>{object.name}</Option>
)
})}
</Select>
</InputGroup>
<div className="sortinxdirection" style={{
height: "33px",
lineHeight: "28px",
}}>
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
return (
<div className="mytags" style={{
position: "relative",
}}>
<p className="w100s stestcen lh32">{object.name}</p>
<i className="iconfont icon-roundclose font-25 lg ml7 icondowncolorss"
onClick={() => this.deletesobject(object, index)}></i>
</div>
)
})}
</div>
</div>
)}
</Form.Item>
</div>
<style>
{
`
.ml19{
margin-left:19px;
}
`
}
</style>
<div className="stud-class-set ">
<style>{
`
.yslzxueshis .ant-input{
border-right: none !important;
height: 38px !important;
width: 970px !important;
}
.yslzxueshisy span .ant-input-group-addon{
width: 65px !important;
background-color: #fafafa!important;
}
.yslzxueshisy .ant-input-group-addon{
width: 65px !important;
background-color: #fafafa!important;
}
`
}</style>
<div className="sjmc">
<Form.Item label="试卷名称:">
{getFieldDecorator('classroom', {
rules: [{required: true, message: "不能为空"}],
})(
<AutoComplete
onSearch={this.handleSearch}
className={"fl construction yslzxueshis "}
dataSource={optionss}
>
<Input className="yslzxueshisy " placeholder="例如:数据结构" onInput={this.handleChange} addonAfter={String(addonAfteronelens3)+"/60"} maxLength={60} />
</AutoComplete>
)}
<div id='isclassroom'></div>
</Form.Item>
</div>
</div>
<style>
{
`
.kssc .ant-form-item-label{
line-height: 38px !important;
}
`
}
</style>
<div className="kssc">
<Form.Item label="考试时长:">
{getFieldDecorator('kssc')(<InputNumber
min={0}
step={0.1}
></InputNumber>)}
<span className="ant-form-text"> 分钟</span>
</Form.Item>
</div>
{/*<div className="tixing">*/}
{/*<Form.Item*/}
{/* label="题型:"*/}
{/*>*/}
{/* {getFieldDecorator("rbtx",*/}
{/* {*/}
{/* rules: [{required: true, message: '请选择题型'}],*/}
{/* }*/}
{/* )(*/}
{/* <InputGroup compact>*/}
{/* <Select style={{width: '258px'}} value={this.state.rbtx} onChange={this.handleFormtixing}*/}
{/* placeholder="请选择...">*/}
{/* <Option value="SINGLE">单选题</Option>*/}
{/* <Option value="MULTIPLE">多选题</Option>*/}
{/* <Option value="JUDGMENT">判断题</Option>*/}
{/* <Option value="PROGRAM">编程题</Option>*/}
{/* </Select>*/}
{/* </InputGroup>*/}
{/* )}*/}
{/*</Form.Item>*/}
{/*</div>*/}
<style>
{
`
.rbndclass .ant-radio-button-wrapper{
width:106px !important;
height:33px !important;
background:#EEEEEE;
border-radius:17px !important;
color:#333333;
text-align: center !important;
border:0px !important;
margin-right: 27px !important;
margin-top: 6px !important;
}
.rbndclass .ant-radio-button-wrapper-checked {
width: 106px !important;
height: 33px !important;
background: #4CACFF !important;
border-radius: 17px !important;
text-align: center !important;
border:0px !important;
color: #ffffff !important;
margin-right: 27px !important;
margin-top: 6px!important;
}
.rbndclass .ant-radio-button-wrapper:not(:first-child)::before{
border:0px !important;
width:0px !important;
}
.rbndclass .ant-radio-button-wrapper{
border:0px !important;
}
.rbndclass .ant-radio-group{
border:0px !important;
}
.rbndclass .ant-radio-group label{
border:0px !important;
}
.rbndclass .ant-radio-group span{
border:0px !important;
}
ant-radio-button-wrapper:focus-within {
outline: 0px solid #ffffff;
}
`
}
</style>
<div className="rbndclass">
<Form.Item label="难度:">
{getFieldDecorator('rbnd',
{
rules: [{required: true, message: '请选择难度'}],
}
)(
<Radio.Group value={this.state.rbnd} onChange={this.handleFormLayoutChange}>
<Radio.Button value="1">简单</Radio.Button>
<Radio.Button value="2">适中</Radio.Button>
<Radio.Button value="3">困难</Radio.Button>
</Radio.Group>,
)}
</Form.Item>
</div>
</Form>
<div className="h20"></div>
</div>
)
}
}
const Comthetestpaperss = Form.create({name: 'Itembankstops'})(Comthetestpapers);
export default Comthetestpaperss;

@ -41,7 +41,7 @@ const options = [
],
},
];
//Itembankstop 题库的
class Comthetestpaperst extends Component {
constructor(props) {
super(props);
@ -54,10 +54,16 @@ class Comthetestpaperst extends Component {
knowledgepoints: [],
knowledgepoints2:[],
options: [],
NewknTypedel:false
NewknTypedel:false,
boolred:false,
}
}
setboolred=(bool)=>{
this.setState({
boolred:bool
})
}
//初始化
componentDidMount() {
try {
@ -125,7 +131,9 @@ class Comthetestpaperst extends Component {
// this.handleFormtixing(this.props.item_banksedit.item_type);
// }
if (this.props.item_banksedit.difficulty) {
this.handleFormLayoutChange(this.props.item_banksedit.difficulty);
// this.handleFormLayoutChange(this.props.item_banksedit.difficulty);
this.handleFormLayoutChangeysl(this.props.item_banksedit.difficulty);
}
if (this.props.item_banksedit.tag_disciplines) {
this.handletag_disciplinesChange(this.props.item_banksedit.tag_disciplines);
@ -231,7 +239,7 @@ class Comthetestpaperst extends Component {
};
handleChange=(e)=>{
console.log(e);
//console.log(e);
this.props.form.setFieldsValue({
// course:value,
classroom:e.target.value,
@ -316,19 +324,19 @@ class Comthetestpaperst extends Component {
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
////console.log("获取的form 数据");
////console.log(values);
//////console.log("获取的form 数据");
//////console.log(values);
}
});
}
handleFormLayoutChange = (value) => {
handleFormLayoutChangeysl = (value) => {
//难度塞选
////console.log("难度塞选");
////console.log(value);
//////console.log("难度塞选");
//////console.log(value);
this.props.form.setFieldsValue({
rbnd: value + "",
});
@ -336,11 +344,24 @@ class Comthetestpaperst extends Component {
rbnd: value + "",
})
}
handleFormLayoutChange = (e) => {
//难度塞选
//////console.log("难度塞选");
//////console.log(value);
this.props.form.setFieldsValue({
rbnd: e.target.value + "",
});
this.setState({
rbnd: e.target.value + "",
})
}
handleFormkechen = (value) => {
//课程
////console.log("课程");
////console.log(value);
//////console.log("课程");
//////console.log(value);
if(this.state.Knowpoints.length>4){
this.props.showNotification(`知识点最多选择5个`);
return
@ -361,8 +382,8 @@ class Comthetestpaperst extends Component {
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
console.log("guonue");
console.log(item);
//console.log("guonue");
//console.log(item);
_result.push(item);
}
});
@ -377,8 +398,8 @@ class Comthetestpaperst extends Component {
}
handleFormzhishidian = (value) => {
console.log("handleFormzhishidian 课程");
console.log(value);
//console.log("handleFormzhishidian 课程");
//console.log(value);
//课程
this.props.form.setFieldsValue({
@ -387,8 +408,8 @@ class Comthetestpaperst extends Component {
this.setState({
rbkc:value,
})
// console.log("handleFormzhishidian");
// console.log(this.props.disciplinesdata);
// //console.log("handleFormzhishidian");
// //console.log(this.props.disciplinesdata);
const didata = this.props.disciplinesdata;
const knowledgepointsdata = [];
@ -432,8 +453,8 @@ class Comthetestpaperst extends Component {
handleFormtixing = (value) => {
//题型
//console.log("题型");
//console.log(value);
////console.log("题型");
////console.log(value);
this.setState({
rbtx: value + "",
})
@ -444,7 +465,7 @@ class Comthetestpaperst extends Component {
}
preventDefault = (e) => {
e.preventDefault();
////console.log('Clicked! But prevent default.');
//////console.log('Clicked! But prevent default.');
}
deletesobject = (item, index) => {
debugger
@ -488,6 +509,10 @@ class Comthetestpaperst extends Component {
}
NewknTypedeldel=(bool)=>{
if(this.state.rbkc===undefined || this.state.rbkc===null || this.state.rbkc===""){
this.props.showNotification(`请选择课程方向`);
return;
}
this.setState({
NewknTypedel:bool
})
@ -495,21 +520,30 @@ class Comthetestpaperst extends Component {
}
NewknTypedeltyoedel=(value)=>{
var knowledgepointmys= this.state.knowledgepoints;
for(let myda of knowledgepointmys) {
if(myda.name===value){
this.props.showNotification(`重复的知识点`);
this.setboolred(true);
break;
}
}
if(value===null||value===""){
this.props.showNotification(`请输入知识点`);
this.setboolred(true);
return
}
if(value.length===0){
this.props.showNotification(`请输入知识点`);
this.setboolred(true);
return
}
if(this.state.rbkc===undefined || this.state.rbkc===null || this.state.rbkc===""){
this.props.showNotification(`请选择课程方向`);
return;
}
var data={
name:value,
sub_discipline_id:this.state.rbkc[1]
@ -518,27 +552,44 @@ class Comthetestpaperst extends Component {
axios.post(url,data)
.then((result) => {
if (result.data.status === 0) {
this.props.showNotification(`新增知识点成功!`);
// this.props.showNotification(`新增知识点成功!`);
var leydata={
id: result.data.tag_discipline_id,
name:value,
}
this.state.knowledgepoints.push(leydata);
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
Knowpoints: this.state.Knowpoints,
knowledgepoints: this.state.knowledgepoints,
knowledgepoints2: _result,
})
if(this.state.Knowpoints.length>=5){
this.state.knowledgepoints.push(leydata);
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
Knowpoints: this.state.Knowpoints,
knowledgepoints: this.state.knowledgepoints,
knowledgepoints2: _result,
})
}else{
this.state.Knowpoints.push(leydata);
this.state.knowledgepoints.push(leydata);
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
Knowpoints: this.state.Knowpoints,
knowledgepoints: this.state.knowledgepoints,
knowledgepoints2: _result,
})
}
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
this.setState({
@ -575,7 +626,23 @@ class Comthetestpaperst extends Component {
.ant-select-selection{
height: 33px !important;
}
.ant-input-group{
.kechen .ant-input-group{
width:258px !important;
}
.zsdd .ant-input-group{
width:258px !important;
}
.sjmc .ant-input-group{
width:258px !important;
}
.kssc .ant-input-group{
width:258px !important;
}
.rbndclass .ant-input-group{
width:258px !important;
}
.ant-input {
@ -593,6 +660,8 @@ class Comthetestpaperst extends Component {
{
NewknTypedel?
<Newknledpots {...this.state} {...this.props}
boolred={this.state.boolred}
setboolred={(bool)=>this.setboolred(bool)}
NewknTypedeldel={(bool)=>this.NewknTypedeldel(bool)}
NewknTypedeltyoedel={(value)=>this.NewknTypedeltyoedel(value)}
></Newknledpots>
@ -600,24 +669,24 @@ class Comthetestpaperst extends Component {
}
<Form onSubmit={this.handleSubmit}>
<div className="kechen">
<div className="sortinxdirection">
<Form.Item
label="课程"
>
{getFieldDecorator("rbkc",
{
{getFieldDecorator("rbkc"
,
{initialValue: this.state.rbkc,
rules: [{required: true, message: '请选择课程'}],
}
)(
<div className="sortinxdirection">
<InputGroup compact>
<Cascader style={{width: '258px'}} value={this.state.rbkc} options={options} onChange={this.handleFormzhishidian}
<Cascader style={{width: '258px'}} options={options} onChange={this.handleFormzhishidian}
placeholder="请选择..."/>
</InputGroup>
</div>
)}
</Form.Item>
</div>
</div>
<div className="zsdd">
<Form.Item
label="知识点"
>
@ -637,36 +706,37 @@ class Comthetestpaperst extends Component {
<img className=" ml22 zjzsdian xiaoshou" src={getImageUrl("/images/educoder/zjzsd.png")} onClick={()=>this.NewknTypedeldel(true)}/>
<img className=" ml22 zjzsdian xiaoshou" src={getImageUrl("images/educoder/zjzsd.png")} onClick={()=>this.NewknTypedeldel(true)}/>
<div className="sortinxdirection" style={{
height: "33px",
lineHeight: "28px",
</div>
)}
</Form.Item>
</div>
{
this.state.Knowpoints===undefined||this.state.Knowpoints===null?"":
this.state.Knowpoints.length>0?
<div className="sortinxdirection huanhan w100s mt15" style={{
minHeight: "33px",
lineHeight: "28px",
}}>
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
return (
<div key={index} className="mytags" style={{
<div key={index} className={index===0?"mytags mb20":"mytags"} style={{
position: "relative",
}}>
<p className="w100s stestcen lh32">{object.name}</p>
<img className=" ml7 zjzsdian xiaoshou icondowncolorssy" onClick={() => this.deletesobject(object, index)} src={getImageUrl("/images/educoder/bzucha.png")}/>
<img className=" ml7 zjzsdian xiaoshou icondowncolorssy" onClick={() => this.deletesobject(object, index)} src={getImageUrl("images/educoder/bzucha.png")}/>
</div>
)
})}
</div>
</div>
)}
</Form.Item>
:
""
}
<style>
{
`
@ -706,7 +776,7 @@ class Comthetestpaperst extends Component {
className={"fl construction yslzxueshis "}
dataSource={optionss}
>
<Input className="yslzxueshisy " placeholder="例如:数据结构" onInput={this.handleChange} addonAfter={String(addonAfteronelens3)+"/60"} maxLength={60} />
<Input className="yslzxueshisy " placeholder="请输入名称最大限制60个字符" onInput={this.handleChange} addonAfter={String(addonAfteronelens3)+"/60"} maxLength={60} />
</AutoComplete>
)}
<div id='isclassroom'></div>
@ -791,12 +861,13 @@ class Comthetestpaperst extends Component {
</style>
<div className="rbndclass">
<Form.Item label="难度">
{getFieldDecorator('rbnd',
{
{getFieldDecorator('rbnd'
,
{initialValue: this.state.rbnd,
rules: [{required: true, message: '请选择难度'}],
}
)(
<Radio.Group initialValue={this.state.rbnd} onChange={this.handleFormLayoutChange}>
<Radio.Group onChange={this.handleFormLayoutChange}>
<Radio.Button value="1">简单</Radio.Button>
<Radio.Button value="2">适中</Radio.Button>
<Radio.Button value="3">困难</Radio.Button>

@ -0,0 +1,831 @@
import React, {Component} from "react";
import {Link, NavLink} from 'react-router-dom';
import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder';
import axios from 'axios';
import {
notification,
Spin,
Table,
Pagination,
Radio,
Checkbox,
Form,
Input,
Select,
Cascader,
Col, Row, InputNumber, DatePicker, AutoComplete, Button, Tag,Icon
} from "antd";
import './../questioncss/questioncom.css';
import Newknledpots from '../component/Newknledpots';
import Ldanxuan from './lntlligentpone';
const InputGroup = Input.Group;
const {Option} = Select;
//Itembankstop Comthetestpaperst 题库的
class Intelligentcomponents extends Component {
constructor(props) {
super(props);
this.contentMdRef = React.createRef()
this.state = {
page: 1,
Knowpoints: [],
rbtx: undefined,
rbkc: undefined,
knowledgepoints: [],
knowledgepoints2:[],
options: [],
NewknTypedel:false,
boolred:false,
rbly:"1"
}
}
setboolred=(bool)=>{
this.setState({
boolred:bool
})
}
//初始化
componentDidMount() {
try {
this.props.getJudquestio(this);
} catch (e) {
}
this.setState({
options: this.props.disciplmy,
})
}
componentDidUpdate(prevProps) {
//编辑的时候
if (prevProps.disciplmy !== this.props.disciplmy) {
this.setState({
options: this.props.disciplmy
})
}
}
handdisciplinesChange =(name,title)=>{
this.setState({
rbkc:[name.id,title.id]
})
this.props.form.setFieldsValue({
rbkc: [name.id,title.id],
});
}
handleSearch=(value)=>{
if(value!=""){
this.props.form.setFieldsValue({
classroom:value,
// course:value
});
// this.Searchvalue(value)
}
};
handleChange=(e)=>{
//console.log(e);
if(e.target.value){
if(e.target.value.length>60){
this.setState({
bordebool:true,
})
}else if(e.target.value.length===0){
this.setState({
bordebool:true,
})
}else{
this.setState({
bordebool:false,
})
}
}else{
this.setState({
bordebool:true
})
}
};
handletag_disciplinesChange = (data) => {
//是否选中的知识点
try {
var sju=data[data.length-1].name;
this.setState({
Knowpoints:data,
})
this.props.form.setFieldsValue({
rbzsd: sju,
});
}catch (e) {
}
}
onChange = (e) => {
}
Getdatas = () => {
return this.handleSubmits();
}
handleSubmits = () => {
var dxt=0;
var dxtx=0;
var pdt=0;
var bct=0;
try {
dxt=this.$dxt.mygetinputnumber();
}catch (e) {
dxt=0;
}
try {
dxtx=this.$ddxt.mygetinputnumber();
}catch (e) {
dxtx=0;
}
try {
pdt=this.$pdt.mygetinputnumber();
}catch (e) {
pdt=0;
}
try {
bct=this.$bct.mygetinputnumber();
}catch (e) {
bct=0;
}
var data = [];
this.props.form.validateFields((err, values) => {
data = [];
if (!err) {
data.push({
rbnd: parseInt(values.rbnd)
})
data.push({
rbzsd: this.state.Knowpoints
})
data.push({
rbkc: values.rbkc
})
data.push({
rbdxt: dxt
})
data.push({
rbdxtx: dxtx
})
data.push({
rbpdt: pdt
})
data.push({
rbbct: bct
})
data.push({
rbly: parseInt(values.rbly)
})
}
});
return data;
}
handleSubmit = (e) => {
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
//////console.log("获取的form 数据");
//////console.log(values);
}
});
}
handleFormLayoutChanges = (e) => {
// //console.log("handleFormLayoutChanges");
// //console.log(value);
// debugger
//来源
this.props.form.setFieldsValue({
rbly: e.target.value + "",
});
this.setState({
rbly: e.target.value + "",
})
try {
this.props.getdatassssy(e.target.value);
}catch (e) {
}
}
handleFormLayoutChange = (e) => {
// //console.log("handleFormLayoutChange");
// //console.log(value);
// debugger
//难度塞选
this.props.form.setFieldsValue({
rbnd: e.target.value + "",
});
this.setState({
rbnd: e.target.value + "",
});
try {
this.props.getdatass(parseInt(e.target.value));
}catch (e) {
}
}
handleFormkechen = (value) => {
//课程
if(this.state.Knowpoints.length>4){
this.props.showNotification(`知识点最多选择5个`);
return
}
var valuename = undefined;
this.props.form.setFieldsValue({
rbzsd: value,
});
var arr = this.state.knowledgepoints;
for (let data of arr) {
if (data.id === value) {
this.state.Knowpoints.push(data);
valuename = data.name;
}
}
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
rbzsd: valuename,
Knowpoints: this.state.Knowpoints,
knowledgepoints2: _result,
})
try {
this.props.getdatassss(this.state.Knowpoints);
}catch (e) {
}
}
handleFormzhishidian = (value) => {
//console.log("handleFormzhishidian 课程");
//console.log(value);
//课程
this.props.form.setFieldsValue({
rbkc: value,
});
this.setState({
rbkc:value,
})
// //console.log("handleFormzhishidian");
// //console.log(this.props.disciplinesdata);
const didata = this.props.disciplinesdata;
const knowledgepointsdata = [];
for (var i = 0; i < didata.length; i++) {
//方向
if (value[0] === didata[i].id) {
const fxdidata = didata[i].sub_disciplines;
for (var j = 0; j < fxdidata.length; j++) {
//课程
if (value[1] === fxdidata[j].id) {
const zsddata = fxdidata[j].tag_disciplines;
for (var k = 0; k < zsddata.length; k++) {
//知识点
knowledgepointsdata.push(zsddata[k]);
}
}
}
}
}
this.setState({
Knowpoints: [],
knowledgepoints: knowledgepointsdata,
knowledgepoints2:knowledgepointsdata,
})
this.props.form.setFieldsValue({
rbzsd: undefined,
});
this.setState({
rbzsd: undefined,
})
try {
this.props.getdatasss(parseInt(value[1]));
}catch (e) {
}
}
handleFormtixing = (value) => {
//题型
////console.log("题型");
////console.log(value);
this.setState({
rbtx: value + "",
})
this.props.form.setFieldsValue({
rbtx: value + "",
});
this.props.setitem_type(value);
}
preventDefault = (e) => {
e.preventDefault();
//////console.log('Clicked! But prevent default.');
}
deletesobject = (item, index) => {
var tmp = this.state.Knowpoints;
for (var i = 0; i < tmp.length; i++) {
if (i ===index) {
tmp.splice(i,1);
}
}
this.props.form.setFieldsValue({
rbzsd: this.state.Knowpoints,
});
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
Knowpoints: this.state.Knowpoints,
knowledgepoints2:_result,
})
if (this.state.Knowpoints.length === 0) {
this.setState({
rbzsd: undefined,
})
} else if (this.state.Knowpoints.length > 0) {
try {
const myknowda = this.state.Knowpoints;
this.setState({
rbzsd: myknowda[this.state.Knowpoints.length - 1].name,
})
} catch (e) {
}
}
//删除知识点
try {
this.props.getdatassss(this.state.Knowpoints);
}catch (e) {
}
}
NewknTypedeldel=(bool)=>{
if(this.state.rbkc===undefined || this.state.rbkc===null || this.state.rbkc===""){
this.props.showNotification(`请选择课程方向`);
return;
}
this.setState({
NewknTypedel:bool
})
}
NewknTypedeltyoedel=(value)=>{
var knowledgepointmys= this.state.knowledgepoints;
for(let myda of knowledgepointmys) {
if(myda.name===value){
this.props.showNotification(`重复的知识点`);
this.setboolred(true);
break;
}
}
if(value===null||value===""){
this.props.showNotification(`请输入知识点`);
this.setboolred(true);
return
}
if(value.length===0){
this.props.showNotification(`请输入知识点`);
this.setboolred(true);
return
}
var data={
name:value,
sub_discipline_id:this.state.rbkc[1]
}
const url="/tag_disciplines.json";
axios.post(url,data)
.then((result) => {
if (result.data.status === 0) {
// this.props.showNotification(`新增知识点成功!`);
var leydata={
id: result.data.tag_discipline_id,
name:value,
}
if(this.state.Knowpoints.length>=5){
this.state.knowledgepoints.push(leydata);
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
Knowpoints: this.state.Knowpoints,
knowledgepoints: this.state.knowledgepoints,
knowledgepoints2: _result,
})
}else{
this.state.Knowpoints.push(leydata);
this.state.knowledgepoints.push(leydata);
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
Knowpoints: this.state.Knowpoints,
knowledgepoints: this.state.knowledgepoints,
knowledgepoints2: _result,
})
}
}
}).catch((error) => {
////console.log(error);
})
//新增知识点
try {
this.getdatassss(this.state.Knowpoints);
}catch (e) {
}
this.setState({
NewknTypedel:false
})
}
render() {
let {page, options,NewknTypedel,knowledgepoints,knowledgepoints2,Knowpoints} = this.state;
const {getFieldDecorator} = this.props.form;
const optionss = this.state.searchlist && this.state.searchlist.map(d => <Option key={d.name} value={d.name}>{d.name}</Option>);
return (
<div className=" clearfix educontent Contentquestionbankstyle w100s w1200fpx mt19">
<style>
{
`
.ant-form-item{
margin-bottom: 0px !important;
}
.ant-form-explain{
padding-left:0px !important;
margin-top: 3px !important;
}
.ant-select-selection{
height: 33px !important;
}
.kechen .ant-input-group{
width:258px !important;
}
.zsdd .ant-input-group{
width:258px !important;
}
.sjmc .ant-input-group{
width:258px !important;
}
.kssc .ant-input-group{
width:258px !important;
}
.rbndclass .ant-input-group{
width:258px !important;
}
.ant-input {
height: 33px !important;
}
.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):focus-within {
outline: 0px solid rgba(24, 144, 255, 0.06) !important;
}
`
}
</style>
<div className="h12"></div>
{
NewknTypedel?
<Newknledpots {...this.state} {...this.props}
boolred={this.state.boolred}
setboolred={(bool)=>this.setboolred(bool)}
NewknTypedeldel={(bool)=>this.NewknTypedeldel(bool)}
NewknTypedeltyoedel={(value)=>this.NewknTypedeltyoedel(value)}
></Newknledpots>
:""
}
<Form onSubmit={this.handleSubmit}>
<div className="kechen">
<div className="sortinxdirection">
<Form.Item
label="课程"
>
{getFieldDecorator("rbkc"
,
{initialValue: this.state.rbkc,
rules: [{required: true, message: '请选择课程'}],
}
)(
<Cascader style={{width: '258px'}} options={options} onChange={this.handleFormzhishidian}
placeholder="请选择..."/>
)}
</Form.Item>
</div>
</div>
<div className="zsdd">
<Form.Item
label="知识点"
>
{getFieldDecorator("rbzsd"
)(
<div className="sortinxdirection">
<InputGroup compact>
<Select style={{width: '258px'}} value={undefined} onChange={this.handleFormkechen}
placeholder="请选择...">
{knowledgepoints2 && knowledgepoints2.map((object, index) => {
return (
<Option key={object.id} value={object.id}>{object.name}</Option>
)
})}
</Select>
</InputGroup>
<img className=" ml22 zjzsdian xiaoshou" src={getImageUrl("images/educoder/zjzsd.png")} onClick={()=>this.NewknTypedeldel(true)}/>
</div>
)}
</Form.Item>
</div>
{
this.state.Knowpoints===undefined||this.state.Knowpoints===null?"":
this.state.Knowpoints.length>0?
<div className="sortinxdirection huanhan w100s mt15" style={{
minHeight: "33px",
lineHeight: "28px",
}}>
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
return (
<div key={index} className={index===0?"mytagss mb20":"mytagss"} style={{
position: "relative",
}}>
<p className="w100s stestcen lh32">{object.name}</p>
<img className=" ml7 zjzsdian xiaoshou icondowncolorssy" onClick={() => this.deletesobject(object, index)} src={getImageUrl("images/educoder/bzucha.png")}/>
</div>
)
})}
</div>
:
""
}
<style>
{
`
.rbndclasss .ant-radio-button-wrapper{
width:106px !important;
height:33px !important;
background:#EEEEEE;
border-radius:2px;
color:#333333;
text-align: center !important;
border:0px !important;
margin-right: 27px !important;
margin-top: 6px !important;
}
.rbndclasss .ant-radio-button-wrapper-checked {
width: 106px !important;
height: 33px !important;
background: #4CACFF !important;
border-radius:2px;
text-align: center !important;
border:0px !important;
color: #ffffff !important;
margin-right: 27px !important;
margin-top: 6px!important;
}
.rbndclasss .ant-radio-button-wrapper:not(:first-child)::before{
border:0px !important;
width:0px !important;
}
.rbndclasss .ant-radio-button-wrapper{
border:0px !important;
}
.rbndclasss .ant-radio-group{
border:0px !important;
}
.rbndclasss .ant-radio-group label{
border:0px !important;
}
.rbndclasss .ant-radio-group span{
border:0px !important;
}
ant-radio-button-wrapper:focus-within {
outline: 0px solid #ffffff;
}
`
}
</style>
<div className="rbndclasss">
<Form.Item label="来源">
{getFieldDecorator('rbly'
,
{initialValue: this.state.rbly,
}
)(
<Radio.Group onChange={this.handleFormLayoutChanges}>
<Radio.Button value="1">公共</Radio.Button>
<Radio.Button value="0">我的</Radio.Button>
</Radio.Group>,
)}
</Form.Item>
</div>
<p className="conditionsetting mt40">条件设置</p>
<div className="hengxians mt13"></div>
<style>
{
`
.rbndclass .ant-radio-button-wrapper{
width:106px !important;
height:33px !important;
background:#EEEEEE;
border-radius:17px !important;
color:#333333;
text-align: center !important;
border:0px !important;
margin-right: 27px !important;
margin-top: 6px !important;
}
.rbndclass .ant-radio-button-wrapper-checked {
width: 106px !important;
height: 33px !important;
background: #4CACFF !important;
border-radius: 17px !important;
text-align: center !important;
border:0px !important;
color: #ffffff !important;
margin-right: 27px !important;
margin-top: 6px!important;
}
.rbndclass .ant-radio-button-wrapper:not(:first-child)::before{
border:0px !important;
width:0px !important;
}
.rbndclass .ant-radio-button-wrapper{
border:0px !important;
}
.rbndclass .ant-radio-group{
border:0px !important;
}
.rbndclass .ant-radio-group label{
border:0px !important;
}
.rbndclass .ant-radio-group span{
border:0px !important;
}
ant-radio-button-wrapper:focus-within {
outline: 0px solid #ffffff;
}
`
}
</style>
<div className="rbndclass">
<Form.Item label="试卷难度">
{getFieldDecorator('rbnd'
,
{initialValue: this.state.rbnd,
rules: [{required: true, message: '请选择难度'}],
}
)(
<Radio.Group onChange={this.handleFormLayoutChange}>
<Radio.Button value="1">简单</Radio.Button>
<Radio.Button value="2">适中</Radio.Button>
<Radio.Button value="3">困难</Radio.Button>
</Radio.Group>,
)}
</Form.Item>
</div>
</Form>
{
this.props.single_question_count===0&&this.props.multiple_question_count===0&&this.props.judgement_question_count===0&&
this.props.program_question_count===0?
""
:
<div>
<p className={"conditionsettings mt40"}>题型及数量</p>
<div className={"hengxians mt13"}></div>
<Ldanxuan {...this.state} {...this.props} dxtx={"单选题:"} mycount={this.props.single_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
this.$dxt = dom;
}}></Ldanxuan>
<Ldanxuan {...this.state} {...this.props} dxtx={"多选题:"} mycount={this.props.multiple_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
this.$ddxt = dom;
}}></Ldanxuan>
<Ldanxuan {...this.state} {...this.props} dxtx={"判断题:"} mycount={this.props.judgement_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
this.$pdt = dom;
}}></Ldanxuan>
<Ldanxuan {...this.state} {...this.props} dxtx={"编程题:"} mycount={this.props.program_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
this.$bct = dom;
}}></Ldanxuan>
</div>
}
<div className="h20"></div>
</div>
)
}
}
const Intelligentcomponentss = Form.create({name: 'Intelligentcomponents'})(Intelligentcomponents);
export default Intelligentcomponentss;

@ -0,0 +1,169 @@
import React, {Component} from "react";
import {Link, NavLink} from 'react-router-dom';
import {WordsBtn, ActionBtn, getImageUrl, markdownToHTML} from 'educoder';
import axios from 'axios';
import {
notification,
Spin,
Table,
Pagination,
Drawer,
Input,
Button,
Breadcrumb,
Icon,
InputNumber,
Tooltip
} from "antd";
import '../questioncss/questioncom.css';
//判断题
class lntlligentpone extends Component {
constructor(props) {
super(props);
this.state = {
count: 0,
countbool: false,
}
}
//初始化
componentDidMount() {
}
increase = () => {
const datasbool=this.props.getdatas();
// if(datasbool===undefined || datasbool===null){
// if(this.props.mycount===0){
// this.props.showNotification(`题数为0无法增加题目`);
// return
// }
//
// }
const count = this.state.count + 1;
if(count<=this.props.mycount){
this.setState({count: count, countbool: false});
}
};
decline = () => {
const datasbool=this.props.getdatas();
// if(datasbool===undefined || datasbool===null){
// if(this.props.mycount===0){
// this.props.showNotification(`题数为0无法减少题目`);
// return
// }
// }
let count = this.state.count - 1;
if (count < 0) {
count = 0;
}
this.setState({count: count, countbool: false});
};
inputsnumber = (value) => {
const datasbool=this.props.getdatas();
// if(datasbool===undefined || datasbool===null){
// if(this.props.mycount===0){
// this.setState({count: 0, countbool: false});
// this.props.showNotification(`题数为0无法输入`);
// return
// }
// }
if(this.props.mycount===0){
this.setState({count: 0, countbool: false});
}else {
this.setState({count: value, countbool: false});
}
}
//返回数据
mygetinputnumber=()=>{
return this.state.count;
}
isNumber=(val)=>{
var regPos = /^\d+(\.\d+)?$/; //非负浮点数
var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
if(regPos.test(val) && regNeg.test(val)){
return true;
}else{
return false;
}
}
render() {
let {questions, totalscore, total, items} = this.state;
return (
<div>
<p className="dxuantitie mt19">{this.props.dxtx}</p>
{
this.props.mycount===0?
<div className="sortinxdirection mt10 inpustredssdiv">
<Tooltip placement="top" title={"题数为0无法减少"}>
<Button disabled={this.props.mycount===0?true:false} onClick={this.decline}>
<Icon type="minus"/>
</Button>
</Tooltip>
<div className={this.state.countbool === true ? "inpustredss ml12 mr12" : "ml12 mr12"}>
<Tooltip placement="top" title={"题数为0无法输入"}>
<InputNumber
disabled={this.props.mycount===0?true:false}
min={0}
value={this.state.count}
onChange={this.inputsnumber}
></InputNumber>
</Tooltip>
</div>
<Tooltip placement="top" title={"题数为0无法增加"}>
<Button disabled={this.props.mycount===0?true:false} onClick={this.increase}>
<Icon type="plus"/>
</Button>
</Tooltip>
<p className={"ml23 lh32"}>{this.props.mycount}</p>
</div>
:
<div className="sortinxdirection mt10 inpustredssdiv">
<Button onClick={this.decline}>
<Icon type="minus"/>
</Button>
<div className={this.state.countbool === true ? "inpustredss ml12 mr12" : "ml12 mr12"}>
<InputNumber
min={0}
value={this.state.count}
onChange={this.inputsnumber}
></InputNumber>
</div>
<Button onClick={this.increase}>
<Icon type="plus"/>
</Button>
<p className={"ml23 lh32"}>{this.props.mycount}</p>
</div>
}
</div>
)
}
}
export default lntlligentpone

@ -323,7 +323,8 @@
.listjihetixingstitsy {
color: #333333;
font-size: 14px;
line-height: 25px;
line-height: 20px !important;
height: 25px !important;
}
.listjihetixingstits{
@ -332,6 +333,12 @@
line-height:19px;
margin-top: 19px;
}
.listjihetixingstitsp{
color: #333333;
font-size: 14px;
line-height:19px;
margin-top: 10px;
}
.listjihetixingstitssy{
color: #333333;
font-size: 14px;
@ -372,7 +379,7 @@
.selectionss{
width:88px;
height:30px;
background:#eeeeee;
background:#CCCCCC;
border-radius:4px;
text-align: center;
line-height: 30px;
@ -399,7 +406,7 @@
padding-bottom: 20px;
}
.icontianjiadaohangcolor{
color: #FFFFFF;
color: #ffffff;
}
.icontianjiadaohangcolors{
@ -518,11 +525,18 @@
margin-top: 19px;
}
.mytags{
width:106px;
min-width:106px !important;
height:32px;
border-radius:2px;
border:1px solid #DDDDDD;
margin-left: 20px;
margin-right: 20px;
}
.mytagss{
min-width:106px !important;
height:32px;
border-radius:2px;
border:1px solid #DDDDDD;
margin-right: 20px;
}
.lh32{
line-height: 32px;
@ -747,6 +761,17 @@
font-size:12px;
}
.szdfds{
width:100px;
height:40px;
background:#FC7E30;
border-radius:4px 4px 0px 0px;
text-align: center;
color: #ffffff;
line-height: 40px;
margin-right: 27px;
font-size:12px;
}
.pd20{
padding: 20px;
@ -779,6 +804,9 @@
line-height: 20px;
background-color: #fff;
}
.lh20s{
line-height: 20px;
}
.backgroudwhites{
background-color: #fff;
@ -882,3 +910,159 @@
border-radius: 4px;
top: -50%;
}
.shitikussmys{
width:29px !important;
height:20px!important;
background:#FF6601 !important;
border-radius:10px !important;
position: absolute !important;
font-size:11px !important;
color:#ffffff !important;
line-height:20px !important;
top: -14px !important;
right: -14px !important;
}
.maxnamewidth30{
max-width: 30px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
cursor: default;
}
.ball {
width: 8px;
height: 8px;
background: #FF6601;
position: absolute;
left: 0;
top: 0;
border-radius: 50%;
opacity: 0;
z-index: 1;
}
.mt25{
margin-top: 25px;
}
.mr15{
margin-right: 15px;
}
.fangdatwo{
background: #fefefe;
background-color: #fefefe;
height: 100%;
overflow-y: scroll !important;
width: 100%;
position: fixed;
top:0px;
bottom: 0px;
left: 0px;
z-index: 999999;
right: 0px;
}
.searchwidth{
width: 347px !important;
}
.lh26{
line-height: 26px !important;
}
.tites{
color: #888888 !important;
}
.ant-popover-inner-content{
padding: 0px !important;
}
.huanhan{
flex-wrap: wrap;
}
.mb20{
margin-bottom: 20px;
}
.inpustred .ant-input{
border: 1px solid #f30707;
border-radius: 5px;
}
.mt15{
margin-top: 15px;
}
.conditionsetting{
width:64px;
height:21px;
font-size:16px;
color:#333333;
line-height:21px;
}
.hengxians{
width:1021px;
height:1px;
background: #EEEEEE;
}
.mt13{
margin-top: 13px;
}
.inpustredss .ant-input-number{
border: 1px solid #f30707;
border-radius: 5px;
}
.inpustredssdiv button {
border-radius: 50%;
width: 38px;
height: 38px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.inpustredssdiv .ant-input-number-input{
text-align: center;
}
.lh32{
line-height: 32px;
}
.ml23{
margin-left: 23px;
}
.ml12{
margin-left: 12px;
}
.mr12{
margin-right: 12px;
}
.tishiyuyan{
color: #888888 !important;
font-size:14px;
}
.tishiyuyans{
color: #4CACFF !important;
font-size:14px;
}
.tikutask-btn{
width:80px;
height:34px;
background:rgba(204,204,204,1);
border-radius:4px;
}
.tikutask-btns{
width:80px;
height:34px;
background:rgba(76,172,255,1);
border-radius:4px;
}
.w100{
width: 100px !important;
}
.h34{
height: 34px !important;
}
.lh34{
line-height: 34px !important;
}

@ -0,0 +1,418 @@
import React, {Component} from "react";
import {Link, NavLink} from 'react-router-dom';
import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder';
import axios from 'axios';
import {
notification,
Spin,
Table,
Pagination,
Drawer,
Input,
Button,
Breadcrumb
} from "antd";
import {TPMIndexHOC} from "../tpm/TPMIndexHOC";
import './testioncss/testioncss.css';
import '../tpm/newshixuns/css/Newshixuns.css';
import Bottomsubmit from "../../modules/modals/Bottomsubmit";
import Intelligentcomponents from "../question/comthetestpaper/Intelligentcomponents";
//试卷编辑
class Intecomponents extends Component {
constructor(props) {
super(props);
this.Judquestio = React.createRef();
this.state = {
paperlibrartdata: [],
disciplinesdata: [],
knowledgepoints: [],
disciplmy: [],
item_banksedit: [],
newmyshixunmodelbool:false,
single_question_count:0,
multiple_question_count:0,
judgement_question_count:0,
program_question_count:0,
}
}
getJudquestio = (Ref) => {
//console.log("子组件对象");
//console.log(Ref);
this.Judquestio = Ref;
}
//初始化
componentDidMount() {
let urls = `/disciplines.json`;
axios.get(urls, {
params: {
source: "question"
}
}).then((response) => {
if (response) {
this.setState({
disciplinesdata: response.data.disciplines,
})
if (response.data) {
if (response.data.disciplines) {
const didata = response.data.disciplines;
for (var i = 0; i < didata.length; i++) {
const childern = [];
//方向
const fxdidata = didata[i].sub_disciplines;
for (var j = 0; j < fxdidata.length; j++) {
//课程
const zsddata = fxdidata[j].tag_disciplines;
childern.push(
{
value: fxdidata[j].id,
label: fxdidata[j].name,
}
)
for (var k = 0; k < zsddata.length; k++) {
//知识点
this.state.knowledgepoints.push(zsddata[k]);
}
}
const datakec = {
value: didata[i].id,
label: didata[i].name,
children: childern,
}
this.state.disciplmy.push(datakec);
}
this.setState({
knowledgepoints: this.state.knowledgepoints,
disciplmy: this.state.disciplmy,
})
}
}
}
});
}
//难度
getdatas=()=>{
if (this.Judquestio.Getdatas().length === 0) {
this.scrollToAnchor("Itembankstopid");
return false;
}
//console.log(this.Judquestio.Getdatas());
var myrbkc=[];
var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd;
for(let myda of Getdatasdatas) {
myrbkc.push(myda.id);
}
const url="/examination_intelligent_settings/optinal_items.json";
var data={
sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1],
tag_discipline_id:myrbkc,
source:this.Judquestio.Getdatas()[7].rbly,
difficulty:this.Judquestio.Getdatas()[0].rbnd,
}
this.getwangluodata(url,data);
}
//课程
getdatasss=(kech)=>{
if (this.Judquestio.Getdatas().length === 0) {
this.scrollToAnchor("Itembankstopid");
return false;
}
//console.log(this.Judquestio.Getdatas());
var myrbkc=[];
var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd;
for(let myda of Getdatasdatas) {
myrbkc.push(myda.id);
}
const url="/examination_intelligent_settings/optinal_items.json";
var data={
sub_discipline_id:kech,
tag_discipline_id:myrbkc,
source:this.Judquestio.Getdatas()[7].rbly,
difficulty:this.Judquestio.Getdatas()[0].rbnd,
}
this.getwangluodata(url,data);
}
//知识点
getdatassss=(zhishidian)=>{
if (this.Judquestio.Getdatas().length === 0) {
this.scrollToAnchor("Itembankstopid");
return false;
}
//console.log(this.Judquestio.Getdatas());
var myrbkc=[];
var Getdatasdatas=zhishidian;
for(let myda of Getdatasdatas) {
myrbkc.push(myda.id);
}
const url="/examination_intelligent_settings/optinal_items.json";
var data={
sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1],
tag_discipline_id:myrbkc,
source:this.Judquestio.Getdatas()[7].rbly,
difficulty:this.Judquestio.Getdatas()[0].rbnd,
}
this.getwangluodata(url,data);
}
//来源
getdatassssy=(rbly)=>{
if (this.Judquestio.Getdatas().length === 0) {
this.scrollToAnchor("Itembankstopid");
return false;
}
//console.log(this.Judquestio.Getdatas());
var myrbkc=[];
var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd;
for(let myda of Getdatasdatas) {
myrbkc.push(myda.id);
}
const url="/examination_intelligent_settings/optinal_items.json";
var data={
sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1],
tag_discipline_id:myrbkc,
source:rbly,
difficulty:this.Judquestio.Getdatas()[0].rbnd,
}
this.getwangluodata(url,data);
}
getwangluodata=(url,data)=>{
axios.post(url,data).then((response) => {
if (response) {
//console.log("智能组卷");
//console.log(response);
if(response.data){
this.setState({
single_question_count:response.data.single_question_count,
multiple_question_count:response.data.multiple_question_count,
judgement_question_count:response.data.judgement_question_count,
program_question_count:response.data.program_question_count,
})
}
}
});
}
//难度
getdatass=(nandu)=>{
if (this.Judquestio.Getdatas().length === 0) {
this.scrollToAnchor("Itembankstopid");
return false;
}
//console.log(this.Judquestio.Getdatas());
var myrbkc=[];
var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd;
for(let myda of Getdatasdatas) {
myrbkc.push(myda.id);
}
const url="/examination_intelligent_settings/optinal_items.json";
var data={
sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1],
tag_discipline_id:myrbkc,
source:this.Judquestio.Getdatas()[7].rbly,
difficulty:nandu,
}
axios.post(url,data).then((response) => {
if (response) {
//console.log("智能组卷");
//console.log(response);
if(response.data){
this.setState({
single_question_count:response.data.single_question_count,
multiple_question_count:response.data.multiple_question_count,
judgement_question_count:response.data.judgement_question_count,
program_question_count:response.data.program_question_count,
})
}
}
});
}
componentDidUpdate(prevProps) {
}
//跳转道描点的地方
scrollToAnchor = (anchorName) => {
try {
if (anchorName) {
// 找到锚点
let anchorElement = document.getElementById(anchorName);
// 如果对应id的锚点存在就跳转到锚点
if (anchorElement) {
anchorElement.scrollIntoView();
}
}
} catch (e) {
}
}
preservation = () => {
if (this.Judquestio.Getdatas().length === 0) {
this.scrollToAnchor("Itembankstopid");
return;
}
var myrbkc=[];
var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd;
for(let myda of Getdatasdatas) {
myrbkc.push(myda.id);
}
// //console.log(myrbkc);
// //console.log("preservation");
// //console.log(this.Judquestio.Getdatas());
var question_settings =[
{
"item_type": "SINGLE",
"count": this.Judquestio.Getdatas()[3].rbdxt
},
{
"item_type": "MULTIPLE",
"count": this.Judquestio.Getdatas()[4].rbdxtx
},
{
"item_type": "JUDGMENT",
"count": this.Judquestio.Getdatas()[5].rbpdt
},
{
"item_type": "PROGRAM",
"count": this.Judquestio.Getdatas()[6].rbbct
}
]
const url="/examination_intelligent_settings.json"
var data = {
discipline_id: this.Judquestio.Getdatas()[2].rbkc[0],
sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1],
tag_discipline_id:myrbkc,
source:this.Judquestio.Getdatas()[7].rbly,
difficulty:this.Judquestio.Getdatas()[0].rbnd,
question_settings:question_settings,
}
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
//console.log("组卷成功");
this.props.history.push(`/Integeneration/Intelligence/${result.data.exam_setting_id}`);
}
}).catch((error) => {
//console.log(error);
})
}
setitem_type = (item_type) => {
}
setCohetepaperbool = (bool) => {
}
getcontentMdRef = (Ref) => {
this.contentMdRef = Ref;
}
setnewmyshixunmodelbool=()=>{
}
render() {
let {paperlibrartdata,newmyshixunmodelbool,single_question_count,multiple_question_count,judgement_question_count,program_question_count} = this.state;
const params = this.props && this.props.match && this.props.match.params;
return (
<div>
<div id={"Itembankstopid"} className="newMain clearfix intermediatecenter "
>
<style>
{
`
.newFooter{
display: none;
}
`
}
</style>
<div className="w1200ms">
<div className="w100s mt30">
<Breadcrumb separator=">">
<Breadcrumb.Item href="/paperlibrary">试题库</Breadcrumb.Item>
<Breadcrumb.Item className={"shubiao"}>智能组卷</Breadcrumb.Item>
</Breadcrumb>
</div>
<Intelligentcomponents {...this.state} {...this.props}
single_question_count={this.state.single_question_count}
multiple_question_count={this.state.multiple_question_count}
judgement_question_count={this.state.judgement_question_count}
program_question_count={this.state.program_question_count}
getdatas={()=>this.getdatas()}
getdatass={(nd)=>this.getdatass(nd)}
getJudquestio={(ref) => this.getJudquestio(ref)}
getdatasss={(e)=>this.getdatasss(e)}
getdatassss={(e)=>this.getdatassss(e)}
getdatassssy={(e)=>this.getdatassssy(e)}
></Intelligentcomponents>
</div>
</div>
{
newmyshixunmodelbool === true ? "" :
<Bottomsubmit {...this.props} {...this.state} bottomvalue={"保存"}
Cohetepaperbool={false}
setCohetepaperbool={(bool) => this.setCohetepaperbool(bool)}
onSubmits={() => this.preservation()} url={'/paperlibrary'}></Bottomsubmit>
}
</div>
)
}
}
export default SnackbarHOC()(TPMIndexHOC(Intecomponents));

@ -22,8 +22,10 @@ import Paperlibraryseeid_item from './component/Paperlibraryseeid_item';
import Comthetestpaperst from '../question/comthetestpaper/Comthetestpaperst';
import Paperlibraryseeid_itemss from './component/Paperlibraryseeid_itemss';
import JudquestionEditor from "../question/component/JudquestionEditor";
import NewMyShixunModel from "../question/NewMyShixunModel";
//人工组卷预览
//试卷编辑
class Paperlibraryeditid extends Component {
constructor(props) {
super(props);
@ -33,15 +35,16 @@ class Paperlibraryeditid extends Component {
disciplinesdata: [],
knowledgepoints: [],
disciplmy: [],
item_banksedit: []
item_banksedit: [],
newmyshixunmodelbool:false,
}
}
getJudquestio = (Ref) => {
console.log("子组件对象");
console.log(Ref);
//console.log("子组件对象");
//console.log(Ref);
this.Judquestio = Ref;
}
@ -163,11 +166,11 @@ class Paperlibraryeditid extends Component {
axios.put(url, data)
.then((result) => {
if (result.data.status === 0) {
this.props.showNotification(`试卷更新成功`);
// this.props.showNotification(`试卷更新成功`);
this.props.history.push('/paperlibrary');
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -185,14 +188,50 @@ class Paperlibraryeditid extends Component {
this.contentMdRef = Ref;
}
setnewmyshixunmodelbool=(bool)=>{
if(bool===true){
let scrollToTop = window.setInterval(function() {
let pos = window.pageYOffset;
if ( pos > 0 ) {
window.scrollTo( 0, pos - 20 ); // how far to scroll on each step
} else {
window.clearInterval( scrollToTop );
}
}, 2);
}
this.setState({
newmyshixunmodelbool:bool
})
this.getdata();
}
render() {
let {paperlibrartdata} = this.state;
let {paperlibrartdata,newmyshixunmodelbool} = this.state;
const params = this.props && this.props.match && this.props.match.params;
// //console.log(params);
// //console.log("newmyshixunmodelbool");
// //console.log(newmyshixunmodelbool);
return (
<div>
<div id={"Itembankstopid"} className="newMain clearfix intermediatecenter "
>
{
newmyshixunmodelbool===true?
<style>{
`
body{ overflow: hidden !important; }
`
}</style>
:""
}
{
newmyshixunmodelbool===true?
<div className="fangdatwo">
<NewMyShixunModel {...this.state} {...this.props} exam_id={this.props.match.params.id} setnewmyshixunmodelbool={(e)=>this.setnewmyshixunmodelbool(e)}></NewMyShixunModel>
</div>
:
""
}
<style>
{
@ -219,16 +258,24 @@ class Paperlibraryeditid extends Component {
<div className=" clearfix educontent Contentquestionbankstyle w100s w1200wuh mt19">
<style>
{
`
.seeoagertitscss .jixuxuanti{
background:#4CACFF;
}
`
}
</style>
<div className={"seeoagertitscss"}>
<Seeoagertits
setnewmyshixunmodelbool={(e)=>this.setnewmyshixunmodelbool(e)}
all_score={paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.all_questions_count}
all_questions_count={paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.all_score}
difficulty={paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.difficulty}
>
</Seeoagertits>
</div>
<Paperlibraryseeid_itemss
{...this.state}
{...this.props}
@ -253,10 +300,12 @@ class Paperlibraryeditid extends Component {
</div>
<Bottomsubmit {...this.props} {...this.state} bottomvalue={"保存"}
setCohetepaperbool={(bool) => this.setCohetepaperbool(bool)}
onSubmits={() => this.preservation()} url={'/paperlibrary'}></Bottomsubmit>
{
newmyshixunmodelbool === true ? "" :
<Bottomsubmit {...this.props} {...this.state} bottomvalue={"保存"}
setCohetepaperbool={(bool) => this.setCohetepaperbool(bool)}
onSubmits={() => this.preservation()} url={'/paperlibrary'}></Bottomsubmit>
}
</div>
)

@ -35,7 +35,7 @@ class Paperlibraryseeid extends Component {
//初始化
componentDidMount() {
console.log("Paperlibraryseeid");
////console.log("Paperlibraryseeid");
this.getdata();
@ -94,7 +94,7 @@ class Paperlibraryseeid extends Component {
render() {
let {paperlibrartdata} = this.state;
const params = this.props && this.props.match && this.props.match.params;
// //console.log(params);
// ////console.log(params);
return (
<div>
<div id={"Itembankstopid"} className="newMain clearfix intermediatecenter "

@ -36,7 +36,7 @@ class Testpaperlibrary extends Component {
booljupyterurls:false,
Contentdata:[],
items_count:0,
defaultActiveKey:"0",
defaultActiveKey:"1",
modalsTypes:false,
modalsType:false,
timuid:0,
@ -53,8 +53,8 @@ class Testpaperlibrary extends Component {
componentDidMount() {
let url = `/users/get_navigation_info.json`;
axios.get(url, {}).then((response) => {
// ////console.log("开始请求/get_navigation_info.json");
// ////console.log(response);
// //////console.log("开始请求/get_navigation_info.json");
// //////console.log(response);
if (response != undefined) {
if (response.status === 200) {
this.setState({
@ -64,7 +64,6 @@ class Testpaperlibrary extends Component {
}
}
});
//获取题库筛选资料
let urls = `/disciplines.json`;
axios.get(urls, {params: {
@ -76,18 +75,6 @@ class Testpaperlibrary extends Component {
})
}
});
var data={
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
keywords: this.state.keywords,
page: 1,
per_page:10,
}
this.getdata(data);
}
paginationonChange=(pages)=>{
@ -171,14 +158,14 @@ class Testpaperlibrary extends Component {
} else {
}
////console.log("item_banks");
////console.log(response);
//////console.log("item_banks");
//////console.log(response);
this.setState({
Contentdata: response.data,
items_count: response.data.exam_count,
})
}).catch((error) => {
////console.log(error)
//////console.log(error)
this.setState({
booljupyterurls:false,
})
@ -207,7 +194,7 @@ class Testpaperlibrary extends Component {
this.getdata(data);
}
setsub_discipline_id=(sub_discipline_id)=>{
setsub_discipline_id=(discipline_id,sub_discipline_id)=>{
this.setState({
sub_discipline_id:sub_discipline_id,
tag_discipline_id:null,
@ -216,7 +203,7 @@ class Testpaperlibrary extends Component {
per_page:10,
})
var data = {
discipline_id:this.state.discipline_id,
discipline_id:discipline_id,
sub_discipline_id:sub_discipline_id,
tag_discipline_id:null,
public: this.state.defaultActiveKey,
@ -290,7 +277,7 @@ class Testpaperlibrary extends Component {
axios.post(url)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`公开试卷成功`);
// this.props.showNotification(`公开试卷成功`);
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
@ -304,7 +291,7 @@ class Testpaperlibrary extends Component {
this.getdata(data);
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
}
@ -315,7 +302,7 @@ class Testpaperlibrary extends Component {
axios.delete(url)
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification('删除试卷成功')
// this.props.showNotification('删除试卷成功');
// props.history.push(response.data.right_url)
var data = {
discipline_id:this.state.discipline_id,
@ -331,7 +318,7 @@ class Testpaperlibrary extends Component {
}
})
.catch(function (error) {
//console.log(error);
////console.log(error);
});
}
@ -417,6 +404,12 @@ class Testpaperlibrary extends Component {
render() {
let{Headertop,items_count,page,per_page,modalsTypes,modalsType}=this.state;
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
return (
<div className="newMain clearfix" ref={this.saveContainer}>
{
@ -441,7 +434,7 @@ class Testpaperlibrary extends Component {
<Headplugselections {...this.props} {...this.state}
disciplinesdata={this.state.disciplinesdata}
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)}
setitem_types={(e) => this.setitem_types(e)}
setdifficulty={(e) => this.setdifficulty(e)}
@ -450,6 +443,7 @@ class Testpaperlibrary extends Component {
<Contentpart
{...this.props}
{...this.state}
Isitapopup={"false"}
Testpapereditor={(e)=>this.Testpapereditor(e)}
setdifficulty={(e)=>this.setdifficulty(e)}
showmodels={(e)=>this.showmodels(e)}

@ -38,9 +38,31 @@ class Contentpart extends Component {
}
componentDidUpdate(prevProps) {
if(prevProps.current_user !== this.props.current_user) {
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
let {defaultActiveKey} = this.props;
var defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
defaultActiveKeys="1"
}
this.props.callback(defaultActiveKeys);
}
}
render() {
let {page}=this.state;
let {defaultActiveKey}=this.props;
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
const contents = (
<div className="questiontypes" style={{
width:'93px',
@ -56,8 +78,10 @@ class Contentpart extends Component {
<p className="questiontypeheng"></p>
</div>
);
return (
<div className=" clearfix mt40">
<div className=" clearfix mt25">
<div className="educontent mt10 pb20 w1200s">
<div className="w1200ms contentparttit" style={{
position: "relative",
@ -82,12 +106,20 @@ class Contentpart extends Component {
}
</style>
<Tabs defaultActiveKey={defaultActiveKey} onChange={(e)=>this.props.callback(e)}>
<TabPane tab="公共" key="1">
</TabPane>
<TabPane tab="我的" key="0">
</TabPane>
</Tabs>
{
isysladmins===true||(is_teacher===true&&professional_certification===true)?
<Tabs activeKey={defaultActiveKey} onChange={(e)=>this.props.callback(e)}>
<TabPane tab="公共" key="1">
</TabPane>
<TabPane tab="我的" key="0">
</TabPane>
</Tabs>
:
<Tabs activeKey={1} onChange={(e)=>this.props.callback(e)}>
<TabPane tab="公共" key="1">
</TabPane>
</Tabs>
}
<div className=" mt19" style={{
position:"absolute",
top: "0px",
@ -112,7 +144,7 @@ class Contentpart extends Component {
`
}
</style>
<div className="sortinxdirection">
<div className={isysladmins===true||(is_teacher===true&&professional_certification===true)?"sortinxdirection":"xaxisreverseorder"}>
<Search
style={{ width: "347px",marginRight:"60px",}}
placeholder="请输入题目名称、内容"
@ -123,26 +155,26 @@ class Contentpart extends Component {
value={this.props.keywords}
/>
<div className="xaxisreverseorder" style={{
width:"50%"
}}>
<a href={'/question/newitem'}>
<div className="newbutoonss">
<p className="newbutoontess" >智能组卷</p>
</div>
</a>
<a href={'/question'} >
<div className="newbutoons mr39">
<p className="newbutoontess" >人工组卷</p>
{
isysladmins===true||(is_teacher===true&&professional_certification===true)?
<div className="xaxisreverseorder" style={{
width:"50%"
}}>
<a href={'/Integeneration'}>
<div className="newbutoonss">
<p className="newbutoontess" >智能组卷</p>
</div>
</a>
<a href={'/question'} >
<div className="newbutoons mr39">
<p className="newbutoontess" >人工组卷</p>
</div>
</a>
</div>
</a>
</div>
:""
}
</div>
@ -189,6 +221,7 @@ class Contentpart extends Component {
Testpapereditor={(e)=>this.props.Testpapereditor(e)}
showmodels={(e)=>this.props.showmodels(e)}
showmodelysl={(e)=>this.props.showmodelysl(e)}
Isitapopup={this.props.Isitapopup}
>
</Listjihe>

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

@ -76,8 +76,8 @@ class Listjihe extends Component {
return (
<div className={" borderwdsst pd20 mb20 intermediatecenter listjihecolor "} >
<div className="sortinxdirection w100s">
<div className="sjimg ">
<img src={getImageUrl("images/educoder/shijuans.png ")} width={80}/>
<div className="sjimg intermediatecenter">
<img src={getImageUrl("images/educoder/shijuans.png")} className="imgtp"/>
</div>
<div className="w100s verticallayout ml20" >
<div className="w100s " > <p className="sjtitle xiaoshou" onClick={()=>this.gotoseesj(items.id)}>{names}</p></div>
@ -114,12 +114,18 @@ class Listjihe extends Component {
<i className="iconfont icon-shanchu1 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>删除</span>
</p>
<a >
<p className="viewparsings xiaoshou mr25 " onClick={()=>this.props.Testpapereditor(items.id)}>
<i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>编辑</span>
</p>
</a>
{
this.props.Isitapopup&&this.props.Isitapopup==="true"?
""
:
<a >
<p className="viewparsings xiaoshou mr25 " onClick={()=>this.props.Testpapereditor(items.id)}>
<i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>编辑</span>
</p>
</a>
}
{
items.public === false ?
<p className="viewparsings xiaoshou mr25 " onClick={() => this.props.showmodels(items.id)}>

@ -69,8 +69,8 @@ class Paperreview_item extends Component {
}
onDragEnd = (result) => {
console.log("单选题");
console.log(result);
//console.log("单选题");
//console.log(result);
const ids = this.props.single_questions.questions[result.source.index].id;
const positions = this.props.single_questions.questions[result.destination.index].position;
@ -81,17 +81,17 @@ class Paperreview_item extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata();
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
onDragEnds = (result) => {
console.log("多选题");
console.log(result);
//console.log("多选题");
//console.log(result);
const ids = this.props.multiple_questions.questions[result.source.index].id;
const positions = this.props.multiple_questions.questions[result.destination.index].position;
const url = `/examination_items/${ids}/adjust_position.json`;
@ -101,11 +101,11 @@ class Paperreview_item extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata();
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
@ -113,8 +113,8 @@ class Paperreview_item extends Component {
onDragEndss = (result) => {
console.log("判断题");
console.log(result);
//console.log("判断题");
//console.log(result);
const ids = this.props.judgement_questions.questions[result.source.index].id;
const positions = this.props.judgement_questions.questions[result.destination.index].position;
const url = `/examination_items/${ids}/adjust_position.json`;
@ -125,18 +125,18 @@ class Paperreview_item extends Component {
.then((result) => {
debugger
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata();
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
onDragEndsss = (result) => {
console.log("编程题");
console.log(result);
//console.log("编程题");
//console.log(result);
const ids = this.props.program_questions.questions[result.source.index].id;
const positions = this.props.program_questions.questions[result.destination.index].position;
@ -147,11 +147,11 @@ class Paperreview_item extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata();
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -181,12 +181,12 @@ class Paperreview_item extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`调分成功`);
// this.props.showNotification(`调分成功`);
this.props.getdata({});
this.Singlemagazine("", false);
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -198,12 +198,12 @@ class Paperreview_item extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`调分成功`);
// this.props.showNotification(`调分成功`);
this.props.getdata({});
this.Singlemagazines(false);
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -225,7 +225,7 @@ class Paperreview_item extends Component {
}
hideparagraph = (name) => {
console.log("hideparagraph");
//console.log("hideparagraph");
}
@ -238,7 +238,7 @@ class Paperreview_item extends Component {
})
}
showparagraph = (name) => {
console.log("showparagraph");
//console.log("showparagraph");
if (name === "SINGLE") {
this.setState({
singlebool: true,
@ -290,8 +290,8 @@ class Paperreview_item extends Component {
}
showparagraphs = (e,name) => {
// console.log("showparagraphs");
// console.log(e);
// //console.log("showparagraphs");
// //console.log(e);
this.setState({
paperreviewsingleindex: e,
paperreviewsinglename:name,

@ -15,6 +15,7 @@ import {
} from "antd";
import '../testioncss/testioncss.css';
import '../../tpm/newshixuns/css/Newshixuns.css';
import QuillForEditor from "../../../common/quillForEditor";
const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
@ -67,15 +68,52 @@ class Paperlibraryseeid_items extends Component {
render() {
let {questions, totalscore, total, items} = this.state;
let {objectsingle, indexx, paperreviewsingleindex, indexxy,name} = this.props;
// console.log("objectsingle");
// console.log(objectsingle);
var itemssname="";
try {
itemssname= JSON.parse(objectsingle.name);
}catch (e) {
}
if(itemssname===undefined){
itemssname=objectsingle.name
}
var itemsnamesy="";
try {
itemsnamesy= JSON.parse(objectsingle&&objectsingle.program_attr&&objectsingle.program_attr.description);
}catch (e) {
itemsnamesy=objectsingle&&objectsingle.program_attr&&objectsingle.program_attr.description;
}
return (
<div key={indexxy}
className={ "w100s borderwdswuh mb20 pd20 "}
style={{
minHeight: "114px",
}}>
<style>{
`
.programquill .ql-editor{
padding-left: 0px !important;
padding-top: 0px !important;
}
.programquill .ql-editor p{
line-height: 28px;
}
.programquills .ql-editor{
padding-left: 0px !important;
padding-top: 0px !important;
}
.programquills .ql-editor p{
line-height: 20px;
}
`
}</style>
{/*顶部*/}
<div className="w100s sortinxdirection ">
<div className=" sortinxdirection ">
@ -100,29 +138,49 @@ class Paperlibraryseeid_items extends Component {
}
</style>
{
this.props.typenames==="PROGRAM"?
<div className=" lh28 listjihetixingstit markdown-body cretitlecolrlist" style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML( objectsingle.name).replace(/▁/g, "▁▁▁")}}>
</div>
objectsingle.item_type==="PROGRAM"?
<div className="w100s sortinxdirection">
<div className=" tites lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{wordBreak: "break-word",
minWidth:"32px"
}}
>
({objectsingle.score})
</div>
<div className="ml10 lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML(objectsingle.name).replace(/▁/g, "▁▁▁")}}>
</div>
</div>
:
<div className=" lh28 listjihetixingstit markdown-body cretitlecolrlist" style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML(`${objectsingle.score}分) ` + objectsingle.name).replace(/▁/g, "▁▁▁")}}>
<div className="w100s sortinxdirection">
<div className="tites lh28 listjihetixingstit markdown-body cretitlecolrlist " style={{wordBreak: "break-word",
minWidth:"32px"}}
>
({objectsingle.score})
</div>
<div className="ml10 lh28 listjihetixingstit cretitlecolrlist programquill" style={{wordBreak: "break-word"}}
>
<QuillForEditor
readOnly={true}
value={itemssname}
/>
</div>
</div>
}
</div>
{/*内容*/}
<div className="w100s sortinxdirection">
{
objectsingle.item_type === "JUDGMENT" ?
<p className="w100s listjihetixingstits sortinxdirection ">
{
objectsingle === undefined || objectsingle === null ? "" : objectsingle.choices.map((object, index) => {
return (
<p className={index === 1 ? "sortinxdirection ml10" : "sortinxdirection "} key={index}>
<Radio checked={object.is_answer}>
<p className={index === 1 ? "sortinxdirection ml10" : "sortinxdirection "}>
<Radio disabled={true} >
{object.choice_text}
</Radio>
</p>
@ -134,19 +192,47 @@ class Paperlibraryseeid_items extends Component {
objectsingle.item_type === "PROGRAM" ?
<p className="w100s listjihetixingstitssy sortinxdirection ">
<p className={"sortinxdirection mt15"}>
<p style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML(objectsingle.program_attr.description).replace(/▁/g, "▁▁▁")}}></p>
{
objectsingle&&objectsingle.program_attr&&objectsingle.program_attr.description?
<p className="programquill" style={{wordBreak: "break-word"}}
>
<QuillForEditor
readOnly={true}
value={itemsnamesy}
/>
</p>
:
""}
</p>
</p>
:
<p className="w100s listjihetixingstits verticallayout ">
{
objectsingle === undefined || objectsingle === null ? "" : objectsingle.choices.map((object, index) => {
var string=""
try {
string=JSON.parse(object.choice_text);
}catch (e) {
string=object.choice_text;
}
return (
<p className={index === 0 ? "sortinxdirection" : "sortinxdirection mt15"} key={index}>
<p className={index === 0 ? "sortinxdirection" : "sortinxdirection mt15"}>
{tagArray[index]}
<p style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML(object.choice_text).replace(/▁/g, "▁▁▁")}}></p>
<p className="programquills" style={{wordBreak: "break-word"}}>
{object ?
object.choice_text === undefined || object.choice_text=== null || object.choice_text === "" ?
""
:
object.choice_text.length>0?
<QuillForEditor
readOnly={true}
value={string}
/>
:""
:
""
}
</p>
</p>
)
})
@ -154,7 +240,6 @@ class Paperlibraryseeid_items extends Component {
</p>
}
</div>

@ -89,11 +89,11 @@ class Paperlibraryseeid_itemss extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata({});
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -108,11 +108,11 @@ class Paperlibraryseeid_itemss extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata({});
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
@ -129,11 +129,11 @@ class Paperlibraryseeid_itemss extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata({});
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -149,11 +149,11 @@ class Paperlibraryseeid_itemss extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`拖动成功`);
// this.props.showNotification(`拖动成功`);
this.props.getdata({});
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -184,12 +184,12 @@ class Paperlibraryseeid_itemss extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`调分成功`);
// this.props.showNotification(`调分成功`);
this.props.getdata({});
this.Singlemagazine("", false);
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -201,12 +201,12 @@ class Paperlibraryseeid_itemss extends Component {
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
this.props.showNotification(`调分成功`);
// this.props.showNotification(`调分成功`);
this.props.getdata({});
this.Singlemagazines(false);
}
}).catch((error) => {
console.log(error);
//console.log(error);
})
}
@ -247,7 +247,7 @@ class Paperlibraryseeid_itemss extends Component {
})
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification('大题删除成功');
// this.props.showNotification('大题删除成功');
this.props.getdata({});
this.setState({
titilesms: ""
@ -255,7 +255,7 @@ class Paperlibraryseeid_itemss extends Component {
}
})
.catch(function (error) {
//console.log(error);
////console.log(error);
});
@ -275,7 +275,7 @@ class Paperlibraryseeid_itemss extends Component {
axios.delete((url))
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification('试题删除成功');
// this.props.showNotification('试题删除成功');
this.props.getdata({});
}
})
@ -299,7 +299,7 @@ class Paperlibraryseeid_itemss extends Component {
}
hideparagraph = (name) => {
console.log("hideparagraph");
//console.log("hideparagraph");
}
@ -312,7 +312,7 @@ class Paperlibraryseeid_itemss extends Component {
})
}
showparagraph = (name) => {
console.log("showparagraph");
//console.log("showparagraph");
if (name === "SINGLE") {
this.setState({
singlebool: true,
@ -364,8 +364,8 @@ class Paperlibraryseeid_itemss extends Component {
}
showparagraphs = (e,name) => {
// console.log("showparagraphs");
// console.log(e);
// //console.log("showparagraphs");
// //console.log(e);
this.setState({
paperreviewsingleindex: e,
paperreviewsinglename:name,

@ -48,7 +48,7 @@ class Seeoagertit extends Component {
</div>
<div className="w30s xaxisreverseorder">
<div className="jixuxuanti xiaoshou" onClick={() => this.jixuxuantioncli()}>
<div className="jixuxuanti xiaoshou" onClick={() => this.props.setnewmyshixunmodelbool(true)}>
继续选题
</div>
</div>

@ -366,7 +366,7 @@
.selectionss{
width:88px;
height:30px;
background:#eeeeee;
background:#CCCCCC;
border-radius:4px;
text-align: center;
line-height: 30px;
@ -548,7 +548,7 @@
height:32px;
border-radius:2px;
border:1px solid #DDDDDD;
margin-left: 20px;
margin-right: 20px;
}
.lh32{
line-height: 32px;
@ -884,3 +884,46 @@
text-align: center;
line-height: 20px;
}
.mt25{
margin-top: 25px;
}
.imgtp{
width: 39px;
height: 44px;
}
.tites{
color: #888888 !important;
}
.conditionsetting{
width:64px;
height:21px;
font-size:16px;
color:#333333;
line-height:21px;
}
.conditionsettings{
width:80px;
height:21px;
font-size:16px;
font-family:MicrosoftYaHei;
color:rgba(51,51,51,1);
line-height:21px;
}
.hengxians{
width:1021px;
height:1px;
background: #EEEEEE;
}
.mt13{
margin-top: 13px;
}
.dxuantitie{
width:57px;
height:19px;
font-size:14px;
font-family:MicrosoftYaHei;
color:rgba(51,51,51,1);
line-height:19px;
}

@ -949,6 +949,13 @@ submittojoinclass=(value)=>{
return (
<div className="newHeaders" id="nHeader" >
<style>{
`
body .questionbanks .ant-popover-inner-content {
padding:0px !important;
}
`
}</style>
{isRender===true?<LoginDialog
Modifyloginvalue={()=>this.Modifyloginvalue()}
@ -1040,17 +1047,17 @@ submittojoinclass=(value)=>{
`
}
</style>
{/*<li className={`pr questionbanks`}>*/}
{/* <Popover placement="bottom" content={contents} trigger="click" >*/}
{/* <div className=" sortinxdirection mr10">*/}
{/* <div style={{*/}
{/* color:"#fff"*/}
{/* }}>*/}
{/* 题库*/}
{/* </div>*/}
{/* </div>*/}
{/* </Popover>*/}
{/*</li>*/}
<li className={`pr questionbanks`}>
<Popover placement="bottom" content={contents} trigger="click" >
<div className=" sortinxdirection mr10">
<div style={{
color:"#fff"
}}>
题库
</div>
</div>
</Popover>
</li>
<li
style={{display: this.props.Headertop === undefined ? 'none' : this.props.Headertop.auth === null ? 'none' : 'block'}}

@ -268,8 +268,32 @@ body>.-task-title {
background: #EEEEEE;
}
.mystask-sidebar{
right: 210px !important;
right: 220px !important;
}
.mystask-sidebars{
right: 10px !important;
right: 20px !important;
}
.shitikussmys{
width:29px !important;
height:20px!important;
background:#FF6601 !important;
border-radius:10px !important;
position: absolute !important;
font-size:11px !important;
color:#ffffff !important;
line-height:20px !important;
top: -13px !important;
right: -10px !important;
}
.maxnamewidth30{
max-width: 30px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
cursor: default;
}
.mystask-sidebarss{
right: 5px !important;
}

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ExaminationIntelligentSetting, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ExaminationTypeSetting, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save