Merge branch 'dev_aliyun' into dev_ec

dev_cs
hjm 5 years ago
commit 01e1230691

@ -23,7 +23,7 @@ module GitHelper
Rails.logger.info "encoding: #{cd['encoding']} confidence: #{cd['confidence']}" Rails.logger.info "encoding: #{cd['encoding']} confidence: #{cd['confidence']}"
# 字符编码问题GB18030编码识别率不行 # 字符编码问题GB18030编码识别率不行
decode_content = decode_content =
if cd["encoding"] == 'GB18030' && cd['confidence'] == 1.0 if cd["encoding"] == 'GB18030' && cd['confidence'] > 0.8
content.encode('UTF-8', 'GBK', {:invalid => :replace, :undef => :replace, :replace => ' '}) content.encode('UTF-8', 'GBK', {:invalid => :replace, :undef => :replace, :replace => ' '})
else else
content.force_encoding('UTF-8') content.force_encoding('UTF-8')

@ -494,20 +494,88 @@ class ExerciseQuestionsController < ApplicationController
def adjust_score def adjust_score
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
ex_all_scores = @exercise.exercise_questions.pluck(:question_score).sum
ex_obj_score = @exercise_current_user.objective_score #全部客观题得分 ex_obj_score = @exercise_current_user.objective_score #全部客观题得分
ex_subj_score = @exercise_current_user.subjective_score < 0.0 ? 0.0 : @exercise_current_user.subjective_score #全部主观题得分 ex_subj_score = @exercise_current_user.subjective_score < 0.0 ? 0.0 : @exercise_current_user.subjective_score #全部主观题得分
ex_answers = @exercise_question.exercise_answers.search_answer_users("user_id",@user_id) #当前用户答案的得分 ex_answers = @exercise_question.exercise_answers.search_answer_users("user_id",@user_id) #当前用户答案的得分
if @exercise_question.question_type == Exercise::COMPLETION #当为填空题,更新问题的总分, if @exercise_question.question_type == Exercise::MULTIPLE
ex_answer_old = ex_answers.score_reviewed.pluck(:score).sum #每一关的得分总和 if ex_answers.present? #学生有回答时 取学生的答题得分否则0分
each_right_score = (@c_score / ex_answers.count.to_f) #调分后,平均每关的分数 answer_choice_array = []
new_obj_score = ex_obj_score - ex_answer_old + @c_score ex_answers.each do |a|
if a.try(:exercise_choice).try(:choice_position).present?
answer_choice_array.push(a&.exercise_choice&.choice_position) #学生答案的位置
end
end
user_answer_content = answer_choice_array.reject(&:blank?).sort
standard_answer = @exercise_question.exercise_standard_answers.pluck(:exercise_choice_id).sort
if standard_answer.size == 1 # 老数据需要判断学生答题是否正确, 正确取原题得分否则是0分
standard_answer = standard_answer.first.to_s.split("").map(&:to_i).sort
if user_answer_content == standard_answer
ex_answer_old = @exercise_question.question_score
else
ex_answer_old = 0
end
else # 新多选题只需取第一条答题记录的得分
ex_answer_old = ex_answers.first.score > 0 ? ex_answers.first.score : 0
end
ex_answers.update_all(:score => @c_score) #所有的正确选项需重新更新
else
answer_option = {
:user_id => @user_id,
:exercise_question_id => @exercise_question.id,
:score => @c_score,
:answer_text => ""
}
ExerciseAnswer.create(answer_option)
ex_answer_old = 0
end
if ex_obj_score <= 0.0
new_obj_score = @c_score
else
new_obj_score = ex_obj_score - ex_answer_old + @c_score
end
total_scores = new_obj_score + ex_subj_score total_scores = new_obj_score + ex_subj_score
if total_scores < 0.0
total_scores = 0.0
elsif total_scores > ex_all_scores
total_scores = ex_all_scores
end
ex_scores = {
:objective_score => new_obj_score,
:score => total_scores
}
@exercise_current_user.update_attributes(ex_scores)
elsif @exercise_question.question_type == Exercise::COMPLETION #当为填空题,更新问题的总分,
if ex_answers.exists?
ex_answer_old = ex_answers.score_reviewed.pluck(:score).sum #每一关的得分总和
each_right_score = (@c_score / ex_answers.count.to_f) #调分后,平均每关的分数
new_obj_score = ex_obj_score - ex_answer_old + @c_score
ex_answers.update_all(:score => each_right_score) #所有的正确选项需重新更新
else #如果学生未答,则创建新的答题记录
answer_option = {
:user_id => @user_id,
:exercise_question_id => @exercise_question.id,
:score => @c_score,
:answer_text => ""
}
ExerciseAnswer.create(answer_option)
new_obj_score = ex_obj_score + @c_score
end
total_scores = new_obj_score + ex_subj_score
if total_scores < 0.0
total_scores = 0.0
elsif total_scores > ex_all_scores
total_scores = ex_all_scores
end
ex_scores = { ex_scores = {
:objective_score => new_obj_score, :objective_score => new_obj_score,
:score => total_scores :score => total_scores
} }
@exercise_current_user.update_attributes(ex_scores) @exercise_current_user.update_attributes(ex_scores)
ex_answers.update_all(:score => each_right_score) #所有的正确选项需重新更新
elsif @exercise_question.question_type == Exercise::SUBJECTIVE #当为主观题时 elsif @exercise_question.question_type == Exercise::SUBJECTIVE #当为主观题时
if ex_answers.exists? if ex_answers.exists?
ex_answers_old_score = ex_answers.first.score > 0.0 ? ex_answers.first.score : 0.0 #原分数小于0取0 ex_answers_old_score = ex_answers.first.score > 0.0 ? ex_answers.first.score : 0.0 #原分数小于0取0
@ -524,6 +592,11 @@ class ExerciseQuestionsController < ApplicationController
new_sub_score = ex_subj_score + @c_score new_sub_score = ex_subj_score + @c_score
end end
total_scores = ex_obj_score + new_sub_score total_scores = ex_obj_score + new_sub_score
if total_scores < 0.0
total_scores = 0.0
elsif total_scores > ex_all_scores
total_scores = ex_all_scores
end
ex_scores = { ex_scores = {
:subjective_score => new_sub_score, :subjective_score => new_sub_score,
:score => total_scores :score => total_scores
@ -549,6 +622,11 @@ class ExerciseQuestionsController < ApplicationController
new_obj_score = @c_score new_obj_score = @c_score
end end
total_scores = new_obj_score + ex_subj_score total_scores = new_obj_score + ex_subj_score
if total_scores < 0.0
total_scores = 0.0
elsif total_scores > ex_all_scores
total_scores = ex_all_scores
end
ex_scores = { ex_scores = {
:objective_score => new_obj_score, :objective_score => new_obj_score,
:score => total_scores :score => total_scores
@ -556,30 +634,33 @@ class ExerciseQuestionsController < ApplicationController
@exercise_current_user.update_attributes(ex_scores) @exercise_current_user.update_attributes(ex_scores)
end end
comments = params[:comment] comments = params[:comment]
question_comment = @exercise_question.exercise_answer_comments.first question_comment = @exercise_question.exercise_answer_comments&.first
if question_comment.present? if question_comment.present?
comment_option = { comment_option = {
:comment => comments.present? ? comments : question_comment.comment, :comment => comments,
:score => @c_score, :score => @c_score,
:exercise_answer_id => ex_answers.present? ? ex_answers.first.id : nil :exercise_answer_id => ex_answers.present? ? ex_answers.first.id : nil,
:user_id => current_user.id
} }
question_comment.update_attributes(comment_option) question_comment.update_attributes(comment_option)
@exercise_comments = question_comment @exercise_comments = question_comment
else else
ex_answer_comment_id = @exercise_question.exercise_answers.find_by(user_id: @user_id).try(:id)
comment_option = { comment_option = {
:user_id => current_user.id, :user_id => current_user.id,
:comment => comments, :comment => comments,
:score => @c_score, :score => @c_score,
:exercise_question_id => @exercise_question.id, :exercise_question_id => @exercise_question.id,
:exercise_shixun_answer_id => @shixun_a_id.present? ? @shixun_a_id : nil, :exercise_shixun_answer_id => @shixun_a_id.present? ? @shixun_a_id : nil,
:exercise_answer_id => ex_answers.present? ? ex_answers.first.id : nil :exercise_answer_id => ex_answer_comment_id
} }
@exercise_comments = ExerciseAnswerComment.new(comment_option) @exercise_comments = ExerciseAnswerComment.new(comment_option)
@exercise_comments.save @exercise_comments.save
end end
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("没有权限") tip_exception(e.message)
raise ActiveRecord::Rollback raise ActiveRecord::Rollback
end end
end end
@ -703,8 +784,8 @@ class ExerciseQuestionsController < ApplicationController
normal_status(-1,"用户不存在!") normal_status(-1,"用户不存在!")
elsif @c_score.blank? elsif @c_score.blank?
normal_status(-1,"分数不能为空!") normal_status(-1,"分数不能为空!")
elsif @exercise_question.question_type <= Exercise::JUDGMENT elsif @exercise_question.question_type == Exercise::SINGLE || @exercise_question.question_type == Exercise::JUDGMENT
normal_status(-1,"题/判断题不能调分!") normal_status(-1,"选题/判断题不能调分!")
elsif params[:comment].present? && params[:comment].length > 100 elsif params[:comment].present? && params[:comment].length > 100
normal_status(-1,"评语不能超过100个字符!") normal_status(-1,"评语不能超过100个字符!")
else else

@ -324,7 +324,7 @@ class GraduationTasksController < ApplicationController
tip_exception("缺少截止时间参数") if params[:end_time].blank? tip_exception("缺少截止时间参数") if params[:end_time].blank?
tip_exception("截止时间必须晚于当前时间") if params[:end_time] <= strf_time(Time.now) tip_exception("截止时间必须晚于当前时间") if params[:end_time] <= strf_time(Time.now)
tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
@course.end_date.present? && params[:end_time] > @course.end_date.end_of_day @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
# ActiveRecord::Base.transaction do # ActiveRecord::Base.transaction do
begin begin
@ -401,7 +401,7 @@ class GraduationTasksController < ApplicationController
tip_exception("截止时间不能早于当前时间") if params[:end_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S") tip_exception("截止时间不能早于当前时间") if params[:end_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S")
tip_exception("截止时间不能早于发布时间") if params[:publish_time] > params[:end_time] tip_exception("截止时间不能早于发布时间") if params[:publish_time] > params[:end_time]
tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
@course.end_date.present? && params[:end_time] > @course.end_date.end_of_day @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
@task.publish_time = params[:publish_time] @task.publish_time = params[:publish_time]
@task.end_time = params[:end_time] @task.end_time = params[:end_time]
@ -414,7 +414,7 @@ class GraduationTasksController < ApplicationController
tip_exception("截止时间不能为空") if params[:end_time].blank? tip_exception("截止时间不能为空") if params[:end_time].blank?
tip_exception("截止时间不能早于当前时间") if params[:end_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S") tip_exception("截止时间不能早于当前时间") if params[:end_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S")
tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
@course.end_date.present? && params[:end_time] > @course.end_date.end_of_day @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
@task.end_time = params[:end_time] @task.end_time = params[:end_time]
end end
@ -426,7 +426,7 @@ class GraduationTasksController < ApplicationController
tip_exception("补交结束时间不能为空") if params[:late_time].blank? tip_exception("补交结束时间不能为空") if params[:late_time].blank?
tip_exception("补交结束时间不能早于截止时间") if params[:late_time] <= @task.end_time tip_exception("补交结束时间不能早于截止时间") if params[:late_time] <= @task.end_time
tip_exception("补交结束时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if tip_exception("补交结束时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
@course.end_date.present? && params[:late_time] > @course.end_date.end_of_day @course.end_date.present? && params[:late_time] > strf_time(@course.end_date.end_of_day)
tip_exception("迟交扣分应为正整数") if params[:late_penalty] && params[:late_penalty].to_i < 0 tip_exception("迟交扣分应为正整数") if params[:late_penalty] && params[:late_penalty].to_i < 0
@task.allow_late = true @task.allow_late = true

@ -271,7 +271,11 @@ class MyshixunsController < ApplicationController
unless @hide_code || @myshixun.shixun&.vnc_evaluate unless @hide_code || @myshixun.shixun&.vnc_evaluate
# 远程版本库文件内容 # 远程版本库文件内容
last_content = GitService.file_content(repo_path: @repo_path, path: path)["content"] last_content = GitService.file_content(repo_path: @repo_path, path: path)["content"]
content = params[:content] content = if @myshixun.mirror_name.select {|a| a.include?("MachineLearning") || a.include?("Python")}.present? && params[:content].present?
params[:content].gsub(/\t/, ' ').gsub(/ /, ' ') # 这个不是空格在windows机器上带来的问题
else
params[:content]
end
Rails.logger.info("###11222333####{content}") Rails.logger.info("###11222333####{content}")
Rails.logger.info("###222333####{last_content}") Rails.logger.info("###222333####{last_content}")

@ -264,8 +264,9 @@ class QuestionBanksController < ApplicationController
# new_exercise.create_exercise_list # new_exercise.create_exercise_list
# exercise.update_column(:quotes, exercise.quotes+1) # exercise.update_column(:quotes, exercise.quotes+1)
# end # end
new_exercise if new_exercise.save! new_exercise.save!
exercise.update_column(:quotes, exercise.quotes+1) exercise.update_column(:quotes, exercise.quotes+1)
new_exercise
end end
end end
@ -292,8 +293,9 @@ class QuestionBanksController < ApplicationController
# new_poll.create_polls_list # new_poll.create_polls_list
# poll.update_column(:quotes, poll.quotes+1) # poll.update_column(:quotes, poll.quotes+1)
# end # end
new_poll if new_poll.save! new_poll.save!
poll.update_column(:quotes, poll.quotes+1) poll.update_column(:quotes, poll.quotes+1)
new_poll
end end
end end

@ -0,0 +1,10 @@
class ShixunListsController < ApplicationController
def index
@results = ShixunSearchService.call(search_params)
end
private
def search_params
params.permit(:keyword, :type, :page, :limit, :order, :type, :status, :diff)
end
end

@ -1,6 +1,7 @@
class ShixunsController < ApplicationController class ShixunsController < ApplicationController
include ShixunsHelper include ShixunsHelper
include ApplicationHelper include ApplicationHelper
include ElasticsearchAble
before_action :require_login, :check_auth, except: [:download_file, :index, :menus, :show, :show_right, :ranking_list, before_action :require_login, :check_auth, except: [:download_file, :index, :menus, :show, :show_right, :ranking_list,
:discusses, :collaborators, :fork_list, :propaedeutics] :discusses, :collaborators, :fork_list, :propaedeutics]
@ -131,8 +132,16 @@ class ShixunsController < ApplicationController
offset = (page.to_i - 1) * (limit.to_i) offset = (page.to_i - 1) * (limit.to_i)
order = params[:order] || "desc" order = params[:order] || "desc"
## 搜索关键字创建者、实训名称、院校名称 ## 搜索关键字创建者、实训名称、院校名称
keyword = params[:search].blank? ? "*" : params[:search] keyword = params[:keyword].to_s.strip.presence || '*'
@shixuns = Shixun.search keyword, where: {id: @shixuns.pluck(:id)}, order: {"myshixuns_count" => order}, limit: limit, offset: offset
model_options = {
index_name: [Shixun],
model_includes: Shixun.searchable_includes
}
model_options.merge(where: { id: @shixuns.pluck(:id) }).merge(order: {"myshixuns_count" => order}).merge(limit: limit, offset: offset)
model_options.merge(default_options)
@shixuns = Searchkick.search(keyword, model_options)
# @shixuns = Shixun.search keyword, where: {id: @shixuns.pluck(:id)}, order: {"myshixuns_count" => order}, limit: limit, offset: offset
@total_count = @shixuns.total_count @total_count = @shixuns.total_count
end end

@ -16,18 +16,26 @@ module ExercisesHelper
end end
if q_type <= Exercise::JUDGMENT if q_type <= Exercise::JUDGMENT
if answers_content.present? #学生有回答时 if answers_content.present? #学生有回答时,分数已经全部存到exercise_answer 表,所以可以直接取第一个值
answer_choice_array = [] ques_score = answers_content.first.score
answers_content.each do |a| ques_score = ques_score < 0 ? 0.0 : ques_score
answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置 # answer_choice_array = []
end # answers_content.each do |a|
user_answer_content = answer_choice_array.sort # answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个 # end
if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分 # user_answer_content = answer_choice_array.sort
ques_score = q.question_score # standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
else # if q_type == Exercise::MULTIPLE && standard_answer.size == 1 # 老数据的问题
ques_score = 0.0 # ques_score = answers_content.first.score
end # else
#
# end
# if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
# ques_score = q.question_score
# else
# ques_score = 0.0
# end
else else
ques_score = 0.0 ques_score = 0.0
end end
@ -58,7 +66,6 @@ module ExercisesHelper
exercise_sub_status.each do |s| exercise_sub_status.each do |s|
sub_answer = s.exercise_answers.search_answer_users("user_id",user_id) #主观题只有一个回答 sub_answer = s.exercise_answers.search_answer_users("user_id",user_id) #主观题只有一个回答
if sub_answer.present? && sub_answer.first.score >= 0.0 if sub_answer.present? && sub_answer.first.score >= 0.0
if s.question_score <= sub_answer.first.score if s.question_score <= sub_answer.first.score
stand_status = 1 stand_status = 1
else else
@ -775,22 +782,24 @@ module ExercisesHelper
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : nil user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : nil
elsif ques_type == 5 || ques_type == 3 elsif ques_type == 5 || ques_type == 3
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : 0.0 user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : 0.0
else else #选择题,判断题根据第一个记录查分
if exercise_answers.present? #判断题和选择题时, user_score = user_score_pre.present? ? user_score_pre.first.score : 0.0
answer_choice_array = []
exercise_answers.each do |a| # if exercise_answers.present? #判断题和选择题时,
answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置 # answer_choice_array = []
end # exercise_answers.each do |a|
user_answer_content = answer_choice_array.sort # answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个 # end
if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分 # user_answer_content = answer_choice_array.sort
user_score = q.question_score # standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
else # if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
user_score = 0.0 # user_score = q.question_score
end # else
else # user_score = 0.0
user_score = 0.0 # end
end # else
# user_score = 0.0
# end
end end
end end

@ -3,7 +3,7 @@ class ExerciseAnswerComment < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :exercise_question belongs_to :exercise_question
belongs_to :exercise_shixun_answer, optional: true belongs_to :exercise_shixun_answer, optional: true
belongs_to :exercise_answer,optional: true belongs_to :exercise_answer, optional: true
scope :search_answer_comments, lambda {|name,ids| where("#{name}":ids)} scope :search_answer_comments, lambda {|name,ids| where("#{name}":ids)}
end end

@ -51,13 +51,12 @@ module Searchable::Shixun
visits_count: visits, visits_count: visits,
challenges_count: challenges_count, challenges_count: challenges_count,
study_count: myshixuns_count, study_count: myshixuns_count,
description: description
} }
end end
module ClassMethods module ClassMethods
def searchable_includes def searchable_includes
{ user: { user_extension: :school } } [ :shixun_info, user: { user_extension: :school } ]
end end
end end
end end

@ -46,8 +46,7 @@ class Subject < ApplicationRecord
# 挑战过路径的成员数(金课统计去重后的报名人数) # 挑战过路径的成员数(金课统计去重后的报名人数)
def member_count def member_count
excellent && CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).length > shixuns.pluck(:myshixuns_count).sum ? excellent ? CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).length : shixuns.pluck(:myshixuns_count).sum
CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).length : shixuns.pluck(:myshixuns_count).sum
end end
def all_score def all_score

@ -22,4 +22,9 @@ class Tiding < ApplicationRecord
value value
end end
def anonymous?
(container_type == 'StudentWorksScore' && extra.to_i == 3) ||
(container_type == 'StudentWorksScoresAppeal' && parent_container_type == 'StudentWork' && tiding_type == 'System')
end
end end

@ -28,9 +28,11 @@ module ElasticsearchAble
end end
def body_options def body_options
{ hash = {}
min_score: EduSetting.get('es_min_score') || 10
} hash[:min_score] = (EduSetting.get('es_min_score') || 10) if keyword != '*'
hash
end end
def per_page def per_page

@ -0,0 +1,56 @@
class ShixunSearchService < ApplicationService
include ElasticsearchAble
attr_reader :params
def initialize(params)
@params = params
end
def call
# 全部实训/我的实训
type = params[:type] || "all"
# 状态:已发布/未发布
status = params[:status] || "all"
# 超级管理员用户显示所有未隐藏的实训、非管理员显示所有已发布的实训(对本单位公开且未隐藏未关闭)
if type == "mine"
@shixuns = User.current.shixuns.none_closed
else
if User.current.admin? || User.current.business?
@shixuns = Shixun.none_closed.where(hidden: 0)
else
none_shixun_ids = ShixunSchool.where("school_id != #{User.current.school_id}").pluck(:shixun_id)
@shixuns = Shixun.where.not(id: none_shixun_ids).none_closed.where(hidden: 0)
end
end
unless status == "all"
@shixuns = status == "published" ? @shixuns.where(status: 2) : @shixuns.where(status: [0, 1])
end
## 筛选 难度
if params[:diff].present? && params[:diff].to_i != 0
@shixuns = @shixuns.where(trainee: params[:diff])
end
Shixun.search(keyword, search_options)
end
private
def search_options
model_options = {
includes: [ :shixun_info, :challenges, :subjects, user: { user_extension: :school } ]
}
model_options.merge!(where: { id: @shixuns.pluck(:id) })
model_options.merge!(order: {"myshixuns_count" => sort_str})
model_options.merge!(default_options)
model_options
end
def sort_str
params[:order] || "desc"
end
end

@ -1,4 +1,4 @@
# json.shixun_list @shixuns do |shixun| # json.shixun_lists @shixuns do |shixun|
# json.shixun_identifier shixun.identifier # json.shixun_identifier shixun.identifier
# json.name shixun.name # json.name shixun.name
# json.creator shixun.user&.full_name # json.creator shixun.user&.full_name

@ -0,0 +1,22 @@
json.shixuns_count @results.total_count
json.shixun_list do
json.array! @results.with_highlights(multiple: true) do |obj, highlights|
json.merge! obj.to_searchable_json
json.challenge_names obj.challenges.pluck(:subject)
# 去除开头标点符号
reg = /^[,。?:;‘’!“”—……、]/
highlights[:description]&.first&.sub!(reg, '')
highlights[:content]&.first&.sub!(reg, '')
json.title highlights.delete(:name)&.join('...') || obj.searchable_title
json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]
json.content highlights
json.level level_to_s(obj.trainee)
json.subjects obj.subjects.uniq do |subject|
json.(subject, :id, :name)
end
end
end

@ -10,7 +10,7 @@ json.shixun_list do
# json.description highlights.values[0,5].each { |arr| arr.is_a?(Array) ? arr.join('...') : arr }.join('<br/>') # json.description highlights.values[0,5].each { |arr| arr.is_a?(Array) ? arr.join('...') : arr }.join('<br/>')
json.content highlights json.content highlights
json.level level_to_s(obj.trainee) json.level level_to_s(obj.trainee)
json.subjects obj.subjects do |subject| json.subjects obj.subjects.uniq do |subject|
json.(subject, :id, :name) json.(subject, :id, :name)
end end
end end

@ -17,8 +17,13 @@ json.homework_type homework_type
json.time tiding.how_long_time json.time tiding.how_long_time
json.new_tiding tiding.unread?(@onclick_time) json.new_tiding tiding.unread?(@onclick_time)
# 需要系统头像
show_system_user = tiding.trigger_user_id.zero? ||
(tiding.trigger_user_id == 1 && tiding.tiding_type == 'System') ||
tiding.anonymous?
json.trigger_user do json.trigger_user do
if tiding.trigger_user_id.zero? || (tiding.trigger_user_id == 1 && tiding.tiding_type == 'System') if show_system_user
json.id 0 json.id 0
json.name "系统" json.name "系统"
json.login "" json.login ""

@ -202,6 +202,7 @@
2_end: "别人对你的匿评发起的申诉申请:%s审核未通过" 2_end: "别人对你的匿评发起的申诉申请:%s审核未通过"
StudentWork: StudentWork:
Apply_end: "发起了匿评申诉申请:%s" Apply_end: "发起了匿评申诉申请:%s"
HomeworkCommon_end: "发起了匿评申诉申请:%s"
System_end: "有人对你的匿评发起了申诉:%s" System_end: "有人对你的匿评发起了申诉:%s"
Department_end: "你选填的二级单位:%s%s因不符合规范,已被系统删除.请重新选择" Department_end: "你选填的二级单位:%s%s因不符合规范,已被系统删除.请重新选择"
Library: Library:

@ -174,7 +174,10 @@ Rails.application.routes.draw do
end end
end end
resources :shixun_lists
resources :shixuns, param: :identifier do resources :shixuns, param: :identifier do
collection do collection do
get :menus get :menus
get :get_recommend_shixuns get :get_recommend_shixuns
@ -182,7 +185,7 @@ Rails.application.routes.draw do
get :get_mirror_script get :get_mirror_script
post :apply_shixun_mirror post :apply_shixun_mirror
get :download_file get :download_file
get :shixun_list get :shixun_lists
end end
member do member do

Binary file not shown.

@ -81,8 +81,10 @@ namespace :public_classes do
homework.update_columns(publish_time: publish_time, end_time: end_time, created_at: created_at, updated_at: updated_at) homework.update_columns(publish_time: publish_time, end_time: end_time, created_at: created_at, updated_at: updated_at)
homework.homework_detail_manual.update_columns(comment_status: 6, created_at: created_at, updated_at: updated_at) homework.homework_detail_manual.update_columns(comment_status: 6, created_at: created_at, updated_at: updated_at)
homework.update_homework_work_score
homework.update_attribute('calculation_time', end_time)
homework.student_works.where("work_status !=0 and update_time > '#{end_time}'").update_all(update_time: end_time) # homework.student_works.where("work_status !=0 and update_time > '#{end_time}'").update_all(update_time: end_time)
end end
when 3 when 3
# 试卷 # 试卷

File diff suppressed because one or more lines are too long

@ -34,8 +34,9 @@
// location.href = './compatibility' // location.href = './compatibility'
location.href = '/compatibility.html' location.href = '/compatibility.html'
} }
const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); // const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
if (isMobile) { const isWeiXin = (/MicroMessenger/i.test(navigator.userAgent.toLowerCase()));
if (isWeiXin) {
document.write('<script type="text/javascript" src="/javascripts/wx/jweixin-1.3.0.js"><\/script>'); document.write('<script type="text/javascript" src="/javascripts/wx/jweixin-1.3.0.js"><\/script>');
} }
</script> </script>

@ -9,7 +9,7 @@ import {
Route, Route,
Switch Switch
} from 'react-router-dom'; } from 'react-router-dom';
import axios from 'axios';
import '@icedesign/base/dist/ICEDesignBase.css'; import '@icedesign/base/dist/ICEDesignBase.css';
import '@icedesign/base/index.scss'; import '@icedesign/base/index.scss';
@ -37,7 +37,7 @@ import {MuiThemeProvider, createMuiTheme} from 'material-ui/styles';
import history from './history'; import history from './history';
import {SnackbarHOC, configShareForIndex} from 'educoder' import {SnackbarHOC} from 'educoder'
import {initAxiosInterceptors} from './AppConfig' import {initAxiosInterceptors} from './AppConfig'
@ -303,47 +303,7 @@ class App extends Component {
mydisplay:true, mydisplay:true,
}) })
}; };
initWXShare = () => {
if (window.wx) {
const wx = window.wx
const url = '/wechats/js_sdk_signature.json'
const currentUrl = window.location.href.split('#')[0]
// window.encodeURIComponent()
axios.post(url, {
url: window.__testUrl || currentUrl,
}).then((response) => {
console.log('got res')
const data = response.data;
wx.config({
debug: false,
appId: data.appid,
timestamp: data.timestamp,
nonceStr: data.noncestr,
signature: data.signature,
jsApiList: [
'onMenuShareTimeline',//
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone'
]
});
wx.ready(function () {
console.log('wx is ready')
configShareForIndex('/')
});
wx.error(function (res) {
console.log('wx is error')
console.log(res)
//alert(res.errMsg);//错误提示
});
}).catch((error) => {
console.log(error)
})
}
}
disableVideoContextMenu = () => { disableVideoContextMenu = () => {
window.$( "body" ).on( "mousedown", "video", function(event) { window.$( "body" ).on( "mousedown", "video", function(event) {
if(event.which === 3) { if(event.which === 3) {
@ -365,7 +325,6 @@ class App extends Component {
}); });
initAxiosInterceptors(this.props) initAxiosInterceptors(this.props)
this.initWXShare()
// //
// axios.interceptors.response.use((response) => { // axios.interceptors.response.use((response) => {
// // console.log("response"+response); // // console.log("response"+response);

@ -10,7 +10,7 @@ broadcastChannelOnmessage('refreshPage', () => {
}) })
function locationurl(list){ function locationurl(list){
debugger
if (window.location.port === "3007") { if (window.location.port === "3007") {
} else { } else {

@ -3,4 +3,6 @@ export function isDev() {
} }
// const isMobile // const isMobile
export const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); export const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
// const isWeiXin = (/MicroMessenger/i.test(navigator.userAgent.toLowerCase()));

@ -1,4 +1,5 @@
const host = window.location.host import axios from 'axios'
const host = window.location.protocol + '//' + window.location.host
const wx = window.wx const wx = window.wx
function share(shareData) { function share(shareData) {
try { try {
@ -11,7 +12,47 @@ function share(shareData) {
console.log(e) console.log(e)
} }
} }
const urlDoneMap = {}
function requestForSignatrue (callback) {
const currentUrl = window.location.href.split('#')[0]
if (window.wx && !urlDoneMap[currentUrl]) {
const wx = window.wx
const url = '/wechats/js_sdk_signature.json'
urlDoneMap[currentUrl] = true
// window.encodeURIComponent()
axios.post(url, {
url: window.__testUrl || currentUrl,
}).then((response) => {
console.log('got res')
const data = response.data;
wx.config({
debug: false,
appId: data.appid,
timestamp: data.timestamp,
nonceStr: data.noncestr,
signature: data.signature,
jsApiList: [
'onMenuShareTimeline',//
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone'
]
});
wx.ready(function () {
callback && callback()
});
wx.error(function (res) {
console.log('wx is error')
console.log(res)
//alert(res.errMsg);//错误提示
});
}).catch((error) => {
console.log(error)
})
}
}
/** /**
实践课程 平台提供涵盖基础入门案例实践和创新应用的完整实训项目体系通过由浅入深的实训路径帮助学生快速提升实战能力 实践课程 平台提供涵盖基础入门案例实践和创新应用的完整实训项目体系通过由浅入深的实训路径帮助学生快速提升实战能力
实训项目 覆盖不同专业的IT实验和实训每周更新无需配置本机实验环境随时随地开启企业级真实实训 实训项目 覆盖不同专业的IT实验和实训每周更新无需配置本机实验环境随时随地开启企业级真实实训
@ -19,60 +60,72 @@ function share(shareData) {
单个课程和实训 获取课程/实训的简介 该课程或者实训展示的缩略图 单个课程和实训 获取课程/实训的简介 该课程或者实训展示的缩略图
*/ */
export function configShareForIndex (path) { export function configShareForIndex (path) {
if (!wx) return; requestForSignatrue(() => {
var shareData = { var shareData = {
title: 'EduCoder - 首页', title: 'EduCoder - 首页',
desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台提供企业级工程实训以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动将传统的知识传授和时兴的工程实战一体化。', desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台提供企业级工程实训以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动将传统的知识传授和时兴的工程实战一体化。',
link: host + (path || ''), link: host + (path || ''),
imgUrl: window.__testImageUrl imgUrl: window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg' || host + '/react/build/images/share_logo_icon.jpg'
}; };
share(shareData) share(shareData)
})
} }
export function configShareForPaths () { export function configShareForPaths () {
if (!wx) return; requestForSignatrue(() => {
var shareData = { console.log('configShareForPaths', host)
title: 'EduCoder - 实践课程', var shareData = {
desc: '平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系,通过由浅入深的实训路径,帮助学生快速提升实战能力。', title: 'EduCoder - 实践课程',
link: `${host}/paths`, desc: '平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系,通过由浅入深的实训路径,帮助学生快速提升实战能力。',
imgUrl: window.__testImageUrl link: `${host}/paths`,
|| host + '/react/build/images/share_logo_icon.jpg' imgUrl: window.__testImageUrl
}; || host + '/react/build/images/share_logo_icon.jpg'
share(shareData) };
share(shareData)
})
} }
export function configShareForShixuns () { export function configShareForShixuns () {
if (!wx) return; requestForSignatrue(() => {
var shareData = { console.log('configShareForShixuns', host)
title: 'EduCoder - 实训项目',
desc: '覆盖不同专业的IT实验和实训每周更新无需配置本机实验环境随时随地开启企业级真实实训。', var shareData = {
link: `${host}/shixuns`, title: 'EduCoder - 实训项目',
imgUrl: window.__testImageUrl desc: '覆盖不同专业的IT实验和实训每周更新无需配置本机实验环境随时随地开启企业级真实实训。',
|| host + '/react/build/images/share_logo_icon.jpg' link: `${host}/shixuns`,
}; imgUrl: window.__testImageUrl
share(shareData) || host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
})
} }
export function configShareForCourses () { export function configShareForCourses () {
if (!wx) return; requestForSignatrue(() => {
var shareData = { console.log('configShareForCourses', host)
title: 'EduCoder - 翻转课堂',
desc: '自动评测实训任务,支持技能统计,提供教学活动分析报告,减轻教师和助教的辅导压力,免去作业发布和批改的困扰,实时了解学生学习情况,全面提升教师施教效率和水平。', var shareData = {
link: `${host}/courses`, title: 'EduCoder - 翻转课堂',
imgUrl: window.__testImageUrl desc: '自动评测实训任务,支持技能统计,提供教学活动分析报告,减轻教师和助教的辅导压力,免去作业发布和批改的困扰,实时了解学生学习情况,全面提升教师施教效率和水平。',
|| host + '/react/build/images/share_logo_icon.jpg' link: `${host}/courses`,
}; imgUrl: window.__testImageUrl
share(shareData) || host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
})
} }
// detail // detail
export function configShareForCustom (title, desc, path, imgUrl) { export function configShareForCustom (title, desc, path, imgUrl) {
if (!wx) return; requestForSignatrue(() => {
var shareData = { console.log('configShareForCustom', host)
title: title,
desc: desc, var shareData = {
link: `${host}/${path}`, title: title,
imgUrl: imgUrl || window.__testImageUrl desc: desc,
|| host + '/react/build/images/share_logo_icon.jpg' link: `${host}/${path}`,
}; imgUrl: imgUrl || window.__testImageUrl
share(shareData) || host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
})
} }

@ -174,7 +174,7 @@ class TPIContextProvider extends Component {
} }
let testPath = '' let testPath = ''
if (window.location.port == 3007) { if (window.location.port == 3007) {
testPath = 'http://pre-newweb.educoder.net' testPath = 'http://test-newweb.educoder.net'
} }
// var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time` // var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time`
var url = `${testPath}/api/tasks/${ game.identifier }/cost_time` var url = `${testPath}/api/tasks/${ game.identifier }/cost_time`

@ -93,13 +93,13 @@ class ListPageIndex extends Component{
} }
componentDidMount(){ componentDidMount(){
console.log("77"); // console.log("77");
var yslGuideone = window.localStorage.getItem('yslGuideone'); var yslGuideone = window.localStorage.getItem('yslGuideone');
console.log("78"); // console.log("78");
console.log(yslGuideone); // console.log(yslGuideone);
try { try {
if (yslGuideone === "true") { if (yslGuideone === "true") {
console.log("true 字符串"); // console.log("true 字符串");
this.setState({ this.setState({
yslGuideone:true, yslGuideone:true,
}) })
@ -107,7 +107,7 @@ class ListPageIndex extends Component{
this.setState({ this.setState({
yslGuideone:false, yslGuideone:false,
}); });
console.log("false 字符串"); // console.log("false 字符串");
} }
}catch (e) { }catch (e) {
console.log(e); console.log(e);
@ -133,8 +133,7 @@ class ListPageIndex extends Component{
window.localStorage.setItem('yslGuideone', bool); window.localStorage.setItem('yslGuideone', bool);
try { try {
if (bool === "true") { if (bool === "true") {
console.log("115");
console.log("true 字符串");
this.setState({ this.setState({
yslGuideone:true, yslGuideone:true,
}) })
@ -142,11 +141,10 @@ class ListPageIndex extends Component{
this.setState({ this.setState({
yslGuideone:false, yslGuideone:false,
}); });
console.log("124");
console.log("false 字符串");
} }
}catch (e) { }catch (e) {
console.log(e); // console.log(e);
this.setState({ this.setState({
yslGuideone:false, yslGuideone:false,
}); });

@ -0,0 +1,555 @@
import React,{Component} from 'react';
import { Modal,Checkbox,Select,Input,Tooltip,Spin,Icon,Drawer,Dropdown,Menu,Breadcrumb,Pagination,Button,notification} from "antd";
import axios from'axios';
import NoneData from "../coursesPublic/NoneData";
import './Newshixunmodel.css';
const Search = Input.Search;
class NewShixunModel extends Component{
constructor(props){
super(props)
this.state={
shixun_list:undefined,
shixuns_count:undefined,
Grouplist:[],
allGrouplist:[{page:1,list:[]}],
page:1,
type:'all',
status:'all',
keyword:undefined,
order:'desc',
diff:0,
limit:15,
}
}
componentDidMount() {
let{page,type,keyword,order,diff,limit,status}=this.state;
this.getdatalist(page,type,status,keyword,order,diff,limit)
}
getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype)=>{
this.setState({
isspinning:true
})
let status=this.props.statustype===undefined?newstatus:'published';
let url="/shixun_lists.json"
axios.get(url,{params:{
page,
type,
status,
keyword,
order,
diff,
limit
}}).then((response) => {
if(response.data){
if(pagetype===undefined){
this.setState({
shixun_list:response.data.shixun_list,
shixuns_count:response.data.shixuns_count,
Grouplist:[],
isspinning:false
})
}else if(pagetype==="pagetype"){
this.setState({
shixun_list:response.data.shixun_list,
shixuns_count:response.data.shixuns_count,
isspinning:false
})
}
}
}).catch((error) => {
this.setState({
isspinning:false
})
})
}
DropdownClick=(diff)=>{
this.setState({
diff:diff
})
let{page,type,status,keyword,order,limit}=this.state;
this.getdatalist(page,type,status,keyword,order,diff,limit)
}
ItsCourse=(item)=>{
return <Menu>
{item.map((list,key)=>{
return(
<Menu.Item key={key} id={list.id}>
<a target="_blank" href={`/paths/${list.id}`} className={"newshixun500"} title={list.name}>{list.name}</a>
</Menu.Item>
)
})}
</Menu>
}
getGrouplist=(Grouplist)=>{
let {page,allGrouplist}=this.state;
let newallGrouplist=allGrouplist;
var a=newallGrouplist.find((value,index,arr)=>{
return value.page==page
});
if(a!=undefined){
newallGrouplist.map((item,key)=>{
if(item.page===page){
item.list=Grouplist
}
})
}
let newGrouplist=[];
newallGrouplist.map((item,key)=>{
item.list.map((items,ke)=>{
newGrouplist.push(items)
})
})
this.setState({
Grouplist: newGrouplist,
allGrouplist:newallGrouplist
})
}
PaginationCourse=(pageNumber)=>{
let {allGrouplist}=this.state;
let newallGrouplist=allGrouplist;
var v=newallGrouplist.find((value,index,arr)=>{
return value.page==pageNumber
});
if(v===undefined){
newallGrouplist.push({page:pageNumber,list:[]})
}
let{type,status,keyword,order,diff,limit}=this.state;
this.getdatalist(pageNumber,type,status,keyword,order,diff,limit,"pagetype")
this.setState({
page:pageNumber,
allGrouplist:newallGrouplist
})
}
belongto=(value)=>{
this.setState({
type:value,
keyword:undefined,
page:1
})
let{status,order,diff,limit}=this.state;
this.getdatalist(1,value,status,undefined,order,diff,limit)
}
updatedlist=(order)=>{
if(order==="desc"){
this.setState({
order:"asc"
})
let{type,page,status,keyword,diff,limit}=this.state;
this.getdatalist(page,type,status,keyword,"asc",diff,limit)
}else{
this.setState({
order:"desc"
})
let{type,page,status,keyword,diff,limit}=this.state;
this.getdatalist(page,type,status,keyword,"desc",diff,limit)
}
}
setdatafunsval=(e)=>{
this.setState({
keyword:e.target.value
})
}
setdatafuns=(value)=>{
this.setState({
keyword:value,
type:undefined,
page:1,
status:'all',
order:'desc',
diff:0,
limit:15,
})
this.getdatalist(1,undefined,'all',value,'desc',0,15)
}
showNotification = (description, message = "提示", icon) => {
const data = {
message,
description
}
if (icon) {
data.icon = icon;
}
notification.open(data);
}
savecouseShixunModal=()=>{
this.setState({
hometypepvisible:true
})
let {coursesId}=this.props;
let{Grouplist}=this.state;
if(Grouplist.length===0){
this.setState({
hometypepvisible:false
})
this.showNotification("请先选择实训")
return
}
if (this.props.chooseShixun) {
if(Grouplist.length>1){
this.setState({
hometypepvisible:false
})
this.showNotification("试卷选择的实训数不能大于1")
return
}
this.props.chooseShixun(Grouplist)
this.setState({
hometypepvisible:false
})
return;
}
if (this.props.pathShixun) {
this.setState({
hometypepvisible:false
})
this.props.pathShixun(Grouplist)
return;
}
let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json";
axios.post(url, {
category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id),
shixun_ids:Grouplist,
}
).then((response) => {
if(response.data.status===-1){
// this.props.showNotification(response.data.message)
}else{
// this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids)
this.showNotification("操作成功")
this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order);
this.props.hideNewShixunModelType()
}
this.setState({
hometypepvisible:false
})
// category_id: 3
// homework_ids: (5) [9171, 9172, 9173, 9174, 9175]
}).catch((error) => {
console.log(error)
this.setState({
hometypepvisible:false
})
})
}
poststatus=(status)=>{
this.setState({
status:status
})
let{page,type,keyword,order,diff,limit}=this.state;
this.getdatalist(page,type,status,keyword,order,diff,limit)
}
render() {
let {diff,Grouplist,status,shixun_list,shixuns_count,page,type,order}=this.state;
// let {visible,patheditarry}=this.props;
// console.log(Grouplist)
// console.log(allGrouplist)
const statusmenus=(
<Menu className="menus">
<Menu.Item>
<a className={status==="all"?"color-blue":""} onClick={()=>this.poststatus("all")}>
所有
</a>
</Menu.Item>
<Menu.Item >
<a className={status==="published"?"color-blue":""} onClick={()=>this.poststatus("published")} >
已发布
</a>
</Menu.Item>
<Menu.Item>
<a className={status==="unpublished"?"color-blue":""} onClick={()=>this.poststatus("unpublished")}>
未发布
</a>
</Menu.Item>
</Menu>
);
const menus = (
<Menu className="menus">
<Menu.Item>
<a className={diff===0?"color-blue":""} onClick={()=>this.DropdownClick(0)}>
所有
</a>
</Menu.Item>
<Menu.Item >
<a className={diff===1?"color-blue":""} onClick={()=>this.DropdownClick(1)} >
初级
</a>
</Menu.Item>
<Menu.Item>
<a className={diff===2?"color-blue":""} onClick={()=>this.DropdownClick(2)}>
中级
</a>
</Menu.Item>
<Menu.Item>
<a className={diff===3?"color-blue":""} onClick={()=>this.DropdownClick(3)}>
高级
</a>
</Menu.Item>
<Menu.Item>
<a className={diff===4?"color-blue":""} onClick={()=>this.DropdownClick(4)}>
顶级
</a>
</Menu.Item>
</Menu>
);
return(
<div>
<style>
{
`body{ overflow: hidden !important; }
.ant-drawer-content{ overflow:auto !important; background: #f5f5f5; }
.yslbottomsj{position: absolute;bottom: -8px;}
`
}
</style>
<Drawer
placement="bottom"
closable={false}
destroyOnClose={true}
visible={this.props.NewShixunModelType}
height={'100%'}
>
<Spin spinning={this.state.isspinning}>
<div className={"clearfix educontent pr"}>
<div className={"square-list clearfix"}>
<div className="newshixunheadersear">
<div style={{height:"53px"}}></div>
<Search
style={{ width: "800px"}}
className="packinput"
placeholder="实训信息 / 院校名称 / 创建者"
value={this.state.keyword}
enterButton={<span>搜索</span>}
onInput={(e)=>this.setdatafunsval(e)}
onSearch={ (value)=>this.setdatafuns(value)} />
</div>
<div className="clearfix font-12 mt30">
<div className="font-12 ml5 fl">
<span className="fl color-grey-9 mr20">已选 <span className={"color-blue"}>{Grouplist.length}</span> </span>
<span className="fl color-grey-9 mr20"> <span className={"color-blue"}>{shixuns_count===undefined?"":shixuns_count}</span> </span>
<span className="fl color-grey-9 pointer mr30">
<a className={" color-grey-6"} onClick={()=>this.updatedlist(order)}>学习人数</a>
<sapn className="relativef ml5 " >
<i className={order==="desc"?"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9"}></i>
<i className={order==="asc"?"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9"}></i>
</sapn>
</span>
{this.props.statustype===undefined?<Dropdown overlay={statusmenus}>
<a className="ant-dropdown-link color-grey-6 mr20">
{status==='all'?"发布状态":status==='published'?"已发布":status==="unpublished"?"未发布":""}<Icon type="down" className={"color-grey-6"}/>
</a>
</Dropdown>:""}
<Dropdown overlay={menus}>
<a className="ant-dropdown-link color-grey-6">
{diff===0?"难度":diff===1?"初级":diff===2?"中级":diff===3?"高级":diff===4?"顶级":""}<Icon type="down" className={"color-grey-6"}/>
</a>
</Dropdown>
</div>
<div className="font-12 alltopiscright ml25 fr">
<span className={"fr pointer color-grey-3"} onClick={()=>this.props.hideNewShixunModelType()}>返回</span>
<span className={type==="mine"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 pointer color-grey-3"} onClick={()=>this.belongto("mine")}>我的实训</span>
<span className={type==="all"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 pointer color-grey-3"} onClick={()=>this.belongto("all")}>全部实训</span>
</div>
</div>
<Checkbox.Group onChange={this.getGrouplist} value={Grouplist} >
{shixun_list===undefined?"":shixun_list.length===0?"":shixun_list.map((item,key)=>{
return(
<div className="mt20 edu-back-white pd20 relativef newshixunlist" key={key}>
<div className="clearfix">
<div className="item-body">
<div className="clearfix ds pr contentSection">
<Checkbox
value={item.id}
key={item.id}
className="fl task-hide edu-txt-left mt3"
name="shixun_homework[]"
></Checkbox>
<a target="_blank" href={`/shixuns/${item.identifier}/challenges`} title={item.title} className="ml15 fl font-16 color-dark maxwidth1100"
dangerouslySetInnerHTML={{__html: item.title}}
>
</a>
<div className="cl"></div>
<style>
{
`
.newradioStyles{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
max-height: 42px;
}
`
}
</style>
{JSON.stringify(item.description) == "{}"?"":<div className="newshixunmodelmidfont newradioStyles" title={item.description} dangerouslySetInnerHTML={{__html: item.description}}>
</div>}
{item.challenge_names.length===0?"":<div className="newshixunmodelbotfont">
{item.challenge_names.map((item,key)=>{
return(
<span>{key+1}{item}</span>
)
})}
</div>}
<div className={"newshixunpd030"}>
<div className="xuxianpro"></div>
</div>
<div className="color-grey panel-lightgrey fl ml30">
<style>
{`
.ant-breadcrumb-separator{
color: #D7D7D7 !important;
}
.panel-lightgrey, .panel-lightgrey span{
color: #999 !important;
}
.ant-breadcrumb-link{
margin-right:10px !important;
}
.ant-breadcrumb-separator{
margin-right:20px !important;
}
`}
</style>
<Breadcrumb separator="|">
<Breadcrumb.Item>{item.author_name}</Breadcrumb.Item>
<Breadcrumb.Item>{item.author_school_name}</Breadcrumb.Item>
<Breadcrumb.Item>难度系数{item.level}</Breadcrumb.Item>
<Breadcrumb.Item>学习人数{item.study_count}</Breadcrumb.Item>
</Breadcrumb>
</div>
{item.subjects.length===0?"":<Dropdown overlay={()=>this.ItsCourse(item.subjects)}>
<a className="ant-dropdown-link fl ml30 newshixunfont12 color-blue" >
所属课程<Icon className={"color-blue"} type="down" />
</a>
</Dropdown>}
</div>
</div>
</div>
</div>
)})
}
</Checkbox.Group>
{shixun_list===undefined||shixuns_count===undefined?"":shixun_list.length===0||shixuns_count===0?"":shixuns_count>15?<div className={" edu-txt-center pd303010"}>
<Pagination
showQuickJumper
defaultCurrent={1}
pageSize={15}
total={shixuns_count===undefined?"":shixuns_count}
current={page}
onChange={this.PaginationCourse}
/>
</div>:""}
{
shixun_list===undefined?
<div className={"minhegiht300"}>
</div>
:shixun_list.length===0? <NoneData></NoneData>:""
}
{
shixun_list===undefined?"":shixun_list.length===0?"":<div className={" edu-txt-center padding20-30"}>
<Button className={"mr20 newshixunmode"} onClick={()=>this.props.hideNewShixunModelType()}>取消</Button>
<Button className={"newshixunmode"} type="primary" onClick={()=>this.savecouseShixunModal()} loading={this.state.hometypepvisible}>确定</Button>
</div>}
</div>
</div>
</Spin>
</Drawer>
</div>
)
}
}
export default NewShixunModel;
// {JSON.stringify(item.content) == "{}"?<div className="newshixunmodelmidfont newradioStyles" title={item.description} dangerouslySetInnerHTML={{__html: item.description}}>
// </div>:<div className="newshixunmodelbotfont">
// {item.content.description === undefined || item.content.description===0?"":item.content.description.map((item,key)=>{
// return(
// <span dangerouslySetInnerHTML={{__html: item}}>{}</span>
// )
// })}
// </div>}
//
// {JSON.stringify(item.content) == "{}"?item.challenge_names.length===0?"":<div className="newshixunmodelbotfont">
// {item.challenge_names.map((item,key)=>{
// return(
// <span>第{key+1}关:{item}</span>
// )
// })}
// </div>:<div className="newshixunmodelbotfont">
// {item.content.challenge_names === undefined || item.content.challenge_names===0?"":item.content.challenge_names.map((item,key)=>{
// return(
// <span dangerouslySetInnerHTML={{__html: item}}>{}</span>
// )
// })}
// </div>}

@ -0,0 +1,250 @@
.searchinput{
width: 800px;
margin-top: 53px;
}
.newshixunheadersear{
display: flex;
justify-content: center;
}
.packinput .ant-input{
height: 55px;
width:663px !important;
font-size: 14px;
/*color: #681616 !important;*/
border-color: #E1EDF8 !important;
padding-left: 20px;
}
.packinput .ant-input-group-addon .ant-btn{
width:137px !important;
font-size: 18px;
height: 53px;
background:rgba(76,172,255,1);
}
.tabtitle{
height: 62px !important;
box-shadow: 3px 10px 21px 0px rgba(76, 76, 76, 0.15);
border-radius: 6px;
background: #fff;
display: flex;
justify-content: center;
}
.tabtitles2{
background: #fff;
height: 62px !important;
width: 1200px;
}
.tabtitless{
height: 62px !important;
line-height: 62px !important;
}
.tabtitle1{
}
.tabtitle2{
margin-left: 30px !important;
}
.counttit{
display: flex;
justify-content: center;
}
.counttittext{
text-align: left;
width: 1200px;
height: 18px;
color: #888888;
font-size: 13px;
margin-top: 24px;
}
.counttittexts{
color: #4CACFF !important;
font-size: 13px;
}
.mainx{
display: flex;
justify-content: center;
margin-top: 17px;
}
.project-packages-list{
}
.project-package-item{
display: -webkit-flex;
display: flex;
flex-direction:column;
margin-bottom: 20px;
padding: 20px;
background: white;
/* box-shadow: 1px 3px 3px 1px rgba(156,156,156,0.16); */
}
.xuxianpro{
height: 20px;
border-bottom: 1px dashed;
border-color: #EAEAEA;
margin-bottom: 18px;
}
.magr11{
margin-top: 11px;
}
.highlight{
color: #4CACFF;
}
.fonttext{
font-size: 20px;
font-weight:bold;
}
.fontextcolor{
color: #777777;
}
.tzbq{
margin-left: 68px;
}
.tzbqx{
/* margin-left: 24px; */
}
.bjyss{
background: #F8F8F8;
}
.zj{
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap
}
.ziticor{
color: #777777;
font-size: 13px;
}
.foohter{
margin-top: 20px;
display: flex;
flex-direction:row;
}
.maxwidth1100{
max-width: 1100px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
font-size: 18px !important;
font-weight: 500;
color: rgba(51,51,51,1) !important;
}
.newshixunmodelmidfont{
font-size: 14px;
font-weight: 400;
color: #999999;
margin-top: 15px;
margin-left: 30px;
max-width: 1100px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.newshixunmodelbotfont{
font-size:12px;
font-weight:400;
color:rgba(102,102,102,1);
margin-top: 15px;
margin-left: 30px;
}
.newshixunlist{
max-height:227px;
width: 1200px;
}
.xuxianpro {
height: 20px;
border-bottom: 1px dashed;
border-color: #eaeaea;
margin-bottom: 18px;
}
.newshixunpd030{
padding: 0px 30px;
}
.pd303010{
padding: 30px 30px 10px;
}
.newshixunfont12{
font-size: 12px;
color: rgba(76,172,255,1);
line-height: 21px;
}
.newshixunmode{
width: 100px;
height: 38px;
border-radius: 3px;
border: 1px solid rgba(191,191,191,1);
}
.ntopsj {
position: absolute;
top: -4px;
}
.nyslbottomsj {
position: absolute;
bottom: -6px;
}
.inherits .ant-dropdown-menu-item{
cursor: inherit !important;
}
.menus{
width: 91px;
text-align: center;
}
.newshixunmodelbotfont span{
display: inline-block;
margin-right: 34px;
}
.minhegiht300{
min-height: 300px;
}
.newshixunlist:hover{
box-shadow: 1px 6px 16px rgba(156,156,156,0.16);
opacity: 1;
border-radius: 2px;
}
.newshixun500{
max-width: 500px;
overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: nowrap;
}
.mt3 {
margin-top: 3px !important;
}
.highlight{
color: #4CACFF;
}

@ -1,120 +1,122 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import { Modal,Checkbox,Select,Input,Tooltip} from "antd"; import { Modal,Checkbox,Select,Input,Tooltip} from "antd";
import axios from'axios'; import axios from'axios';
import ShixunModal from './ShixunModal' import NewShixunModel from '../coursesPublic/NewShixunModel';
const Option = Select.Option; const Option = Select.Option;
const Search = Input.Search; const Search = Input.Search;
class ShixunChooseModal extends Component{ class ShixunChooseModal extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state={ this.state={
shixunmodal: false, shixunmodal: false,
hometypepvisible: false, hometypepvisible: false,
} }
} }
setVisible = (visible) => { setVisible = (visible) => {
if (visible) { // if (visible) {
this.createCommonWork() // this.createCommonWork()
} else { // } else {
this.setState({ shixunmodal: visible }) //
} // }
} this.setState({ shixunmodal: visible })
hidecouseShixunModal = () => { }
this.setVisible(false) hidecouseShixunModal = () => {
} this.setVisible(false)
componentDidMount() { }
componentDidMount() {
}
funshixunmodallist=(search,type,loading,page)=>{ }
let{newshixunmodallist}=this.state; funshixunmodallist=(search,type,loading,page)=>{
let newshixunmodallists=[] let{newshixunmodallist}=this.state;
if(page>1){ let newshixunmodallists=[]
newshixunmodallists=newshixunmodallist; if(page>1){
} newshixunmodallists=newshixunmodallist;
this.setState({ }
hometypepvisible:loading this.setState({
}) hometypepvisible:loading
let coursesId=this.props.match.params.coursesId; })
let url = this.props.shixunsUrl || "/courses/"+coursesId+"/homework_commons/shixuns.json"; let coursesId=this.props.match.params.coursesId;
let url = this.props.shixunsUrl || "/courses/"+coursesId+"/homework_commons/shixuns.json";
axios.get(url, {
params: { axios.get(url, {
search: search, params: {
type:type, search: search,
page:page type:type,
} page:page
}).then((result)=>{ }
if(result.status===200){ }).then((result)=>{
if(result.status===200){
let shixun_list=result.data.shixun_list;
for(var i=0; i<shixun_list.length;i++){ let shixun_list=result.data.shixun_list;
newshixunmodallists.push(shixun_list[i]) for(var i=0; i<shixun_list.length;i++){
} newshixunmodallists.push(shixun_list[i])
this.setState({ }
shixunmodal:true, this.setState({
shixunmodallist:result.data, shixunmodal:true,
newshixunmodallist:newshixunmodallists, shixunmodallist:result.data,
hometypepvisible:false newshixunmodallist:newshixunmodallists,
}) hometypepvisible:false
} })
}).catch((error)=>{ }
console.log(error); }).catch((error)=>{
}) console.log(error);
} })
funpatheditarry=(list)=>{ }
this.setState({ funpatheditarry=(list)=>{
patheditarry:list this.setState({
}) patheditarry:list
} })
createCommonWork=()=>{ }
createCommonWork=()=>{
this.setState({
hometypepvisible:true, this.setState({
patheditarry:[] hometypepvisible:true,
}) patheditarry:[]
})
let coursesId=this.props.match.params.coursesId;
let url = this.props.shixunsUrl || "/courses/"+coursesId+"/homework_commons/shixuns.json"; let coursesId=this.props.match.params.coursesId;
let url = this.props.shixunsUrl || "/courses/"+coursesId+"/homework_commons/shixuns.json";
axios.get(url).then((result)=>{
if(result.status===200){ axios.get(url).then((result)=>{
this.setState({ if(result.status===200){
shixunmodal:true, this.setState({
shixunmodallist:result.data, shixunmodal:true,
hometypepvisible:false, shixunmodallist:result.data,
newshixunmodallist:result.data.shixun_list, hometypepvisible:false,
}) newshixunmodallist:result.data.shixun_list,
} })
}).catch((error)=>{ }
console.log(error); }).catch((error)=>{
}) console.log(error);
} })
render(){ }
let {Searchvalue,type,category_id, datas, shixunmodal, shixunmodallist render(){
, hometypepvisible, newshixunmodallist, patheditarry }=this.state; let {Searchvalue,type,category_id, datas, shixunmodal, shixunmodallist
let {visible}=this.props; , hometypepvisible, newshixunmodallist, patheditarry }=this.state;
let {visible}=this.props;
// console.log(patheditarry)
return( // console.log(patheditarry)
<ShixunModal return(
datas={datas} shixunmodal===true?<NewShixunModel
category_id={this.props.match.params.category_id} statustype={'published'}
visible={shixunmodal} datas={datas}
shixunmodallist={shixunmodallist} category_id={this.props.match.params.category_id}
funshixunmodallist={(search,type,loading,page)=>this.funshixunmodallist(search,type,loading,page)} NewShixunModelType={shixunmodal}
hometypepvisible={hometypepvisible} shixunmodallist={shixunmodallist}
hidecouseShixunModal={this.hidecouseShixunModal} funshixunmodallist={(search,type,loading,page)=>this.funshixunmodallist(search,type,loading,page)}
newshixunmodallist={newshixunmodallist} hometypepvisible={hometypepvisible}
coursesId={this.props.match.params.coursesId} hideNewShixunModelType={this.hidecouseShixunModal}
courseshomeworkstart={(category_id,homework_ids)=> this.props.newhomeworkstart newshixunmodallist={newshixunmodallist}
&& this.props.newhomeworkstart(category_id,homework_ids)} coursesId={this.props.match.params.coursesId}
funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)} courseshomeworkstart={(category_id,homework_ids)=> this.props.newhomeworkstart
patheditarry={patheditarry} && this.props.newhomeworkstart(category_id,homework_ids)}
{...this.props} funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)}
></ShixunModal> patheditarry={patheditarry}
) {...this.props}
} ></NewShixunModel>:""
} )
}
}
export default ShixunChooseModal; export default ShixunChooseModal;

@ -77,7 +77,9 @@ class ExerciseReviewAndAnswer extends Component{
exerciseTotalScore:undefined, exerciseTotalScore:undefined,
// 加载效果 // 加载效果
isSpin:false isSpin:false,
// 调分数组
ajustSore:undefined
} }
} }
componentDidUpdate (prevProps) { componentDidUpdate (prevProps) {
@ -190,7 +192,23 @@ class ExerciseReviewAndAnswer extends Component{
user_exercise_status:1, user_exercise_status:1,
Id:result.data.exercise_answer_user.user_id, Id:result.data.exercise_answer_user.user_id,
exerciseTotalScore:result.data.exercise_answer_user.score, exerciseTotalScore:result.data.exercise_answer_user.score,
isSpin:false isSpin:false,
})
// 先将未批的简答题放入到调分数组中
let ajustSore = [];
result.data && result.data.exercise_questions.length>0 && result.data.exercise_questions.map((item,key)=>{
if( item.question_type == 4 && item.answer_status == 0 ){
ajustSore.push({
inputSore:0,
desc:undefined,
id:item.question_id,
position:item.q_position,
setTip:""
})
}
})
this.setState({
ajustSore
}) })
} }
}).catch((error)=>{ }).catch((error)=>{
@ -227,7 +245,7 @@ class ExerciseReviewAndAnswer extends Component{
} }
scrollToAnchor=(index)=>{ scrollToAnchor=(index)=>{
let name="Anchor_"+index; let name="Anchor_"+index;
console.log($("#Anchor_"+index).scrollTop()); // console.log($("#Anchor_"+index).scrollTop());
if (index) { if (index) {
// let anchorElement = document.getElementById(name); // let anchorElement = document.getElementById(name);
// if(anchorElement) { anchorElement.scrollIntoView(); } // if(anchorElement) { anchorElement.scrollIntoView(); }
@ -244,62 +262,115 @@ class ExerciseReviewAndAnswer extends Component{
) )
} }
// 调分 // 调分
showSetScore=(key,flag,setId)=>{ showSetScore=(key,flag,position,type,id)=>{
this.setState( this.setState(
(prevState) => ({ (prevState) => ({
exercise_questions : update(prevState.exercise_questions, {[key]: { setScore: {$set: flag == undefined || flag==false ? true : false}}}) exercise_questions : update(prevState.exercise_questions, {[key]: { setScore: {$set: flag == undefined || flag==false ? true : false}}})
}),()=>{ }),()=>{
if (setId && (flag == undefined || flag==false)) { if (position && type && (flag == undefined || flag==false)) {
$("html").animate({ scrollTop: $("#Anchor_"+setId).offset().top - 150 }) $("#input_"+position+"_"+type).focus();
$("html").animate({ scrollTop: $("#Anchor_"+position+"_"+type).offset().top - 150 });
if(id){
let { ajustSore } = this.state;
let obj = ajustSore.filter(obj => obj.id === id).length > 0;
if(!obj){
ajustSore.push({
id,
inputSore:0,
desc:undefined,
position:position,
setTip:""
})
}
}
} }
} }
) )
this.setState({ // this.setState({
score:undefined // score:undefined
}) // })
} }
inputScore=(value)=>{ inputScore=(value,id)=>{
let { ajustSore } = this.state;
var index = ajustSore.map(function (item) { return item.id; }).indexOf(id);
let reg = /^[0-9]+.?[0-9]*$/; let reg = /^[0-9]+.?[0-9]*$/;
if(reg.test(value)==false){ if(reg.test(value)==false){
this.setState({ // this.setState({
setTip:"请输入数字" // setTip:"请输入数字"
}) // })
this.setState(
(prevState) => ({
ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "请输入数字"}}})
})
)
return; return;
}else{ }else{
this.setState({ // this.setState({
setTip:"", // setTip:"",
score:value // score:value
}) // })
this.setState(
(prevState) => ({
ajustSore : update(prevState.ajustSore, {[index]: { inputSore: {$set: value},setTip:{$set: ""}}})
})
)
} }
} }
changeScoreReasons=(e)=>{ changeScoreReasons=(e,id)=>{
console.log(e.target.value); // console.log(e.target.value);
this.setState({ // this.setState({
setScoreReason:e.target.value // setScoreReason:e.target.value
}) // })
let value = e.target.value;
let { ajustSore } = this.state;
var index = ajustSore.map(function (item) { return item.id; }).indexOf(id);
this.setState(
(prevState) => ({
ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: value}}})
})
)
} }
//确认调分 //确认调分
setAction=(key,q_id,maxScore)=>{ setAction=(key,q_id,maxScore,oldScore)=>{
let {ajustSore}=this.state;
let{ score,setScoreReason ,setTip }=this.state; let list = ajustSore.filter(obj => obj.id == q_id);
let index = ajustSore.map(function (item) { return item.id; }).indexOf(q_id);
let score = list[0].inputSore;
let setScoreReason = list[0].desc;
let{ setTip }=this.state;
if(!score && score != 0){ if(!score && score != 0){
this.setState({ // this.setState({
setTip:"请输入分数" // setTip:"请输入分数"
}) // })
this.setState(
(prevState) => ({
ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "请输入分数"}}})
})
)
return; return;
} }
if(score < 0){ if(score < 0){
this.setState({ // this.setState({
setTip:"分数必须大于或者等于0" // setTip:"分数必须大于或者等于0"
}) // })
this.setState(
(prevState) => ({
ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "分数必须大于或者等于0"}}})
})
)
return; return;
} }
if(score > maxScore){ if(score > maxScore){
this.setState({ // this.setState({
setTip:"分数不能大于当前题目的分数" // setTip:"分数不能大于当前题目的分数"
}) // })
this.setState(
(prevState) => ({
ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "分数不能大于当前题目的分数"}}})
})
)
return; return;
} }
if(setTip==""){ if(setTip==""){
@ -311,21 +382,26 @@ class ExerciseReviewAndAnswer extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.status==200){ if(result.status==200){
this.props.showNotification('调分成功'); this.props.showNotification('调分成功');
console.log(this.state.exercise_questions); this.getInfo();
let statusScore = score==0 ? 0 : score > 0 && score < maxScore ? 2 : 1; // let statusScore = score==0 ? 0 : score > 0 && score < maxScore ? 2 : 1;
console.log(statusScore);
this.setState( // this.setState(
(prevState) => ({ // (prevState) => ({
exercise_questions : update(prevState.exercise_questions, {[key]: { user_score: {$set: score},answer_status : {$set: statusScore},question_comments:{$set:result.data.question_comments} }}), // exercise_questions : update(prevState.exercise_questions, {[key]: { user_score: {$set: parseFloat(score).toFixed(1)},answer_status : {$set: statusScore},question_comments:{$set:result.data.question_comments} }}),
}) // })
) // )
console.log(this.state.exercise_questions);
this.setState({ // this.setState(
score:undefined, // (prevState) => ({
setTip:"", // ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: undefined},inputSore:{ $set:undefined }}})
setScoreReason:undefined // })
}) // )
this.showSetScore(key,true); // let {exerciseTotalScore} = this.state;
// let newScore = parseFloat(parseFloat(exerciseTotalScore)+parseFloat(score)-parseFloat(oldScore)).toFixed(1);
// this.setState({
// exerciseTotalScore:newScore
// })
// this.showSetScore(key,true);
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
@ -518,12 +594,13 @@ class ExerciseReviewAndAnswer extends Component{
ModalSave, ModalSave,
Loadtype, Loadtype,
exerciseTotalScore, exerciseTotalScore,
isSpin isSpin,
ajustSore
}=this.state }=this.state
let isAdmin = this.props.isAdmin(); let isAdmin = this.props.isAdmin();
let isStudent =this.props.isStudent(); let isStudent =this.props.isStudent();
const { current_user } = this.props const { current_user } = this.props
console.log(data&&data.exercise.user_name) // console.log(data&&data.exercise.user_name)
return( return(
<div className="newMain" style={{paddingTop:"0px"}}> <div className="newMain" style={{paddingTop:"0px"}}>
<Spin size="large" spinning={isSpin}> <Spin size="large" spinning={isSpin}>
@ -709,6 +786,7 @@ class ExerciseReviewAndAnswer extends Component{
<div> <div>
{ {
exercise_questions && exercise_questions.map((item,key)=>{ exercise_questions && exercise_questions.map((item,key)=>{
let list = ajustSore && ajustSore.filter(obj => obj.id === item.question_id);
return( return(
<div className="bor-top-greyE pt30 pb30" id={"Anchor_"+parseInt(key+1)}> <div className="bor-top-greyE pt30 pb30" id={"Anchor_"+parseInt(key+1)}>
<p className="clearfix font-16 pl30 pr30"> <p className="clearfix font-16 pl30 pr30">
@ -716,32 +794,32 @@ class ExerciseReviewAndAnswer extends Component{
<span className="fr"> <span className="fr">
{ {
// 填空(一直都有调分),和简答题调分:老师身份 已经评分的才能出现调分按钮 // 填空(一直都有调分),和简答题调分:老师身份 已经评分的才能出现调分按钮
isAdmin && ((parseInt(item.answer_status) != 0 && item.question_type == 4) || item.question_type == 3) ? isAdmin && ((parseInt(item.answer_status) != 0 && item.question_type == 4) || item.question_type == 3 || item.question_type == 1) ?
<WordsBtn style="blue" className="mr20 font-16 fl" onClick={()=>this.showSetScore(key,item.setScore,item.q_position+"_"+item.question_type)}>调分</WordsBtn>:"" <WordsBtn style="blue" className="ml20 font-16 fl" onClick={()=>this.showSetScore(key,item.setScore,item.q_position,item.question_type,item.question_id)}>调分</WordsBtn>:""
} }
{ {
// 简答题,未评分的显示未批 // 简答题,未评分的显示未批
isAdmin && parseInt(item.answer_status) == 0 && item.question_type == 4 ? isAdmin && parseInt(item.answer_status) == 0 && item.question_type == 4 ?
<span className="color-red fl mr20">未批</span>:"" <span className="color-red fl ml20">未批</span>:""
} }
{ {
// 客观题:老师||学生(试卷已截止且答案公开)显示正确答案 // 客观题:老师||学生(试卷已截止且答案公开)显示正确答案
item.question_type < 3 && item.standard_answer_show ? item.question_type < 3 && item.standard_answer_show ?
<span className="font-16 ml20"> <span className="font-16 fl ml20">
正确答案{ item.standard_answer_show } 正确答案{ item.standard_answer_show }
</span>:"" </span>:""
} }
{ {
//(老师身份且除实训题外) || (学生身份且试卷已经截止)就显示用户当前题目所得分数 //(老师身份且除实训题外) || (学生身份且试卷已经截止)就显示用户当前题目所得分数
( isAdmin || (isStudent && exercise.exercise_status == 3)) && item.question_type != 5 && item.user_score ? ( isAdmin || (isStudent && exercise.exercise_status == 3)) && item.question_type != 5 && item.user_score ?
<span className="font-16 ml20"> <span className="font-16 ml20 fl">
<span><span className={parseInt(item.answer_status) == 0 ?"color-red":parseInt(item.answer_status) == 1 ?"color-green":"color-orange-tip"}>{item.user_score}</span> </span> <span><span className={parseInt(item.answer_status) == 0 ?"color-red":parseInt(item.answer_status) == 1 ?"color-green":"color-orange-tip"}>{item.user_score}</span> </span>
</span> : "" </span> : ""
} }
{ {
//实训题 ,答题 //实训题 ,答题
item.question_type == 5 && item.question_type == 5 &&
<a href={"/shixuns/"+item.shixun_identifier+"/challenges"} target="_blank" class="font-16 color-blue" target={"_blank"}>实训详情</a> <a href={"/shixuns/"+item.shixun_identifier+"/challenges"} target="_blank" class="font-16 color-blue fl" target={"_blank"}>实训详情</a>
} }
</span> </span>
</p> </p>
@ -825,7 +903,7 @@ class ExerciseReviewAndAnswer extends Component{
{ {
//调分理由部分 //调分理由部分
item.question_comments && item.question_comments.comment && (item.question_type == 3 || item.question_type == 4) && item.question_comments && item.question_comments.comment && (item.question_type == 3 || item.question_type == 4 || item.question_type == 1) &&
<div className="ml30 mr30 bor-top-greyE pt30 mt20 clearfix df"> <div className="ml30 mr30 bor-top-greyE pt30 mt20 clearfix df">
<img src={getImageUrl(`images/${item.question_comments.user_picture}`)} width="48" height="48" className="radius mr10"/> <img src={getImageUrl(`images/${item.question_comments.user_picture}`)} width="48" height="48" className="radius mr10"/>
<div className="flex1"> <div className="flex1">
@ -839,7 +917,7 @@ class ExerciseReviewAndAnswer extends Component{
} }
{ {
// 调分输入部分 // 调分输入部分
isAdmin && ((item.setScore && item.question_type == 3) || ((item.setScore || parseInt(item.answer_status) == 0) && item.question_type == 4))? isAdmin && ((item.setScore && item.question_type == 3) || (item.setScore && item.question_type == 1) || ((item.setScore || parseInt(item.answer_status) == 0) && item.question_type == 4))?
<div className="ml30 mr30 bor-top-greyE pt20 mt20" id={`${"Anchor_"+item.q_position+"_"+item.question_type}`}> <div className="ml30 mr30 bor-top-greyE pt20 mt20" id={`${"Anchor_"+item.q_position+"_"+item.question_type}`}>
<div className="edu-txt-right"> <div className="edu-txt-right">
<span><span className="color-red">*</span></span> <span><span className="color-red">*</span></span>
@ -848,25 +926,26 @@ class ExerciseReviewAndAnswer extends Component{
<InputNumber <InputNumber
placeholder="请填写分数" placeholder="请填写分数"
min={0} min={0}
max={item.question_score} // max={item.question_score}
value={score} value={list && list.length>0 && list[0].inputSore}
step={0.1} step={0.1}
precision={1} precision={1}
className={ setTip !="" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"} className={ list && list.length>0 && list[0].setTip !="" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"}
onChange={this.inputScore} onChange={(value)=>this.inputScore(value,item.question_id)}
id={`${"input_"+item.q_position+"_"+item.question_type}`}
></InputNumber> ></InputNumber>
<span className="ml5"></span> <span className="ml5"></span>
{ {
parseInt(item.answer_status) == 0 && item.question_type == 4 ? <span className="color-red ml10 font-16">未评分</span> : '' parseInt(item.answer_status) == 0 && item.question_type == 4 ? <span className="color-red ml10 font-16">未评分</span> : ''
} }
<ActionBtn style="blue" className="middle ml20" onClick={()=>this.setAction(key,item.question_id,item.question_score)}>确认</ActionBtn> <ActionBtn style="blue" className="middle ml20" onClick={()=>this.setAction(key,item.question_id,item.question_score,item.user_score)}>确认</ActionBtn>
</p> </p>
{ {
setTip !="" ? <p className="color-red edu-txt-left">{setTip}</p> :"" list && list.length > 0 && list[0].setTip !="" ? <p className="color-red edu-txt-left">{ list[0].setTip }</p> :""
} }
</li> </li>
</div> </div>
<Textarea className="winput-100-150 mt20" value={setScoreReason} style={{height:"180px"}} maxLength="100" onChange={this.changeScoreReasons} placeholder="请您输入评语最大限制100个字符"></Textarea> <Textarea className="winput-100-150 mt20" value={list && list.length>0 && list[0].desc} style={{height:"180px"}} maxLength="100" onChange={(e)=>this.changeScoreReasons(e,item.question_id)} placeholder="请您输入评语最大限制100个字符"></Textarea>
</div>:"" </div>:""
} }
</div> </div>

@ -35,10 +35,15 @@ class ShixunWorkDetails extends Component {
} }
}).then((result) => { }).then((result) => {
if (result.status === 200) { if (result.status === 200) {
this.setState({ if (result.data.status === 403 || result.data.status === 401 || result.data.status === 407 || result.data.status === 408|| result.data.status === 409 || result.data.status === 500) {
data:result.data,
spinning:false }else{
}) this.setState({
data:result.data,
spinning:false
})
}
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -50,7 +55,33 @@ class ShixunWorkDetails extends Component {
shixuntypes:type[3] shixuntypes:type[3]
}) })
} }
updatas=()=>{
this.setState({
spinning:true
})
let homeworkid=this.props.match.params.homeworkid;
let userid=this.props.match.params.userid;
let url = "/homework_commons/"+homeworkid+"/code_review_detail.json";
axios.get(url,{
params: {
user_id:userid,
}
}).then((result) => {
if (result.status === 200) {
if (result.data.status === 403 || result.data.status === 401 || result.data.status === 407 || result.data.status === 408|| result.data.status === 409 || result.data.status === 500) {
}else{
this.setState({
data:result.data,
spinning:false
})
}
}
}).catch((error) => {
console.log(error)
})
}
goback=(sum)=>{ goback=(sum)=>{
// let{data}=this.state // let{data}=this.state
// if(sum===1){ // if(sum===1){
@ -102,14 +133,18 @@ class ShixunWorkDetails extends Component {
<span className="fl color-orange font-14">非编程类型任务不参与查重</span> <span className="fl color-orange font-14">非编程类型任务不参与查重</span>
<span className="fr mt4"> <span className="fr mt4">
<span className={"color656565"}>被查作品</span> <span className={"color656565"}>被查作品</span>
<span className={"mr20"}>{data&&data.username}</span> <span className={"mr50"}><span className={"color-orange"}>{data&&data.username}</span></span>
<span className={"color-orange"}>{data&&data.final_score}</span> {data&&data.eff_score===null||data&&data.eff_score===undefined||data&&data.eff_score_full===null||data&&data.eff_score_full===undefined?"":<span className={"mr50"}>效率分<span className={"color-orange"}>{data&&data.eff_score}</span>/{data&&data.eff_score_full}</span>}
<span className={""}>最终成绩<span className={"color-orange"}>{data&&data.final_score}</span></span>
</span> </span>
</div> </div>
<div className="stud-class-set bor-bottom-greyE"> <div className="stud-class-set bor-bottom-greyE">
<div className="clearfix edu-back-white poll_list"> <div className="clearfix edu-back-white poll_list">
<ShixunCustomsPass <ShixunCustomsPass
{...this.props}
{...this.state}
updatas={()=>this.updatas()}
data={data} data={data}
/> />
</div> </div>

@ -1,10 +1,10 @@
import React, {Component} from "react"; import React, {Component} from "react";
import {WordsBtn} from 'educoder'; import {WordsBtn} from 'educoder';
import {Table} from "antd"; import {Table,InputNumber} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom'; import {Link,Switch,Route,Redirect} from 'react-router-dom';
import moment from 'moment'; import moment from 'moment';
import { MonacoDiffEditor } from 'react-monaco-editor'; import { MonacoDiffEditor } from 'react-monaco-editor';
import axios from 'axios';
class ShixunCustomsPass extends Component { class ShixunCustomsPass extends Component {
constructor(props) { constructor(props) {
@ -18,10 +18,51 @@ class ShixunCustomsPass extends Component {
componentDidMount() { componentDidMount() {
} }
editgame_scores=(e,id,maxsum,code_rate,copy_user_id)=>{
let{datas}=this.state;
let newdatas=datas;
let score=e.target.value;
if(score!=null&&score!=undefined&&score!=""){
if(score<0){
this.props.showNotification("不能小于0");
this.setState({
customsids:id
})
}else if(score>maxsum){
this.props.showNotification(`不能大于关卡分值${maxsum}`);
this.setState({
customsids:id
})
}else{
let work_id=this.props.data.work_id;
let url=`/student_works/${work_id}/adjust_review_score.json`
axios.post(url,{
type:"review",
score:score,
challenge_id:id,
code_rate:code_rate,
copy_user_id:copy_user_id
}).then((result)=>{
if(result.data.status===0){
this.props.updatas();
this.props.showNotification(result.data.message);
}else{
this.props.showNotification(result.data.message);
}
}).catch((error)=>{
})
}
}else{
this.props.showNotification("调分为空将不会修改之前的分数");
}
}
render() { render() {
let {data}=this.props; let {data}=this.props;
console.log(data) let {customsids}=this.state;
// console.log(data)
let datas=[]; let datas=[];
data&&data.challenge_list.forEach((item,key)=>{ data&&data.challenge_list.forEach((item,key)=>{
@ -33,6 +74,8 @@ class ShixunCustomsPass extends Component {
finishtime:item.copy_username, finishtime:item.copy_username,
elapsedtime:item.copy_end_time===null?"无":item.copy_end_time===undefined?"无":item.copy_end_time===""?"无":moment(item.copy_end_time).format('YYYY-MM-DD HH:mm:ss'), elapsedtime:item.copy_end_time===null?"无":item.copy_end_time===undefined?"无":item.copy_end_time===""?"无":moment(item.copy_end_time).format('YYYY-MM-DD HH:mm:ss'),
empvalue:item.code_rate, empvalue:item.code_rate,
challenge_id:{id:item.id},
copy_user_id:item.copy_user_id
// adjustmentminute:asdasd // adjustmentminute:asdasd
}) })
}) })
@ -112,6 +155,22 @@ class ShixunCustomsPass extends Component {
render: (text, record) => ( render: (text, record) => (
<span className={"color-grey-9"}> <span className={"color-grey-9"}>
{record.elapsedtime} {record.elapsedtime}
</span>
),
},{
title: '调分',
key: 'adjustmentminute',
dataIndex: 'adjustmentminute',
render: (text, record) => (
<span>
<a>
{record.copy_user_id===null?"":<InputNumber size="small" className={customsids===record.challenge_id.id?"bor-red":""} defaultValue={record.evaluating.final_score}
onBlur={(e) => this.editgame_scores(e,record.challenge_id.id,record.evaluating.all_score,record.empvalue,record.copy_user_id)}
// min={0} max={record.game_scores.game_score_full}
/>}
</a>
{/*<a style={{textAlign: "center"}} className="color-blue font-14 mr20">查看</a>*/}
</span> </span>
), ),
}, { }, {
@ -138,7 +197,15 @@ class ShixunCustomsPass extends Component {
// }, // },
if(this.props.isAdmin()===false){
columns.some((item,key)=> {
if (item.title === "调分") {
columns.splice(key, 1)
return true
}
}
)
}
return ( return (
<div> <div>
@ -177,6 +244,9 @@ class ShixunCustomsPass extends Component {
.customsPass{ .customsPass{
text-align: left !important; text-align: left !important;
} }
.ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 16px 12px;
}
`} `}
</style> </style>
{datas===undefined?"":<Table {datas===undefined?"":<Table

@ -6,6 +6,7 @@ import axios from'axios';
import HomeworkModal from "../coursesPublic/HomeworkModal"; import HomeworkModal from "../coursesPublic/HomeworkModal";
import ShixunModal from "../coursesPublic/ShixunModal"; import ShixunModal from "../coursesPublic/ShixunModal";
import PathModal from "../coursesPublic/PathModal"; import PathModal from "../coursesPublic/PathModal";
import NewShixunModel from '../coursesPublic/NewShixunModel';
import AddcoursesNav from "../coursesPublic/AddcoursesNav"; import AddcoursesNav from "../coursesPublic/AddcoursesNav";
import Modals from '../../modals/Modals'; import Modals from '../../modals/Modals';
import moment from 'moment'; import moment from 'moment';
@ -445,18 +446,18 @@ class ShixunHomework extends Component{
} }
// 选用实训 // // 选用实训
createCommonWork=()=>{ // createCommonWork=()=>{
//
this.setState({ // this.setState({
hometypepvisible:true, // hometypepvisible:true,
shixunmodal:true, // shixunmodal:true,
patheditarry:[], // patheditarry:[],
checkBoxValues:[] // checkBoxValues:[]
}) // })
//
//
} // }
// 选用实训路径 // 选用实训路径
createCommonpath=()=>{ createCommonpath=()=>{
@ -502,9 +503,9 @@ class ShixunHomework extends Component{
// }).then((result)=>{ // }).then((result)=>{
// if(result.status===200){ // if(result.status===200){
// //
// let shixun_list=result.data.shixun_list; // let shixun_lists=result.data.shixun_lists;
// for(var i=0; i<shixun_list.length;i++){ // for(var i=0; i<shixun_lists.length;i++){
// newshixunmodallists.push(shixun_list[i]) // newshixunmodallists.push(shixun_lists[i])
// } // }
// this.setState({ // this.setState({
// shixunmodal:true, // shixunmodal:true,
@ -540,9 +541,9 @@ class ShixunHomework extends Component{
// }).then((result)=>{ // }).then((result)=>{
// if(result.status===200){ // if(result.status===200){
// //
// let shixun_list=result.data.subject_list; // let shixun_lists=result.data.subject_list;
// for(var i=0; i<shixun_list.length;i++){ // for(var i=0; i<shixun_lists.length;i++){
// newshixunmodallists.push(shixun_list[i]) // newshixunmodallists.push(shixun_lists[i])
// } // }
// this.setState({ // this.setState({
// shixunpath:true, // shixunpath:true,
@ -896,6 +897,18 @@ class ShixunHomework extends Component{
this.props.history.push(this.props.current_user.first_category_url); this.props.history.push(this.props.current_user.first_category_url);
} }
} }
showNewShixunModelType=()=>{
this.setState({
NewShixunModelType:true,
patheditarry:[],
checkBoxValues:[]
})
}
hideNewShixunModelType=()=>{
this.setState({
NewShixunModelType:false
})
}
render(){ render(){
let { let {
modalname, modalname,
@ -931,7 +944,7 @@ class ShixunHomework extends Component{
course_modules, course_modules,
shixunpath, shixunpath,
order, order,
antIcon, NewShixunModelType,
}=this.state; }=this.state;
let main_id=this.props.match.params.main_id; let main_id=this.props.match.params.main_id;
@ -940,6 +953,23 @@ class ShixunHomework extends Component{
return( return(
<React.Fragment > <React.Fragment >
<div> <div>
{/*新版实训model*/}
{NewShixunModelType===true?<NewShixunModel
{...this.props}
{...this.state}
category_id={this.props.match.params.category_id}
type={'shixuns'}
hideNewShixunModelType={()=>this.hideNewShixunModelType()}
coursesId={this.props.match.params.coursesId}
homeworkupdatalists={(Coursename,page,order)=>this.homeworkupdatalist(Coursename,page,order)}
Coursename={Coursename}
page={page}
order={order}
statustype={'published'}
/>:""}
{/*提示*/} {/*提示*/}
{Modalstype&&Modalstype===true?<Modals {Modalstype&&Modalstype===true?<Modals
modalsType={this.state.Modalstype} modalsType={this.state.Modalstype}
@ -973,23 +1003,23 @@ class ShixunHomework extends Component{
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)} getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
/>:""} />:""}
{/*选择实训*/} {/*/!*选择实训*!/*/}
{shixunmodal===true?<ShixunModal {/*{shixunmodal===true?<ShixunModal*/}
{...this.props} {/*{...this.props}*/}
{...this.state} {/*{...this.state}*/}
datas={datas} {/*datas={datas}*/}
category_id={this.props.match.params.category_id} {/*category_id={this.props.match.params.category_id}*/}
visible={shixunmodal} {/*visible={shixunmodal}*/}
shixunmodallist={shixunmodallist} {/*shixunmodallist={shixunmodallist}*/}
homeworkupdatalists={(Coursename,page,order)=>this.homeworkupdatalist(Coursename,page,order)} {/*homeworkupdatalists={(Coursename,page,order)=>this.homeworkupdatalist(Coursename,page,order)}*/}
hometypepvisible={hometypepvisible} {/*hometypepvisible={hometypepvisible}*/}
hidecouseShixunModal={this.hidecouseShixunModal} {/*hidecouseShixunModal={this.hidecouseShixunModal}*/}
newshixunmodallist={newshixunmodallist} {/*newshixunmodallist={newshixunmodallist}*/}
coursesId={this.props.match.params.coursesId} {/*coursesId={this.props.match.params.coursesId}*/}
courseshomeworkstart={(category_id,homework_ids)=>this.newhomeworkstart(category_id,homework_ids)} {/*courseshomeworkstart={(category_id,homework_ids)=>this.newhomeworkstart(category_id,homework_ids)}*/}
funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)} {/*funpatheditarry={(patheditarry)=>this.funpatheditarry(patheditarry)}*/}
patheditarry={patheditarry} {/*patheditarry={patheditarry}*/}
/>:""} {/*/>:""}*/}
{shixunmodal===true||shixunpath===true?<style> {shixunmodal===true||shixunpath===true?<style>
{ {
@ -1051,7 +1081,7 @@ class ShixunHomework extends Component{
</span>: </span>:
<WordsBtn style="blue" onClick={()=>this.editDir(datas&&datas.category_name)} className={"mr30 font-16"}>目录重命名</WordsBtn>:""} <WordsBtn style="blue" onClick={()=>this.editDir(datas&&datas.category_name)} className={"mr30 font-16"}>目录重命名</WordsBtn>:""}
{this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?<WordsBtn style="blue" className="mr30 font-16" onClick={this.createCommonpath}>选用实践课程</WordsBtn>:"":""} {this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?<WordsBtn style="blue" className="mr30 font-16" onClick={this.createCommonpath}>选用实践课程</WordsBtn>:"":""}
{this.props.isAdmin()===true?<a className={"btn colorblue font-16"} onClick={()=>this.createCommonWork()}>选用实训</a>:""} {this.props.isAdmin()===true?<a className={"btn colorblue font-16"} onClick={()=>this.showNewShixunModelType()}>选用实训</a>:""}
</li> </li>
</p> </p>

@ -391,9 +391,16 @@ class MainContentContainer extends Component {
// var fileUpdatePromise = this.doFileUpdateRequest(true) // var fileUpdatePromise = this.doFileUpdateRequest(true)
// }); // });
// } // }
window.addEventListener("beforeunload", this.beforeunload);
} }
componentWillUnmount() { componentWillUnmount() {
// window.$(window).off( "unload" ) // window.$(window).off( "unload" )
window.removeEventListener("beforeunload", this.beforeunload);
}
beforeunload = () => {
this.doFileUpdateRequestOnCodeMirrorBlur()
} }

@ -1,10 +1,11 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {getImageUrl} from 'educoder'; import {getImageUrl} from 'educoder';
import {Modal,Input,Checkbox,Tooltip,Spin} from "antd"; import {Modal,Input,Checkbox,Tooltip,Spin,notification} from "antd";
import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd'; import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd';
import Modals from '../../modals/Modals'; import Modals from '../../modals/Modals';
import '../ShixunPaths.css'; import '../ShixunPaths.css';
import axios from 'axios'; import axios from 'axios';
import NewShixunModel from '../../courses/coursesPublic/NewShixunModel';
const $ = window.$; const $ = window.$;
const Search = Input.Search; const Search = Input.Search;
@ -60,36 +61,34 @@ class DetailCardsEditAndAdd extends Component{
this.setState({ this.setState({
selectShixun:true, selectShixun:true,
patheditarry:[], patheditarry:[],
page:1
}) })
this.changeTag(0,""); // this.changeTag(0,"");
} }
//关闭选择实训弹框 //关闭选择实训弹框
cloasShixunBox =()=>{ cloasShixunBox =()=>{
this.setState({ this.setState({
selectShixun:false, selectShixun:false,
page:1,
patheditarry:[] patheditarry:[]
}) })
} }
clickShixunchoose=()=>{ showNotification = (description, message = "提示", icon) => {
const data = {
let{patheditarry,shixuns_listeditlist,shixuns_listedit}=this.state message,
description
}
if (icon) {
data.icon = icon;
}
notification.open(data);
}
clickShixunchoose=(patheditarry)=>{
let{shixuns_listeditlist,shixuns_listedit}=this.state
let newshixuns_listedit=shixuns_listedit; let newshixuns_listedit=shixuns_listedit;
let list=shixuns_listeditlist let list=shixuns_listeditlist
if(patheditarry.length===0){
this.setState({
Modalstype:true,
Modalstopval:'请选择实训',
cardsModalsave:this.cardsModalsave
})
return
}
let url='/paths/append_to_stage.json' let url='/paths/append_to_stage.json'
axios.post(url,{ axios.post(url,{
shixun_id:patheditarry shixun_id:patheditarry
@ -98,6 +97,19 @@ class DetailCardsEditAndAdd extends Component{
if(response.data){ if(response.data){
let newshixun_lists=response.data.shixun_lists; let newshixun_lists=response.data.shixun_lists;
for(var j=0; j<newshixuns_listedit.length; j++){
for(var a=0; a<newshixun_lists.length; a++){
if(newshixuns_listedit[j].shixun_id===newshixun_lists[a].shixun_id){
// this.setState({
// Modalstype:true,
// Modalstopval:'请勿重复选择'+newshixun_lists[a].shixun_name+'实训',
// })
this.showNotification('请勿重复选择:'+newshixun_lists[a].shixun_name+'实训')
return
}
}
}
for(var z=0; z<newshixun_lists.length; z++){ for(var z=0; z<newshixun_lists.length; z++){
newshixuns_listedit.push(newshixun_lists[z]); newshixuns_listedit.push(newshixun_lists[z]);
} }
@ -148,38 +160,7 @@ class DetailCardsEditAndAdd extends Component{
}) })
} }
//打开选择实训弹框初始化tag标签和列表
changeTag=(id,search)=>{
this.setState({
ChooseShixunListshixun_list:[],
page:1,
hometypepvisible:true,
})
let pathId=this.props.pathid;
let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+1
if(search!="" && search!=undefined){
url+="&search="+search;
}
if(id!=0){
url+="&type="+id;
}
axios.get(encodeURI(url)).then((result)=>{
if(result.status===200){
this.setState({
ChooseShixunList:result.data,
hometypepvisible:false,
type:id,
ChooseShixunListshixun_list:result.data.shixun_list
})
}
}).catch((error)=>{
console.log(error);
})
}
//勾选实训 //勾选实训
shixunhomeworkedit=(list)=>{ shixunhomeworkedit=(list)=>{
@ -307,57 +288,7 @@ class DetailCardsEditAndAdd extends Component{
} }
contentViewScrolladd=(e)=>{
const {ChooseShixunList}=this.state;
//滑动到底判断
let newscrollTop=parseInt(e.currentTarget.scrollTop);
let allclientHeight=e.currentTarget.clientHeight+newscrollTop;
if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){
if(ChooseShixunList.shixun_list.length===0){
return
}else{
// console.log("到达底部");
this.setState({
hometypepvisible:true
})
let pathId=this.props.pathid;
let {search,page,type,ChooseShixunListshixun_list}=this.state;
let newpage=page+1;
let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
if(search!="" && search!=undefined){
url+="&search="+search;
}
if(type!=0){
url+="&type="+type;
}
axios.get(encodeURI(url)).then((result)=>{
if(result.status===200){
let list =result.data.shixun_list;
for(var i=0; i<list.length; i++){
newChooseShixunListshixun_list.push(list[i])
}
this.setState({
ChooseShixunList:result.data,
hometypepvisible:false,
type:type,
search:search,
page:newpage,
ChooseShixunListshixun_list:newChooseShixunListshixun_list
})
}
}).catch((error)=>{
console.log(error);
})
}
}
}
onDragEnd (result) { onDragEnd (result) {
let {shixuns_listedit,shixuns_listeditlist} =this.state; let {shixuns_listedit,shixuns_listeditlist} =this.state;
@ -456,99 +387,13 @@ class DetailCardsEditAndAdd extends Component{
` `
} }
</style>:""} </style>:""}
{selectShixun===true?<NewShixunModel
NewShixunModelType={selectShixun}
hideNewShixunModelType={this.cloasShixunBox}
pathShixun={this.clickShixunchoose}
{...this.props}
></NewShixunModel>:""}
<Modal
keyboard={false}
title="选择实训"
visible={selectShixun}
closable={false}
footer={null}
width="840px"
destroyOnClose={true}
>
<Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
<div className="newupload_conbox">
<div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">
<li className="fl mr5 mt5"> <a onClick={()=>this.changeTag(0,`${search}`)} className={ parseInt(type)===0 ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a></li>
{
ChooseShixunList && ChooseShixunList.tags.map((item,key)=>{
return(
<li className="fl mr5 mt5" key={key}>
<a onClick={()=>this.changeTag(`${item.tag_id}`,`${search}`)} className={ parseInt(type) === parseInt(item.tag_id) ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>{item.tag_name}</a>
</li>
)
})
}
</div>
<div className="clearfix mb20" id="shixun_search_form_div">
<span className="fl color-grey-9 font-16 mt3">
<span></span>
<span className="color-orange-tip">{ChooseShixunList && ChooseShixunList.shixuns_count}</span>
<span>个实训</span>
</span>
<div className="fr search-new mb0">
<Search
placeholder="请输入创建者或者实训名称进行搜索"
onInput={this.searchNameInput}
onSearch={()=>this.changeTag(`${type}`,`${search}`)}
style={{width: '115%'}}
></Search>
</div>
</div>
<ul className="clearfix greybackHead edu-txt-center" style={{marginBottom: '0px'}}>
<li className="fl with40 paddingleft22">实训名称</li>
<li className="fl with30 edu-txt-left">使用院校</li>
<li className="fl with10">使用人数</li>
<li className="fl with10">评价等级</li>
<li className="fl with10"></li>
</ul>
<style>
{
`
.over180{min-height: 180px;max-height: 180px;overflow-y: auto}
`
}
</style>
{ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"": <div className="over180 pl20 pr20"
onScroll={this.contentViewScrolladd}
>
<Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
{
ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
return(
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
<li className="fl with40">
<Checkbox
id={"shixun_input_"+item.shixun_id}
value={item.shixun_id}
key={item.shixun_id}
className="fl task-hide edu-txt-left"
style={{"width":"298px"}}
name="shixun_homework[]"
>
<label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title={item.shixun_name}>{item.shixun_name}</label>
</Checkbox>
</li>
<li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li>
<li className="fl with10 paddingl10">{item.myshixuns_count}</li>
<li className="fl with10 color-orange-tip paddingl10">{item.preference}</li>
<li className="fl with10"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
</div>
)
})
}
</Checkbox.Group>
</div>}
<div className="mt20 marginauto clearfix edu-txt-center">
<a className="pop_close task-btn mr30 margin-tp26" onClick={this.cloasShixunBox}>取消</a>
<a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.clickShixunchoose}>确定</a>
</div>
</div>
</Spin>
</Modal>
</div> </div>
{/* 可拖拽选择实训列表*/} {/* 可拖拽选择实训列表*/}
@ -650,4 +495,185 @@ class DetailCardsEditAndAdd extends Component{
) )
} }
} }
export default DetailCardsEditAndAdd; export default DetailCardsEditAndAdd;
//
// <Modal
// keyboard={false}
// title="选择实训"
// visible={selectShixun}
// closable={false}
// footer={null}
// width="840px"
// destroyOnClose={true}
// >
// <Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
// <div className="newupload_conbox">
// <div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">
// <li className="fl mr5 mt5"> <a onClick={()=>this.changeTag(0,`${search}`)} className={ parseInt(type)===0 ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a></li>
// {
// ChooseShixunList && ChooseShixunList.tags.map((item,key)=>{
// return(
// <li className="fl mr5 mt5" key={key}>
// <a onClick={()=>this.changeTag(`${item.tag_id}`,`${search}`)} className={ parseInt(type) === parseInt(item.tag_id) ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>{item.tag_name}</a>
// </li>
// )
// })
// }
//
//
// </div>
// <div className="clearfix mb20" id="shixun_search_form_div">
// <span className="fl color-grey-9 font-16 mt3">
// <span>共</span>
// <span className="color-orange-tip">{ChooseShixunList && ChooseShixunList.shixuns_count}</span>
// <span>个实训</span>
// </span>
// <div className="fr search-new mb0">
// <Search
// placeholder="请输入创建者或者实训名称进行搜索"
// onInput={this.searchNameInput}
// onSearch={()=>this.changeTag(`${type}`,`${search}`)}
// style={{width: '115%'}}
// ></Search>
// </div>
// </div>
// <ul className="clearfix greybackHead edu-txt-center" style={{marginBottom: '0px'}}>
// <li className="fl with40 paddingleft22">实训名称</li>
// <li className="fl with30 edu-txt-left">使用院校</li>
// <li className="fl with10">使用人数</li>
// <li className="fl with10">评价等级</li>
// <li className="fl with10"></li>
// </ul>
//
// <style>
// {
// `
// .over180{min-height: 180px;max-height: 180px;overflow-y: auto}
// `
// }
// </style>
// {ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"": <div className="over180 pl20 pr20"
// onScroll={this.contentViewScrolladd}
// >
// <Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
// {
// ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
// return(
// <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
// <li className="fl with40">
// <Checkbox
// id={"shixun_input_"+item.shixun_id}
// value={item.shixun_id}
// key={item.shixun_id}
// className="fl task-hide edu-txt-left"
// style={{"width":"298px"}}
// name="shixun_homework[]"
// >
// <label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title={item.shixun_name}>{item.shixun_name}</label>
// </Checkbox>
// </li>
// <li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li>
// <li className="fl with10 paddingl10">{item.myshixuns_count}</li>
// <li className="fl with10 color-orange-tip paddingl10">{item.preference}</li>
// <li className="fl with10"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
// </div>
// )
// })
// }
// </Checkbox.Group>
// </div>}
// <div className="mt20 marginauto clearfix edu-txt-center">
// <a className="pop_close task-btn mr30 margin-tp26" onClick={this.cloasShixunBox}>取消</a>
// <a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.clickShixunchoose}>确定</a>
// </div>
// </div>
// </Spin>
// </Modal>
// contentViewScrolladd=(e)=>{
// const {ChooseShixunList}=this.state;
// //滑动到底判断
// let newscrollTop=parseInt(e.currentTarget.scrollTop);
// let allclientHeight=e.currentTarget.clientHeight+newscrollTop;
//
// if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){
//
// if(ChooseShixunList.shixun_list.length===0){
// return
// }else{
// // console.log("到达底部");
// this.setState({
// hometypepvisible:true
// })
// let pathId=this.props.pathid;
// let {search,page,type,ChooseShixunListshixun_list}=this.state;
// let newpage=page+1;
// let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
// let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
// if(search!="" && search!=undefined){
// url+="&search="+search;
// }
// if(type!=0){
// url+="&type="+type;
// }
// axios.get(encodeURI(url)).then((result)=>{
// if(result.status===200){
// let list =result.data.shixun_list;
//
// for(var i=0; i<list.length; i++){
// newChooseShixunListshixun_list.push(list[i])
// }
// this.setState({
// ChooseShixunList:result.data,
// hometypepvisible:false,
// type:type,
// search:search,
// page:newpage,
// ChooseShixunListshixun_list:newChooseShixunListshixun_list
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
//
// }
//
// }
//
// }
//
// //打开选择实训弹框初始化tag标签和列表
// changeTag=(id,search)=>{
//
// this.setState({
// ChooseShixunListshixun_list:[],
// page:1,
// hometypepvisible:true,
// })
//
// let pathId=this.props.pathid;
//
// let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+1
// if(search!="" && search!=undefined){
// url+="&search="+search;
// }
// if(id!=0){
// url+="&type="+id;
// }
//
// axios.get(encodeURI(url)).then((result)=>{
// if(result.status===200){
// this.setState({
// ChooseShixunList:result.data,
// hometypepvisible:false,
// type:id,
// ChooseShixunListshixun_list:result.data.shixun_list
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
// }

@ -1,8 +1,9 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {getImageUrl} from 'educoder'; import {getImageUrl} from 'educoder';
import {Modal,Input,Checkbox,Tooltip,Spin} from "antd"; import {Modal,Input,Checkbox,Tooltip,Spin,notification} from "antd";
import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd'; import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd';
import Modals from '../../modals/Modals'; import Modals from '../../modals/Modals';
import NewShixunModel from '../../courses/coursesPublic/NewShixunModel';
import '../ShixunPaths.css'; import '../ShixunPaths.css';
import axios from 'axios'; import axios from 'axios';
const $ = window.$; const $ = window.$;
@ -63,7 +64,7 @@ class DetailCardsEditAndEdit extends Component{
selectShixun:true, selectShixun:true,
patheditarry:[] patheditarry:[]
}) })
this.changeTag(0,""); // this.changeTag(0,"");
} }
//关闭选择实训弹框 //关闭选择实训弹框
cloasShixunBox =()=>{ cloasShixunBox =()=>{
@ -79,36 +80,7 @@ class DetailCardsEditAndEdit extends Component{
}) })
} }
//打开选择实训弹框初始化tag标签和列表
changeTag(id,search){
this.setState({
ChooseShixunListshixun_list:[],
page:1,
hometypepvisible:true
})
let pathId=this.props.pathid;
let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+1
if(search!="" && search!=undefined){
url+="&search="+search;
}
if(id!=0){
url+="&type="+id;
}
axios.get(encodeURI(url)).then((result)=>{
if(result.status===200){
this.setState({
ChooseShixunList:result.data,
hometypepvisible:false,
type:id,
search:search,
ChooseShixunListshixun_list:result.data.shixun_list
})
}
}).catch((error)=>{
console.log(error);
})
}
shixunhomeworkedit=(list)=>{ shixunhomeworkedit=(list)=>{
@ -158,22 +130,12 @@ class DetailCardsEditAndEdit extends Component{
} }
clickShixunchoose=()=>{ clickShixunchoose=(patheditarry)=>{
let{patheditarry,shixuns_listedit,shixuns_listeditlist}=this.state let{shixuns_listedit,shixuns_listeditlist}=this.state
let newshixuns_listedit=shixuns_listedit; let newshixuns_listedit=shixuns_listedit;
let list=shixuns_listeditlist let list=shixuns_listeditlist
if(patheditarry.length===0){
this.setState({
Modalstype:true,
Modalstopval:'请选择实训',
})
return
}
let url='/paths/append_to_stage.json' let url='/paths/append_to_stage.json'
axios.post(url,{ axios.post(url,{
shixun_id:patheditarry shixun_id:patheditarry
@ -184,10 +146,11 @@ class DetailCardsEditAndEdit extends Component{
for(var j=0; j<newshixuns_listedit.length; j++){ for(var j=0; j<newshixuns_listedit.length; j++){
for(var a=0; a<newshixun_lists.length; a++){ for(var a=0; a<newshixun_lists.length; a++){
if(newshixuns_listedit[j].shixun_id===newshixun_lists[a].shixun_id){ if(newshixuns_listedit[j].shixun_id===newshixun_lists[a].shixun_id){
this.setState({ // this.setState({
Modalstype:true, // Modalstype:true,
Modalstopval:'请勿重复选择'+newshixun_lists[a].shixun_name+'实训', // Modalstopval:'请勿重复选择'+newshixun_lists[a].shixun_name+'实训',
}) // })
this.showNotification('请勿重复选择:'+newshixun_lists[a].shixun_name+'实训')
return return
} }
} }
@ -338,69 +301,16 @@ class DetailCardsEditAndEdit extends Component{
}) })
} }
contentViewScrolledit=(e)=>{ showNotification = (description, message = "提示", icon) => {
//滑动到底判断 const data = {
const {ChooseShixunList}=this.state; message,
let newscrollTop=parseInt(e.currentTarget.scrollTop); description
let allclientHeight=e.currentTarget.clientHeight+newscrollTop; }
if (icon) {
if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){ data.icon = icon;
}
if(ChooseShixunList.shixun_list.length===0){ notification.open(data);
return }
}else{
this.setState({
hometypepvisible:true
})
// console.log("到达底部");
let {page,type,search,ChooseShixunListshixun_list}=this.state;
let newpage=page+1;
let pathId=this.props.pathid;
let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
if(search!="" && search!=undefined){
url+="&search="+search;
}
if(type!=0){
url+="&type="+type;
}
axios.get(encodeURI(url)).then((result)=>{
if(result.status===200){
let list =result.data.shixun_list;
for(var i=0; i<list.length; i++){
newChooseShixunListshixun_list.push(list[i])
}
this.setState({
ChooseShixunList:result.data,
hometypepvisible:false,
type:type,
page:newpage,
search:search,
ChooseShixunListshixun_list:newChooseShixunListshixun_list
})
}
}).catch((error)=>{
console.log(error);
})
}
}
}
render(){ render(){
let {selectShixun, let {selectShixun,
@ -483,99 +393,13 @@ class DetailCardsEditAndEdit extends Component{
} }
</style>:""} </style>:""}
{selectShixun===true?<NewShixunModel
NewShixunModelType={selectShixun}
hideNewShixunModelType={this.cloasShixunBox}
pathShixun={this.clickShixunchoose}
{...this.props}
></NewShixunModel>:""}
<Modal
keyboard={false}
title="选择实训"
visible={selectShixun}
closable={false}
footer={null}
width="840px"
destroyOnClose={true}
>
<Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
<div className="newupload_conbox">
<div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">
<li className="fl mr5 mt5"> <a onClick={()=>this.changeTag(0,`${search}`)} className={ parseInt(type)===0 ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a></li>
{
ChooseShixunList && ChooseShixunList.tags.map((item,key)=>{
return(
<li className="fl mr5 mt5" key={key}>
<a onClick={()=>this.changeTag(`${item.tag_id}`,`${search}`)} className={ parseInt(type) === parseInt(item.tag_id) ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>{item.tag_name}</a>
</li>
)
})
}
</div>
<div className="clearfix mb20" id="shixun_search_form_div">
<span className="fl color-grey-9 font-16 mt3">
<span></span>
<span className="color-orange-tip">{ChooseShixunList && ChooseShixunList.shixuns_count}</span>
<span>个实训</span>
</span>
<div className="fr search-new mb0">
<Search
placeholder="请输入创建者或者实训名称进行搜索"
onInput={this.searchNameInput}
onSearch={()=>this.changeTag(`${type}`,`${search}`)}
style={{width: '115%'}}
></Search>
</div>
</div>
<ul className="clearfix greybackHead edu-txt-center" style={{marginBottom: '0px'}}>
<li className="fl with40 paddingleft22">实训名称</li>
<li className="fl with30 edu-txt-left">使用院校</li>
<li className="fl with10">使用人数</li>
<li className="fl with10">评价等级</li>
<li className="fl with10"></li>
</ul>
<style>
{
`
.over180{min-height: 180px;max-height: 180px;overflow-y: auto}
`
}
</style>
{ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"":<div className="over180 pl20 pr20"
onScroll={this.contentViewScrolledit}
>
<Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
{
ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
return(
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
<li className="fl with40">
<Checkbox
id={"shixun_input_"+item.shixun_id}
value={item.shixun_id}
key={item.shixun_id}
className="fl task-hide edu-txt-left"
style={{"width":"298px"}}
name="shixun_homework[]"
>
<label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title={item.shixun_name}>{item.shixun_name}</label>
</Checkbox>
</li>
<li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li>
<li className="fl with10 paddingl10">{item.myshixuns_count}</li>
<li className="fl with10 color-orange-tip paddingl10">{item.preference}</li>
<li className="fl with10"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
</div>
)
})
}
</Checkbox.Group>
</div>}
<div className="mt20 marginauto clearfix edu-txt-center">
<a className="pop_close task-btn mr30 margin-tp26" onClick={this.cloasShixunBox}>取消</a>
<a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.clickShixunchoose}>确定</a>
</div>
</div>
</Spin>
</Modal>
</div> </div>
{/* 可拖拽选择实训列表*/} {/* 可拖拽选择实训列表*/}
@ -716,4 +540,191 @@ export default DetailCardsEditAndEdit;
// </div> // </div>
// ) // )
// }) // })
// } // }
// <Modal
// keyboard={false}
// title="选择实训"
// visible={selectShixun}
// closable={false}
// footer={null}
// width="840px"
// destroyOnClose={true}
// >
// <Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
// <div className="newupload_conbox">
// <div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">
// <li className="fl mr5 mt5"> <a onClick={()=>this.changeTag(0,`${search}`)} className={ parseInt(type)===0 ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a></li>
// {
// ChooseShixunList && ChooseShixunList.tags.map((item,key)=>{
// return(
// <li className="fl mr5 mt5" key={key}>
// <a onClick={()=>this.changeTag(`${item.tag_id}`,`${search}`)} className={ parseInt(type) === parseInt(item.tag_id) ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>{item.tag_name}</a>
// </li>
// )
// })
// }
//
//
// </div>
// <div className="clearfix mb20" id="shixun_search_form_div">
// <span className="fl color-grey-9 font-16 mt3">
// <span>共</span>
// <span className="color-orange-tip">{ChooseShixunList && ChooseShixunList.shixuns_count}</span>
// <span>个实训</span>
// </span>
// <div className="fr search-new mb0">
// <Search
// placeholder="请输入创建者或者实训名称进行搜索"
// onInput={this.searchNameInput}
// onSearch={()=>this.changeTag(`${type}`,`${search}`)}
// style={{width: '115%'}}
// ></Search>
// </div>
// </div>
// <ul className="clearfix greybackHead edu-txt-center" style={{marginBottom: '0px'}}>
// <li className="fl with40 paddingleft22">实训名称</li>
// <li className="fl with30 edu-txt-left">使用院校</li>
// <li className="fl with10">使用人数</li>
// <li className="fl with10">评价等级</li>
// <li className="fl with10"></li>
// </ul>
//
// <style>
// {
// `
// .over180{min-height: 180px;max-height: 180px;overflow-y: auto}
// `
// }
// </style>
// {ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"":<div className="over180 pl20 pr20"
// onScroll={this.contentViewScrolledit}
// >
// <Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
// {
// ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{
// return(
// <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
// <li className="fl with40">
// <Checkbox
// id={"shixun_input_"+item.shixun_id}
// value={item.shixun_id}
// key={item.shixun_id}
// className="fl task-hide edu-txt-left"
// style={{"width":"298px"}}
// name="shixun_homework[]"
// >
// <label style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name" title={item.shixun_name}>{item.shixun_name}</label>
// </Checkbox>
// </li>
// <li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li>
// <li className="fl with10 paddingl10">{item.myshixuns_count}</li>
// <li className="fl with10 color-orange-tip paddingl10">{item.preference}</li>
// <li className="fl with10"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
// </div>
// )
// })
// }
// </Checkbox.Group>
// </div>}
// <div className="mt20 marginauto clearfix edu-txt-center">
// <a className="pop_close task-btn mr30 margin-tp26" onClick={this.cloasShixunBox}>取消</a>
// <a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.clickShixunchoose}>确定</a>
// </div>
// </div>
// </Spin>
// </Modal>
// //打开选择实训弹框初始化tag标签和列表
// changeTag(id,search){
//
// this.setState({
// ChooseShixunListshixun_list:[],
// page:1,
// hometypepvisible:true
// })
// let pathId=this.props.pathid;
// let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+1
// if(search!="" && search!=undefined){
// url+="&search="+search;
// }
// if(id!=0){
// url+="&type="+id;
// }
// axios.get(encodeURI(url)).then((result)=>{
// if(result.status===200){
// this.setState({
// ChooseShixunList:result.data,
// hometypepvisible:false,
// type:id,
// search:search,
// ChooseShixunListshixun_list:result.data.shixun_list
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
// }
// contentViewScrolledit=(e)=>{
// //滑动到底判断
// const {ChooseShixunList}=this.state;
// let newscrollTop=parseInt(e.currentTarget.scrollTop);
// let allclientHeight=e.currentTarget.clientHeight+newscrollTop;
//
// if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){
//
// if(ChooseShixunList.shixun_list.length===0){
// return
// }else{
// this.setState({
// hometypepvisible:true
// })
// // console.log("到达底部");
//
// let {page,type,search,ChooseShixunListshixun_list}=this.state;
//
// let newpage=page+1;
//
// let pathId=this.props.pathid;
//
// let newChooseShixunListshixun_list=ChooseShixunListshixun_list;
//
// let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage
//
// if(search!="" && search!=undefined){
// url+="&search="+search;
// }
//
// if(type!=0){
// url+="&type="+type;
// }
// axios.get(encodeURI(url)).then((result)=>{
// if(result.status===200){
//
// let list =result.data.shixun_list;
//
// for(var i=0; i<list.length; i++){
// newChooseShixunListshixun_list.push(list[i])
// }
// this.setState({
// ChooseShixunList:result.data,
// hometypepvisible:false,
// type:type,
// page:newpage,
// search:search,
// ChooseShixunListshixun_list:newChooseShixunListshixun_list
// })
// }
// }).catch((error)=>{
// console.log(error);
// })
//
//
// }
//
//
//
// }
//
// }

@ -362,6 +362,9 @@ class PathDetailIndex extends Component{
.head-right{ .head-right{
line-height: 30px; line-height: 30px;
} }
.padding40-20-30{
padding:40px 20px 30px;
}
` `
} }
</style> </style>
@ -457,7 +460,7 @@ class PathDetailIndex extends Component{
} }
{ {
this.props.checkIfLogin()===false?"":progress === undefined ? "" : progress === null ? "" : this.props.checkIfLogin()===false?"":progress === undefined ? "" : progress === null ? "" :
<div className="edu-back-white myProgress padding40-20 mb10"> <div className="edu-back-white myProgress padding40-20-30 mb10">
<p className="mb20"> <p className="mb20">
<span className="font-16 mr10">关卡数</span> <span className="font-16 mr10">关卡数</span>
<Tooltip placement="bottom" title="已通关数/关卡总数"> <Tooltip placement="bottom" title="已通关数/关卡总数">
@ -468,7 +471,8 @@ class PathDetailIndex extends Component{
<span className="fl color-green">已学 {progress.learned}%</span> <span className="fl color-green">已学 {progress.learned}%</span>
<span className="fr color-grey-9" id="time-consuming">学习耗时{this.timeStamp(progress.time)} </span> <span className="fr color-grey-9" id="time-consuming">学习耗时{this.timeStamp(progress.time)} </span>
</p> </p>
<div className="myProgressNav"><div className="myProgressGreen" style={{"width":`${progress.learned+"%"}`}}></div></div> <div className="myProgressNav mb20"><div className="myProgressGreen" style={{"width":`${progress.learned+"%"}`}}></div></div>
<span className="font-14 color-grey-8">: 我的进展以已发布的实训详情关卡数为准</span>
</div> </div>
} }

@ -8,6 +8,7 @@ class ShixunPath extends Component{
super(props) super(props)
} }
componentDidMount() { componentDidMount() {
console.log('configShareForPaths')
configShareForPaths() configShareForPaths()
} }

@ -220,6 +220,7 @@ export default class TPMsettings extends Component {
can_copy: undefined, can_copy: undefined,
task_pass: undefined, task_pass: undefined,
test_set_permission: undefined, test_set_permission: undefined,
code_edit_permission: undefined,
hide_code: undefined, hide_code: undefined,
code_hidden: undefined, code_hidden: undefined,
forbid_copy: undefined, forbid_copy: undefined,
@ -352,6 +353,7 @@ export default class TPMsettings extends Component {
task_pass: response.data.shixun.task_pass, task_pass: response.data.shixun.task_pass,
test_set_permission: response.data.shixun.test_set_permission, test_set_permission: response.data.shixun.test_set_permission,
hide_code: response.data.shixun.hide_code, hide_code: response.data.shixun.hide_code,
code_edit_permission: response.data.shixun.code_edit_permission,
code_hidden: response.data.shixun.code_hidden, code_hidden: response.data.shixun.code_hidden,
is_secret_repository: response.data.shixun.is_secret_repository, is_secret_repository: response.data.shixun.is_secret_repository,
init_is_secret_repository: response.data.shixun.is_secret_repository, init_is_secret_repository: response.data.shixun.is_secret_repository,
@ -546,7 +548,11 @@ export default class TPMsettings extends Component {
}); });
} }
code_edit_permission = (e) => {
this.setState({
code_edit_permission: e.target.checked
})
}
code_hidden=(e)=>{ code_hidden=(e)=>{
let sum = "" let sum = ""
if (e.target.checked === false) { if (e.target.checked === false) {
@ -869,7 +875,7 @@ export default class TPMsettings extends Component {
let { let {
name, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum, vnc_evaluate, name, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum, vnc_evaluate,
evaluate_script, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh, evaluate_script, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh,
opening_time,shixunmemoMDvalue,shixun_service_configlist, is_secret_repository opening_time,shixunmemoMDvalue,shixun_service_configlist, is_secret_repository, code_edit_permission
} = this.state; } = this.state;
let newshixun_service_configlist = shixun_service_configlist.map(v => { let newshixun_service_configlist = shixun_service_configlist.map(v => {
@ -982,6 +988,7 @@ export default class TPMsettings extends Component {
vnc_evaluate: vnc_evaluate===null?undefined:vnc_evaluate, vnc_evaluate: vnc_evaluate===null?undefined:vnc_evaluate,
test_set_permission: test_set_permission, test_set_permission: test_set_permission,
code_hidden: code_hidden, code_hidden: code_hidden,
code_edit_permission: code_edit_permission,
trainee: trainee, trainee: trainee,
task_pass: task_pass, task_pass: task_pass,
hide_code: hide_code, hide_code: hide_code,
@ -1563,6 +1570,7 @@ export default class TPMsettings extends Component {
test_set_permission, test_set_permission,
hide_code, hide_code,
forbid_copy, forbid_copy,
code_edit_permission,
code_hidden, code_hidden,
vnc, vnc,
vnc_evaluate, vnc_evaluate,
@ -2274,6 +2282,15 @@ export default class TPMsettings extends Component {
</span> </span>
</div> </div>
{!code_hidden && !hide_code && <div className="clearfix mt20 ml30">
<span className="color-grey-6 mt5 fl" style={{minWidth: '95px'}}>代码开放修改:</span>
<span className="fl mt5">
<Checkbox checked={code_edit_permission === undefined ? false : code_edit_permission}
onChange={this.code_edit_permission}></Checkbox>
<label style={{top:'6px'}} className="color-grey-9 ml10" >勾选则学员可以修改版本库目录中的任意文件内容</label>
</span>
</div>}
<div className="clearfix mt20 ml30"> <div className="clearfix mt20 ml30">
<span className="color-grey-6 mt5 fl" style={{minWidth: '95px'}}>隐藏代码窗口:</span> <span className="color-grey-6 mt5 fl" style={{minWidth: '95px'}}>隐藏代码窗口:</span>
<span className="fl mt5"> <span className="fl mt5">

@ -16,8 +16,8 @@ require('codemirror/lib/codemirror.css');
let origin = getUrl(); let origin = getUrl();
let path = getUrl("/editormd/lib/") let path = '/editormd/lib/'
path = getUrl("/editormd/lib/")
const $ = window.$; const $ = window.$;
let timeout; let timeout;
@ -171,7 +171,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
$("#" + _id + " [type=\"inline\"]").bind("click", function () { $("#" + _id + " [type=\"inline\"]").bind("click", function () {
_editorName.cm.replaceSelection("`$$$$`"); _editorName.cm.replaceSelection("`$$$$`");
var __Cursor = _editorName.cm.getDoc().getCursor(); var __Cursor = _editorName.cm.getDoc().getCursor();
_editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); _editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
_editorName.cm.focus(); _editorName.cm.focus();
}); });
$("[type=\"inline\"]").attr("title", "行内公式"); $("[type=\"inline\"]").attr("title", "行内公式");

@ -12,7 +12,7 @@
height: 55px; height: 55px;
width:663px !important; width:663px !important;
font-size: 18px; font-size: 18px;
color: #681616 !important; /*color: #681616 !important;*/
border-color: #E1EDF8 !important; border-color: #E1EDF8 !important;
} }

Loading…
Cancel
Save