Merge branch 'dev_aliyun' into develop

dev_new_shixunsrepository
cxt 5 years ago
commit ed863bd1cd

@ -23,21 +23,21 @@ class ApplicationController < ActionController::Base
# 所有请求必须合法签名
def check_sign
# Rails.logger.info("66666 #{params}")
# suffix = request.url.split(".").last
# suffix_arr = ["xls", "xlsx"] # 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)
#
# sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
# Rails.logger.info("2222 #{sign}")
# tip_exception(501, "请求不合理") if sign != params[:client_key]
# else
# tip_exception(501, "请求不合理")
# end
# end
Rails.logger.info("66666 #{params}")
suffix = request.url.split(".").last
suffix_arr = ["xls", "xlsx"] # 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)
sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
Rails.logger.info("2222 #{sign}")
tip_exception(501, "请求不合理") if sign != params[:client_key]
else
tip_exception(501, "请求不合理")
end
end
end
# 全局配置参数
@ -285,7 +285,7 @@ class ApplicationController < ActionController::Base
# # reacct静态资源加载不需要走这一步
return if params[:controller] == "main"
# Find the current user
Rails.logger.info("current_laboratory is #{current_laboratory} domain is #{request.subdomain}")
#Rails.logger.info("current_laboratory is #{current_laboratory} domain is #{request.subdomain}")
User.current = find_current_user
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))

@ -10,6 +10,7 @@ class Cooperative::BaseController < ApplicationController
before_action :laboratory_exist!, :require_login, :require_cooperative_manager!
after_action :rebind_event_if_ajax_render_partial
skip_before_action :check_sign
helper_method :current_laboratory, :current_setting_or_default

@ -44,12 +44,13 @@ class HacksController < ApplicationController
begin
logger.info("##########{hack_params}")
hack = Hack.new(hack_params)
ActiveRecord::Base.transaction do
hack.user_id = current_user.id
hack.identifier = generate_identifier Hack, 8
ActiveRecord::Base.transaction do
hack.save!
# 创建测试集与代码
hack.hack_sets.create!(hack_sets_params)
# 新建知识点
hack_codes = hack.hack_codes.new(hack_code_params)
hack_codes.modify_time = Time.now
hack_codes.save!

@ -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(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

@ -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
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
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)
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
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
end
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

@ -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

@ -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]

@ -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

@ -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

@ -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

@ -0,0 +1,5 @@
class AddBatchCommentToShixunWork < ActiveRecord::Migration[5.2]
def change
add_column :shixun_work_comments, :batch_comment, :boolean, default: 0
end
end

@ -1812,6 +1812,12 @@
<div class="code-name">&amp;#xe710;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe711;</span>
<div class="name">编组</div>
<div class="code-name">&amp;#xe711;</div>
</li>
</ul>
<div class="article markdown">
<h2 id="unicode-">Unicode 引用</h2>
@ -4535,6 +4541,15 @@
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-bianzu2"></span>
<div class="name">
编组
</div>
<div class="code-name">.icon-bianzu2
</div>
</li>
</ul>
<div class="article markdown">
<h2 id="font-class-">font-class 引用</h2>
@ -6940,6 +6955,14 @@
<div class="code-name">#icon-fuzhi3</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-bianzu2"></use>
</svg>
<div class="name">编组</div>
<div class="code-name">#icon-bianzu2</div>
</li>
</ul>
<div class="article markdown">
<h2 id="symbol-">Symbol 引用</h2>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -2083,6 +2083,13 @@
"font_class": "fuzhi3",
"unicode": "e710",
"unicode_decimal": 59152
},
{
"icon_id": "12608142",
"name": "编组",
"font_class": "bianzu2",
"unicode": "e711",
"unicode_decimal": 59153
}
]
}

@ -911,6 +911,9 @@ Created by iconfont
<glyph glyph-name="fuzhi3" unicode="&#59152;" d="M648.533333-128h-477.866666C75.093333-128 0-52.906667 0 42.666667v477.866666C0 616.106667 75.093333 691.2 170.666667 691.2h477.866666C744.106667 691.2 819.2 616.106667 819.2 520.533333v-477.866666c0-95.573333-75.093333-170.666667-170.666667-170.666667z m-477.866666 750.933333C116.053333 622.933333 68.266667 575.146667 68.266667 520.533333v-477.866666c0-54.613333 47.786667-102.4 102.4-102.4h477.866666c54.613333 0 102.4 47.786667 102.4 102.4v477.866666c0 54.613333-47.786667 102.4-102.4 102.4h-477.866666zM955.733333 110.933333c-20.48 0-34.133333 13.653333-34.133333 34.133334V691.2c0 54.613333-47.786667 102.4-102.4 102.4H273.066667c-20.48 0-34.133333 13.653333-34.133334 34.133333s13.653333 34.133333 34.133334 34.133334h546.133333c95.573333 0 170.666667-75.093333 170.666667-170.666667v-546.133333c0-20.48-13.653333-34.133333-34.133334-34.133334z" horiz-adv-x="1024" />
<glyph glyph-name="bianzu2" unicode="&#59153;" d="M512 353.882353m-240.941176 0a240.941176 240.941176 0 1 1 481.882352 0 240.941176 240.941176 0 1 1-481.882352 0ZM512 534.588235m-361.411765 0a361.411765 361.411765 0 1 1 722.82353 0 361.411765 361.411765 0 1 1-722.82353 0ZM402.552471 426.285176L279.491765 527.600941a9.035294 9.035294 0 0 0 0 13.974588l123.030588 101.315765a9.035294 9.035294 0 0 0 14.757647-6.987294v-52.103529a9.035294 9.035294 0 0 1 9.035294-9.035295h171.309177a9.035294 9.035294 0 0 1 9.035294 9.035295v52.103529a9.035294 9.035294 0 0 0 14.757647 6.987294l123.030588-101.315765a9.035294 9.035294 0 0 0 0-13.974588l-123.030588-101.315765a9.035294 9.035294 0 0 0-14.757647 6.987295v52.103529a9.035294 9.035294 0 0 1-9.035294 9.035294H426.345412a9.035294 9.035294 0 0 1-9.035294-9.035294v-52.103529a9.035294 9.035294 0 0 0-14.757647-6.987295z" horiz-adv-x="1024" />
</font>

Before

Width:  |  Height:  |  Size: 374 KiB

After

Width:  |  Height:  |  Size: 375 KiB

@ -10,6 +10,7 @@ const $ = window.$;
const opens ="79e33abd4b6588941ab7622aed1e67e8";
let timestamp;
let checkSubmitFlg = false;
let message501=false;
broadcastChannelOnmessage('refreshPage', () => {
window.location.reload()
})
@ -23,6 +24,7 @@ function locationurl(list){
}
// TODO 开发期多个身份切换
let debugType =""
if (isDev) {
@ -41,6 +43,8 @@ if (isDev) {
//ebugType="teacher";
// 学生
//debugType="student";
function railsgettimes(proxy) {
if(timestamp&&checkSubmitFlg===false){
$.ajax({url:proxy,async:false,success:function(data){
@ -51,7 +55,7 @@ if (isDev) {
checkSubmitFlg=true
window.setTimeout(function () {
checkSubmitFlg=false;
}, 3500);
}, 2000);
}else if(checkSubmitFlg===false){
$.ajax({url:proxy,async:false,success:function(data){
if(data.status===0){
@ -61,7 +65,7 @@ if (isDev) {
checkSubmitFlg=true
window.setTimeout(function () {
checkSubmitFlg=false;
}, 3500);
}, 2000);
}
}
window._debugType = debugType;
@ -90,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;
// }
@ -224,10 +229,20 @@ export function initAxiosInterceptors(props) {
}
if (response.data.status === 501) {
notification.warning({
if(message501===false){
message501=true
notification.open({
message:"提示",
description:response.data.message || '访问异常,请求不合理',
style: {
zIndex: 99999999
}
})
}
window.setTimeout(function () {
message501=false
}, 2000);
}
// if (response.data.status === 402) {

@ -1,3 +1,5 @@
import md5 from 'md5';
const $ = window.$;
const isDev = window.location.port == 3007;
export const TEST_HOST = "https://test-newweb.educoder.net"
export function getImageUrl(path) {
@ -68,19 +70,46 @@ export function getUrl2(path, goTest) {
}
return `${path ? path: ''}`;
}
const newopens ="79e33abd4b6588941ab7622aed1e67e8";
let newtimestamp;
let checkSubmitFlgs = false;
function railsgettimess(proxy) {
if(checkSubmitFlgs===false){
$.ajax({url:proxy,async:false,success:function(data){
if(data.status===0){
newtimestamp=data.message;
}
}})
checkSubmitFlgs=true
window.setTimeout(function () {
checkSubmitFlgs=false;
}, 2500);
}
}
export function Railsgettimes() {
railsgettimess(`${getUrl()}/api/main/first_stamp.json`);
}
export function getUploadActionUrl(path, goTest) {
return `${getUrl()}/api/attachments.json${isDev ? `?debug=${window._debugType || 'admin'}` : ''}`
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
return `${getUrl()}/api/attachments.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`;
}
export function getUploadActionUrltwo(id) {
return `${getUrlmys()}/api/shixuns/${id}/upload_data_sets.json${isDev ? `?debug=${window._debugType || 'admin'}` : ''}`
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
return `${getUrlmys()}/api/shixuns/${id}/upload_data_sets.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
}
export function getUploadActionUrlthree() {
return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ? `?debug=${window._debugType || 'admin'}` : ''}`
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
}
export function getUploadActionUrlOfAuth(id) {
return `${getUrl()}/api/users/accounts/${id}/auth_attachment.json${isDev ? `?debug=${window._debugType || 'admin'}` : ''}`
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
return `${getUrl()}/api/users/accounts/${id}/auth_attachment.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
}
export function test(path) {
@ -96,6 +125,11 @@ export function getTaskUrlById(id) {
return `/tasks/${id}`
}
export function getRandomcode(url) {
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
return `${url}?randomcode=${newtimestamp}&client_key=${anewopens}`
}
export function htmlEncode(str) {
var s = "";

@ -2,7 +2,7 @@
// export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil';
export { getImageUrl as getImageUrl, getUrl as getUrl, getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl
export { getImageUrl as getImageUrl, getUrl as getUrl, getRandomcode as getRandomcode,getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl
, getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo ,getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
, getTaskUrlById as getTaskUrlById, TEST_HOST ,htmlEncode as htmlEncode } from './UrlTool';
export { default as queryString } from './UrlTool2';

@ -6,7 +6,7 @@ import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import PropTypes from 'prop-types';
import classNames from 'classnames'
import { getImageUrl, toPath, getUrl,getUploadActionUrl } from 'educoder';
import './CommentItemMDEditor.css'
const $ = window.$;
@ -36,7 +36,7 @@ class CommentItemMDEditor extends Component {
if( $(`#${initMD_ID} textarea`).length === 1 ) { // 没有初始化
const placeholder = '我要回复...'
// const imageUrl = `/upload_with_markdown?container_id=${commentId}&container_type=Memo`;
const imageUrl = `/api/attachments.json`;
const imageUrl = `${getUploadActionUrl()}`;
const otherOptions = {
watch: false,

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import {Button, Card, Row, Col ,Upload,Icon,message,Tabs} from 'antd';
import axios from 'axios';
import {getImageUrl,getUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder';
import {getUploadActionUrl,getUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
const { TabPane } = Tabs;
class CompetitionContentsMd extends Component{
@ -184,7 +184,7 @@ class CompetitionContentsMd extends Component{
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleContentUploadChange,
onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'),
beforeUpload: (file) => {

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import {Button,Layout,Row, Col,Divider,Table} from 'antd';
import axios from 'axios';
import {getImageUrl} from 'educoder';
import {getImageUrl,getRandomcode} from 'educoder';
import './CompetitionContentspdfdownload.css';
// import NoneData from "../../../courses/shixunHomework/shixunHomework";
@ -158,7 +158,7 @@ class CompetitionContentspdfdownload extends Component{
return(
<span className={"mr10"} key={key}>
<img src={ getImageUrl(`images/educoder/pdfs.png`)} />
<a className={"pdfdownloadfont4CACFF ml10"} href={item.url} download=""
<a className={"pdfdownloadfont4CACFF ml10"} href={getRandomcode(item.url)} download=""
title="下载" mce_href="#">立即下载</a>
</span>
)
@ -172,7 +172,7 @@ class CompetitionContentspdfdownload extends Component{
return(
<span className={"mr10"} key={key}>
<img src={ getImageUrl(`images/educoder/pdfs.png`)} />
<a className={"pdfdownloadfont4CACFF ml10"} href={item.url} download=""
<a className={"pdfdownloadfont4CACFF ml10"} href={getRandomcode(item.url)} download=""
title="下载" mce_href="#">立即下载</a>
</span>
)

@ -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 未提交 */}
{/*<React.Fragment>*/}
{/*</React.Fragment>*/}
{ isAdmin && <Tooltip placement="bottom" title={<pre>调整学生最终成绩<br/>其它历史评分将全部失效</pre>}>
{ isAdmin && <Tooltip placement="bottom" title={<pre>调整学生当前成绩<br/>其它历史评分将全部失效</pre>}>
<a style={{color: "#4CACFF"}}
onClick={() => that.showModulationModal(record)}
>调分</a>

@ -3,7 +3,7 @@ import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon, message, Moda
import axios from 'axios'
import '../css/busyWork.css'
import '../css/Courses.css'
import { WordsBtn, getUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder'
import {getUploadActionUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder'
import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
import CBreadcrumb from '../common/CBreadcrumb'
@ -333,7 +333,7 @@ class NewWorkForm extends Component{
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleContentUploadChange,
onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'),
beforeUpload: (file) => {
@ -352,7 +352,7 @@ class NewWorkForm extends Component{
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleAnswerUploadChange,
onRemove: (file) => this.onAttachmentRemove(file, 'answerFileList'),
beforeUpload: (file) => {

@ -150,8 +150,8 @@ class TabRightComponents extends Component{
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mt20" style={{"padding":"0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a href={exportResultUrl} onClick={(url)=>this.confirmysl(exportResultUrl)} className="color-dark">导出成绩</a></li>
<li><a href={exportUrl} onClick={(url)=>this.confirmysl(exportUrl)} className="color-dark">导出作品附件</a></li>
<li><a onClick={(url)=>this.confirmysl(exportResultUrl)} className="color-dark">导出成绩</a></li>
<li><a onClick={(url)=>this.confirmysl(exportUrl)} className="color-dark">导出作品附件</a></li>
</ul>
</li>:""}

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import {Button, Card, Row, Col ,Upload,Icon,message,Tabs} from 'antd';
import axios from 'axios';
import {getImageUrl,getUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder';
import {getUploadActionUrl,getUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
const { TabPane } = Tabs;
class CompetitionContentsMd extends Component{
@ -184,7 +184,7 @@ class CompetitionContentsMd extends Component{
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleContentUploadChange,
onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'),
beforeUpload: (file) => {

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import {Button,Layout,Row, Col,Divider,Table} from 'antd';
import axios from 'axios';
import {getImageUrl} from 'educoder';
import {getImageUrl,getRandomcode} from 'educoder';
import './CompetitionContentspdfdownload.css';
// import NoneData from "../../../courses/shixunHomework/shixunHomework";
@ -158,7 +158,7 @@ class CompetitionContentspdfdownload extends Component{
return(
<span className={"mr10"} key={key}>
<img src={ getImageUrl(`images/educoder/pdfs.png`)} />
<a className={"pdfdownloadfont4CACFF ml10"} href={item.url} download=""
<a className={"pdfdownloadfont4CACFF ml10"} href={getRandomcode(item.url)} download=""
title="下载" mce_href="#">立即下载</a>
</span>
)
@ -172,7 +172,7 @@ class CompetitionContentspdfdownload extends Component{
return(
<span className={"mr10"} key={key}>
<img src={ getImageUrl(`images/educoder/pdfs.png`)} />
<a className={"pdfdownloadfont4CACFF ml10"} href={item.url} download=""
<a className={"pdfdownloadfont4CACFF ml10"} href={getRandomcode(item.url)} download=""
title="下载" mce_href="#">立即下载</a>
</span>
)

@ -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(
<div>
<style>
{
`
@media (max-width: 2000px) {
.WordNumberTextarea{
height: 130px !important;
}
}
@media (max-width: 1350px) {
.HomeworkModal{
top:10px !important;
}
.WordNumberTextarea{
height: 80px !important;
}
}
@media (max-width: 1250px) {
.HomeworkModal{
top:0px !important;
}
.WordNumberTextarea{
height: 40px !important;
}
}
`
}
</style>
<Modal
keyboard={false}
className={"HomeworkModal"}
title={this.props.ApprausePublicName||"一键评阅"}
visible={this.props.visible}
closable={false}
footer={null}
destroyOnClose={true}
>
<div className={"pd015"}>
<style>
{
`
.pd015 {
padding: 0px 15px 15px 7px;
}
.font{
font-size: 14px;
font-weight: 400;
color: rgba(5,16,26,1);
}
.newfont{
height: 16px;
font-size: 16px;
font-weight: 400;
color: rgba(5,16,26,1);
line-height: 16px;
margin-bottom: 5px;
}
`
}
</style>
<div className="clearfix">
<p className={"font mb10 ml10"}>
可见(学生可查看老师的评阅内容
</p>
{/*<Radio.Group onChange={this.onChanges} value={this.state.valuetype}>*/}
{/*<Radio value={0} style={radioStyle} className={"newfont"}>可见 (学生查看老师的评阅内容)</Radio>*/}
{/*<Radio value={1} style={radioStyle} className={"newfont"}>不可见 (仅对课堂老师可见)</Radio>*/}
{/*</Radio.Group>*/}
<WordNumberTextarea
placeholder={"请填写评阅内容"}
onInput={(e)=>this.comment(e)}
value={comment}
maxlength={500}
/>
<p className={"font mt10 mb10 ml10"}>
不可见(仅对课堂老师可见
</p>
<WordNumberTextarea
placeholder={"请填写评阅内容"}
onInput={(e)=>this.hidden_comment(e)}
value={hidden_comment}
maxlength={500}
/>
<li style={{height:"20px",lineHeight:"20px"}} className={textareavaltype===true?"color-red mt5 mb10 ml10":"none"}><span>评阅内容至少有一个不为空</span></li>
</div>
<div className={textareavaltype===false?"mt20 clearfix edu-txt-center":"clearfix edu-txt-center"}>
<a className="task-btn color-white mr30" onClick={()=>this.props.Cancel()}>{this.props.Cancelname || '取消'}</a>
<a className="task-btn task-btn-orange" onClick={()=>this.Saves()}>{this.props.Savesname || '确定'}</a>
</div>
</div>
</Modal>
</div>
)
}
}
export default ApprausePublic;

@ -6,7 +6,7 @@ import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css";
import { getImageUrl, toPath, getUrl } from 'educoder';
import { getImageUrl, toPath, getUrl,getUploadActionUrl } from 'educoder';
import axios from 'axios';
@ -171,7 +171,7 @@ export default class CoursesMarkdown extends Component {
// const placeholder = "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
const imageUrl = `${getUploadActionUrl()}`;
// 创建editorMd
const answers_editormd = create_editorMD(_id, '100%', 400, placeholder, imageUrl, () => {

@ -308,7 +308,7 @@
backgroud: rgba(234, 234, 234, 1);
width: 530px;
margin-left: 10px;
margin-top: 25px;
margin-top: 5px;
height: 214px !important;
}

@ -1,7 +1,7 @@
import React,{ Component } from "react";
import { Modal,Checkbox,Select,Input,Upload,Button,Icon,message,DatePicker,Tooltip,Radio} from "antd";
import axios from'axios';
import {getUrl,handleDateString,appendFileSizeToUploadFileAll} from 'educoder';
import {getUrl,handleDateString,appendFileSizeToUploadFileAll,getUploadActionUrl} from 'educoder';
import locale from 'antd/lib/date-picker/locale/zh_CN';
import moment from 'moment';
import Modals from '../../modals/Modals';
@ -264,7 +264,7 @@ class Selectsetting extends Component{
const uploadProps = {
width: 600,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {

@ -2,7 +2,7 @@ import React,{ Component } from "react";
import { Modal,Checkbox,Upload,Button,Icon,message,DatePicker,Select,Tooltip,Radio} from "antd";
import axios from 'axios';
import Modals from '../../modals/Modals';
import {getUrl,handleDateString,bytesToSize,appendFileSizeToUploadFileAll} from 'educoder';
import {getUploadActionUrl,handleDateString,appendFileSizeToUploadFileAll} from 'educoder';
import locale from 'antd/lib/date-picker/locale/zh_CN';
import moment from 'moment';
const CheckboxGroup = Checkbox.Group;
@ -246,7 +246,7 @@ class Sendresource extends Component{
const uploadProps = {
width: 600,
// showUploadList:false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {

@ -1,7 +1,7 @@
import React,{ Component } from "react";
import {Checkbox,Input,Table, Pagination,Menu,Spin} from "antd";
import {Link,NavLink} from 'react-router-dom';
import { WordsBtn ,ActionBtn,queryString,downloadFile} from 'educoder';
import { WordsBtn ,ActionBtn,queryString,getRandomcode} from 'educoder';
import CoursesListType from '../coursesPublic/CoursesListType';
import '../css/members.css';
import '../css/busyWork.css';
@ -404,7 +404,7 @@ class Testpapersettinghomepage extends Component{
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a onClick={()=>this.confirmysl(`/exercises/${this.props.match.params.Id}/exercise_lists.xlsx`,this.child)}>学生成绩</a></li>
{/* <li><a onClick={()=>this.confpdf(`/api/exercises/${this.props.match.params.Id}/export_exercise`)} >空白试卷</a></li> */}
<li><a href={`/api/exercises/${this.props.match.params.Id}/export_exercise`} target="_blank">空白试卷</a></li>
<li><a href={getRandomcode(`/api/exercises/${this.props.match.params.Id}/export_exercise`)} target="_blank">空白试卷</a></li>
{/*<li><a onClick={()=>this.confirmysl(`/zip/export_exercises?exercise_id=${this.props.match.params.Id}${this.state.groupyslsval===null||this.state.groupyslsval===undefined?null:this.state.groupyslsval}`)}>学生答题试卷</a></li>*/}
</ul>
</li></Spin>:""}

@ -98,7 +98,10 @@ class SingleDisplay extends Component{
// }
if (question_type == 0) { // 单选
return (
<div className="mb10 clearfix" key={optionIndex}>
<div className="mb10 clearfix " style={{
display: "flex",
flexDirection:"row",
}} key={optionIndex}>
<Radio disabled className="fl lineh-25" checked={item.standard_boolean}>{prefix}</Radio>
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1) + '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
@ -109,7 +112,10 @@ class SingleDisplay extends Component{
} else {
return (
<div className="mb10 clearfix" key={optionIndex}>
<div className="mb10 clearfix" style={{
display: "flex",
flexDirection:"row",
}} key={optionIndex}>
<Checkbox disabled className="fl lineh-25 mr8" checked={item.standard_boolean}>{prefix}</Checkbox>
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1)+ '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}

@ -2,7 +2,7 @@ import React,{Component} from "react";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Spin,Tooltip} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import { WordsBtn,getUrl ,bytesToSize,getImageUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder';
import { WordsBtn,getUploadActionUrl ,bytesToSize,getImageUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
const Search = Input.Search;
@ -512,7 +512,7 @@ class GraduationTasksSubmitedit extends Component{
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {

@ -3,7 +3,7 @@ import React,{Component} from "react";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Tooltip,Spin} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import { WordsBtn,getUrl,getImageUrl,bytesToSize,appendFileSizeToUploadFileAll} from 'educoder';
import { WordsBtn,getUrl,getImageUrl,getUploadActionUrl,appendFileSizeToUploadFileAll} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
const Search = Input.Search;
@ -536,7 +536,7 @@ render(){
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {

@ -2,7 +2,7 @@ import React,{Component} from "react";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import { WordsBtn,getUrl ,bytesToSize,appendFileSizeToUploadFileAll,AttachmentList,appendFileSizeToUploadFile} from 'educoder';
import { WordsBtn,getUrl ,getUploadActionUrl,appendFileSizeToUploadFileAll,AttachmentList,appendFileSizeToUploadFile} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
import '../../css/Courses.css';
@ -314,7 +314,7 @@ class GraduationTasksedit extends Component{
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {

@ -7,7 +7,7 @@ import {
} from 'antd';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import axios from 'axios'
import {getUrl} from 'educoder';
import {getUrl,getUploadActionUrl} from 'educoder';
import "../../common/formCommon.css"
// import './board.css'
@ -248,7 +248,7 @@ class GraduateTopicPostWorksNew extends Component{
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {

@ -112,10 +112,12 @@ class PollDetailTabForth extends Component{
// 已有设置数据的查询
getSettingInfo=()=>{
this.props.getPollInfo();
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);
})
@ -440,7 +443,7 @@ class PollDetailTabForth extends Component{
})
}else{
this.setState({
flagPageEdit:true
flagPageEdit:this.props.isAdmin()?true:false
})
}
}
@ -589,7 +592,7 @@ class PollDetailTabForth extends Component{
<div className="clearfix">
<span className="mr15 fl mt10 font-16">截止时间</span>
<div className="fl">
<Tooltip placement="bottom" title={un_change_end ? this.props.isAdmin()?"截止时间已过,不能再修改":"":""}>
<Tooltip placement="bottom" title={un_change_end ? this.props.isAdmin()?"":"截止时间已过,不能再修改":""}>
<span>
<DatePicker
showToday={false}
@ -605,7 +608,8 @@ class PollDetailTabForth extends Component{
disabledDate={disabledDate}
onChange={this.onChangeTimeEnd}
value={ end_time && moment(end_time,dataformat) }
disabled={un_change_end == true ?true : !flagPageEdit }
// disabled={un_change_end == true ?true : !flagPageEdit }
disabled={un_change_end == true ? this.props.isAdmin()?!flagPageEdit:true : !flagPageEdit }
>
</DatePicker>
</span>

@ -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(
<div className="bor-top-greyE pt20">
<p className="clearfix mb10">
@ -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{
</p>
</div>
{
flagPageEdit ?
flagPageEdit ?this.props.isAdmin()?
<li className="fl pt5">
{rule.p_timeflag===undefined?r > 0&&rule.publish_time===null?<Tooltip title="删除">
<a className="mr20" onClick={()=>this.removeRules(`${r}`)}><i className="iconfont icon-shanchu color-grey-9 font-18"></i></a>
@ -508,7 +509,7 @@ class PollDetailTabForthRules extends Component{
}
<Tooltip title="新增"><a className="mt6" onClick={this.AddRules}><i className="iconfont icon-tianjiafangda color-green font-18"></i></a> </Tooltip>
</li>
:""
:"":""
}
</div>

@ -1294,11 +1294,11 @@ class Listofworksstudentone extends Component {
record.submitstate === "未开启" ?
<a style={{textAlign: "center",width: '40px'}} className="color-blue"
onMouseDown={(e) => this.Viewstudenttraininginformationtysl2(e, record)}
onClick={() => this.Viewstudenttraininginformationt(record)}>评阅</a> :
onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅 "}</a> :
<span>
<a style={{textAlign: "center"}} className="color-blue maxnamewidth120"
onMouseDown={(e) => this.Viewstudenttraininginformationtysl2(e, record)}
onClick={() => this.Viewstudenttraininginformationt(record)}>评阅</a>
onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅 "}</a>
</span>
)
},
@ -1656,11 +1656,11 @@ class Listofworksstudentone extends Component {
record.submitstate === "未开启" ?
<a style={{textAlign: "center",width: '40px'}} className="color-blue"
onMouseDown={(e) => this.Viewstudenttraininginformationtysl2(e, record)}
onClick={() => this.Viewstudenttraininginformationt(record)}>评阅</a> :
onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅"}</a> :
<span>
<a style={{textAlign: "center"}} className="color-blue"
onMouseDown={(e) => this.Viewstudenttraininginformationtysl2(e, record)}
onClick={() => this.Viewstudenttraininginformationt(record)}>评阅</a>
onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅"}</a>
</span>
)
},
@ -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}`

@ -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}
>
</Modals>
{AppraiseModaltype===true?<ApprausePublic
{...this.props}
{...this.state}
ApprausePublicName={"一键评阅"}
visible={AppraiseModaltype}
Cancel={()=>this.hideAppraiseModaltype()}
SaveAppraiseModal={(comment,hidden_comment)=>this.SaveAppraiseModal(comment,hidden_comment)}
/>:""}
<div className={"educontent mt10 mb20"} style={{width: "1200px"}}>
<Spin size="large" spinning={this.state.mylistisSpin}>
{
@ -313,10 +360,17 @@ class ShixunHomeworkPage extends Component {
<a className="fr color-blue font-16" onClick={(child)=>this.homeworkstarts(this.child)}>立即发布</a>
: ""
: ""}
{this.props.isAdmin() ?
teacherdatapage && teacherdatapage.code_review === true ?
<a className="fr color-blue font-16" onClick={(child)=>this.workshowmodels(this.child)}>代码查重</a>
: "" : ""}
{parseInt(tab) === 0 ?this.props.isAdmin() ?
jobsettingsdatapage === undefined ? [""] : jobsettingsdatapage.data.homework_status[0] === "未发布" ? "" :
<a className="fr color-blue font-16" onClick={()=>this.Akeyreviewit()}>一键评阅</a>
: "":""}
{
parseInt(tab)===1?
this.props.isAdmin() ?

@ -1,6 +1,6 @@
import React,{ Component } from "react";
import {Table, Pagination,Popover,Spin, Row, Col ,Tabs, Icon} from "antd";
import { WordsBtn,on, off, trigger ,getImageUrl,sortDirections} from 'educoder';
import { WordsBtn,on, off, getRandomcode ,getImageUrl,sortDirections} from 'educoder';
import axios from'axios';
import Dropdownbox from './Dropdownbox';
import Dynamiclist from './Dynamiclist';
@ -172,7 +172,7 @@ class Statistics extends Component{
}
})
this.props.slowDownload(`${url}?${urllist}`);
this.props.slowDownload(getRandomcode(`${url}?${urllist}`));
}

@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames'
import { isDev } from 'educoder'
import { getUploadActionUrl } from 'educoder'
import './MemoDetailEditor.css'
@ -36,7 +36,7 @@ class MemoDetailMDEditor extends Component {
// 因为props.memo不存在时本组件不会被加载这里直接在didMount里初始化即可
const placeholder = '我要回复...'
// const imageUrl = `/upload_with_markdown?container_id=${this.props.memo.id}&container_type=Memo`;
const imageUrl = `/api/attachments.json`;
const imageUrl = `${getUploadActionUrl()}`;
if (this.isMDInited) {
return;
}

@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames'
import { isDev } from 'educoder'
import { getUploadActionUrl } from 'educoder'
import './MemoDetailEditor.css'
@ -35,7 +35,7 @@ class MemoDetailMDEditortwo extends Component {
// 因为props.memo不存在时本组件不会被加载这里直接在didMount里初始化即可
const placeholder = '我要回复...'
// const imageUrl = `/upload_with_markdown?container_id=${this.props.memo.id}&container_type=Memo`;
const imageUrl = `/api/attachments.json`;
const imageUrl = `${getUploadActionUrl()}`;
// 执行太快了,样式不正常
window.__tt = 400;

@ -441,7 +441,7 @@ class MemoNew extends Component {
// amp;
// 编辑时要传memoId
// const imageUrl = `/upload_with_markdown?container_id=&container_type=Memo`;
const imageUrl = `/api/attachments.json`;
const imageUrl = `${getUploadActionUrl()}`;
// 创建editorMd

@ -2,6 +2,7 @@ import React,{ Component } from "react";
import {getUrl,markdownToHTML} from 'educoder';
import {Input,Button} from 'antd';
import TPMMDEditor from "../tpm/challengesnew/TPMMDEditor";
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import axios from 'axios';
@ -11,79 +12,11 @@ require('codemirror/lib/codemirror.css');
const $ = window.$;
let origin = getUrl();
let path = getUrl("/editormd/lib/");
function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) {
var editorName = window.editormd(id, {
width: width,
height: high,
path: path, // "/editormd/lib/"
markdown : initValue,
syncScrolling: "single",
tex: true,
tocm: true,
emoji: true,
taskList: true,
codeFold: true,
searchReplace: true,
htmlDecode: "style,script,iframe",
sequenceDiagram: true,
autoFocus: false,
placeholder: placeholder,
toolbarIcons: function () {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
},
toolbarCustomIcons: {
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea: true,
// 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标
dialogMaskOpacity: 0.6,
imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL: imageUrl,//url
onload: function () {
// this.previewing();
var id = this.id;
var editorName = this;
$("#" + id + " [type=\"latex\"]").bind("click", function () {
editorName.cm.replaceSelection("```latex");
editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("```");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line - 1, 0);
});
$("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("`$$$$`");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");
$("[type=\"latex\"]").attr("title", "多行公式");
callback && callback()
}
});
// 一个页面有多个md时onload方法只执行了一次
// window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`);
return editorName;
}
class PathNew extends Component{
constructor(props){
super(props);
this.contentMdRef = React.createRef();
this.Point_editMD = React.createRef();
this.state={
pathName:"",
description:"",
@ -104,7 +37,7 @@ class PathNew extends Component{
})
return;
}
let des=this.Des_editMD.getValue();
let des= this.contentMdRef.current.getValue().trim();
if(des===""){
this.props.showSnackbar("请输入实践课程的简介");
window.location.href="#part_Des";
@ -115,7 +48,7 @@ class PathNew extends Component{
window.location.href="#part_Des";
return;
}
let point = this.Point_editMD.getValue();
let point = this.Point_editMD.current.getValue().trim();
if(point===""){
this.props.showSnackbar("请输入实践课程的学习须知");
window.location.href="#part_point";
@ -207,13 +140,9 @@ class PathNew extends Component{
this.setState({
pathName: response.data.name
})
this.contentMdRef.current.setValue(response.data && response.data.description);
this.Point_editMD.current.setValue(response.data && response.data.learning_notes);
const Des_editMD = create_editorMD("shixun_introduction","100%","490px"
,"请在此输入实践课程的简介最大限制8000个字符","/api/attachments.json", response.data.description,"");
this.Des_editMD=Des_editMD;
const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px"
,"请在此输入实践课程的学习须知最大限制2000个字符","/api/attachments.json",response.data.learning_notes,"");
this.Point_editMD=Point_editMD;
}
}).catch((error)=>{
console.log(error);
@ -221,10 +150,8 @@ class PathNew extends Component{
} else {
this.isEditPage = false
const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实践课程的简介最大限制8000个字符","/api/attachments.json","","");
this.Des_editMD=Des_editMD;
const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实践课程的学习须知最大限制2000个字符","/api/attachments.json","","");
this.Point_editMD=Point_editMD;
this.contentMdRef.current.setValue("");
this.Point_editMD.current.setValue("");
}
}
@ -266,8 +193,14 @@ class PathNew extends Component{
<div className="df">
<span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20">
<div id="shixun_introduction" className="new_li editormd editormd-vertical">
<textarea className="input-100-45" name="description" placeholder="请在此输入实践课程的简介" value={description}></textarea>
<div id="shixun_introduction" className="new_li">
{/*<textarea className="input-100-45" name="description" placeholder="请在此输入实践课程的简介" value={description}></textarea>*/}
<TPMMDEditor ref={this.contentMdRef} placeholder="请在此输入实践课程的简介最大限制8000个字符" mdID={'courseContentMD'}
refreshTimeout={1500}
className="courseMessageMD"
// initValue={this.state.description === null ? "" : this.state.description}
></TPMMDEditor>
</div>
<p id="e_tip_shixun_introduction" className="edu-txt-right color-grey-cd font-12"></p>
<p id="e_tips_shixun_introduction" className="edu-txt-right color-grey-cd font-12"></p>
@ -280,8 +213,13 @@ class PathNew extends Component{
<div className="df">
<span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20">
<div id="shixun_propaedeutics" className="new_li editormd editormd-vertical">
<textarea name="learning_notes" placeholder="请在此输入实践课程的学习须知" value={point}></textarea>
<div id="shixun_propaedeutics" className="new_li ">
{/*<textarea name="learning_notes" placeholder="请在此输入实践课程的学习须知" value={point}></textarea>*/}
<TPMMDEditor ref={this.Point_editMD} placeholder="请在此输入实践课程的学习须知最大限制2000个字符" mdID={'Point_editMDs'}
refreshTimeout={1500}
className="courseMessageMD"
// initValue={this.state.description === null ? "" : this.state.description}
></TPMMDEditor>
</div>
<p id="e_tip_shixun_propaedeutics" className="edu-txt-right color-grey-cd font-12"></p>
<p id="e_tips_shixun_propaedeutics" className="edu-txt-right color-grey-cd font-12"></p>

@ -4,7 +4,7 @@ import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
import { getImageUrl, toPath, getUrl } from 'educoder';
import { getImageUrl, getUploadActionUrl, getUrl } from 'educoder';
require('codemirror/lib/codemirror.css');
@ -222,7 +222,7 @@ export default class MDEditors extends Component {
const _placeholder = placeholder || "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
const imageUrl = `${getUploadActionUrl()}`;
// 创建editorMd
let react_id = `react_${_id}`;

@ -15,7 +15,7 @@ import axios from 'axios';
import './css/TPMsettings.css';
import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
import { getImageUrl, toPath, getUrl ,getUploadActionUrl} from 'educoder';
let origin = getUrl();
@ -280,7 +280,7 @@ export default class TPMsettings extends Component {
const placeholder = "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
const imageUrl = `${getUploadActionUrl()}`;
// 创建editorMd
const description_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> {
@ -307,7 +307,7 @@ export default class TPMsettings extends Component {
const placeholder = "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
const imageUrl = `${getUploadActionUrl()}`;
// 创建editorMd
const evaluate_script_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> {

@ -6,7 +6,7 @@ import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css";
import { getImageUrl, toPath, getUrl } from 'educoder';
import { getImageUrl, getUploadActionUrl, getUrl } from 'educoder';
import '../../courses/css/Courses.css'
import axios from 'axios';
@ -226,7 +226,7 @@ export default class TPMMDEditor extends Component {
const _placeholder = placeholder || "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
const imageUrl = `${getUploadActionUrl()}`;
// 创建editorMd
let react_id = `react_${_id}`;
// 将实例存到了window

@ -1,6 +1,6 @@
import React, {Component} from 'react';
import {getUrl} from 'educoder';
import {getUrl,getUploadActionUrl} from 'educoder';
let path = getUrl("/editormd/lib/");
@ -85,7 +85,7 @@ export default class TPMeditorMD extends Component {
// amp;
// 编辑时要传memoId
// const imageUrl = `/upload_with_markdown?container_id=&container_type=Memo`;
const imageUrl = `/api/attachments.json`;
const imageUrl = `${getUploadActionUrl()}`;
// 创建editorMd
let questio_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => {

@ -6,7 +6,7 @@ import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css";
import { getImageUrl, toPath, getUrl } from 'educoder';
import { getImageUrl, getUploadActionUrl, getUrl } from 'educoder';
import axios from 'axios';
@ -170,7 +170,7 @@ export default class TPManswer extends Component {
const placeholder = "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
const imageUrl = `${getUploadActionUrl()}`;
// 创建editorMd
const answers_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => {

@ -733,7 +733,7 @@ a.white-btn.use_scope-btn:hover{
backgroud: rgba(234, 234, 234, 1);
width: 530px;
margin-left: 10px;
margin-top: 25px;
margin-top: 5px;
height: 214px !important;
}

@ -243,7 +243,7 @@ class Newshixuns extends Component {
const placeholder = "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
const imageUrl = `getUploadActionUrl`;
// 创建editorMd
const taskpass_editormd = create_editorMD("memoMD", '100%', 400, placeholder, imageUrl, () => {

@ -1,7 +1,7 @@
import React,{ Component } from "react";
import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon, message, Modal } from "antd";
import axios from 'axios'
import { WordsBtn, getUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder'
import { getUploadActionUrl, getUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder'
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
const $ = window.$;
const MAX_TITLE_LENGTH = 60;
@ -191,7 +191,7 @@ class NewGtaskForms extends Component{
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleContentUploadChange,
onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'),
beforeUpload: (file) => {

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