Merge branches 'dev_aliyun' and 'dev_ysm' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_ysm

dev_ysm
杨树明 5 years ago
commit c1a6ce1697

@ -19,6 +19,13 @@ class Admins::LaboratoryShixunsController < Admins::BaseController
render_ok
end
def destroy
return render_js_error('不能删除自建实训', type: :notify) if current_laboratory_shixun.ownership?
current_laboratory_shixun.destroy!
render_delete_success
end
def homepage
current_laboratory_shixun.update!(homepage: true)
render_ok

@ -21,6 +21,15 @@ class Admins::LaboratorySubjectsController < Admins::BaseController
render_ok
end
def destroy
return render_js_error('不能删除自建课程', type: :notify) if current_laboratory_subject.ownership?
current_laboratory_subject.destroy!
render_delete_success
end
def homepage
current_laboratory_subject.update!(homepage: true)
render_ok

@ -15,6 +15,13 @@ class Cooperative::LaboratoryShixunsController < Cooperative::BaseController
end
def destroy
return render_js_error('不能删除自建实训', type: :notify) if current_laboratory_shixun.ownership?
current_laboratory_shixun.destroy!
render_delete_success
end
def homepage
current_laboratory_shixun.update!(homepage: true)
render_ok

@ -18,6 +18,13 @@ class Cooperative::LaboratorySubjectsController < Cooperative::BaseController
current_laboratory_subject.subject.update!(update_params)
end
def destroy
return render_js_error('不能删除自建实践课程', type: :notify) if current_laboratory_subject.ownership?
current_laboratory_subject.destroy!
render_delete_success
end
def homepage
current_laboratory_subject.update!(homepage: true)
render_ok

@ -458,15 +458,14 @@ class ExercisesController < ApplicationController
# 统一设置或者分班为0则更新试卷并删除试卷分组
if unified_setting || (course_group_ids.size == 0)
params_publish_time = params[:publish_time].blank? ? nil : params[:publish_time].to_time
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
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 (exercise_status != Exercise::UNPUBLISHED) && (@exercise.publish_time != params_publish_time)
normal_status(-1,"已发布/已截止,不允许修改发布时间")
@ -500,16 +499,16 @@ class ExercisesController < ApplicationController
old_exercise_groups = exercise_groups_ids - total_common_group #后来传入的分班里,没有了的班级,即需要删除
params_times.each do |t|
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]
exercise_publish_time = t[:publish_time].present? ? t[:publish_time].to_time : nil
exercise_end_time = nil
if t[:end_time].blank?
if exercise_publish_time.present?
exercise_end_time = exercise_publish_time + 30.days
end
else
exercise_end_time = t[:end_time].to_time
end
exercise_publish_time = t[:publish_time].to_time
exercise_end_time = t[:end_time].to_time
exercise_group = exercise_groups.find_in_exercise_group("course_group_id",course_id) #判断该分班是否存在
if exercise_group.present? && (exercise_group.first.publish_time < Time.now) && (exercise_publish_time != exercise_group.first.publish_time)
error_count += 1
@ -553,7 +552,7 @@ class ExercisesController < ApplicationController
:end_time => exercise_end_time
}
new_exercise_group = ExerciseGroupSetting.new(exercise_group_params)
new_exercise_group.save
new_exercise_group.save!
end
end
end
@ -602,7 +601,7 @@ class ExercisesController < ApplicationController
end
rescue Exception => e
uid_logger_error(e.message)
tip_exception("提交出现错误!")
tip_exception("试卷提交失败")
raise ActiveRecord::Rollback
end
end
@ -613,9 +612,9 @@ class ExercisesController < ApplicationController
exercise_user = @exercise.exercise_users.find_by!(user_id: params[:user_id])
tip_exception("已提交的作品请去评阅页进行调分") if exercise_user.commit_status == 1
if @exercise.subjective_score > 0
tip_exception("主观题成绩不能为空") if params[:subject_score].blank?
tip_exception("主观题成绩不能小于零") if params[:subject_score].to_f < 0
tip_exception("主观题成绩不能大于总分值:#{@exercise.subjective_score}") if params[:subject_score].to_f.round(1) > @exercise.subjective_score.round(1)
tip_exception("主观题成绩不能为空") if params[:subjective_score].blank?
tip_exception("主观题成绩不能小于零") if params[:subjective_score].to_f < 0
tip_exception("主观题成绩不能大于总分值:#{@exercise.subjective_score}") if params[:subjective_score].to_f.round(1) > @exercise.subjective_score.round(1)
end
if @exercise.objective_score > 0
@ -626,7 +625,7 @@ class ExercisesController < ApplicationController
ActiveRecord::Base.transaction do
start_at_time = exercise_user.start_at || Time.now
subjective_score = @exercise.subjective_score > 0 ? params[:subject_score].to_f.round(2) : 0
subjective_score = @exercise.subjective_score > 0 ? params[:subjective_score].to_f.round(2) : 0
objective_score = @exercise.objective_score > 0 ? params[:objective_score].to_f.round(2) : 0
score = subjective_score + objective_score
exercise_user.update_attributes!(start_at: start_at_time, end_at: Time.now, status: 1, commit_status: 1, score: score,
@ -1534,7 +1533,7 @@ class ExercisesController < ApplicationController
ex_group_settings = @exercise.exercise_group_settings
if ex_group_settings.present?
p_time_present = ex_group_settings.publish_time_no_null.map(&:publish_time).min
if p_time_present < Time.now
if p_time_present && p_time_present < Time.now
normal_status(-1,"设置失败,存在已发布的分班")
end
elsif params[:publish_time].blank?

@ -20,7 +20,12 @@ class MessagesController < ApplicationController
sort = params[:sort].to_i == 1 ? 'asc' : 'desc'
sort_type = params[:sort_type] || 'time'
messages = @board.messages.root_nodes.by_keywords(params[:search])
if @board.parent_id == 0
messages = Message.where(board_id: @board.course.boards.pluck(:id))
else
messages = @board.messages
end
messages = messages.root_nodes.by_keywords(params[:search])
messages = messages.reorder('(sticky = 1) DESC') # 置顶
@ -31,7 +36,7 @@ class MessagesController < ApplicationController
else messages.order("created_on #{sort}")
end
messages = messages.includes(:author)
messages = messages.includes(:author, :board)
@messages = Kaminari.paginate_array(messages).page(@page).per(@page_size)
ids = @messages.map(&:id)

@ -0,0 +1,29 @@
class Weapps::CourseStickiesController < Weapps::BaseController
# before_action :require_wechat_login!
def create
courses = params[:category] == "study" ? current_user.as_student_courses.started : current_user.manage_courses
courses = courses.order("course_members.sticky=1 desc, course_members.sticky_time desc, courses.created_at desc").first
return render_error("该课堂已置顶,请勿重复操作") if course_member.sticky && courses&.id.to_i == current_course.id
course_member.update!(sticky: 1, sticky_time: Time.now)
render_ok
end
def cancel_sticky
return render_error("该课堂未置顶,无法取消") unless course_member.sticky
course_member.update!(sticky: 0, sticky_time: nil)
render_ok
end
private
def current_course
@_current_course = Course.find params[:course_id]
end
def course_member
@_course_member = params[:category] == "study" ? current_course.students.find_by!(user_id: current_user.id) :
current_course.teachers.find_by!(user_id: current_user.id)
end
end

@ -0,0 +1,27 @@
class Weapps::CoursesController < Weapps::BaseController
# before_action :require_wechat_login!
def create
return render_error("只有老师身份才能创建课堂") unless current_user.is_teacher?
course = Course.new(tea_id: current_user.id)
Weapps::CreateCourseService.call(course, course_params)
render_ok
rescue ApplicationService::Error => ex
render_error(ex.message)
end
def edit
end
def update
end
private
def course_params
params.permit(:name, :course_list_name, :credit, course_module_types: [])
end
end

@ -1,15 +1,24 @@
class Weapps::HomesController < Weapps::BaseController
before_action :require_wechat_login!
def show
# banner
@carousels = WeappSettings::Carousel.only_online
# 广告
@advert = WeappSettings::Advert.only_online.first
# 热门实训
@shixuns = Shixun.where(homepage_show: true).includes(:tag_repertoires, :challenges).limit(4)
# 热门实践课程
@subjects = Subject.where(homepage_show: true).includes(:shixuns, :repertoire).limit(4)
# 我的课堂
@category = params[:category] && ["manage", "study"].include?(params[:category]) ? params[:category] : (current_user.is_teacher? ? "manage" : "study")
@courses = case @category
when 'study' then
current_user.as_student_courses.started
when 'manage' then
current_user.manage_courses
end
@courses = @courses.not_deleted.not_excellent
@course_count = @courses.count
order_str = "course_members.sticky=1 desc, course_members.sticky_time desc, courses.created_at desc"
@courses = paginate(@courses.order(order_str).includes(:teacher, :school))
@user = current_user
end
end

@ -0,0 +1,20 @@
class Weapps::CreateCourseForm
include ActiveModel::Model
attr_accessor :course
attr_accessor :name, :course_list_name, :credit, :course_module_types
validates :name, presence: true
validates :course_list_name, presence: true
validate :course_name_prefix
validate :check_course_modules
def course_name_prefix
raise '课堂名称应以课程名称开头' unless name.index(course_list_name) && name.index(course_list_name) == 0
end
def check_course_modules
raise '请至少添加一个课堂模块' if course_module_types.blank?
end
end

@ -108,40 +108,28 @@ module ExercisesHelper
ques_less_title = nil
ex_answers = ex.exercise_answers
effictive_users = ex_answers.search_answer_users("user_id",user_ids)
effictive_users_count = effictive_users.where("exercise_choice_id is not null or (answer_text is not null and answer_text !='')").pluck(:user_id).uniq.size if ex.question_type != Exercise::COMPLETION
else
ques_title = ex.shixun.name
ques_less_title = ex.question_title
ex_answers = ex.exercise_shixun_answers
effictive_users = ex_answers.search_shixun_answers("user_id",user_ids)
effictive_users_count = effictive_users.pluck(:user_id).uniq.size
end
effictive_users_count = effictive_users.size #有效回答数可能有重复的用户id这里仅统计是否回答这个问题的全部人数
# effictive_users_count = effictive_users.size #有效回答数可能有重复的用户id这里仅统计是否回答这个问题的全部人数
#
if ex.question_type > Exercise::COMPLETION #当为主观题和实训题时,
ex_answered_scores = effictive_users.score_reviewed.pluck(:score).sum #该问题的全部得分
percent = (ex_total_score == 0.0 ? 0.0 : (ex_answered_scores / ex_total_score.to_f).round(3) * 100) #正确率
end
# if ex.question_type != Exercise::MULTIPLE
# ex_answered_scores = effictive_users.score_reviewed.pluck(:score).sum #该问题的全部得分
# percent = (ex_total_score == 0.0 ? 0.0 : (ex_answered_scores / ex_total_score.to_f).round(3) * 100) #正确率
# else
# multiple_score = 0
# user_ids.each do |user_id|
# ex_answer_score = ex_answers.select{|answer| answer.user_id == user_id}&.first&.score.to_f
# multiple_score += ex_answer_score
# end
# percent = (ex_total_score == 0.0 ? 0.0 : (multiple_score / ex_total_score.to_f).round(3) * 100) #正确率
# end
question_answer_infos = []
if ex.question_type <= Exercise::JUDGMENT #选择题和判断题
ex_choices = ex.exercise_choices
standard_answer = ex.exercise_standard_answers.pluck(:exercise_choice_id).sort #标准答案的位置
right_users_count = 0
#该问题的正确率
if ex.question_type == Exercise::MULTIPLE #多选题
if standard_answer.size == 1 #以前的多选题答案存在一个表里
standard_answer = standard_answer.first.to_s.split("").map(&:to_i)
end
@ -178,6 +166,17 @@ module ExercisesHelper
question_answer_infos.push(answer_option)
end
elsif ex.question_type == Exercise::COMPLETION #填空题
effictive_users_ids = effictive_users.where("answer_text is not null and answer_text !=''").pluck(:user_id).uniq
effictive_users_count = effictive_users_ids.size
user_wrong_count = 0
effictive_users_ids.each do |s|
user_score = effictive_users.where(user_id: s).pluck(:score).sum
if user_score.to_f < ex&.question_score.to_f
user_wrong_count = user_wrong_count + 1
end
end
# user_wrong_ids = effictive_users.where()
# user_wrong_count = (user_wrong_ids & effictive_users_ids).uniq.size
ex_ordered = ex.is_ordered
null_standard_answer = ex.exercise_standard_answers
null_stand_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text
@ -185,34 +184,48 @@ module ExercisesHelper
standard_answer_count = 0
each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.uniq.size).round(3) : 0.0
all_user_count = 0
null_stand_choice.each_with_index do |s,index|
user_count = 0
s_choice_text = null_stand_text[index]
if ex_ordered #有序排列
user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
else
user_count = user_count + effictive_users.select{|answer| answer.answer_text == s_choice_text }.size #回答了标准答案的用户
end
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
answer_option = {
if ex_ordered
all_user_answers = effictive_users.pluck(:answer_text)
null_stand_choice.each_with_index do |s,index|
s_choice_text = null_stand_text[index]
user_count = 0
# user_count = user_count + effictive_users.where("exercise_choice_id = ? and answer_text = ?",s,s_choice_text).pluck(:user_id).uniq.size
user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
answer_option = {
:choice_position => index+1,
:choice_text => s_choice_text,
:choice_users_count => user_count,
:choice_percent => answer_percent.round(2).to_s,
:right_answer => true
}
question_answer_infos.push(answer_option)
all_user_count += user_count
standard_answer_count += 1
}
question_answer_infos.push(answer_option)
all_user_count += user_count
standard_answer_count += 1
all_user_answers = all_user_answers - [s]
end
else
# cycled_stand = {}
null_stand_text.uniq.each_with_index do |stand, index|
user_count = 0
user_count = user_count + effictive_users.where("answer_text = ?",stand).pluck(:user_id).uniq.size
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
answer_option = {
:choice_position => index+1,
:choice_text => stand,
:choice_users_count => user_count,
:choice_percent => answer_percent.round(2).to_s,
:right_answer => true
}
question_answer_infos.push(answer_option)
all_user_count += user_count
standard_answer_count += 1
end
end
answer_user_score = all_user_count * each_null_score
percent = (ex_total_score == 0.0 ? 0.0 : (answer_user_score / ex_total_score.to_f).round(3) * 100) #正确率
# percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0
user_wrong_count = (effictive_users_count - all_user_count )
if effictive_users_count > 0 && user_wrong_count >= 0
wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3)
else
@ -479,17 +492,28 @@ module ExercisesHelper
end
end
else
st_answer_text = standard_answer_array.pluck(:answer_text).reject(&:blank?).map{|a| a.strip.downcase}
st_answer_text = standard_answer_array.pluck(:answer_text).reject(&:blank?).map{|a| a.strip.downcase}.uniq
answers_content.each do |u|
u_answer_text = u.answer_text.strip.downcase
if st_answer_text.include?(u_answer_text) #只要标准答案包含用户的答案,就有分数。同时,下一次循环时,就会删除该标准答案。防止用户的相同答案获分
u.update_column("score",q_score_2)
score2 = score2 + q_score_2
st_answer_text.delete(u_answer_text)
if st_answer_text.size == 1
if st_answer_text.first == u_answer_text
u.update_column("score",q_score_2)
score2 = score2 + q_score_2
else
u.update_column('score',-1.0)
score2 += 0.0
end
else
u.update_column('score',-1.0)
score2 += 0.0
if st_answer_text.include?(u_answer_text) #只要标准答案包含用户的答案,就有分数。同时,下一次循环时,就会删除该标准答案。防止用户的相同答案获分
u.update_column("score",q_score_2)
score2 = score2 + q_score_2
st_answer_text.delete(u_answer_text)
else
u.update_column('score',-1.0)
score2 += 0.0
end
end
end
end
else

@ -12,7 +12,7 @@ module MyshixunsHelper
end
end
def view_answer_time game, user_id
game.game_answers.where(user_id: user_id).last&.view_time
def view_answer_time game
game.game_answers.where(user_id: game.user_id).last&.view_time
end
end

@ -13,7 +13,7 @@ module PollsHelper
end
def poll_votes_count(votes,user_ids)
votes.find_current_vote("user_id",user_ids.uniq).reject(&:blank?).size
votes.find_current_vote("user_id",user_ids.uniq).pluck(:user_id).uniq.reject(&:blank?).size
end
#公用tab页的相关信息

@ -90,7 +90,7 @@ class Course < ApplicationRecord
}
scope :started, -> { where("start_date is null or start_date <= '#{Date.today}'") }
acts_as_taggable
# acts_as_taggable
# 课程权限判断

@ -0,0 +1,30 @@
class Weapps::CreateCourseService < ApplicationService
attr_reader :course, :params
def initialize(course, params)
@course = course
@params = params
end
def call
Weapps::CreateCourseForm.new(form_params).validate!
ActiveRecord::Base.transaction do
course.name = params[:name].to_s.strip
course.school_id = course.teacher&.school_id
course.is_public = 0
course.credit = params[:credit].blank? ? nil : params[:credit]
course.save!
course.generate_invite_code
CourseMember.create!(course_id: course.id, user_id: course.tea_id, role: 1)
course.create_course_modules(params[:course_module_types])
end
end
private
def form_params
params.merge(course: course)
end
end

@ -25,4 +25,8 @@
<%= link_to('去修改', admins_shixun_settings_path(id: laboratory_shixun.shixun_id)) %>
<%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? 'display:none' : '') %>
<%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? '' : 'display:none') %>
<% unless laboratory_shixun.ownership? %>
<%= delete_link '删除', admins_laboratory_laboratory_shixun_path(current_laboratory, laboratory_shixun, element: ".laboratory-shixun-item-#{laboratory_shixun.id}") %>
<% end %>
</td>

@ -36,6 +36,10 @@
<%= link_to('去修改', admins_subjects_path(id: laboratory_subject.subject_id)) %>
<%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? 'display:none' : '') %>
<%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? '' : 'display:none') %>
<% unless laboratory_subject.ownership? %>
<%= delete_link '删除', admins_laboratory_laboratory_subject_path(current_laboratory, laboratory_subject, element: ".laboratory-subject-item-#{laboratory_subject.id}") %>
<% end %>
</td>
</tr>
<% end %>

@ -4,7 +4,7 @@ json.user_ranks @user_ranks.each do |user_rank|
json.rank rank == 0 ? "--" : rank
json.team_name user_rank.name
json.user_name user_rank.user.real_name
json.cost_time rank == 0 && user_rank.cost_time ? "--" : com_spend_time(user_rank.cost_time)
json.cost_time rank == 0 || !user_rank.cost_time ? "--" : com_spend_time(user_rank.cost_time)
json.score rank == 0 ? "--" : user_rank.score.round(2)
json.competition_prize user_rank.competition_prize
end

@ -29,4 +29,8 @@
<% end %>
<%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? 'display:none' : '') %>
<%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? '' : 'display:none') %>
<% unless laboratory_shixun.ownership? %>
<%= delete_link '删除', cooperative_laboratory_shixun_path(laboratory_shixun, element: ".laboratory-shixun-item-#{laboratory_shixun.id}") %>
<% end %>
</td>

@ -25,4 +25,8 @@
<%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? 'display:none' : '') %>
<%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? '' : 'display:none') %>
<% unless laboratory_subject.ownership? %>
<%= delete_link '删除', cooperative_laboratory_subject_path(laboratory_subject, element: ".laboratory-subject-item-#{laboratory_subject.id}") %>
<% end %>
</td>

@ -3,11 +3,11 @@ json.images_url @images_url
json.reps @rep_list
json.shixuns do
json.partial! 'shixuns/shixun', locals: {shixuns: @shixuns.present? ? @shixuns : @main_shixuns}
json.partial! 'shixuns/shixun', locals: {shixuns: @shixuns}
end
json.subjects do
json.partial! 'subjects/subject', locals: {subjects: @subjects.present? ? @subjects : @main_subjects}
json.partial! 'subjects/subject', locals: {subjects: @subjects}
end
if current_laboratory.main_site?

@ -7,7 +7,8 @@ json.data do
json.messages do
json.array! @messages do |message|
json.extract! message, :id, :parent_id, :subject, :created_on, :total_replies_count,
:praises_count, :visits, :sticky, :is_hidden, :is_public
:praises_count, :visits, :sticky, :is_hidden, :is_public, :board_id
json.category_name message.board&.name if @board.parent_id == 0 && message.board_id != @board.id
json.total_praises_count @praises_count_map.fetch(message.id, 0)

@ -6,6 +6,6 @@ json.array! @games do |game|
json.identifier get_game_identifier(@shixun.task_pass, game, @identity)
json.get_gold game.user_get_gold_and_experience(@shixun.status, challenge)[0]
json.get_experience game.user_get_gold_and_experience(@shixun.status, challenge)[1]
json.view_answer_time view_answer_time(game, current_user.id)
json.view_answer_time view_answer_time(game)
json.finished_time game.end_time
end

@ -14,7 +14,7 @@ if @poll_questions_count > 0
json.array! @poll_questions do |question|
json.partial! "polls/commit_answers_result", question: question,
answers:question.poll_answers,
question_votes:question.poll_votes.where(user_id:@poll_commit_ids) #问题的全部答案
question_votes: question.poll_votes.where(user_id:@poll_commit_ids) #问题的全部答案
end
end
else

@ -13,6 +13,7 @@ json.phone @user.phone
json.email @user.mail
json.profile_completed @user.profile_completed?
json.professional_certification @user.professional_certification
json.main_site current_laboratory.main_site?
if @course
json.course_identity @course_identity
json.course_name @course.name

@ -16,25 +16,13 @@ else
json.advert nil
end
json.shixuns do
json.array! @shixuns do |shixun|
json.id shixun.id
json.identifier shixun.identifier
json.name shixun.name
json.status shixun.status
json.power (current_user.shixun_permission(shixun)) # 现在首页只显示已发布的实训
# REDO: 局部缓存
json.tag_name @tag_name_map&.fetch(shixun.id, nil) || shixun.tag_repertoires.first.try(:name)
json.myshixuns_count shixun.myshixuns_count
json.stu_num shixun.myshixuns_count
json.score_info shixun.averge_star
json.challenges_count shixun.challenges_count
#json.exp shixun.all_score
json.level level_to_s(shixun.trainee)
json.pic Util::FileManage.source_disk_file_url(shixun, '_weapp')
end
json.course_count @course_count
json.courses @courses.each do |course|
json.(course, :id, :name, :visits, :course_members_count)
json.creator course.teacher.real_name
json.avatar_url url_to_avatar(course.teacher)
json.school course.school&.name
course_member = @category == "study" ? course.students.where(user_id: @user.id).first : course.teachers.where(user_id: @user.id).first
json.sticky course_member.sticky
end
json.subjects do
json.partial! 'subjects/subject', locals: { subjects: @subjects }
end

@ -876,6 +876,11 @@ Rails.application.routes.draw do
resource :check_account, only: [:create]
resources :searchs, only: [:index]
resources :course_stickies, only: [:create] do
post :cancel_sticky, on: :collection
end
resources :courses, only: [:create, :update, :edit]
end
resources :users_for_partners, only: [:index]
@ -1049,13 +1054,13 @@ Rails.application.routes.draw do
post :drag, on: :collection
end
resources :laboratory_shixuns, only: [:index, :create] do
resources :laboratory_shixuns, only: [:index, :create, :destroy] do
member do
post :homepage
post :cancel_homepage
end
end
resources :laboratory_subjects, only: [:index, :create] do
resources :laboratory_subjects, only: [:index, :create, :destroy] do
member do
post :homepage
post :cancel_homepage
@ -1132,13 +1137,13 @@ Rails.application.routes.draw do
resources :carousels, only: [:index, :create, :update, :destroy] do
post :drag, on: :collection
end
resources :laboratory_shixuns, only: [:index, :edit, :update] do
resources :laboratory_shixuns, only: [:index, :edit, :update, :destroy] do
member do
post :homepage
post :cancel_homepage
end
end
resources :laboratory_subjects, only: [:index, :edit, :update] do
resources :laboratory_subjects, only: [:index, :edit, :update, :destroy] do
member do
post :homepage
post :cancel_homepage

@ -0,0 +1,25 @@
class MigrateGccProjectTeam < ActiveRecord::Migration[5.2]
def change
competition = Competition.find_by(id: 8)
if competition
competition.competition_teams.destroy_all
all_login = [['mu2pwryse', 'pljq3f9xp', 'pfx7gfmiz'], ['p9rs7xtfl', 'prx72s8uc', 'plezci23p', 'pjysrikw7'], ['m40352189', 'p05394287'],
['m9ozhx83t', 'p05296348'], ['p35490268', 'p48921607', 'p24019738'], ['p29165708', 'm43960821']]
all_login.each do |user_login|
leader = User.find_by(login: user_login.first)
next if leader.blank?
team = CompetitionTeam.create!(name: "#{leader.real_name}", user_id: leader.id, competition_id: 8)
team.generate_invite_code
team.save!
team.team_members.create!(user_id: leader.id, competition_id: competition.id, role: 1, is_teacher: 0)
user_login.each_with_index do |user_login, index|
if index > 0
user = User.find_by(login: user_login)
team.team_members.create!(user_id: user.id, competition_id: competition.id, role: 2, is_teacher: 0)
end
end
end
end
end
end

@ -0,0 +1,9 @@
class GccCourseCompetitionRankData < ActiveRecord::Migration[5.2]
def change
competition = Competition.find_by(identifier: 'gcc-course-2019')
stage = competition.competition_stages.first
return if competition.blank? || stage.blank?
competition.competition_scores.update_all(competition_stage_id: stage.id)
end
end

@ -0,0 +1,6 @@
class AddStickyToCourseMembers < ActiveRecord::Migration[5.2]
def change
add_column :course_members, :sticky, :boolean, default: 0
add_column :course_members, :sticky_time, :datetime
end
end

@ -302,10 +302,10 @@ $(function(){
refresh_editor_monaco(m)
var _iframe = document.getElementById("game_webssh");
if(!_iframe){
return;
}
// var _iframe = document.getElementById("game_webssh");
// if(!_iframe){
// return;
// }
var FF = !(window.mozInnerScreenX == null);
var websshLineHeight = FF ? 19 : 18

@ -1,7 +1,8 @@
import React,{ Component } from "react";
import {Tooltip} from 'antd'
import moment from 'moment'
import { getUrl, WordsBtn } from 'educoder'
import { getUrl, WordsBtn, ConditionToolTip } from 'educoder'
import './boardsListItem.css';
class BoardsListItem extends Component{
constructor(props){
super(props);
@ -76,6 +77,16 @@ class BoardsListItem extends Component{
}
</h6>
<div className="fr">
{(isAdmin || discussMessage.author.login == current_user.login) &&
<WordsBtn style="blue" className="fl font-16 ml28"
onClick={(e) => { this.props.toEditPage(this.props.match.params.coursesId, this.props.match.params.boardId, discussMessage.id )} }>编辑</WordsBtn> }
{ isAdmin && <WordsBtn style="blue" className="fl font-16 ml28"
onClick={(e) => { debugger; onSticky(discussMessage); e.cancelBubble = true; e.stopPropagation();}}>
{ discussMessage.sticky ? '取消置顶' : '置顶' }</WordsBtn> }
</div>
<div className="cl"></div>
<p className="color-grey panel-lightgrey mt18 fl">
<span className="mr50">
@ -88,19 +99,19 @@ class BoardsListItem extends Component{
<span className="mr15 color-light-grey-C font-14">{moment(discussMessage.created_on).fromNow()} </span>
</span>
</p>
<div className="fr mt15">
{(isAdmin || discussMessage.author.login == current_user.login) &&
<WordsBtn style="blue" className="fl font-16 ml28"
onClick={(e) => { this.props.toEditPage(this.props.match.params.coursesId, this.props.match.params.boardId, discussMessage.id )} }>编辑</WordsBtn> }
{ isAdmin && <WordsBtn style="blue" className="fl font-16 ml28"
onClick={(e) => { debugger; onSticky(discussMessage); e.cancelBubble = true; e.stopPropagation();}}>
{ discussMessage.sticky ? '取消置顶' : '置顶' }</WordsBtn> }
</div>
{
discussMessage.category_name &&
<div className={'directory_style'}>
<ConditionToolTip title={discussMessage.category_name} condition={discussMessage.category_name}>
{ <div className=" color-grey9 task-hide fr"
style={{"maxWidth":"216px"}}
title={discussMessage.category_name}>
所属目录{discussMessage.category_name}
</div>
}
</ConditionToolTip>
</div>
}
{/* { (isAdmin || discussMessage.author.login == current_user.login) &&
<div className="homepagePostSetting" style={{"right":"4px","top":"5px","display":"block"}}>

@ -0,0 +1,9 @@
.directory_style {
position: absolute;
right: 0;
bottom: 0;
maxSize: 20px;
overflow: hidden;
whiteSpace: nowrap;
textOverflow: ellipsis
}

@ -386,8 +386,8 @@ class Boards extends Component{
{
boards && boards.filter((item)=> {
return item.id != bid && (!this.state.dirSearchValue || item.name.indexOf(this.state.dirSearchValue) != -1)
}).map( (item) => {
return <li onClick={() => this.moveTo(item)} title={item.name}>{item.name}</li>
}).map( (item, index) => {
return <li key={`i_${index}`} onClick={() => this.moveTo(item)} title={item.name}>{item.name}</li>
})
}
{ isAdmin && !isCourseEnd &&
@ -427,7 +427,7 @@ class Boards extends Component{
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
{ messages.map((item, index) => {
return (
<div className="mt20 edu-back-white padding02010">
<div className="mt20 edu-back-white padding02010" key={`d_${index}`}>
<BoardsListItem
{...this.props}
discussMessage={item}

@ -45,6 +45,7 @@ class ModulationModal_exercise extends Component {
}
Saves = () => {
debugger
let {
textareaval,
subjective_questions,
@ -123,7 +124,7 @@ class ModulationModal_exercise extends Component {
Inputsvaltests: "请输入0-100的分数",
})
return;
} else if (parseFloat(Inputsval) > this.props.objective_score) {
} else if (parseFloat(Inputsvals) > this.props.objective_score) {
this.setState({
Inputsvals: Inputsvals,
Inputsvaltypes: true,
@ -312,7 +313,9 @@ class ModulationModal_exercise extends Component {
""
}
<div className="mexertwo">
<div className="mexertwo" style={{
marginTop: "20px",
}}>
<p className="mexeheigth2">主观题成绩:</p>
<Input
className={Inputsvaltype === true ? "borerinput myinputnumbers bor-reds" : "myinputnumbers"}
@ -355,7 +358,9 @@ class ModulationModal_exercise extends Component {
""
}
<div className="mexertwo">
<div className="mexertwo" style={{
marginTop: "20px",
}}>
<p className="mexeheigth2">客观题成绩:</p>
<Input
@ -382,6 +387,13 @@ class ModulationModal_exercise extends Component {
}}>{Inputsvaltests}</p>
: ""
}
<div className="minbuttionte">
<a className="task-btn color-white mr30" style={{width: "72px",}}
onClick={this.props.Cancel}>{this.props.Cancelname || '取消'}</a>
<a className="task-btn task-btn-orange" style={{width: "72px",}}
onClick={this.Saves}>{this.props.Savesname || '保存'}</a>
</div>
</div>
:
<div className="mt20">

@ -428,7 +428,7 @@ class Studentshavecompletedthelist extends Component {
textAlign: "center",
width:'255px',
}}>--</span>:
<a className="maxnamewidth255" tyle={{
<a className="maxnamewidth255" style={{
color: '#07111B',
textAlign: "center",
width:'255px',
@ -661,7 +661,7 @@ class Studentshavecompletedthelist extends Component {
key: 'classroom',
dataIndex: 'classroom',
align: 'center',
className: "edu-txt-center font-14",
className: "edu-txt-center font-14 maxnamewidth260",
width:"260px",
render: (text, record) => (
<span>
@ -669,15 +669,15 @@ class Studentshavecompletedthelist extends Component {
<span style={{
color: '#999999',
textAlign: "center"
}}>--</span> : record.classroom === "" ?
}} className="maxnamewidth260">--</span> : record.classroom === "" ?
<span style={{
color: '#999999',
textAlign: "center"
}}>--</span> :
}} className="maxnamewidth260">--</span> :
<span style={{
color: '#07111B',
textAlign: "center"
}}>{record.classroom}</span>
}} className="maxnamewidth260">{record.classroom}</span>
}
</span>
@ -904,14 +904,14 @@ class Studentshavecompletedthelist extends Component {
key: 'classroom',
dataIndex: 'classroom',
align: 'center',
className: "edu-txt-center font-14",
className: "edu-txt-center font-14 maxnamewidth260",
width:'260px',
render: (text, record) => (
<span>
{record.classroom==="--"?
<span style={{color: '#999999', textAlign: "center"}}>{record.classroom}</span>
<span style={{color: '#999999', textAlign: "center"}} className="maxnamewidth260">{record.classroom}</span>
:
<span style={{color: '#07111B', textAlign: "center"}}>{record.classroom}</span>
<a style={{color: '#07111B', textAlign: "center"}} className="maxnamewidth260" title={record.classroom}>{record.classroom}</a>
}
</span>
)
@ -1030,15 +1030,17 @@ class Studentshavecompletedthelist extends Component {
className: "edu-txt-center font-14",
render: (text, record) => (
<span>
{record.finalscore==="--"?
<span style={{textAlign: "center", color: '#999999'}}
>--</span>
:
<a style={{textAlign: "center"}} className="color-blue"
target="_blank"
href={`/courses/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/users/${record.myid}`}>{record.finalscore}</a>
{
record.submitstate === "未提交"||record.commit_method===5?
<a style={{textAlign: "center"}} className="color-blue"
target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a>
:record.submitstate === "已提交"?
<a style={{textAlign: "center"}} className="color-blue"
target="_blank"
href={`/courses/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/users/${record.myid}`}>{record.finalscore}</a>
:
<span style={{textAlign: "center", color: '#999999'}}>--</span>
}
</span>
)
},
@ -1100,14 +1102,14 @@ class Studentshavecompletedthelist extends Component {
key: 'classroom',
dataIndex: 'classroom',
align: 'center',
className: "edu-txt-center font-14",
className: "edu-txt-center font-14 maxnamewidth260 ",
width:'260px',
render: (text, record) => (
<span>
{record.classroom==="--"?
<span style={{color: '#999999', textAlign: "center"}}>{record.classroom}</span>
<span style={{color: '#999999', textAlign: "center"}} className="maxnamewidth260">{record.classroom}</span>
:
<span style={{color: '#07111B', textAlign: "center"}}>{record.classroom}</span>
<a style={{color: '#07111B', textAlign: "center"}} className="maxnamewidth260" title={record.classroom}>{record.classroom}</a>
}
</span>
)
@ -1226,15 +1228,17 @@ class Studentshavecompletedthelist extends Component {
className: "edu-txt-center font-14",
render: (text, record) => (
<span>
{record.finalscore==="--"?
<span style={{textAlign: "center", color: '#999999'}}
>--</span>
:
<a style={{textAlign: "center"}} className="color-blue"
target="_blank"
href={`/courses/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/users/${record.myid}`}>{record.finalscore}</a>
{
record.submitstate === "未提交"||record.commit_method===5?
<a style={{textAlign: "center"}} className="color-blue"
target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a>
:record.submitstate === "已提交"?
<a style={{textAlign: "center"}} className="color-blue"
target="_blank"
href={`/courses/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/users/${record.myid}`}>{record.finalscore}</a>
:
<span style={{textAlign: "center", color: '#999999'}}>--</span>
}
</span>
)
},
@ -1521,7 +1525,8 @@ class Studentshavecompletedthelist extends Component {
completion: exercise_users[i].objective_score === undefined ? "--" : exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score,
levelscore: exercise_users[i].subjective_score === undefined ? "--" : exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score,
efficiencyscore: exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score,
operating: "评阅"
operating: "评阅",
commit_method:exercise_users[i].commit_method
})
} else {
datalist.push({
@ -1536,7 +1541,8 @@ class Studentshavecompletedthelist extends Component {
completion: exercise_users[i].objective_score === undefined ? "--" : exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score,
levelscore: exercise_users[i].subjective_score === undefined ? "--" : exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score,
efficiencyscore: exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score,
operating: "--"
operating: "--",
commit_method:exercise_users[i].commit_method
})
}
@ -1599,7 +1605,8 @@ class Studentshavecompletedthelist extends Component {
completion: exercise_users[i].objective_score === undefined ? "--" : exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score,
levelscore: exercise_users[i].subjective_score === undefined ? "--" : exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score,
efficiencyscore: exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score,
operating: "查看"
operating: "查看",
commit_method:exercise_users[i].commit_method,
})
noclassroom = exercise_users[i].user_group_name;
}
@ -1744,7 +1751,8 @@ class Studentshavecompletedthelist extends Component {
levelscore: exercise_users[i].subjective_score === undefined ? "--" : exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score,
efficiencyscore: exercise_users[i].score === undefined ? "--" : exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score,
finalscore: "评阅",
user_id: exercise_users[i].user_id
user_id: exercise_users[i].user_id,
commit_method:exercise_users[i].commit_method
})
} else {
datalist.push({
@ -1760,7 +1768,8 @@ class Studentshavecompletedthelist extends Component {
levelscore: exercise_users[i].subjective_score === undefined ? "--" : exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score,
efficiencyscore: exercise_users[i].score === undefined ? "--" : exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score,
finalscore: "--",
user_id: exercise_users[i].user_id
user_id: exercise_users[i].user_id,
commit_method:exercise_users[i].commit_method
})
indexi++;
}
@ -2032,7 +2041,8 @@ class Studentshavecompletedthelist extends Component {
columnsys: arr,
subjective: response.data.exercise_types.subjective,
objective_score: response.data.exercise_types.objective_score,
subjective_score: response.data.exercise_types.subjective_score,
subjective_score: response.data.exercise_types.subjective_score
})
}

@ -47,3 +47,11 @@
white-space:nowrap;
cursor: default;
}
.maxnamewidth260 {
max-width: 260px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}

@ -24,25 +24,28 @@ class Bullsubdirectory extends Component{
Modalstopval:"是否确认删除?",
ModalCancel:"",
ModalSave:"",
index:0,
}
//不能显示数据编辑的时候没有赋值
//没加initialValue 输入不能赋值到from 上
}
componentDidMount() {
console.log("获取到数据");
console.log(this.props);
let{id,myname,mydescription} =this.props
let{id,myname,mydescription,index,item} =this.props
this.props.form.setFieldsValue({
id:id,
eduintits:myname,
description:mydescription,
eduintits:item.name,
description:item.description,
});
// this.contentMdRef.current.setValue(mydescription);
this.setState({
id:id,
eduintits:myname,
description:mydescription,
eduintits:item.name,
description:item.description,
index:index
})
if(myname!=undefined){
this.setState({
@ -108,10 +111,20 @@ class Bullsubdirectory extends Component{
}
bianji = (bians)=>{
bianji = (bians,i)=>{
console.log("bianji");
console.log(this.props.myname);
console.log(this.props.mydescription);
this.setState({
whethertoeditysl:bians,
})
eduintits:this.props.myname,
description:this.props.mydescription,
index:i
});
this.props.form.setFieldsValue({
eduintits:this.props.myname,
description:this.props.mydescription,
});
if(bians===true){
this.props.getyslbooltrue();
}else {
@ -143,6 +156,7 @@ class Bullsubdirectory extends Component{
handleSubmit=(e) => {
e.preventDefault();
this.props.form.validateFields((err, values) => {
debugger
if (!err) {
console.log(values.description);
if(values.eduintits === undefined|| values.eduintits === "" || values.eduintits ===null){
@ -180,11 +194,11 @@ class Bullsubdirectory extends Component{
if(result){
if(result.data){
if(result.data.status === 0){
this.props.form.setFieldsValue({
id:this.state.id,
eduintits:titname,
description:values.description,
});
// this.props.form.setFieldsValue({
// id:this.state.id,
// eduintits:titname,
// description:values.description,
// });
this.setState({
whethertoeditysl:false,
id:this.state.id,
@ -266,111 +280,118 @@ class Bullsubdirectory extends Component{
render(){
let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state;
let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl,index} =this.state;
let{myname,mydescription,id}=this.props;
const {getFieldDecorator} = this.props.form;
// console.log("Bullsubdirectory");
// console.log(this.props.isAdmin());
// console.log(this.props);
console.log(this.props);
console.log(whethertoeditysl);
console.log(this.state.eduintits);
console.log(this.state.description);
return(
<React.Fragment >
<div >
{this.state.Modalstype&&this.state.Modalstype===true?<Modals
modalsType={this.state.Modalstype}
modalsTopval={this.state.Modalstopval}
modalCancel={this.state.ModalCancel}
modalSave={this.state.ModalSave}
/>:""}
<Spin size="large" spinning={isSpinysl} >
<div className="edu-back-white ">
{
whethertoeditysl === false?
<div>
<div className="fudonyingxiangysls">
<div className="fudonyingxiangysl">
<div style={{marginRight:"60px"}}>
<span className="ysltitbt">{myname}</span>
</div>
<div>
<React.Fragment key={this.props.index} id={this.props.id}>
<div key={this.props.index} id={this.props.id}>
{this.state.Modalstype&&this.state.Modalstype===true?<Modals
modalsType={this.state.Modalstype}
modalsTopval={this.state.Modalstopval}
modalCancel={this.state.ModalCancel}
modalSave={this.state.ModalSave}
/>:""}
<Spin size="large" spinning={isSpinysl} >
<div className="edu-back-white " id={
index
}>
{
whethertoeditysl === false?
<div id={this.props.index}>
<div className="fudonyingxiangysls">
<div className="fudonyingxiangysl">
<div style={{marginRight:"60px"}}>
<span className="ysltitbt">{myname}</span>
</div>
<div>
<span className="fr yslbianji" style={{marginRight:"17px"}}>
{
this.props.isAdmin() === true ?
(this.props.yslbool===false?
<Tooltip placement="bottom" title={<div>
编辑
</div>}>
<i className="iconfont icon-bianji1 newbianji1" onClick={()=>this.bianji(true)}></i>
</Tooltip>
<Tooltip placement="bottom" title={<div>
编辑
</div>}>
<i className="iconfont icon-bianji1 newbianji1" onClick={()=>this.bianji(true,this.props.index)}></i>
</Tooltip>
:
""
)
:""
}
</span>
<span className="fr yslbianji" style={{marginRight:"22px"}}>
<span className="fr yslbianji" style={{marginRight:"22px"}}>
{
this.props.isAdmin() === true ?
(this.props.yslbool===false?
<Tooltip placement="bottom" title={<div>
删除
</div>}>
<i className="iconfont icon-shanchu newbianji1" style={{ color: "#4CACFF"}} onClick={()=>this.setModeltrue(true)}></i>
</Tooltip>
<Tooltip placement="bottom" title={<div>
删除
</div>}>
<i className="iconfont icon-shanchu newbianji1" style={{ color: "#4CACFF"}} onClick={()=>this.setModeltrue(true)}></i>
</Tooltip>
:
""
)
:""
}
</span>
{
this.props.length - 1 === this.props.index ? "" :
this.props.isAdmin() === true ?
(this.props.yslbool === false ?
<a className="fr yslbianji mr30"
style={{
lineHeight: "31px",
}}
onClick={() => this.Movedown(this.props.id)}
><Tooltip
title="下移"><i
style={{color: "#4CACFF"}}
className=" font-18 iconfont icon-xiangxiayi"></i></Tooltip></a>
:
""
)
: ""
}
{
this.props.index === 0 ? "" :
this.props.isAdmin() === true ?
(this.props.yslbool === false ?
<a className="fr yslbianji mr30"
style={{
lineHeight: "31px",
}}
onClick={() => this.Moveupward(this.props.id)}
><Tooltip
title="上移"><i
style={{color: "#4CACFF"}}
className=" font-18 iconfont icon-xiangshangyi"></i></Tooltip></a>
:
""
)
: ""
}
</div>
<div className="yslclear"></div>
</div>
<div id="MakedownHTML"className="markdown-body fonttext yslmtopcg yslminHeigth markdownysltext" dangerouslySetInnerHTML={{__html: markdownToHTML(mydescription).replace(/▁/g, "▁▁▁")}}/>
{
this.props.length - 1 === this.props.index ? "" :
this.props.isAdmin() === true ?
(this.props.yslbool === false ?
<a className="fr yslbianji mr30"
style={{
lineHeight: "31px",
}}
onClick={() => this.Movedown(this.props.id)}
><Tooltip
title="下移"><i
style={{color: "#4CACFF"}}
className=" font-18 iconfont icon-xiangxiayi"></i></Tooltip></a>
:
""
)
: ""
}
{
this.props.index === 0 ? "" :
this.props.isAdmin() === true ?
(this.props.yslbool === false ?
<a className="fr yslbianji mr30"
style={{
lineHeight: "31px",
}}
onClick={() => this.Moveupward(this.props.id)}
><Tooltip
title="上移"><i
style={{color: "#4CACFF"}}
className=" font-18 iconfont icon-xiangshangyi"></i></Tooltip></a>
:
""
)
: ""
}
</div>
{parseInt(this.props&&this.props.informs.length)===parseInt(this.props&&this.props.index+1)?"":<div className="bor-bottom-greyE mr25 ml25"></div>}
<div className="yslclear"></div>
</div>
:
<div className="edu-back-white ">
<Form layout='vertical' onSubmit={this.handleSubmit} >
<style>
{
`.ant-form-item{
<div id="MakedownHTML"className="markdown-body fonttext yslmtopcg yslminHeigth markdownysltext" dangerouslySetInnerHTML={{__html: markdownToHTML(mydescription).replace(/▁/g, "▁▁▁")}}/>
</div>
{parseInt(this.props&&this.props.informs.length)===parseInt(this.props&&this.props.index+1)?"":<div className="bor-bottom-greyE mr25 ml25"></div>}
</div>
:
whethertoeditysl === true?
<div className="edu-back-white " key={this.props.index} id={this.props.id}>
<Form layout='vertical' onSubmit={this.handleSubmit} key={this.props.index}>
<style>
{
`.ant-form-item{
margin-bottom:0px !important;
}
.chooseDestwo .ant-form-item{
@ -385,49 +406,50 @@ class Bullsubdirectory extends Component{
}
`
}
</style>
<Form.Item
style={{"borderBottom":'none'}}
className="chooseDestwo "
>
{getFieldDecorator('eduintits',{ initialValue: this.state.eduintits }, {
rules: [{
required: true, message: '请在此输入标题,最多60个字符',
}],
})(
<div className="ysleduinwh">
<div className="yslduinlefts">
<span className="yslduincolorred">*</span>
</div>
<div className="yslduinleft">
<style>{
`
}
</style>
<Form.Item
style={{"borderBottom":'none'}}
className="chooseDestwo "
key={this.props.index}
>
{getFieldDecorator('eduintits', { initialValue: eduintits}, {
rules: [{
required: true, message: '请在此输入标题,最多60个字符',
}],
})(
<div className="ysleduinwh">
<div className="yslduinlefts">
<span className="yslduincolorred">*</span>
</div>
<div className="yslduinleft">
<style>{
`
.ant-input{
border-right: none !important;
height: 40px !important;
}
`
}</style>
<Input placeholder="请在此输入标题最多60个字符" maxLength="60"
style={{ textAlign: "left",width:"100%",}}
onInput={this.changeTopicName}
autoComplete="off"
addonAfter={String(addonAfter)+"/60"}
value={eduintits}
className="searchViewAfter"></Input>
</div>
}</style>
<Input placeholder="请在此输入标题最多60个字符" key={this.props.index} maxLength="60"
style={{ textAlign: "left",width:"100%",}}
onInput={this.changeTopicName}
autoComplete="off"
addonAfter={String(addonAfter)+"/60"}
value={eduintits}
className="searchViewAfter"></Input>
</div>
)}
</Form.Item>
</div>
)}
</Form.Item>
<div className="edu-back-white ">
<div className={"yslmt16px"}>
<style>
{
`
<div className="edu-back-white " key={this.props.index}>
<div className={"yslmt16px"}>
<style>
{
`
.ant-form-item-children {
position: unset;
}
@ -473,46 +495,52 @@ class Bullsubdirectory extends Component{
margin-bottom: 24px !important;
}
`
}
</style>
<Form.Item
style={{"borderBottom":'none'}}
className="chooseDes "
>
{getFieldDecorator('description', { initialValue: this.state.description },{
rules: [{
required: true, message: '请在此输入内容,最多5000个字符',
}, {
len: 5000, message: '最大限制为5000个字符',
}],
})(
<TPMMDEditor ref={this.messageRef}
placeholder={'请在此输入内容,最多5000个字符'}
initValue={description}
mdID={'courseMessageMD'}
className="courseMessageMD "
height={518}
></TPMMDEditor>
)}
</Form.Item>
</div>
</div>
}
</style>
<Form.Item
style={{"borderBottom":'none'}}
className="chooseDes "
key={this.props.index}
>
{getFieldDecorator('description', { initialValue: description},{
rules: [{
required: true, message: '请在此输入内容,最多5000个字符',
}, {
len: 5000, message: '最大限制为5000个字符',
}],
})(
<TPMMDEditor ref={this.messageRef}
key={this.props.index}
placeholder={'请在此输入内容,最多5000个字符'}
initValue={description}
mdID={'courseMessageMD'}
className="courseMessageMD "
height={518}
></TPMMDEditor>
)}
</Form.Item>
<Form.Item>
<div className="clearfix mt28 fr pb50 mr25">
<a className="defalutCancelbtn fl mr20 " onClick={()=>this.bianji(false)}>取消</a>
<Button htmlType="submit" className="ant-btn defalutSubmitbtn fl ant-btn-primary">
<span> </span></Button>
</div>
</Form.Item>
</Form>
<div className="bor-bottom-greyE mr25 ml25"></div>
</div>
}
</div>
</Spin>
</div>
</div>
</div>
<Form.Item>
<div className="clearfix mt28 fr pb50 mr25">
<a className="defalutCancelbtn fl mr20 " onClick={()=>this.bianji(false,this.props.index)}>取消</a>
<Button htmlType="submit" className="ant-btn defalutSubmitbtn fl ant-btn-primary">
<span> </span></Button>
</div>
</Form.Item>
</Form>
<div className="bor-bottom-greyE mr25 ml25"></div>
</div>
:""
}
</div>
</Spin>
</div>
</React.Fragment>
)
}

@ -497,6 +497,7 @@ class Eduinforms extends Component{
<Bullsubdirectory {...this.state} {...this.props} key={index} index={index}
length={informs.length} yslbool={yslbool} id={item.id}
myname={item.name} mydescription={item.description}
item={item}
getyslbooltrue={()=>this.getyslbooltrue()}
getyslboolfalse={()=>this.getyslboolfalse()}
getinputdata={()=>this.getinputdata()} ></Bullsubdirectory>

@ -246,13 +246,13 @@ class PollDetailTabFirst extends Component{
dataIndex: 'No',
key: 'No',
className:"edu-txt-center",
width:110
width:120
}, {
title: '姓名',
dataIndex: 'name',
key: 'name',
className:"edu-txt-center",
width:160
width:170
}, {
title: '学号',
dataIndex: 'StudentNo',
@ -269,11 +269,11 @@ class PollDetailTabFirst extends Component{
title: '分班',
key: 'classes',
dataIndex: 'classes',
width:160,
width:220,
className:poll_types && poll_types.groups_count > 0 ? "edu-txt-center":"edu-txt-center none",
render:(classes,item,index)=>{
return(
item.classes ? <span>{item.classes}</span> : <span className="color-grey-9">--</span>
item.classes ? <span style={{maxWidth:'208px',display:"block"}} title={item.classes} className="task-hide">{item.classes}</span> : <span className="color-grey-9">--</span>
)
}
}, {
@ -281,7 +281,7 @@ class PollDetailTabFirst extends Component{
dataIndex: 'status',
key: 'status',
className:"edu-txt-center",
width:160,
width:170,
render:(status,item,index)=>{
return(
item.status == 1 ?<span className='color-green'>按时提交</span>:<span></span>
@ -292,7 +292,7 @@ class PollDetailTabFirst extends Component{
dataIndex: 'time',
key: 'time',
className:"edu-txt-center",
width:160,
width:170,
sorter: true,
defaultSortOrder: 'descend',
sortDirections: sortDirections,
@ -395,7 +395,7 @@ class PollDetailTabFirst extends Component{
{/* </div>*/}
{/*}*/}
</div>}
<div className="edu-table edu-back-white minH-560">
<div className="edu-table edu-back-white minH-560 pollResultList">
{
data && data.length > 0 ? <Table columns={columns} dataSource={data} pagination={false}
onChange={this.table1handleChange}></Table> : <NoneData></NoneData>

@ -64,7 +64,7 @@ class PollDetailTabSecond extends Component{
let {page, limit, questions, questionsInfo , isSpin} = this.state;
return(
<Spin size="large" spinning={ isSpin }>
<div>
<React.Fragment>
{
questions && questions.length>0 && questions.map((item,key)=>{
return(
@ -179,7 +179,7 @@ class PollDetailTabSecond extends Component{
})
}
{
questions && questions.length == 0 && <NoneData></NoneData>
questions && questions.length == 0 && <div className="edu-back-white"><NoneData></NoneData></div>
}
{
questionsInfo && questionsInfo.q_counts > limit &&
@ -189,7 +189,7 @@ class PollDetailTabSecond extends Component{
</div>
}
</div>
</React.Fragment>
</Spin>
)
}

@ -1,6 +1,7 @@
import React,{ Component } from "react";
import {Checkbox,Radio} from "antd";
import NoneData from "../coursesPublic/NoneData"
import '../css/members.css'
import '../css/busyWork.css'
@ -26,31 +27,34 @@ class PollDetailTabThirdInfo extends Component{
pollDetail !== pollDetail.poll.polls_description &&
<p style={{whiteSpace:"pre-wrap"}} className="color-grey-3 padding20-30">{ pollDetail.poll.polls_description }</p>
}
<p className="padding20-30 clearfix edu-txt-left" style={{background:"#fafafa"}}>
{ !pollDetail || !pollDetail.question_types || pollDetail.question_types.q_counts===0 ? "" :
<span className="color-grey-3">
{
pollDetail && pollDetail.question_types && pollDetail.question_types.q_counts > 0 &&
<span>合计{pollDetail.question_types && pollDetail.question_types.q_counts}</span>
}
{
pollDetail && pollDetail.question_types.q_singles > 0 &&
<span className="mr15 color-grey-9">单选题{pollDetail.question_types.q_singles}</span>
}
{
pollDetail && pollDetail.question_types.q_doubles > 0 &&
<span className="mr15 color-grey-9">多选题{pollDetail.question_types.q_doubles}</span>
}
{
pollDetail && pollDetail.question_types.q_mains > 0 &&
<span className="color-grey-9">主观题{pollDetail.question_types.q_mains}</span>
}
</span>
}
</p>
{
pollDetail && pollDetail.questions && pollDetail.questions.length > 0 &&
<p className="padding20-30 clearfix edu-txt-left" style={{background:"#fafafa"}}>
{ !pollDetail || !pollDetail.question_types || pollDetail.question_types.q_counts===0 ? "" :
<span className="color-grey-3">
{
pollDetail && pollDetail.question_types && pollDetail.question_types.q_counts > 0 &&
<span>合计{pollDetail.question_types && pollDetail.question_types.q_counts}</span>
}
{
pollDetail && pollDetail.question_types.q_singles > 0 &&
<span className="mr15 color-grey-9">单选题{pollDetail.question_types.q_singles}</span>
}
{
pollDetail && pollDetail.question_types.q_doubles > 0 &&
<span className="mr15 color-grey-9">多选题{pollDetail.question_types.q_doubles}</span>
}
{
pollDetail && pollDetail.question_types.q_mains > 0 &&
<span className="color-grey-9">主观题{pollDetail.question_types.q_mains}</span>
}
</span>
}
</p>
}
{
pollDetail && pollDetail.questions && pollDetail.questions.map((item,key)=>{
pollDetail && pollDetail.questions && pollDetail.questions.length > 0 && pollDetail.questions.map((item,key)=>{
return(
<div className="previewList">
<p className="pl30 pr30 pt30 pb15 font-16 clearfix">
@ -120,6 +124,10 @@ class PollDetailTabThirdInfo extends Component{
)
})
}
{
pollDetail && pollDetail.questions && pollDetail.questions.length == 0 && <NoneData></NoneData>
}
</div>
: ""
}

@ -338,7 +338,9 @@ textarea:read-only{
border:1px solid #FF0000;
border-radius: 5px;
}
.pollResultList .ant-table-thead > tr > th,.pollResultList .ant-table-tbody > tr > td{
padding:15px 6px;
}
/* 试卷 */
.setScoreInput{
width: 60px!important;height: 30px!important;box-sizing: border-box;

@ -1174,7 +1174,7 @@ class Listofworksstudentone extends Component {
<div>{record.late_penalty === "--" ? <span>迟交扣分0</span> :
<span>迟交扣分{record.late_penalty}</span>}</div>
{record.view_answer_count===null?"":answer_open_evaluation===true?"":<div>查看参考答案{record.view_answer_count}</div>}
{answer_open_evaluation===true?"":<div>查看参考答案{record.view_answer_count}</div>}
<div>{record.finalscore === "--" ? <span>最终成绩0</span> :
<span>最终成绩{record.finalscore}</span>}</div>
@ -1511,7 +1511,7 @@ class Listofworksstudentone extends Component {
<div>{record.late_penalty === "--" ? <span>迟交扣分0</span> :
<span>迟交扣分{record.late_penalty}</span>}</div>
{record.view_answer_count===null?"":answer_open_evaluation===true?"":<div>查看参考答案{record.view_answer_count}</div>}
{answer_open_evaluation===true?"":<div>查看参考答案{record.view_answer_count}</div>}
<div>{record.finalscore === "--" ? <span>最终成绩0</span> :
<span>最终成绩{record.finalscore}</span>}</div>

@ -112,13 +112,30 @@ class ShixunsHome extends Component {
}
const MyRate = ({ defaultValue, ...rest }) => {
let myValue = defaultValue;
// console.log(myValue-Math.floor(myValue))
// if (myValue < Math.ceil(myValue)) {
// myValue = Math.floor(myValue) + 0.5;
// }
return <Rating {...rest} value={myValue} />;
};
let shixuntype=false;
let pathstype=false;
if(this.props&&this.props.mygetHelmetapi!=null){
let shixun="/shixuns";
let paths="/paths";
this.props.mygetHelmetapi.navbar.map((item,key)=>{
var reg = RegExp(item.link);
if(shixun.match(reg)){
if(item.hidden===true){
shixuntype=true
}
}
if(paths.match(reg)){
if(item.hidden===true){
pathstype=true
}
}
})
}
return (
<div className="newMain clearfix backFAFAFA shixunsHome">
{this.state.updata===undefined?"":<UpgradeModals
@ -162,7 +179,7 @@ class ShixunsHome extends Component {
))}
</Slider>
}
<div className="user_navlist">
{this.props.user&&this.props.user.main_site===true?<div className="user_navlist">
<div className="user_navlist_black">
<ul className="black_nav_list">
{homedatalist === undefined ? "" :homedatalistreps.map((item,key)=>{
@ -212,13 +229,13 @@ class ShixunsHome extends Component {
}
</ul>
</div>
</div>
</div>:""}
</div>
</div>
{/*实训路径*/}
<div className="clearfix pt20 educontent pr pb20">
{pathstype===true?"":<div className="clearfix pt20 educontent pr pb20">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>实践课程</p>
<p className="color-grey-cd font-12">TRAINING COURSE</p>
@ -294,10 +311,10 @@ class ShixunsHome extends Component {
}
</div>
</div>
</div>}
{/*精选实训 改为 开发社区*/}
<div className="clearfix pt20 educontent pr pb20">
{shixuntype===true?"":<div className="clearfix pt20 educontent pr pb20">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>实训项目</p>
<p className="color-grey-cd font-12">DEVELOPMENT COMMUNITY</p>
@ -389,13 +406,13 @@ class ShixunsHome extends Component {
</div>
</div>
</div>}
{/*导师排行榜*/}
{/*导师排行榜*/}
{ homedatalist !== undefined && homedatalist.teachers !== undefined && (
<div className="pt60 pb60 mb30 mentor-ranking">
this.props.user&&this.props.user.main_site===true?<div className="pt60 pb60 mb30 mentor-ranking">
<div className="educontent">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>导师排行榜</p>
@ -470,12 +487,12 @@ class ShixunsHome extends Component {
</div>
</div>
</div>:""
)}
{/*程序员排行榜*/}
{ homedatalist !== undefined && homedatalist.students !== undefined && (
<div className="pt60 pb60 mb30 pro-ranking">
this.props.user&&this.props.user.main_site===true?<div className="pt60 pb60 mb30 pro-ranking">
<div className="educontent">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>程序员排行榜</p>
@ -546,7 +563,7 @@ class ShixunsHome extends Component {
</ul>
</div>
</div>
</div>
</div>:""
)}
</div>
</Spin>

@ -19,33 +19,35 @@ class CaseItem extends Component{
{
libraries && libraries.map((item,key)=>{
return(
<li className="library_list_item">
<img alt={item.id} className="mr15 mt3 radius4" height="90" src={getUrl(`${item.cover_url || "/images/educoder/library-default-cover.png"}`)} width="120" />
<div className="flex1">
<p className="clearfix mb25 lineh-40">
<a href={`/moop_cases/${item.id}`} className="task-hide font-22 library_l_name">{item.title}</a>
<span className="fl mt10"><Tags tags={item.tags}></Tags></span>
</p>
<p className="clearfix lineh-20">
<span className="color-grey-3 mr10">{item.author_name}</span>
<span className="color-grey-3 mr20">{item.author_school_name}</span>
<span className="color-grey-c fr">
{
item.visited_count && item.visited_count != 0 ?
<span className="color-grey-c ml20"><span className=" item-group-icon mr5"><i className="fa fa-eye"></i></span>{item.visited_count} </span>:""
}
{
item.praise_count && item.praise_count != 0 ?
<span className="color-grey-c ml20"><span className=" item-group-icon mr5"><i className="fa fa-thumbs-o-up"></i></span>{item.praise_count} </span>:""
}
{
item.download_count && item.download_count != 0 ?
<span className="color-grey-c ml20" style={{"marginRight":'1px'}}><span className=" item-group-icon mr5"><i className="fa fa-download"></i></span>{item.download_count} </span>:""
}
</span>
</p>
</div>
</li>
<a href={`/moop_cases/${item.id}`} target="_blank">
<li className="library_list_item pointer">
<img alt={item.id} className="mr15 mt3 radius4" height="90" src={getUrl(`${item.cover_url || "/images/educoder/library-default-cover.png"}`)} width="120" />
<div className="flex1">
<p className="clearfix mb25 lineh-40">
<a className="task-hide font-22 library_l_name">{item.title}</a>
<span className="fl mt10"><Tags tags={item.tags}></Tags></span>
</p>
<p className="clearfix lineh-20">
<span className="color-grey-3 mr10">{item.author_name}</span>
<span className="color-grey-3 mr20">{item.author_school_name}</span>
<span className="color-grey-c fr">
{
item.visited_count && item.visited_count != 0 ?
<span className="color-grey-c ml20"><span className=" item-group-icon mr5"><i className="fa fa-eye"></i></span>{item.visited_count} </span>:""
}
{
item.praise_count && item.praise_count != 0 ?
<span className="color-grey-c ml20"><span className=" item-group-icon mr5"><i className="fa fa-thumbs-o-up"></i></span>{item.praise_count} </span>:""
}
{
item.download_count && item.download_count != 0 ?
<span className="color-grey-c ml20" style={{"marginRight":'1px'}}><span className=" item-group-icon mr5"><i className="fa fa-download"></i></span>{item.download_count} </span>:""
}
</span>
</p>
</div>
</li>
</a>
)
})
}

@ -77,7 +77,7 @@
}
.Breadcrumbfont{
color:#4CACFF;
color:#4CACFF !important;
}
.ant-breadcrumb-separator{

@ -20,6 +20,8 @@ class Osshackathon extends Component {
hackathonedit:false,
Osshackathonmodeltype:false,
spinning:false,
opentitletype:true,
boxoffsetHeigh:0
}
}
@ -53,6 +55,7 @@ class Osshackathon extends Component {
spinning:true
})
})
}
@ -66,9 +69,16 @@ class Osshackathon extends Component {
}
componentDidUpdate = (prevProps) => {
componentDidUpdate = (prevProps,prevState) => {
if(prevState.data!=this.state.data){
//防止陷入无限循环
let box=document.getElementById("Osshackathonfontlists");
if(box){
this.setState({
boxoffsetHeigh:box.offsetHeight
})
}
}
}
PaginationTask=(pageNumber)=>{
@ -218,9 +228,14 @@ class Osshackathon extends Component {
search:e.target.value
})
}
render() {
let {page,data,hackathonedit}=this.state;
opentitle=()=>{
this.setState({
opentitletype:false
})
}
render() {
let {page,data,hackathonedit,opentitletype}=this.state;
return (
<div className="newMain clearfix newMainybot">
@ -288,11 +303,23 @@ class Osshackathon extends Component {
{hackathonedit===true?"":<Divider />}
{hackathonedit===true?"":<p className={"Osshackathonfontlist mb30"}>
{opentitletype===true?<style>
{
`
.Osshackathonfontlist{
max-height: 180px;
overflow: hidden;
}
`
}
</style>:""}
{hackathonedit===true?"":<p className={"Osshackathonfontlist mb30"} id={"Osshackathonfontlists"}>
{data&&data.hackathon.description===null?"":<div className={"markdown-body"}
dangerouslySetInnerHTML={{__html: markdownToHTML(data&&data.hackathon.description).replace(/▁/g, "▁▁▁")}}></div>}
</p>}
{opentitletype===true&&this.state.boxoffsetHeigh===180?<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont"}>展开阅读全文<Icon type="down" /></Divider>:""}
{hackathonedit===true?<Osshackathonmd
getosshackathon={()=>this.getosshackathonlist()}
hidehackathonedit={()=>this.hidehackathonedit()}
@ -305,7 +332,7 @@ class Osshackathon extends Component {
{...this.props}
{...this.state}
/>:""}
{this.props.user&&this.props.user.admin===true?<Row className={"mb20"}>
{this.props.user&&this.props.user.admin===true?<Row className={"mb20 mt30"}>
<Col span={8}></Col>
<Col span={8}><Button type="primary" className={"OsshackprimaryButton OsshackprimaryButtonsyle"} onClick={()=>this.editSignupentry()}><Icon type="plus" />新建项目</Button></Col>
<Col span={8}></Col>

@ -305,7 +305,8 @@ class LeftViewContainer extends Component {
id: item.answer_id,
name: item.answer_name,
score: item.answer_score,
contents: item.answer_contents
contents: item.answer_contents,
view_time: item.view_time
}
})
newAnswers.forEach((item, index) => {
@ -558,7 +559,7 @@ class LeftViewContainer extends Component {
// /shixuns/mnf6b7z3/shixun_discuss?challenge_id=88
render() {
const { challenge } = this.props
const { tabIndex } = this.state;
const { tabIndex } = this.state;
return (
<React.Fragment>
<ImageLayer {...this.state} onImageLayerClose={this.onImageLayerClose}></ImageLayer>

@ -875,8 +875,33 @@ submittojoinclass=(value)=>{
// console.log("NewHeadergetHelmetapi432423423423");
// console.log(mygetHelmetapi2);
// console.log("NewHeadermygetHelmetapi123123123123");
// console.log(mygetHelmetapi2);
// console.log(this.props);
let shixuntype=false;
let pathstype=false;
let coursestypes=false;
if(this.props&&this.props.mygetHelmetapi!=null){
let shixun="/shixuns";
let paths="/paths";
let courses="/courses";
this.props.mygetHelmetapi.navbar.map((item,key)=>{
var reg = RegExp(item.link);
if(shixun.match(reg)){
if(item.hidden===true){
shixuntype=true
}
}
if(paths.match(reg)){
if(item.hidden===true){
pathstype=true
}
}
if(courses.match(reg)){
if(item.hidden===true){
coursestypes=true
}
}
})
}
return (
<div className="newHeaders" id="nHeader" >
@ -1244,12 +1269,12 @@ submittojoinclass=(value)=>{
{/*href="https://www.educoder.net/login"*/}
<div className="fr head-right">
{/*{ loadHeader()}*/}
{showSearchOpentype===true?"":<a id="search-open" className="fl mr30 headIcon" onClick={(e)=>this.showSearchOpen(e)}>
{showSearchOpentype===true?"":this.props.user&&this.props.user.main_site===true?<a id="search-open" className="fl mr30 headIcon" onClick={(e)=>this.showSearchOpen(e)}>
{/*"/images/educoder/icon/search.svg"
<img src={getImageUrl(`images/educoder/icon/search.svg`)} /> */}
<i className="iconfont icon-sousuo color-white"></i>
</a>}
</a>:""}
{/*</div>*/}
<div className="fl mr30 edu-menu-panel headIcon">
@ -1260,18 +1285,18 @@ submittojoinclass=(value)=>{
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div>
<ul className="fl with50 edu-txt-center pr ul-leftline">
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>新建翻转课堂</a></li>}
<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===true?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>新建翻转课堂</a></li>}
{shixuntype===true?"":<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>}
{this.props.Headertop===undefined?"":
<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>
pathstype===true?"":<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>
}
<li><a onClick={(url)=>this.getUser("/projects/new","projects")} target="_blank">新建开发项目</a></li>
</ul>
<ul className="fl with50 edu-txt-center">
<li>
{coursestypes===true?"":<li>
<a onClick={this.tojoinclass}>加入翻转课堂</a>
</li>
</li>}
{Addcoursestypes===true?<Addcourses
Addcoursestype={Addcoursestypes}

@ -216,5 +216,6 @@ body>.-task-title {
.logoimg{
float: left;
width: 40px;
min-width: 40px;
height:40px;
}

@ -118,7 +118,7 @@ class TPMRightSection extends Component {
}
<div className="padding20 edu-back-white mb10 mt10" style={{
{this.props.user&&this.props.user.main_site===true?<div className="padding20 edu-back-white mb10 mt10" style={{
display: TPMRightSectionData === undefined?"none":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.length === 0 ? "none" : "block"
}}>
<p className="mb20 font-16 clearfix">所属课程</p>
@ -159,10 +159,10 @@ class TPMRightSection extends Component {
})
}
</div>
</div>
</div>:""}
{TPMRightSectionData === undefined?"":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.length === 0 ? "" :
<div className="padding20 edu-back-white"
this.props.user&&this.props.user.main_site===true?<div className="padding20 edu-back-white"
style={{
display:
TPMRightSectionData === undefined?"none":TPMRightSectionData.recommands===undefined?"none":TPMRightSectionData.recommands.length === 0 ? "none" : "block"
@ -191,8 +191,8 @@ class TPMRightSection extends Component {
})
}
</div>
</div> }
</div>:""
}
</div>
}
</div>

@ -34,7 +34,33 @@ class InfosBanner extends Component{
// console.log(is_current)
// console.log(current_user)
// console.log(current_user.is_teacher)
// console.log(current_user.admin)
let shixuntype=false;
let pathstype=false;
let coursestypes=false;
if(this.props&&this.props.mygetHelmetapi!=null){
let shixun="/shixuns";
let paths="/paths";
let courses="/courses";
this.props.mygetHelmetapi.navbar.map((item,key)=>{
var reg = RegExp(item.link);
if(shixun.match(reg)){
if(item.hidden===true){
shixuntype=true
}
}
if(paths.match(reg)){
if(item.hidden===true){
pathstype=true
}
}
if(courses.match(reg)){
if(item.hidden===true){
coursestypes=true
}
}
})
}
return(
<div className="bannerPanel mb60">
<div className="educontent">
@ -91,21 +117,21 @@ class InfosBanner extends Component{
</div>
</div>
<div className="userNav">
<li className={`${moduleName == 'courses' ||moduleName == undefined ? 'active' : '' }`}>
{coursestypes===true?"":<li className={`${moduleName == 'courses' ||moduleName == undefined ? 'active' : '' }`}>
<Link
onClick={() => this.setState({moduleName: 'courses'})}
to={`/users/${username}/courses`}>翻转课堂</Link>
</li>
<li className={`${moduleName == 'shixuns' ? 'active' : '' }`}>
</li>}
{shixuntype===true?"":<li className={`${moduleName == 'shixuns' ? 'active' : '' }`}>
<Link
onClick={() => this.setState({moduleName: 'shixuns'})}
to={`/users/${username}/shixuns`}>实训项目</Link>
</li>
<li className={`${moduleName == 'paths' ? 'active' : '' }`}>
</li>}
{pathstype===true?"":<li className={`${moduleName == 'paths' ? 'active' : '' }`}>
<Link
onClick={() => this.setState({moduleName: 'paths'})}
to={`/users/${username}/paths`}>实践课程</Link>
</li>
</li>}
<li className={`${moduleName == 'projects' ? 'active' : '' }`}>
<Link
onClick={() => this.setState({moduleName: 'projects'})}
@ -116,20 +142,20 @@ class InfosBanner extends Component{
{/* onClick={() => this.setState({moduleName: 'package'})}*/}
{/* to={`/users/${username}/package`}>众包</Link>*/}
{/*</li>*/}
{((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin)
{this.props.user&&this.props.user.main_site===true?((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin)
&& <li className={`${moduleName == 'videos' ? 'active' : '' }`}>
<Link
onClick={() => this.setState({moduleName: 'videos'})}
to={`/users/${username}/videos`}>视频</Link>
</li>}
</li>:""}
{/*自己的主页且不是学生显示题库按钮*/}
{(is_current && current_user&& current_user.is_teacher )
{this.props.user&&this.props.user.main_site===true?(is_current && current_user&& current_user.is_teacher )
&&<li className={`${moduleName == 'topics' ? 'active' : '' }`}>
<Link
onClick={() => this.setState({moduleName: 'topics'})}
to={`/users/${username}/topics/personal`}>题库</Link>
</li>}
</li>:""}
</div>
</div>

Loading…
Cancel
Save