diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f336205cd..254d04cfd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -24,12 +24,12 @@ class ApplicationController < ActionController::Base # 所有请求必须合法签名 def check_sign Rails.logger.info("66666 #{params}") - suffix = request.url.split(".").last - suffix_arr = ["xls", "xlsx"] # excel文件先注释 + suffix = request.url.split(".").last.split("?").first + suffix_arr = ["xls", "xlsx", "pdf"] # excel文件先注释 unless suffix_arr.include?(suffix) if params[:client_key].present? randomcode = params[:randomcode] - tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5) + # tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5) sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}") Rails.logger.info("2222 #{sign}") diff --git a/app/controllers/discusses_controller.rb b/app/controllers/discusses_controller.rb index 6b21526dd..e7d692de5 100644 --- a/app/controllers/discusses_controller.rb +++ b/app/controllers/discusses_controller.rb @@ -14,14 +14,14 @@ class DiscussesController < ApplicationController @disscuss_count = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil).count disscusses = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil) - @discusses = disscusses.limit(LIMIT).joins("left join games on discusses.challenge_id = games.challenge_id and discusses.user_id = games.user_id") - .select("discusses.*, games.identifier").includes(:user, :praise_treads).offset(offset) + @discusses = disscusses.joins("left join games on discusses.challenge_id = games.challenge_id and discusses.user_id = games.user_id") + .select("discusses.*, games.identifier").includes(:user, :praise_treads) else disscusses = Discuss.where("dis_id = :dis_id and dis_type = :dis_type and root_id is null and (discusses.hidden = :hidden or discusses.user_id = :user_id)", {dis_id: @container.id, dis_type: @container.class.to_s, hidden: false, user_id: current_user.id}) @disscuss_count = disscusses.count("discusses.id") - @discusses = disscusses.limit(LIMIT).includes(:user, :praise_treads).offset(offset) + @discusses = disscusses.includes(:user, :praise_treads).limit(LIMIT).offset(offset) end @current_user = current_user diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 89f65c61d..a4d34a1c8 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -11,7 +11,7 @@ class HomeworkCommonsController < ApplicationController before_action :find_homework, only: [:edit, :show, :update, :group_list, :homework_code_repeat, :code_review_results, :code_review_detail, :show_comment, :settings, :works_list, :update_settings, :reference_answer, :publish_groups, :end_groups, :alter_name, :update_explanation, - :update_score, :update_student_score] + :update_score, :update_student_score, :batch_comment] before_action :user_course_identity before_action :homework_publish, only: [:show, :works_list, :code_review_results, :show_comment, :settings, :reference_answer, :update_student_score] @@ -19,7 +19,7 @@ class HomeworkCommonsController < ApplicationController :publish_homework, :end_homework, :set_public, :choose_category, :move_to_category, :choose_category, :create_subject_homework, :multi_destroy, :group_list, :homework_code_repeat, :code_review_results, :code_review_detail, :update_explanation, :update_settings, - :add_to_homework_bank, :publish_groups, :end_groups] + :add_to_homework_bank, :publish_groups, :end_groups, :batch_comment] before_action :require_id_params, only: [:set_public, :multi_destroy, :publish_homework, :end_homework, :move_to_category, :add_to_homework_bank] before_action :course_manager, only: [:alter_name] @@ -214,7 +214,7 @@ class HomeworkCommonsController < ApplicationController limit = params[:limit] || 20 @student_works = @student_works.page(page).per(limit) if @homework.homework_type == "practice" - @student_works = @student_works.includes(:student_works_scores, user: :user_extension, myshixun: :games) + @student_works = @student_works.includes(:student_works_scores, :shixun_work_comments, user: :user_extension, myshixun: :games) else @student_works = @student_works.includes(:student_works_scores, :project, user: :user_extension) end @@ -453,105 +453,8 @@ class HomeworkCommonsController < ApplicationController # 课堂结束后不能再更新 unless @course.is_end + # 发布设置 UpdateHomeworkPublishSettingService.call(@homework, publish_params) - # 作业未发布时,unified_setting参数不能为空 -=begin - if @homework.publish_time.nil? || @homework.publish_time > Time.now - tip_exception("缺少统一设置的参数") if params[:unified_setting].nil? - if params[:unified_setting] || @course.course_groups_count == 0 - tip_exception("发布时间不能为空") if params[:publish_time].blank? - tip_exception("截止时间不能为空") if params[:end_time].blank? - tip_exception("发布时间不能早于当前时间") if params[:publish_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("截止时间不能晚于课堂结束时间(#{@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 - - @homework.unified_setting = 1 - @homework.homework_group_settings.destroy_all - @homework.publish_time = params[:publish_time] - # 截止时间为空时取发布时间后一个月 - @homework.end_time = params[:end_time] - - else - tip_exception("分班发布设置不能为空") if params[:group_settings].blank? - # 创建作业的分班设置 - create_homework_group_settings @homework - - setting_group_ids = [] - - params[:group_settings].each do |setting| - tip_exception("分班id不能为空") if setting[:group_id].length == 0 - tip_exception("发布时间不能为空") if setting[:publish_time].blank? - tip_exception("截止时间不能为空") if setting[:end_time].blank? - tip_exception("发布时间不能早于当前时间") if setting[:publish_time] <= strf_time(Time.now) - tip_exception("截止时间不能早于当前时间") if setting[:end_time] <= strf_time(Time.now) - tip_exception("截止时间不能早于发布时间") if setting[:publish_time] > setting[:end_time] - tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if - @course.end_date.present? && setting[:end_time] > @course.end_date.end_of_day - - - publish_time = setting[:publish_time] == "" ? Time.now : setting[:publish_time] - # 截止时间为空时取发布时间后一个月 - end_time = setting[:end_time] - HomeworkGroupSetting.where(homework_common_id: @homework.id, course_group_id: setting[:group_id]). - update_all(publish_time: publish_time, end_time: end_time) - setting_group_ids << setting[:group_id] - end - - # 未设置的分班:发布时间和截止时间都为nil - HomeworkGroupSetting.where.not(course_group_id: setting_group_ids).where(homework_common_id: @homework.id). - update_all(publish_time: nil, end_time: nil) - - # 记录已发布需要发消息的分班 - publish_group_ids = HomeworkGroupSetting.where(homework_common_id: @homework.id).group_published.pluck(:course_group_id) - - @homework.unified_setting = 0 - @homework.publish_time = @homework.min_group_publish_time - @homework.end_time = @homework.max_group_end_time - end - - # 如果作业立即发布则更新状态、发消息 - if @homework.publish_time <= Time.now and @homework_detail_manual.comment_status == 0 - @homework_detail_manual.comment_status = 1 - send_tiding = true - end - - # 作业在"提交中"状态时 - else - if @homework.end_time > Time.now && @homework.unified_setting - tip_exception("截止时间不能为空") if params[:end_time].blank? - 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 - @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day) - - @homework.end_time = params[:end_time] - - elsif !@homework.unified_setting - create_homework_group_settings @homework - tip_exception("分班发布设置不能为空") if params[:group_settings].blank? - params[:group_settings].each do |setting| - group_settings = HomeworkGroupSetting.where(homework_common_id: @homework.id, course_group_id: setting[:group_id]) - - tip_exception("分班id不能为空") if setting[:group_id].length == 0 - tip_exception("发布时间不能为空") if setting[:publish_time].blank? - tip_exception("截止时间不能为空") if setting[:end_time].blank? - # 如果该发布规则 没有已发布的分班则需判断发布时间 - tip_exception("发布时间不能早于等于当前时间") if setting[:publish_time] <= strf_time(Time.now) && group_settings.group_published.count == 0 - - tip_exception("截止时间不能早于等于当前时间") if setting[:end_time] <= strf_time(Time.now) && group_settings.none_end.count > 0 - tip_exception("截止时间不能早于发布时间") if setting[:publish_time] > setting[:end_time] - tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if - @course.end_date.present? && setting[:end_time] > strf_time(@course.end_date.end_of_day) - - group_settings.none_published.update_all(publish_time: setting[:publish_time]) - group_settings.none_end.update_all(end_time: setting[:end_time]) - end - - @homework.end_time = @homework.max_group_end_time - end - end -=end # 补交设置 tip_exception("缺少allow_late参数") if params[:allow_late].nil? @@ -880,69 +783,6 @@ class HomeworkCommonsController < ApplicationController ## 分页参数 page = params[:page] || 1 @shixuns = @shixuns.reorder("shixuns.created_at desc").includes(:challenges, user: [user_extension: :school]).page(page).per(10) - - # 新版用下面的代码 - # ## 我的实训 - # @shixuns = - # if params[:order_by] == 'mine' - # current_user.my_shixuns.unhidden - # else - # if current_user.admin? - # Shixun.unhidden - # else - # none_shixun_ids = ShixunSchool.where("school_id != #{current_user.school_id}").pluck(:shixun_id) - # - # @shixuns = Shixun.where.not(id: none_shixun_ids).unhidden - # end - # end - # - # ## 方向 - # if params[:tag_level].present? && params[:tag_id].present? - # @shixuns = @shixuns.filter_tag(params[:tag_level].to_i, params[:tag_id].to_i) - # case params[:tag_level].to_i - # when 1 #大类 - # @search_tags = Repertoire.find(params[:tag_id].to_i).name - # when 2 #子类 - # @search_tags = SubRepertoire.find(params[:tag_id].to_i).name - # when 3 #tag - # tag = TagRepertoire.find(params[:tag_id].to_i) - # @search_tags = "#{tag.sub_repertoire.name} / #{tag.name}" - # end - # end - # - # ## 搜索关键字创建者、实训名称、院校名称 - # if params[:keyword].present? - # keyword = params[:keyword].strip - # @shixuns = @shixuns.joins(user: [user_extenison: :school]). - # where("schools.name like '%#{keyword}%' - # or concat(lastname, firstname) like '%#{keyword}%' - # or shixuns.name like '%#{keyword.split(" ").join("%")}%'").distinct - # end - # - # ## 筛选 难度 - # if params[:diff].present? && params[:diff].to_i != 0 - # @shixuns = @shixuns.where(trainee: params[:diff]) - # end - # - # ## 排序参数 - # bsort = params[:sort] || 'desc' - # case params[:order_by] || 'hot' - # when 'hot' - # @shixuns = @shixuns.order("myshixuns_count #{bsort}") - # when 'mine' - # @shixuns = @shixuns.order("shixuns.created_at #{bsort}") - # else - # @shixuns = @shixuns.order("myshixuns_count #{bsort}") - # end - # - # @total_count = @shixuns.count - # - # ## 分页参数 - # page = params[:page] || 1 - # limit = params[:limit] || 15 - # - # @shixuns = @shixuns.includes(:challenges, user: [user_extension: :school]).page(page).per(limit) - # end def create_shixun_homework @@ -1248,31 +1088,6 @@ class HomeworkCommonsController < ApplicationController # homework_challenge_settings = homework.homework_challenge_settings unless student_works.blank? student_works.joins(:myshixun).where("myshixuns.status != 1").update_all(late_penalty: homework.late_penalty) if homework.allow_late - -=begin - student_works.where("work_status != 0").includes(:myshixun).each do |student_work| - unless student_work.myshixun.is_complete? - student_work.update_attributes(work_status: 2, late_penalty: homework.late_penalty) - student_work.late_penalty = homework.late_penalty - end - HomeworksService.new.set_shixun_final_score student_work, student_work.myshixun, homework_detail_manual.answer_open_evaluation, - homework_challenge_settings - end - - student_works.where("work_status = 0").each do |student_work| - myshixun = Myshixun.where(shixun_id: shixun.id, user_id: student_work.user_id).first - if myshixun.present? - student_work.update_attributes(work_status: (myshixun.is_complete? ? 1 : 2), - late_penalty: myshixun.is_complete? ? 0 : homework.late_penalty, - commit_time: myshixun.created_at, myshixun_id: myshixun.id) - student_work.late_penalty = myshixun.is_complete? ? 0 : homework.late_penalty - HomeworksService.new.set_shixun_final_score student_work, myshixun, homework_detail_manual.answer_open_evaluation, - homework_challenge_settings - end - end -=end - - # 更新所有学生的效率分(重新取homework确保是更新后的) end end homework.save! @@ -1558,6 +1373,21 @@ class HomeworkCommonsController < ApplicationController end + def batch_comment + tip_exception(-1, "作业还未发布,不能评阅") if @homework_detail_manual.comment_status == 0 + tip_exception("请至少输入一个评阅") if params[:comment].blank? && params[:hidden_comment].blank? + ActiveRecord::Base.transaction do + work_ids = @homework.student_works.where(work_status: [1, 2], user_id: @course.teacher_group_user_ids(current_user.id)).pluck(:id) + has_comment_ids = ShixunWorkComment.where(challenge_id: 0, student_work_id: work_ids, batch_comment: 0).pluck(:student_work_id) + batch_comment_works = ShixunWorkComment.where(challenge_id: 0, student_work_id: work_ids, batch_comment: 1) + batch_comment_works.update_all(comment: params[:comment], hidden_comment: params[:hidden_comment]) + work_ids = work_ids - has_comment_ids - batch_comment_works.pluck(:student_work_id) + # @homework.student_works.where(work_status: 0, id: work_ids).update_all(work_status: 1, commit_time: @homework.end_time, update_time: Time.now, work_score: 0, final_score: 0) + HomeworkBatchCommentJob.perform_later(params[:comment], params[:hidden_comment], work_ids, @homework.id, current_user.id) + normal_status("评阅成功") + end + end + private def find_homework diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 0c442a613..3e6914dee 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -46,8 +46,8 @@ class PollsController < ApplicationController @polls = member_show_polls.size > 0 ? member_show_polls.public_or_unset : [] else #已分班级的成员,可以查看统一设置和单独设置(试卷是发布在该班级)试卷 # 已发布 当前用户班级分组的 试卷id - not_poll_ids = @course.poll_group_settings.poll_group_not_published.where("course_group_id = #{@member_group_id}").pluck(:poll_id) - @polls = member_show_polls.where.not(id: not_poll_ids) + publish_poll_ids = @course.poll_group_settings.poll_group_published.where("course_group_id = #{@member_group_id}").pluck(:poll_id) + @polls = member_show_polls.unified_setting.or(member_show_polls.where(id: publish_poll_ids)) end else #用户未登陆或不是该课堂成员,仅显示统一设置的(已发布的/已截止的),如有公开,则不显示锁,不公开,则显示锁 @is_teacher_or = 0 @@ -722,19 +722,16 @@ class PollsController < ApplicationController un_anonymous = params[:un_anonymous] ? true : false # 统一设置或者分班为0,则更新问卷,并删除问卷分组 if unified_setting || (course_group_ids.size == 0) - params_publish_time = params[:publish_time].present? ? params[:publish_time].to_time : nil - params_end_time = nil - if params[:end_time].blank? - if params_publish_time.present? - params_end_time = params_publish_time + 30.days - end - else - params_end_time = params[:end_time].to_time - end - # params_end_time = params[:end_time].present? ? params[:end_time].to_time : nil - if poll_status == 2 && @poll.publish_time != params_publish_time - normal_status(-1,"不允许修改发布时间") - elsif poll_status == 3 && (@poll.end_time != params_end_time || @poll.publish_time != params_publish_time) + tip_exception("发布时间不能为空") if params[:publish_time].blank? + tip_exception("截止时间不能为空") if params[:end_time].blank? + tip_exception("截止时间不能早于发布时间") if params[:publish_time].to_time > params[:end_time].to_time + tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if + @course.end_date.present? && params[:end_time].to_time > @course.end_date.end_of_day + + params_publish_time = params[:publish_time].to_time + params_end_time = params[:end_time].to_time + + if poll_status != 1 && @poll.publish_time != params_publish_time normal_status(-1,"不允许修改发布时间") elsif params_publish_time.present? && params_end_time.present? && params_end_time < params_publish_time normal_status(-1,"截止时间不能小于发布时间") @@ -761,24 +758,25 @@ class PollsController < ApplicationController total_common_group = poll_groups_ids & total_common #传入的分班与问卷已存在的分班的交集 old_poll_groups = poll_groups_ids - total_common_group #后来传入的分班里,没有了的班级,即需要删除 params_times.each do |t| - course_id = t[:course_group_id] #为数组,可能会设置分班为各个班级id的数组 - poll_publish_time = t[:publish_time].present? ? t[:publish_time].to_time : nil - # poll_end_time = t[:end_time].present? ? t[:end_time].to_time : nil - poll_end_time = nil - if t[:end_time].blank? - if poll_publish_time.present? - poll_end_time = poll_publish_time + 30.days - end - else - poll_end_time = t[:end_time].to_time - end + tip_exception("发布时间不能为空") if t[:publish_time].blank? + tip_exception("截止时间不能为空") if t[:end_time].blank? + tip_exception("截止时间不能早于发布时间") if t[:publish_time].to_time > t[:end_time].to_time + tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if + @course.end_date.present? && t[:end_time].to_time > @course.end_date.end_of_day + + course_id = t[:course_group_id] + poll_publish_time = t[:publish_time].to_time + poll_end_time = t[:end_time].to_time + poll_group = poll_groups.find_in_poll_group("course_group_id",course_id) #判断该分班是否存在 - if poll_group.present? && poll_group.first.end_time <= Time.now && (poll_end_time != poll_group.first.end_time || poll_publish_time != poll_group.first.publish_time) #已截止且时间改变的,则提示错误 + + if poll_group.present? && (poll_group.first.publish_time < Time.now) && (poll_publish_time != poll_group.first.publish_time) error_count += 1 end - if poll_group.present? && poll_group.first.publish_time < Time.now && poll_publish_time != poll_group.first.publish_time + if poll_group.present? && (poll_group.first.publish_time < Time.now && poll_group.first.end_time > Time.now) && (poll_end_time < Time.now) error_count += 1 end + if error_count == 0 common_group = poll_groups_ids & course_id #传入的班级与问卷已存在的班级的交集,即表示已有分班的 new_group_ids = course_id - common_group #新传入的班级id @@ -794,12 +792,12 @@ class PollsController < ApplicationController if the_group_setting_status == 2 poll_group_params = { :publish_time => the_group_setting.publish_time, - :end_time => poll_end_time + :end_time => poll_end_time < Time.now ? the_group_setting.end_time : poll_end_time } elsif the_group_setting_status == 3 poll_group_params = { :publish_time => the_group_setting.publish_time, - :end_time => the_group_setting.end_time + :end_time => poll_end_time } end the_group_setting.update_attributes(poll_group_params) diff --git a/app/jobs/homework_batch_comment_job.rb b/app/jobs/homework_batch_comment_job.rb new file mode 100644 index 000000000..b9baa8557 --- /dev/null +++ b/app/jobs/homework_batch_comment_job.rb @@ -0,0 +1,20 @@ +# 作业的一键评阅 +class HomeworkBatchCommentJob < ApplicationJob + queue_as :default + + def perform(comment, hidden_comment, work_ids, homework_id, user_id) + # Do something later + homework = HomeworkCommon.find_by(id: homework_id) + return if homework.blank? + + attrs = %i[student_work_id challenge_id user_id comment hidden_comment batch_comment created_at updated_at] + + same_attrs = {challenge_id: 0, user_id: user_id, comment: comment, hidden_comment: hidden_comment, batch_comment: 1} + + ShixunWorkComment.bulk_insert(*attrs) do |worker| + work_ids.each do |work_id| + worker.add same_attrs.merge(student_work_id: work_id) + end + end + end +end diff --git a/app/models/poll.rb b/app/models/poll.rb index 5c1a9a64c..365e46008 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -19,6 +19,7 @@ class Poll < ApplicationRecord scope :poll_by_ids, lambda { |ids| where(id: ids) unless ids.blank? } scope :poll_by_status, lambda { |s| where(polls_status: s) unless s.blank? } scope :poll_group_ended, -> {where("end_time is NOT NULL AND end_time <= ?",Time.now)} + scope :unified_setting, -> { where("unified_setting = ?",true) } scope :poll_search, lambda { |keywords| where("polls_name LIKE ?", "%#{keywords}%") unless keywords.blank?} @@ -103,7 +104,7 @@ class Poll < ApplicationRecord if course.is_end status = 4 else - if user.present? && user.student_of_course?(course) + if user.present? && user.course_identity(course) == Course::STUDENT ex_time = get_poll_times(user.id,false) pb_time = ex_time[:publish_time] ed_time = ex_time[:end_time] diff --git a/app/services/private_messages/create_service.rb b/app/services/private_messages/create_service.rb index 88f3a084f..89365c4a7 100644 --- a/app/services/private_messages/create_service.rb +++ b/app/services/private_messages/create_service.rb @@ -30,6 +30,6 @@ class PrivateMessages::CreateService < ApplicationService def validate! raise Error, '内容不能为空' if content.blank? - raise Error, '内容太长' if content.size > 255 + raise Error, '内容太长' if content.size > 500 end end \ No newline at end of file diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder index 41518d66a..b8fa73b66 100644 --- a/app/views/homework_commons/works_list.json.jbuilder +++ b/app/views/homework_commons/works_list.json.jbuilder @@ -108,6 +108,7 @@ if @homework.homework_type == "practice" json.student_id work.user.try(:student_id) json.group_name @students.select{|student| student.user_id == work.user_id}.first.try(:course_group_name) json.work_status work.compelete_status + json.has_comment work.shixun_work_comments.size > 0 end elsif @homework.homework_type == "group" || @homework.homework_type == "normal" json.anonymous_comment @homework.anonymous_comment diff --git a/config/routes.rb b/config/routes.rb index c9da309d2..b61b2e608 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -513,6 +513,7 @@ Rails.application.routes.draw do post :alter_name get :update_score get :update_student_score + post :batch_comment end collection do diff --git a/db/migrate/20191231040201_add_batch_comment_to_shixun_work.rb b/db/migrate/20191231040201_add_batch_comment_to_shixun_work.rb new file mode 100644 index 000000000..35585bb15 --- /dev/null +++ b/db/migrate/20191231040201_add_batch_comment_to_shixun_work.rb @@ -0,0 +1,5 @@ +class AddBatchCommentToShixunWork < ActiveRecord::Migration[5.2] + def change + add_column :shixun_work_comments, :batch_comment, :boolean, default: 0 + end +end diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 673ee02ee..db6de7f47 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -24,6 +24,7 @@ function locationurl(list){ } + // TODO 开发期多个身份切换 let debugType ="" if (isDev) { @@ -42,6 +43,8 @@ if (isDev) { //ebugType="teacher"; // 学生 //debugType="student"; + + function railsgettimes(proxy) { if(timestamp&&checkSubmitFlg===false){ $.ajax({url:proxy,async:false,success:function(data){ @@ -91,9 +94,10 @@ export function initAxiosInterceptors(props) { requestMap[keyName] = false; } + axios.interceptors.request.use( config => { - + // config.headers['Content-Type']= 'no-cache' // if (token) { // 每次发送请求之前判断是否存在token,如果存在,则统一在http请求的header都加上token,不用每次请求都手动添加了 // config.headers.Authorization = token; // } @@ -137,7 +141,7 @@ export function initAxiosInterceptors(props) { let newopens=md5(opens+timestamp) config.url = url; if (config.url.indexOf('?') == -1) { - config.url = `${config.url}?&randomcode=${timestamp}&client_key=${newopens}`; + config.url = `${config.url}?randomcode=${timestamp}&client_key=${newopens}`; } else { config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`; } diff --git a/public/react/src/common/UrlTool.js b/public/react/src/common/UrlTool.js index 33a84dc55..d50aef505 100644 --- a/public/react/src/common/UrlTool.js +++ b/public/react/src/common/UrlTool.js @@ -128,7 +128,13 @@ export function getTaskUrlById(id) { export function getRandomcode(url) { Railsgettimes() let anewopens=md5(newopens+newtimestamp); - return `${url}?&randomcode=${newtimestamp}&client_key=${anewopens}` + + if (url.indexOf('?') == -1) { + return `${url}?randomcode=${newtimestamp}&client_key=${anewopens}` + }else { + return `${url}&randomcode=${newtimestamp}&client_key=${anewopens}` + } + } export function htmlEncode(str) { diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 8ac0debf5..ca93833bb 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -184,7 +184,7 @@ function buildColumns(that, student_works, studentData) { } columns = columns.concat([{ width: 88, - title: '提交状态', + title: '作品状态', dataIndex: 'work_status', key: 'work_status', @@ -320,7 +320,7 @@ function buildColumns(that, student_works, studentData) { if (!niPingAndIsStudent) { columns.push({ width: '113px', - title: '最终成绩', + title: '当前成绩', key: 'work_score', dataIndex: 'work_score', sorter: true, @@ -362,7 +362,7 @@ function buildColumns(that, student_works, studentData) { {/* 0 未提交 */} {/**/} {/**/} - { isAdmin && 调整学生最终成绩
其它历史评分将全部失效}> + { isAdmin && 调整学生当前成绩
其它历史评分将全部失效}> that.showModulationModal(record)} >调分 diff --git a/public/react/src/modules/courses/coursesPublic/ApprausePublic.js b/public/react/src/modules/courses/coursesPublic/ApprausePublic.js new file mode 100644 index 000000000..af5d1acdd --- /dev/null +++ b/public/react/src/modules/courses/coursesPublic/ApprausePublic.js @@ -0,0 +1,167 @@ +import React,{ Component } from "react"; +import { Modal,Checkbox,Upload,Button,Icon,message,Input,Radio} from "antd"; +import { WordNumberTextarea } from 'educoder'; + + +class ApprausePublic extends Component{ + constructor(props){ + super(props); + this.state={ + group_ids:[], + fileList:[], + Inputsval:undefined, + textareavaltype:false, + comment:undefined, + hidden_comment:undefined + } + } + + componentDidMount() { + + + } + + comment=(e)=>{ + this.setState({ + comment:e.target.value + }) + this.hideentyps(e.target.value) + } + + hideentyps=(value)=>{ + if(value===undefined||value===null||value===""){ + + }else{ + this.setState({ + textareavaltype:false + }) + } + } + hidden_comment=(e)=>{ + this.setState({ + hidden_comment:e.target.value + }) + this.hideentyps(e.target.value) + } + + Saves=()=>{ + let{comment,hidden_comment}=this.state; + let commenttype=comment===undefined||comment===null||comment===""; + let hidden_commenttype=hidden_comment===undefined||hidden_comment===null||hidden_comment===""; + + if(commenttype===true&&hidden_commenttype===true){ + this.setState({ + textareavaltype:true + }) + return + } + this.props.SaveAppraiseModal(this.state.comment,this.state.hidden_comment); + } + render(){ + let {textareavaltype,comment,hidden_comment}=this.state; + return( +
+ + + + +
+ +
+

+ 可见(学生可查看老师的评阅内容) +

+ {/**/} + {/*可见 (学生查看老师的评阅内容)*/} + {/*不可见 (仅对课堂老师可见)*/} + {/**/} + this.comment(e)} + value={comment} + maxlength={500} + /> + +

+ 不可见(仅对课堂老师可见) +

+ this.hidden_comment(e)} + value={hidden_comment} + maxlength={500} + /> + +
  • 评阅内容至少有一个不为空
  • +
    + + +
    +
    +
    + ) + } +} +export default ApprausePublic; \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css b/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css index 9bdf44e68..326548202 100644 --- a/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css +++ b/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css @@ -308,7 +308,7 @@ backgroud: rgba(234, 234, 234, 1); width: 530px; margin-left: 10px; - margin-top: 25px; + margin-top: 5px; height: 214px !important; } diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js index bf900eb2f..b58f1c4e5 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -132,6 +132,7 @@ class Exercisesetting extends Component{ // 已有设置数据的查询 getSettingInfo=()=>{ + this.props.Commonheadofthetestpapers() let Id=this.props.match.params.Id; let url=`/exercises/${Id}/exercise_setting.json`; axios.get(url).then((result)=>{ diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index ca4a0758a..47f42405d 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -61,7 +61,7 @@ class Testpapersettinghomepage extends Component{ } //试卷公用头部 Commonheadofthetestpaper=()=>{ - console.log("Commonheadofthetestpaper 试卷公用头部"); + // console.log("Commonheadofthetestpaper 试卷公用头部"); var exercise_id = this.props.match.params.Id; var url = `/exercises/${exercise_id}/common_header.json`; axios.get(url).then((response) => { @@ -475,7 +475,7 @@ class Testpapersettinghomepage extends Component{ } { - parseInt(tab[0])==3 ? :"" + parseInt(tab[0])==3 ? :"" } diff --git a/public/react/src/modules/courses/exercise/new/SingleDisplay.js b/public/react/src/modules/courses/exercise/new/SingleDisplay.js index 7159b0ee6..4b8d9ee95 100644 --- a/public/react/src/modules/courses/exercise/new/SingleDisplay.js +++ b/public/react/src/modules/courses/exercise/new/SingleDisplay.js @@ -1,129 +1,135 @@ -import React,{ Component } from "react"; - -import { - Form, Input, InputNumber, Switch, Radio, - Slider, Button, Upload, Icon, Rate, Checkbox, message, - Row, Col, Select, Modal, Tooltip -} from 'antd'; -import axios from 'axios' -import QestionDisplayHeader from './QestionDisplayHeader' -import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder'; -const { TextArea } = Input; -const confirm = Modal.confirm; -const $ = window.$ -const { Option } = Select; - -const tagArray = [ - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', - 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', - 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' -] -const qNameArray = [ - '单选题', - '多选题', - '判断题', - '填空题', - '简答题', - '实训题', -] -class SingleDisplay extends Component{ - constructor(props){ - super(props); - - - this.state = { - question_choices: ['', '', '', ''], - standard_answers: [false, false, false, false] - } - } - componentDidMount = () => { - const Id = this.props.match.params.Id - this.isEdit = !!Id - if (Id) { - const url = `/exercises/${Id}/edit.json` - // axios.get(url) - // .then((response) => { - // if (response.data.status == 0) { - - // } - // }) - // .catch(function (error) { - // console.log(error); - // }); - } - } - render() { - let { question_title, question_score, question_type, question_choices, standard_answer, - question_id, question_number, index, displayCount, showActionButton - } = this.props; - - // const { getFieldDecorator } = this.props.form; - - const isAdmin = this.props.isAdmin() - const courseId=this.props.match.params.coursesId; - const isEdit = this.isEdit - const qNumber = `question_${index}`; - // TODO show模式 isNew为false isEdit为false - - // [true, false, true] -> [0, 2] - - // const answerTagArray = standard_answer.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1); - let length = 5; - const qName = qNameArray[question_type] - - const isPreviewPage = showActionButton == false - - return( -
    - - - - - {/* 单选 or 多选 */} -
    - { question_choices.map((item, optionIndex) => { - let prefix = undefined - // if (!isPreviewPage) { - prefix = `${tagArray[optionIndex]}.` - // } - if (question_type == 0) { // 单选 - return ( -
    - {prefix} - - {/* */} -
    ) - } else { - - return ( -
    - {prefix} - - {/* */} -
    ) - } - })} - -
    -
    - ) - } -} -// RouteHOC() -export default (SingleDisplay); \ No newline at end of file +import React,{ Component } from "react"; + +import { + Form, Input, InputNumber, Switch, Radio, + Slider, Button, Upload, Icon, Rate, Checkbox, message, + Row, Col, Select, Modal, Tooltip +} from 'antd'; +import axios from 'axios' +import QestionDisplayHeader from './QestionDisplayHeader' +import {getUrl, ActionBtn, markdownToHTML, MarkdownToHtml} from 'educoder'; +const { TextArea } = Input; +const confirm = Modal.confirm; +const $ = window.$ +const { Option } = Select; + +const tagArray = [ + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', + 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', + 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' +] +const qNameArray = [ + '单选题', + '多选题', + '判断题', + '填空题', + '简答题', + '实训题', +] +class SingleDisplay extends Component{ + constructor(props){ + super(props); + + + this.state = { + question_choices: ['', '', '', ''], + standard_answers: [false, false, false, false] + } + } + componentDidMount = () => { + const Id = this.props.match.params.Id + this.isEdit = !!Id + if (Id) { + const url = `/exercises/${Id}/edit.json` + // axios.get(url) + // .then((response) => { + // if (response.data.status == 0) { + + // } + // }) + // .catch(function (error) { + // console.log(error); + // }); + } + } + render() { + let { question_title, question_score, question_type, question_choices, standard_answer, + question_id, question_number, index, displayCount, showActionButton + } = this.props; + + // const { getFieldDecorator } = this.props.form; + + const isAdmin = this.props.isAdmin() + const courseId=this.props.match.params.coursesId; + const isEdit = this.isEdit + const qNumber = `question_${index}`; + // TODO show模式 isNew为false isEdit为false + + // [true, false, true] -> [0, 2] + + // const answerTagArray = standard_answer.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1); + let length = 5; + const qName = qNameArray[question_type] + + const isPreviewPage = showActionButton == false + + return( +
    + + + + + {/* 单选 or 多选 */} +
    + { question_choices.map((item, optionIndex) => { + let prefix = undefined + // if (!isPreviewPage) { + prefix = `${tagArray[optionIndex]}.` + // } + if (question_type == 0) { // 单选 + return ( +
    + {prefix} + + {/* */} +
    ) + } else { + + return ( +
    + {prefix} + + {/* */} +
    ) + } + })} + +
    +
    + ) + } +} +// RouteHOC() +export default (SingleDisplay); diff --git a/public/react/src/modules/courses/graduation/topics/index.js b/public/react/src/modules/courses/graduation/topics/index.js index 5116b0b12..b4bfa6527 100644 --- a/public/react/src/modules/courses/graduation/topics/index.js +++ b/public/react/src/modules/courses/graduation/topics/index.js @@ -5,7 +5,7 @@ import CourseLayoutcomponent from '../../common/CourseLayoutComponent' import Titlesearchsection from '../../common/titleSearch/TitleSearchSection' import DownloadMessageysl from "../../../modals/DownloadMessageysl"; -import { WordsBtn } from 'educoder' +import { WordsBtn ,getRandomcode} from 'educoder' import NoneData from '../../coursesPublic/NoneData' import Modals from "../../../modals/Modals" import axios from 'axios' @@ -353,7 +353,7 @@ onBoardsNew=()=>{ } }else { this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + window.open(getRandomcode("/api"+url), '_blank'); } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index 38cc3796e..d064fc284 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -68,6 +68,23 @@ class PollDetailIndex extends Component{ } } + newgetPollInfo=()=>{ + // console.log(this.props); + let pollId=this.props.match.params.pollId; + let url=`/polls/${pollId}/common_header.json` + axios.get(url).then((result)=>{ + if(result.status==200){ + this.setState({ + pollDetail:result.data, + user_permission:result.data.user_permission, + polls_status:result.data.polls_status, + }) + } + }).catch((error)=>{ + console.log(error); + }) + + } componentDidMount(){ const query =this.props.location.search; @@ -259,7 +276,7 @@ class PollDetailIndex extends Component{ } { //设置 - parseInt(tab[0])==3 && + parseInt(tab[0])==3 && } diff --git a/public/react/src/modules/courses/poll/PollDetailTabForth.js b/public/react/src/modules/courses/poll/PollDetailTabForth.js index 98127be7e..f5c49f0fe 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabForth.js +++ b/public/react/src/modules/courses/poll/PollDetailTabForth.js @@ -112,10 +112,12 @@ class PollDetailTabForth extends Component{ // 已有设置数据的查询 getSettingInfo=()=>{ + this.props.newgetPollInfo(); let pollId=this.props.match.params.pollId; let url=`/polls/${pollId}/poll_setting.json`; axios.get(url).then((result)=>{ if(result){ + this.setState({ polls:result.data.poll, unitSetting:result.data.poll.unified_setting, @@ -182,6 +184,7 @@ class PollDetailTabForth extends Component{ }) } } + }).catch((error)=>{ console.log(error); }) @@ -194,6 +197,7 @@ class PollDetailTabForth extends Component{ this.props.form.validateFieldsAndScroll((err, values) => { if(!err){ + // 第一次进行问卷设置或者勾选了统一设置 let{unitSetting}=this.state if(unitSetting==true){ @@ -440,7 +444,7 @@ class PollDetailTabForth extends Component{ }) }else{ this.setState({ - flagPageEdit:true + flagPageEdit:this.props.isAdmin()?true:false }) } } @@ -589,7 +593,7 @@ class PollDetailTabForth extends Component{
    截止时间:
    - + diff --git a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js index 1a53b1acd..8cc0adc02 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js +++ b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js @@ -343,6 +343,7 @@ class PollDetailTabForthRules extends Component{ render(){ let {rules,course_group,flagPageEdit}=this.state let isAdmin=this.props.isAdmin(); + console.log(flagPageEdit) return(

    @@ -462,7 +463,7 @@ class PollDetailTabForthRules extends Component{ disabledTime={disabledDateTime} disabledDate={disabledDate} disabled={ - this.props.type==="Exercise"? + this.props.type==="Exercise"||this.props.type==="polls"? rule.e_timeflag === undefined ? rule.publish_time === null ? false : moment(rule.end_time, dataformat) <= moment() ?this.props.isAdmin()?!flagPageEdit: true : !flagPageEdit : rule.e_timeflag == true ? this.props.isAdmin()?!flagPageEdit :true : !flagPageEdit: rule.e_timeflag === undefined ? rule.publish_time === null ? false : moment(rule.end_time, dataformat) <= moment() ? true : !flagPageEdit : rule.e_timeflag == true ? true : !flagPageEdit } @@ -477,7 +478,7 @@ class PollDetailTabForthRules extends Component{

    { - flagPageEdit ? + flagPageEdit ?this.props.isAdmin()?
  • {rule.p_timeflag===undefined?r > 0&&rule.publish_time===null? this.removeRules(`${r}`)}> @@ -508,7 +509,7 @@ class PollDetailTabForthRules extends Component{ }
  • - :"" + :"":"" }
    diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 438df7b05..fee00d4eb 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1294,11 +1294,11 @@ class Listofworksstudentone extends Component { record.submitstate === "未开启" ? this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>评阅 : + onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅 "} : this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>评阅 + onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅 "} ) }, @@ -1656,11 +1656,11 @@ class Listofworksstudentone extends Component { record.submitstate === "未开启" ? this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>评阅 : + onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅"} : this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>评阅 + onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅"} ) }, @@ -1673,35 +1673,13 @@ class Listofworksstudentone extends Component { } componentDidCatch(error, info) { - // console.log("-----------------------------905错误信息"); - // console.log(error); - // console.log(info); + } - // componentWillReceiveProps(nextProps) { - // console.log("+++++++++916"); - // console.log(nextProps); - // console.log(this.props) - // // console.log(this.props.isAdmin()); - // if (nextProps.code_review != this.props.code_review) { - // if (nextProps.code_review !== undefined) { - // console.log("diaoyonglwangluo1"); - // if(this.props.isAdmin() === true){ - // this.tearchar(); - // }else{ - // this.student(); - // } - // } - // } - // - // } + componentDidMount() { - // console.log("componentDidMount "); - // console.log("调用子组件 "); - // console.log(this.props); - // console.log(this.props.isAdmin()) this.student(); } @@ -1886,7 +1864,13 @@ class Listofworksstudentone extends Component { console.log(error); }) } - + //一键评阅的按钮 + AkeyreviewitGetalistofworkstwo=()=>{ + this.setState({ + loadingstate: true, + }) + this.Startsortingt("", "", "", "", 1, 20); + } // 获取作品列表 Getalistofworkstwo = (ordervlue, checkedValuesine, checkedValuesineinfo, searchtext, page, limit) => { // console.log("获取作品列表");222222222222 @@ -2075,6 +2059,7 @@ class Listofworksstudentone extends Component { stduynumber: teacherdata.student_id, classroom: teacherdata.group_name, cost_time: teacherdata.cost_time, + has_comment:teacherdata.has_comment, submitstate: teacherdata.work_status === 0 ? "未开启" : teacherdata.work_status === 1 ? "未通关" : teacherdata.work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", @@ -2091,6 +2076,7 @@ class Listofworksstudentone extends Component { user_name: teacherdata.user_name, user_login: teacherdata.user_login, Curcomlevel: teacherdata.current_complete_count===undefined||teacherdata.current_complete_count===null||teacherdata.current_complete_count===""?0:teacherdata.current_complete_count, + }) // } @@ -2119,6 +2105,7 @@ class Listofworksstudentone extends Component { stduynumber: student_works[i].student_id, classroom: student_works[i].group_name, cost_time: student_works[i].cost_time, + has_comment:student_works[i].has_comment, submitstate: student_works[i].work_status === 0 ? "未开启" : student_works[i].work_status === 1 ? "未通关" : student_works[i].work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", @@ -2280,6 +2267,7 @@ class Listofworksstudentone extends Component { stduynumber: teacherdata.student_id, classroom: teacherdata.group_name, cost_time: teacherdata.cost_time, + has_comment:teacherdata.has_comment, submitstate: teacherdata.work_status === 0 ? "未开启" : teacherdata.work_status === 1 ? "未通关" : teacherdata.work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", @@ -2642,6 +2630,7 @@ class Listofworksstudentone extends Component { stduynumber: student_works[i].student_id, classroom: student_works[i].group_name, cost_time: student_works[i].cost_time, + has_comment:student_works[i].has_comment, submitstate: student_works[i].work_status === 0 ? "未开启" : student_works[i].work_status === 1 ? "未通关" : student_works[i].work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", @@ -2662,11 +2651,7 @@ class Listofworksstudentone extends Component { } - // var teacherlist = { //分页 - // total: student_works.length, //数据总数量 - // pageSize: 20, //一页显示几条 - // current: page, - // } + if (work_efficiency === false) { if (JSON.stringify(course_group_info) === "[]" || course_group_info === undefined || course_group_info === null) { @@ -2883,11 +2868,15 @@ class Listofworksstudentone extends Component { } } else { + } // // console.log(datalist); // console.log("1712"); + // console.log("开始赋值了"); + // console.log(datalistjs); + this.setState({ datajs: datalistjs, columns: columns2js, @@ -3389,27 +3378,7 @@ class Listofworksstudentone extends Component { }); }; - // - // setComputeTime=()=>{ - // this.setState({ - // computeTimetype:false - // }) - // let homeworkid = this.props.match.params.homeworkid; - // let url = "/homework_commons/"+homeworkid+"/update_score.json"; - // - // axios.get(url).then((response) => { - // if(response){ - // this.props.showNotification(response.data.message); - // this.setState({ - // loadingstate: true - // }) - // this.Startsortingt(this.state.order, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); - // } - // }).catch((error) => { - // console.log(error) - // }); - // - // } + daochushixunbaogao = () => { let url = `/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}&work_status=${this.state.course_groupyslstwo === undefined || this.state.course_groupyslstwo === null ? "" : this.state.course_groupyslstwo}&course_group=${this.state.checkedValuesineinfo === undefined || this.state.checkedValuesineinfo === null ? "" : this.state.checkedValuesineinfo}&search=${this.state.searchtext === undefined || this.state.searchtext === null ? "" : this.state.searchtext}` diff --git a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js index d4ccb2af9..92247c676 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js @@ -6,18 +6,20 @@ import { notification, Spin } from "antd"; -import '../css/members.css'; -import "../common/formCommon.css"; -import '../css/Courses.css'; -import './style.css'; -import '../css/busyWork.css'; -import '../poll/pollStyle.css'; +import ApprausePublic from "../coursesPublic/ApprausePublic"; import Listofworksstudentone from './Listofworksstudentone'; import Trainingjobsetting from './Trainingjobsetting'; import Workquestionandanswer from './Workquestionandanswer'; import CoursesListType from '../coursesPublic/CoursesListType'; import ShixunStudentWork from "./ShixunStudentWork"; import Startshixuntask from "../coursesPublic/Startshixuntask"; +import '../css/members.css'; +import "../common/formCommon.css"; +import '../css/Courses.css'; +import './style.css'; +import '../css/busyWork.css'; +import '../poll/pollStyle.css'; + import TPMMDEditor from "../../tpm/challengesnew/TPMMDEditor"; import DownloadMessageysl from "../../modals/DownloadMessageysl"; @@ -41,6 +43,7 @@ class ShixunHomeworkPage extends Component { ModalsType:false, mylistisSpin:false, Showupdateinstructions:false, + AppraiseModaltype:false } } @@ -189,8 +192,41 @@ class ShixunHomeworkPage extends Component { this.props.history.replace(`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.category_id === undefined ? "" : jobsettingsdatapage.data.category.category_id}`); } + + Akeyreviewit=()=>{ + this.setState({ + AppraiseModaltype:true + }) + } + + hideAppraiseModaltype=()=>{ + this.setState({ + AppraiseModaltype:false + }) + } + + SaveAppraiseModal=(comment,hidden_comment)=>{ + let url = `/homework_commons/${this.props.match.params.homeworkid}/batch_comment.json` + axios.post(url,{ + comment: comment, + hidden_comment: hidden_comment, + } + ) + .then((response) => { + if (response.data.status == 0) { + this.props.showNotification('一键评阅成功') + this.hideAppraiseModaltype() + this.child.AkeyreviewitGetalistofworkstwo() + } else { + + } + }) + .catch( (error) =>{ + + }); + } render() { - let {tab, teacherdatapage, jobsettingsdatapage} = this.state; + let {tab, teacherdatapage, jobsettingsdatapage,AppraiseModaltype} = this.state; const isAdmin = this.props.isAdmin(); // console.log(119) @@ -207,6 +243,17 @@ class ShixunHomeworkPage extends Component { loadtype={false} > + + {AppraiseModaltype===true?this.hideAppraiseModaltype()} + SaveAppraiseModal={(comment,hidden_comment)=>this.SaveAppraiseModal(comment,hidden_comment)} + />:""} + +
    { @@ -313,10 +360,17 @@ class ShixunHomeworkPage extends Component { this.homeworkstarts(this.child)}>立即发布 : "" : ""} + {this.props.isAdmin() ? teacherdatapage && teacherdatapage.code_review === true ? this.workshowmodels(this.child)}>代码查重 : "" : ""} + + {parseInt(tab) === 0 ?this.props.isAdmin() ? + jobsettingsdatapage === undefined ? [""] : jobsettingsdatapage.data.homework_status[0] === "未发布" ? "" : + this.Akeyreviewit()}>一键评阅 + : "":""} + { parseInt(tab)===1? this.props.isAdmin() ? diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 7fe9f868e..772d88e19 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -1,6 +1,6 @@ import React, {Component} from "react"; import CoursesListType from '../coursesPublic/CoursesListType'; -import {WordsBtn, ActionBtn, sortDirections} from 'educoder'; +import {WordsBtn, getRandomcode, sortDirections} from 'educoder'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; import HomeworkModal from "../coursesPublic/HomeworkModal"; import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal"; @@ -622,7 +622,7 @@ class ShixunStudentWork extends Component { } }else { this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + window.open(getRandomcode("/api"+url), '_blank'); } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index 10b12eb0a..90e6e6a4f 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -1,5 +1,5 @@ import React, {Component} from "react"; -import {WordsBtn,markdownToHTML,ActionBtn,queryString,downloadFile,getImageUrl} from 'educoder'; +import {WordsBtn,markdownToHTML,getRandomcode,queryString,downloadFile,getImageUrl} from 'educoder'; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider,InputNumber, Tag,DatePicker,Radio,Tooltip,Spin} from "antd"; import {Link,Switch,Route,Redirect} from 'react-router-dom'; import axios from 'axios'; @@ -76,7 +76,7 @@ class ShixunWorkReport extends Component { // this.props.slowDownload(url) // // this.props.showNotification(`正在下载中`); - window.open("/api"+url+"?disposition=inline", '_blank'); + window.open(getRandomcode("/api"+url+"?disposition=inline"), '_blank'); this.setState({ isspinning: false }) } }).catch((error) => { diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 03ae5ec33..d15e8eaab 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -1,7 +1,7 @@ import React, {Component} from "react"; import CoursesListType from '../coursesPublic/CoursesListType'; import HomeworkModal from "../coursesPublic/HomeworkModal"; -import {WordsBtn, ActionBtn, handleDateString, getImageUrl} from 'educoder'; +import {WordsBtn, getRandomcode, handleDateString, getImageUrl} from 'educoder'; import PollDetailTabForthRules from '../poll/PollDetailTabForthRules'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; import { @@ -2263,7 +2263,7 @@ class Trainingjobsetting extends Component { } } else { this.props.showNotification(`正在下载中`); - window.open("/api" + url, '_blank'); + window.open(getRandomcode("/api" + url), '_blank'); } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js index 1dccb298b..4e3e692e1 100644 --- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js +++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js @@ -1,6 +1,6 @@ import React, {Component} from "react"; import CoursesListType from '../coursesPublic/CoursesListType'; -import {WordsBtn, ActionBtn, markdownToHTML} from 'educoder'; +import {WordsBtn, getRandomcode, markdownToHTML} from 'educoder'; import { Form, Select, @@ -413,7 +413,7 @@ class Workquestionandanswer extends Component { } }else { this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + window.open(getRandomcode("/api"+url), '_blank'); } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js b/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js index 6aee871be..4dbc63c95 100644 --- a/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js +++ b/public/react/src/modules/ecs/EcSetting/CourseSupports/index.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - +import {getRandomcode} from 'educoder'; import axios from 'axios'; import { Select,message,Modal,Input,Spin,Icon,Tooltip } from 'antd'; @@ -550,7 +550,7 @@ class CourseSupports extends Component { } }else { this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + window.open(getRandomcode("/api"+url), '_blank'); } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/modals/DownloadMessage.js b/public/react/src/modules/modals/DownloadMessage.js index 4655d7478..f01fe14c1 100644 --- a/public/react/src/modules/modals/DownloadMessage.js +++ b/public/react/src/modules/modals/DownloadMessage.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import {getImageUrl} from 'educoder'; +import {getRandomcode} from 'educoder'; import { Modal} from 'antd'; import axios from 'axios'; @@ -57,7 +57,7 @@ class DownloadMessage extends Component { } }else { this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + window.open(getRandomcode("/api"+url), '_blank'); } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/page/MainContent.js b/public/react/src/modules/page/MainContent.js index a1b7566d0..175ea7bc0 100644 --- a/public/react/src/modules/page/MainContent.js +++ b/public/react/src/modules/page/MainContent.js @@ -41,6 +41,7 @@ class MainContent extends Component { hideCodeEvaluate = () => { const vncContainer = this.refs['vncContainer'] if (vncContainer) { + // console.log('点击的关闭按钮') vncContainer.onBottomDrawerClose && vncContainer.onBottomDrawerClose() } } @@ -124,7 +125,7 @@ class MainContent extends Component {
    } > -
    +
    @@ -179,7 +180,9 @@ class MainContent extends Component {
    -
    +
    diff --git a/public/react/src/modules/page/VNC.css b/public/react/src/modules/page/VNC.css index 1180baf76..58a45d735 100644 --- a/public/react/src/modules/page/VNC.css +++ b/public/react/src/modules/page/VNC.css @@ -39,6 +39,47 @@ user-select: none; } +.btn_test_case, +.btn_test_case_active{ + display: inline-block; + position: absolute; + width: 56px; + height: 28px; + bottom: 23px; + line-height: 28px; + background: rgba(42,58,79,1); + z-index: 10; + left: 50%; + margin-left: -28px; + border-bottom-left-radius: 100px; + border-bottom-right-radius: 100px; + color: #fff; + text-align: center; + cursor: pointer; + opacity: .4; + transition: all .3s; +} + +.btn_test_case:hover, +.btn_test_case_active:hover{ + opacity: 1; +} +.btn_test_case .btn-arrow{ + position: relative; + font-size: 12px; + line-height: 28px; + bottom: 2px; +} + +.btn_test_case_active{ + bottom: 203px; + z-index: 10000; + +} +.btn_test_case_active .btn-arrow{ + bottom: 4px; +} + @keyframes mymove { from {right:0px;} diff --git a/public/react/src/modules/page/VNCContainer.js b/public/react/src/modules/page/VNCContainer.js index aa4d82e78..30e439e8d 100644 --- a/public/react/src/modules/page/VNCContainer.js +++ b/public/react/src/modules/page/VNCContainer.js @@ -204,6 +204,10 @@ class VNCContainer extends Component { render() { const { challenge, vnc_url, git_url } = this.props + const _classCtx = this.state.bottomDrawer ? 'btn_test_case_active' : 'btn_test_case'; + const _classes = this.state.bottomDrawer + ? `iconfont icon-xiajiantou btn-arrow` + : 'iconfont icon-shangjiantou btn-arrow'; const secondDrawerChildren = this.renderSecondDrawerChildren(); return ( @@ -352,9 +356,16 @@ class VNCContainer extends Component { > { this.props.codeEvaluate } - 测试集 + >测试集 */} +
    + {/* */} + +
    diff --git a/public/react/src/modules/page/VNCDisplay.js b/public/react/src/modules/page/VNCDisplay.js index 536ba43cb..98c4cb5e7 100644 --- a/public/react/src/modules/page/VNCDisplay.js +++ b/public/react/src/modules/page/VNCDisplay.js @@ -135,11 +135,13 @@ class VNCDisplay extends Component {