Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_local_cqdsj
SylorHuang 5 years ago
commit c94ef06a66

@ -144,7 +144,8 @@ $(document).on('turbolinks:load', function(){
var html='<div class="row mt-2 align-items-center linkFormItem">\n' + var html='<div class="row mt-2 align-items-center linkFormItem">\n' +
' <div class="col-1 text-right">\n' + ' <div class="col-1 text-right">\n' +
' <label class="checkbox checkbox-primary mt-1">\n' + ' <label class="checkbox checkbox-primary mt-1">\n' +
' <input type="checkbox" name="navbar[][hidden]" value="0" class="font-16" checked="checked">\n' + ' <input type="checkbox" name="navbar[][hidden]" value="0" hidden class="font-16" checked="checked">\n' +
' <input type="checkbox" value="0" class="font-16 module_hidden" checked="checked">\n' +
' </label>\n' + ' </label>\n' +
' </div>\n' + ' </div>\n' +
' <div class="col-md-label mt-1"><input type="hidden" value="md" name="navbar[][module_type]">\n' + ' <div class="col-md-label mt-1"><input type="hidden" value="md" name="navbar[][module_type]">\n' +
@ -203,6 +204,15 @@ $(document).on('turbolinks:load', function(){
$(this).parents(".requireForm_item").remove(); $(this).parents(".requireForm_item").remove();
}); });
$('.nav-setting-form').on('click', '.module_hidden', function(){
var checkEle = $(this);
if (checkEle.is(':checked')) {
checkEle.prev().val(0);
} else {
checkEle.prev().val(1);
}
});
$('.competition-staff-settings').on('click', '.mutiple-limited-radio', function(){ $('.competition-staff-settings').on('click', '.mutiple-limited-radio', function(){
var radio = $(this); var radio = $(this);
if (radio.is(':checked')) { if (radio.is(':checked')) {

@ -80,6 +80,21 @@ $(document).on('turbolinks:load', function(){
}) })
}); });
// reset user login times
$('.users-list-container').on('click', '.reset-login-times-action', function(){
var $action = $(this);
var userId = $action.data('id');
$.ajax({
url: '/admins/users/' + userId + '/reset_login_times',
method: 'POST',
dataType: 'json',
success: function() {
showSuccessNotify();
}
});
});
// ***************** reward grade modal ***************** // ***************** reward grade modal *****************
var $rewardGradeModal = $('.admin-users-reward-grade-modal'); var $rewardGradeModal = $('.admin-users-reward-grade-modal');
var $form = $rewardGradeModal.find('form.admin-users-reward-grade-form'); var $form = $rewardGradeModal.find('form.admin-users-reward-grade-form');

@ -52,6 +52,12 @@ class Admins::UsersController < Admins::BaseController
render_ok(grade: user.grade) render_ok(grade: user.grade)
end end
def reset_login_times
User.find(params[:id]).reset_login_times!
render_ok
end
private private
def update_params def update_params

@ -78,7 +78,7 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController
end end
render_ok render_ok
rescue Competitions::CreatePersonalTeamService::Error => ex rescue ApplicationService::Error => ex
render_error(ex.message) render_error(ex.message)
end end

@ -31,7 +31,7 @@ class Competitions::CompetitionsController < Competitions::BaseController
def show def show
@competition = current_competition @competition = current_competition
current_competition.increment(:visits) current_competition.increment!(:visits)
end end
def update def update
@ -44,6 +44,8 @@ class Competitions::CompetitionsController < Competitions::BaseController
@competition = current_competition @competition = current_competition
@competition_modules = @competition.unhidden_competition_modules @competition_modules = @competition.unhidden_competition_modules
@user = current_user @user = current_user
current_competition.increment!(:visits)
end end
def informs def informs
@ -176,7 +178,7 @@ class Competitions::CompetitionsController < Competitions::BaseController
if personal if personal
row_cells_column << record_user.real_name row_cells_column << record_user.real_name
row_cells_column << record_user.school_name row_cells_column << record_user.school_name
row_cells_column << record_user.student_id row_cells_column << record_user.student_id.present? ? (record_user.student_id.to_s + "\t") : "--"
else else
row_cells_column << record.name row_cells_column << record.name
row_cells_column << record.teachers_name row_cells_column << record.teachers_name

@ -440,6 +440,7 @@ class HomeworkCommonsController < ApplicationController
@user = current_user @user = current_user
@work = @homework.user_work(current_user.id) if @user_course_identity == Course::STUDENT @work = @homework.user_work(current_user.id) if @user_course_identity == Course::STUDENT
@course_groups = @course.course_groups.where(id: @course.charge_group_ids(@user)) @course_groups = @course.course_groups.where(id: @course.charge_group_ids(@user))
@shixun = @homework.shixuns.take if @homework.homework_type == "practice"
end end
def update_settings def update_settings

@ -11,6 +11,6 @@ class Users::AuthenticationAppliesController < Users::BaseAccountController
private private
def create_params def create_params
params.permit(:name, :id_number, :upload_image) params.permit(:name, :gender, :id_number, :upload_image)
end end
end end

@ -38,8 +38,10 @@ module CompetitionsHelper
def chart_stages competition def chart_stages competition
stages = [] stages = []
statistic_stages = competition.competition_stages.where("score_rate > 0") statistic_stages = competition.competition_stages.where("score_rate > 0")
if competition.max_stage_end_time && competition.max_stage_end_time < Time.now && statistic_stages.size > 1
stages << {id: nil, name: "总排行榜", rate: 1.0, start_time: competition.start_time, end_time: competition.end_time} end_time = competition.max_stage_end_time || competition.end_time
if end_time && end_time < Time.now
stages << {id: nil, name: statistic_stages.size > 1 ? "总排行榜" : "排行榜", rate: 1.0, start_time: competition.start_time, end_time: competition.end_time}
end end
statistic_stages.each do |stage| statistic_stages.each do |stage|

@ -44,7 +44,7 @@ module ExportHelper
w_2 = w_user&.login.present? ? w_user&.login : "--" w_2 = w_user&.login.present? ? w_user&.login : "--"
w_3 = w_user&.real_name.present? ? w_user&.real_name : "--" w_3 = w_user&.real_name.present? ? w_user&.real_name : "--"
w_3_1 = w_user&.mail.present? ? w_user.mail : "--" w_3_1 = w_user&.mail.present? ? w_user.mail : "--"
w_4 = w_user.student_id.present? ? w_user.student_id : "--" w_4 = w_user.student_id.present? ? (w_user.student_id.to_s + "\t") : "--"
else else
w_2 = "--" w_2 = "--"
w_3 = "--" w_3 = "--"
@ -132,7 +132,7 @@ module ExportHelper
w_2 = w_user&.login.present? ? w_user&.login : "--" w_2 = w_user&.login.present? ? w_user&.login : "--"
w_3 = w_user&.real_name.present? ? w_user&.real_name : "--" w_3 = w_user&.real_name.present? ? w_user&.real_name : "--"
w_3_1 = w_user&.mail.present? ? w_user.mail : "--" w_3_1 = w_user&.mail.present? ? w_user.mail : "--"
w_4 = w_user.student_id.present? ? w_user.student_id : "--" w_4 = w_user.student_id.present? ? (w_user.student_id.to_s + "\t") : "--"
course_name = course.students.find_by(user_id: w.user_id).try(:course_group_name) course_name = course.students.find_by(user_id: w.user_id).try(:course_group_name)
w_5 = course_name.present? ? course_name : "--" w_5 = course_name.present? ? course_name : "--"
#0 未提交, 1 按时提交, 2 延迟提交 #0 未提交, 1 按时提交, 2 延迟提交
@ -217,7 +217,7 @@ module ExportHelper
w_2 = w_user&.login.present? ? w_user&.login : "--" w_2 = w_user&.login.present? ? w_user&.login : "--"
w_3 = w_user&.real_name.present? ? w_user&.real_name : "--" w_3 = w_user&.real_name.present? ? w_user&.real_name : "--"
w_3_1 = w_user&.mail.present? ? w_user.mail : "--" w_3_1 = w_user&.mail.present? ? w_user.mail : "--"
w_4 = w_user.student_id.present? ? w_user.student_id : "--" w_4 = w_user.student_id.present? ? (w_user.student_id.to_s + "\t") : "--"
w_5 = work.class_grouping_name w_5 = work.class_grouping_name
if task_type_boolean #是否分组 if task_type_boolean #是否分组
w_6 = work.grouping_name w_6 = work.grouping_name
@ -311,7 +311,7 @@ module ExportHelper
end end
user_start_time = e_user.start_at.present? ? e_user.start_at.strftime('%Y-%m-%d %H:%M') : "--" user_start_time = e_user.start_at.present? ? e_user.start_at.strftime('%Y-%m-%d %H:%M') : "--"
user_end_time = e_user.end_at.present? ? e_user.end_at.strftime('%Y-%m-%d %H:%M') : "--" user_end_time = e_user.end_at.present? ? e_user.end_at.strftime('%Y-%m-%d %H:%M') : "--"
user_student_id = user_info.student_id.present? ? user_info.student_id : "--" user_student_id = user_info.student_id.present? ? (user_info.student_id.to_s + "\t") : "--"
user_login = user_info&.login.present? ? user_info.login : "--" user_login = user_info&.login.present? ? user_info.login : "--"
user_real_name = user_info.real_name.present? ? user_info.real_name : "--" user_real_name = user_info.real_name.present? ? user_info.real_name : "--"
user_mail = user_info&.mail.present? ? user_info.mail : "--" user_mail = user_info&.mail.present? ? user_info.mail : "--"
@ -373,7 +373,7 @@ module ExportHelper
w_2 = user&.login.present? ? user&.login : "--" w_2 = user&.login.present? ? user&.login : "--"
w_3 = user&.real_name.present? ? user&.real_name : "--" w_3 = user&.real_name.present? ? user&.real_name : "--"
w_3_1 = user&.mail.present? ? user.mail : "--" w_3_1 = user&.mail.present? ? user.mail : "--"
w_4 = user.student_id.present? ? user.student_id : "--" w_4 = user.student_id.present? ? (user.student_id.to_s + "\t") : "--"
w_5 = student&.course_group_name.present? ? student.course_group_name : "--" w_5 = student&.course_group_name.present? ? student.course_group_name : "--"
w_6 = topic.present? ? topic.name : "--" w_6 = topic.present? ? topic.name : "--"
w_7 = topic.present? ? topic.teacher.full_name : "--" w_7 = topic.present? ? topic.teacher.full_name : "--"

@ -32,6 +32,7 @@ class LimitForbidControl::Base
# 锁定 # 锁定
if value >= allow_times.to_i if value >= allow_times.to_i
Rails.logger.info("[LimitForbidControl] Lock #{cache_key}")
Rails.cache.write(forbid_cache_key, true, expires_in: forbid_expires) Rails.cache.write(forbid_cache_key, true, expires_in: forbid_expires)
Rails.cache.delete(cache_key) Rails.cache.delete(cache_key)
else else
@ -40,6 +41,7 @@ class LimitForbidControl::Base
end end
def clear def clear
Rails.logger.info("[LimitForbidControl] Clear #{cache_key}")
Rails.cache.delete(forbid_cache_key) Rails.cache.delete(forbid_cache_key)
Rails.cache.delete(cache_key) Rails.cache.delete(cache_key)
end end

@ -46,7 +46,16 @@ class Challenge < ApplicationRecord
#self.challenge_chooses.pluck(:score).sum #self.challenge_chooses.pluck(:score).sum
end end
# 关卡总分 def challenge_difficulty
case difficulty
when 1 then "简单"
when 2 then "中等"
when 3 then "困难"
else ''
end
end
# 关卡总分
def all_score def all_score
self.score self.score
# if self.st == 1 # if self.st == 1

@ -47,6 +47,10 @@ class Competition < ApplicationRecord
sponsor_schools.map{|sponsor| sponsor.school.name} sponsor_schools.map{|sponsor| sponsor.school.name}
end end
def region_schools_name
region_schools.map{|region| region.school.name}
end
def competition_status def competition_status
if !status if !status
com_status = "nearly_published" com_status = "nearly_published"

@ -660,6 +660,10 @@ class User < ApplicationRecord
end end
end end
def reset_login_times!
LimitForbidControl::UserLogin.new(self).clear
end
protected protected
def validate_password_length def validate_password_length
# 管理员的初始密码是5位 # 管理员的初始密码是5位

@ -46,12 +46,12 @@ class Admins::UserStatisticQuery < ApplicationQuery
finish_challenge = finish_challenge.where(updated_at: time_range) finish_challenge = finish_challenge.where(updated_at: time_range)
end end
study_myshixun_map = study_myshixun.group(:user_id).count study_myshixun_map = study_myshixun.reorder(nil).group(:user_id).count
finish_myshixun_map = finish_myshixun.group(:user_id).count finish_myshixun_map = finish_myshixun.reorder(nil).group(:user_id).count
study_challenge_map = study_challenge.group(:user_id).count study_challenge_map = study_challenge.reorder(nil).group(:user_id).count
finish_challenge_map = finish_challenge.group(:user_id).count finish_challenge_map = finish_challenge.reorder(nil).group(:user_id).count
evaluate_count_map = study_challenge.group(:user_id).sum(:evaluate_count) evaluate_count_map = study_challenge.reorder(nil).group(:user_id).sum(:evaluate_count)
cost_time_map = study_challenge.group(:user_id).sum(:cost_time) cost_time_map = study_challenge.reorder(nil).group(:user_id).sum(:cost_time)
users.each do |user| users.each do |user|
user._extra_data = { user._extra_data = {

@ -21,7 +21,7 @@ class Admins::CompetitionNavSettingService < ApplicationService
else else
com_module = CompetitionModule.create!(competition_id: competition.id, module_type: 'md') com_module = CompetitionModule.create!(competition_id: competition.id, module_type: 'md')
end end
com_module.update_attributes!(hidden: nav["hidden"] ? 0 : 1, position: nav["position"] ? nav["position"] : com_module.position, name: nav["name"], url: nav["url"]) com_module.update_attributes!(hidden: nav["hidden"] && nav["hidden"].to_i == 0 ? 0 : 1, position: nav["position"] ? nav["position"] : params[:navbar].length, name: nav["name"], url: nav["url"])
end end
delete_module_ids = old_module_ids - module_ids delete_module_ids = old_module_ids - module_ids

@ -1,5 +1,4 @@
class Competitions::CreatePersonalTeamService < ApplicationService class Competitions::CreatePersonalTeamService < ApplicationService
Error = Class.new(StandardError)
attr_reader :competition, :user attr_reader :competition, :user

@ -11,6 +11,8 @@ class Competitions::SaveTeamService < ApplicationService
end end
def call def call
raise Error, '本竞赛只面向部分学校/单位开放,你暂时没有参赛资格' unless competition.open?(creator)
Competitions::SaveTeamForm.new(form_params).validate! Competitions::SaveTeamForm.new(form_params).validate!
new_record = team.new_record? new_record = team.new_record?

@ -22,6 +22,8 @@ class Users::ApplyAuthenticationService < ApplicationService
user.authentication = false user.authentication = false
user.save! user.save!
user.user_extension.update!(gender: params[:gender].to_i) if params[:gender].present?
user.apply_user_authentication.create!(auth_type: 1, status: 0) user.apply_user_authentication.create!(auth_type: 1, status: 0)
move_image_file! unless params[:upload_image].to_s == 'false' move_image_file! unless params[:upload_image].to_s == 'false'

@ -1,7 +1,7 @@
class Users::CourseService class Users::CourseService
include CustomSortable include CustomSortable
sort_columns :updated_at, default_by: :updated_at, default_direction: :desc sort_columns :created_at, :updated_at, default_by: :updated_at, default_direction: :desc
attr_reader :user, :params attr_reader :user, :params
@ -15,7 +15,7 @@ class Users::CourseService
courses = status_filter(courses) courses = status_filter(courses)
custom_sort(courses, :updated_at, params[:sort_direction]) custom_sort(courses, params[:sort_by], params[:sort_direction])
end end
private private

@ -1,7 +1,7 @@
class Users::ProjectService class Users::ProjectService
include CustomSortable include CustomSortable
sort_columns :updated_on, default_by: :updated_on, default_direction: :desc sort_columns :created_on, :updated_on, default_by: :updated_on, default_direction: :desc
attr_reader :user, :params attr_reader :user, :params
@ -21,7 +21,7 @@ class Users::ProjectService
projects = category_filter(projects) projects = category_filter(projects)
projects = status_filter(projects) projects = status_filter(projects)
custom_sort(projects, :updated_on, params[:sort_direction]) custom_sort(projects, params[:sort_by], params[:sort_direction])
end end
private private

@ -77,6 +77,10 @@ class Users::ShixunService
sort_by = sort_by&.downcase sort_by = sort_by&.downcase
sort_direction = sort_direction&.downcase sort_direction = sort_direction&.downcase
if sort_by.blank? || !%w(updated_at created_at).include?(sort_by)
sort_by = 'updated_at'
end
if sort_direction.blank? || !%w(desc asc).include?(sort_direction) if sort_direction.blank? || !%w(desc asc).include?(sort_direction)
sort_direction = 'desc' sort_direction = 'desc'
end end
@ -87,11 +91,11 @@ class Users::ShixunService
case params[:category] case params[:category]
when 'study' then when 'study' then
relations.order("myshixuns.updated_at #{sort_direction}") relations.order("myshixuns.#{sort_by} #{sort_direction}")
when 'manage' then when 'manage' then
relations.order("shixuns.updated_at #{sort_direction}") relations.order("shixuns.#{sort_by} #{sort_direction}")
else else
relations.order("shixuns.created_at #{sort_direction}") relations.order("shixuns.#{sort_by} #{sort_direction}")
end end
end end
end end

@ -1,7 +1,7 @@
class Users::SubjectService class Users::SubjectService
include CustomSortable include CustomSortable
sort_columns :updated_at, default_by: :updated_at, default_direction: :desc sort_columns :created_at, :updated_at, default_by: :updated_at, default_direction: :desc
attr_reader :user, :params attr_reader :user, :params
@ -14,7 +14,7 @@ class Users::SubjectService
subjects = category_scope_subjects subjects = category_scope_subjects
subjects = user_policy_filter(subjects) subjects = user_policy_filter(subjects)
custom_sort(subjects.distinct, :updated_at, params[:sort_direction]) custom_sort(subjects.distinct, params[:sort_by], params[:sort_direction])
end end
private private

@ -45,12 +45,14 @@ class ExercisePublishTask
Rails.logger.info("log--------------------------------exercise_end start") Rails.logger.info("log--------------------------------exercise_end start")
puts "--------------------------------exercise_end start" puts "--------------------------------exercise_end start"
# 1。统一设置的试卷 # 1。统一设置的试卷
exercises = Exercise.includes(:exercise_users,:exercise_questions).where("exercise_status = 2 AND unified_setting = true AND end_time <= ?",Time.now + 900) exercises = Exercise.includes(:exercise_users,:exercise_questions).where("exercise_status = 2 AND
unified_setting = true AND end_time <= ?",Time.now + 900)
exercises&.each do |exercise| exercises&.each do |exercise|
ex_type = exercise.exercise_questions.pluck(:question_type).uniq ex_type = exercise.exercise_questions.pluck(:question_type).uniq
exercise.update_column('exercise_status', 3) exercise.update_column('exercise_status', 3)
exercise.exercise_users&.each do |exercise_user| exercise.exercise_users&.each do |exercise_user|
begin begin
Rails.logger.info("true: user_id:#{exercise_user.user_id}--commit_status:#{exercise_user.commit_status}")
if (exercise_user&.commit_status == 0) && (exercise_user&.start_at.present?) if (exercise_user&.commit_status == 0) && (exercise_user&.start_at.present?)
s_score = calculate_student_score(exercise, exercise_user.user)[:total_score] s_score = calculate_student_score(exercise, exercise_user.user)[:total_score]
if ex_type.include?(4) #是否包含主观题 if ex_type.include?(4) #是否包含主观题
@ -60,6 +62,9 @@ class ExercisePublishTask
end end
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
total_score = s_score + total_score_subjective_score total_score = s_score + total_score_subjective_score
Rails.logger.info("true: user_id:#{exercise_user.user_id}--subjective_score:#{subjective_score}")
Rails.logger.info("true: user_id:#{exercise_user.user_id}--s_score:#{s_score}")
Rails.logger.info("true: user_id:#{exercise_user.user_id}--commit_method:#{exercise_user.commit_method}")
commit_option = { commit_option = {
:status => 1, :status => 1,
:commit_status => 1, :commit_status => 1,
@ -94,6 +99,7 @@ class ExercisePublishTask
exercise_users = exercise.exercise_users.where(:user_id => users.pluck(:user_id)) exercise_users = exercise.exercise_users.where(:user_id => users.pluck(:user_id))
exercise_users&.each do |exercise_user| exercise_users&.each do |exercise_user|
begin begin
Rails.logger.info("false: user_id:#{exercise_user.user_id}--commit_status:#{exercise_user.commit_status}")
if exercise_user.commit_status == 0 && !exercise_user.start_at.nil? if exercise_user.commit_status == 0 && !exercise_user.start_at.nil?
if ex_types.include?(4) #是否包含主观题 if ex_types.include?(4) #是否包含主观题
subjective_score = exercise_user.subjective_score subjective_score = exercise_user.subjective_score
@ -103,6 +109,9 @@ class ExercisePublishTask
s_score = calculate_student_score(exercise, exercise_user.user)[:total_score] s_score = calculate_student_score(exercise, exercise_user.user)[:total_score]
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
total_score = s_score + total_score_subjective_score total_score = s_score + total_score_subjective_score
Rails.logger.info("false: user_id:#{exercise_user.user_id}--s_score:#{s_score}")
Rails.logger.info("false: user_id:#{exercise_user.user_id}--subjective_score:#{subjective_score}")
Rails.logger.info("false: user_id:#{exercise_user.user_id}--commit_method:#{exercise_user.commit_method}")
commit_option = { commit_option = {
:status => 1, :status => 1,
:commit_status => 1, :commit_status => 1,

@ -189,7 +189,8 @@
<div class="row mt-2"> <div class="row mt-2">
<div class="col-1 text-right"> <div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1"> <label class="checkbox checkbox-primary mt-1">
<%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %> <input type="checkbox" name="navbar[][hidden]" value="<%= com_module.hidden ? 1 : 0 %>" hidden class="font-16" checked="checked">
<%= check_box_tag('', 0, !com_module.hidden, id: nil, class: 'font-16 module_hidden') %>
</label> </label>
</div> </div>
<div class="col-md-8 color-blue mt-1"> <div class="col-md-8 color-blue mt-1">
@ -259,7 +260,8 @@
<div class="row mt-2 new_module_div linkFormItem"> <div class="row mt-2 new_module_div linkFormItem">
<div class="col-1 text-right"> <div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1"> <label class="checkbox checkbox-primary mt-1">
<%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %> <input type="checkbox" name="navbar[][hidden]" value="<%= com_module.hidden ? 1 : 0 %>" hidden class="font-16" checked="checked">
<%= check_box_tag('', 0, !com_module.hidden, id: nil, class: 'font-16 module_hidden') %>
</label> </label>
</div> </div>
<div class="col-md-label mt-2"> <div class="col-md-label mt-2">
@ -282,7 +284,8 @@
<div class="row mt-2 align-items-center linkFormItem"> <div class="row mt-2 align-items-center linkFormItem">
<div class="col-1 text-right"> <div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1"> <label class="checkbox checkbox-primary mt-1">
<%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %> <input type="checkbox" name="navbar[][hidden]" value="<%= com_module.hidden ? 1 : 0 %>" hidden class="font-16" checked="checked">
<%= check_box_tag('', 0, !com_module.hidden, id: nil, class: 'font-16 module_hidden') %>
</label> </label>
</div> </div>
<div class="col-md-label mt-1"> <div class="col-md-label mt-1">
@ -325,7 +328,7 @@
</div> </div>
<% if @competition.mode == 1 %> <%# if @competition.mode == 1 %>
<div class="card mb-5 competition-chart-stages"> <div class="card mb-5 competition-chart-stages">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="card-header d-flex justify-content-between align-items-center">
<span>排行榜设置</span> <span>排行榜设置</span>
@ -493,4 +496,4 @@
</div> </div>
</div> </div>
<div style="margin-bottom: 8.5rem;"></div> <div style="margin-bottom: 8.5rem;"></div>
<% end %> <%# end %>

@ -2,15 +2,15 @@
<thead class="thead-light"> <thead class="thead-light">
<tr> <tr>
<th width="10%" class="text-left">真实姓名</th> <th width="10%" class="text-left">真实姓名</th>
<th width="16%">邮件地址</th> <th width="15%">邮件地址</th>
<th width="10%">手机号码</th> <th width="10%">手机号码</th>
<th width="14%">单位</th> <th width="14%">单位</th>
<th width="8%">角色</th> <th width="7%">角色</th>
<th width="10%"><%= sort_tag('创建于', name: 'created_on', path: admins_users_path) %></th> <th width="10%"><%= sort_tag('创建于', name: 'created_on', path: admins_users_path) %></th>
<th width="10%"><%= sort_tag('最后登录', name: 'last_login_on', path: admins_users_path) %></th> <th width="10%"><%= sort_tag('最后登录', name: 'last_login_on', path: admins_users_path) %></th>
<th width="6%"><%= sort_tag('经验值', name: 'experience', path: admins_users_path) %></th> <th width="6%"><%= sort_tag('经验值', name: 'experience', path: admins_users_path) %></th>
<th width="6%"><%= sort_tag('金币', name: 'grade', path: admins_users_path) %></th> <th width="6%"><%= sort_tag('金币', name: 'grade', path: admins_users_path) %></th>
<th width="12%">操作</th> <th width="14%">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -33,8 +33,6 @@
<td class="action-container"> <td class="action-container">
<%= link_to '编辑', edit_admins_user_path(user), class: 'action' %> <%= link_to '编辑', edit_admins_user_path(user), class: 'action' %>
<%= javascript_void_link('奖励', class: 'action reward-grade-action', data: { toggle: 'modal', target: '.admin-users-reward-grade-modal', id: user.id }) %>
<%= javascript_void_link '解锁', class: 'action unlock-action', data: { id: user.id }, style: user.locked? ? '' : 'display: none;' %> <%= javascript_void_link '解锁', class: 'action unlock-action', data: { id: user.id }, style: user.locked? ? '' : 'display: none;' %>
<% if user.registered? %> <% if user.registered? %>
@ -45,7 +43,14 @@
<%= javascript_void_link '加锁', class: 'action lock-action', data: { id: user.id }, style: user.locked? || user.registered? ? 'display: none;' : '' %> <%= javascript_void_link '加锁', class: 'action lock-action', data: { id: user.id }, style: user.locked? || user.registered? ? 'display: none;' : '' %>
<% end %> <% end %>
<%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'delete-user-action' %> <%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
<div class="dropdown-menu more-action-dropdown">
<%= javascript_void_link('奖励', class: 'dropdown-item reward-grade-action', data: { toggle: 'modal', target: '.admin-users-reward-grade-modal', id: user.id }) %>
<%= javascript_void_link '恢复禁密账号', class: 'dropdown-item reset-login-times-action', data: { id: user.id } %>
<%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'dropdown-item delete-user-action' %>
</div>
</td> </td>
</tr> </tr>
<% end %> <% end %>

@ -12,6 +12,8 @@ json.published @competition.published?
json.nearly_published @competition.published_at.present? json.nearly_published @competition.published_at.present?
json.competition_status @competition.competition_status json.competition_status @competition.competition_status
json.region_schools @competition.region_schools_name
json.avatar_url url_to_avatar(@competition) json.avatar_url url_to_avatar(@competition)
json.competition_modules @competition_modules do |com_module| json.competition_modules @competition_modules do |com_module|

@ -24,4 +24,5 @@ json.course_identity @user_course_identity
json.excellent @course.excellent json.excellent @course.excellent
if @course.is_end == 0 if @course.is_end == 0
json.days_remaining (@course.end_date.to_date - Time.now.to_date).to_i json.days_remaining (@course.end_date.to_date - Time.now.to_date).to_i
end end
json.teacher_applies_count CourseMessage.unhandled_join_course_requests_by_course(@course).size if @user_course_identity < Course::ASSISTANT_PROFESSOR

@ -15,17 +15,19 @@ json.group_settings @course_groups do |group|
end end
if @homework.homework_type == "practice" if @homework.homework_type == "practice"
json.shixun_identifier @homework.shixuns.first.try(:identifier) json.shixun_identifier @shixun.try(:identifier)
json.task_pass @shixun&.task_pass
json.(@homework, :work_efficiency, :eff_score) json.(@homework, :work_efficiency, :eff_score)
json.(@homework.homework_detail_manual, :answer_open_evaluation, :shixun_evaluation) json.(@homework.homework_detail_manual, :answer_open_evaluation, :shixun_evaluation)
total_exp = 0 total_exp = 0
json.challenge_settings @homework.shixuns.first.try(:challenges).each do |challenge| json.challenge_settings @shixun.try(:challenges).each do |challenge|
json.challenge_id challenge.id json.challenge_id challenge.id
json.challenge_name challenge.subject json.challenge_name challenge.subject
json.checked challenge_setting(@homework, challenge.id).present? json.checked challenge_setting(@homework, challenge.id).present?
json.challenge_score challenge_setting(@homework, challenge.id).try(:score).to_f json.challenge_score challenge_setting(@homework, challenge.id).try(:score).to_f
json.challenge_exp challenge.score json.challenge_exp challenge.score
json.difficulty challenge.challenge_difficulty
total_exp += challenge.score total_exp += challenge.score
end end

@ -906,6 +906,7 @@ Rails.application.routes.draw do
post :lock post :lock
post :unlock post :unlock
post :active post :active
post :reset_login_times
end end
end end
resource :import_users, only: [:create] resource :import_users, only: [:create]

@ -1,14 +1,5 @@
class MigrateCompetitionChartRules < ActiveRecord::Migration[5.2] class MigrateCompetitionChartRules < ActiveRecord::Migration[5.2]
def change def change
add_column :competition_module_md_contents, :competition_stage_id, :integer, default: 0 add_column :competition_module_md_contents, :competition_stage_id, :integer, default: 0
ChartRule.all.each do |rule|
if rule.competition
com_module = rule.competition.competition_modules.find_by(module_type: "chart")
if com_module
CompetitionModuleMdContent.create!(content: rule.content, competition_module_id: com_module.id, competition_stage_id: rule.competition_stage_id ? rule.competition_stage_id : 0)
end
end
end
end end
end end

@ -0,0 +1,12 @@
class MigrateChartRule < ActiveRecord::Migration[5.2]
def change
ChartRule.all.each do |rule|
if rule.competition
com_module = rule.competition.competition_modules.find_by(module_type: "chart")
if com_module && !com_module.competition_module_md_contents.exists?(competition_stage_id: rule.competition_stage_id ? rule.competition_stage_id : 0)
CompetitionModuleMdContent.create!(content: rule.content, competition_module_id: com_module.id, competition_stage_id: rule.competition_stage_id ? rule.competition_stage_id : 0)
end
end
end
end
end

@ -0,0 +1,7 @@
class ReCounterCourseGroups < ActiveRecord::Migration[5.2]
def change
CourseGroup.find_each do |group|
CourseGroup.reset_counters(group.id, :course_members_count)
end
end
end

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -136192,7 +136192,8 @@ $(document).on('turbolinks:load', function(){
var html='<div class="row mt-2 align-items-center linkFormItem">\n' + var html='<div class="row mt-2 align-items-center linkFormItem">\n' +
' <div class="col-1 text-right">\n' + ' <div class="col-1 text-right">\n' +
' <label class="checkbox checkbox-primary mt-1">\n' + ' <label class="checkbox checkbox-primary mt-1">\n' +
' <input type="checkbox" name="navbar[][hidden]" value="0" class="font-16" checked="checked">\n' + ' <input type="checkbox" name="navbar[][hidden]" value="0" hidden class="font-16" checked="checked">\n' +
' <input type="checkbox" value="0" class="font-16 module_hidden" checked="checked">\n' +
' </label>\n' + ' </label>\n' +
' </div>\n' + ' </div>\n' +
' <div class="col-md-label mt-1"><input type="hidden" value="md" name="navbar[][module_type]">\n' + ' <div class="col-md-label mt-1"><input type="hidden" value="md" name="navbar[][module_type]">\n' +
@ -136251,6 +136252,15 @@ $(document).on('turbolinks:load', function(){
$(this).parents(".requireForm_item").remove(); $(this).parents(".requireForm_item").remove();
}); });
$('.nav-setting-form').on('click', '.module_hidden', function(){
var checkEle = $(this);
if (checkEle.is(':checked')) {
checkEle.prev().val(0);
} else {
checkEle.prev().val(1);
}
});
$('.competition-staff-settings').on('click', '.mutiple-limited-radio', function(){ $('.competition-staff-settings').on('click', '.mutiple-limited-radio', function(){
var radio = $(this); var radio = $(this);
if (radio.is(':checked')) { if (radio.is(':checked')) {
@ -138752,6 +138762,21 @@ $(document).on('turbolinks:load', function(){
}) })
}); });
// reset user login times
$('.users-list-container').on('click', '.reset-login-times-action', function(){
var $action = $(this);
var userId = $action.data('id');
$.ajax({
url: '/admins/users/' + userId + '/reset_login_times',
method: 'POST',
dataType: 'json',
success: function() {
showSuccessNotify();
}
});
});
// ***************** reward grade modal ***************** // ***************** reward grade modal *****************
var $rewardGradeModal = $('.admin-users-reward-grade-modal'); var $rewardGradeModal = $('.admin-users-reward-grade-modal');
var $form = $rewardGradeModal.find('form.admin-users-reward-grade-form'); var $form = $rewardGradeModal.find('form.admin-users-reward-grade-form');

File diff suppressed because one or more lines are too long

@ -150,16 +150,16 @@ export function initAxiosInterceptors(props) {
throw new axios.Cancel('Operation canceled by the user.'); throw new axios.Cancel('Operation canceled by the user.');
} else { } else {
// hash跳转 // hash跳转
var hash = window.location.hash; // var hash = window.location.hash;
if (hash) { // if (hash) {
hashTimeout && window.clearTimeout(hashTimeout) // hashTimeout && window.clearTimeout(hashTimeout)
hashTimeout = setTimeout(() => { // hashTimeout = setTimeout(() => {
var element = document.querySelector(hash); // var element = document.querySelector(hash);
if (element) { // if (element) {
element.scrollIntoView(); // element.scrollIntoView();
} // }
}, 400) // }, 400)
} // }
} }
// if(response.data.status === 401){ // if(response.data.status === 401){
// console.log("401401401") // console.log("401401401")

@ -68,7 +68,8 @@ class Registration extends React.Component {
mutiple_limited: false, mutiple_limited: false,
teamutiple_limited: false, teamutiple_limited: false,
members_count: 0, members_count: 0,
mode: 0 mode: 0,
region_schools: [],
} }
} }
@ -82,8 +83,8 @@ class Registration extends React.Component {
// //// //////console.log(this.props.isAdmin()) // //// //////console.log(this.props.isAdmin())
try { try {
const {keyword, page, per_page} = this.state; const {keyword, page, per_page} = this.state;
this.Getdata(keyword, page, per_page, this.props.user.admin); this.Getdata(keyword, page, per_page, this.props.user.admin);// 获取列表数据
this.GetenrollmentAPI(); this.GetenrollmentAPI();//获取我的报名配置
} catch (e) { } catch (e) {
// const {keyword, page, per_page} = this.state; // const {keyword, page, per_page} = this.state;
// this.Getdata(keyword, page, per_page, this.props.isAdmin()); // this.Getdata(keyword, page, per_page, this.props.isAdmin());
@ -104,6 +105,8 @@ class Registration extends React.Component {
this.Getdata(keyword, page, per_page, this.props.user.admin); this.Getdata(keyword, page, per_page, this.props.user.admin);
//取报名配置 //取报名配置
this.GetenrollmentAPI(); this.GetenrollmentAPI();
//取模式
this.Getdataheader();
} }
} }
@ -116,6 +119,7 @@ class Registration extends React.Component {
if (result.data) { if (result.data) {
this.setState({ this.setState({
mode: result.data.mode, mode: result.data.mode,
region_schools: result.data.region_schools
}) })
} }
@ -219,7 +223,7 @@ class Registration extends React.Component {
//管理员 //管理员
try { try {
this.setState({ this.setState({
type: result.data.competition_teams.length === 0 ? 1 : 4, type: 4,
count: result.data.count, count: result.data.count,
data: result.data.my_teams, data: result.data.my_teams,
competition_teams: result.data.competition_teams, competition_teams: result.data.competition_teams,
@ -454,6 +458,37 @@ class Registration extends React.Component {
return return
} }
let {region_schools} = this.state;
//判断是否是否是同一个学校数组元素为0就不用判断
try {
if (region_schools.length > 0) {
let i = 0;
for (var r = 0; r < region_schools.length; r++) {
if (region_schools[r] === this.props.user.user_school) {
// 终止循环
break;
}
i = i + 1;
}
if (i === region_schools.length) {
//如果i 等于region_schools.length说明本次循环中没有相同的学校本人不支持报名
try {
this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`);
} catch (e) {
}
this.Getdataheader();
return
}
}
} catch (e) {
}
if (this.props.user.is_teacher === true) { if (this.props.user.is_teacher === true) {
try { try {
@ -541,6 +576,34 @@ class Registration extends React.Component {
return return
} }
let {region_schools} = this.state;
//判断是否是否是同一个学校数组元素为0就不用判断
try {
if (region_schools.length > 0) {
let i = 0;
for (var r = 0; r < region_schools.length; r++) {
if (region_schools[r] === this.props.user.user_school) {
// 终止循环
break;
}
i = i + 1;
}
if (i === region_schools.length) {
//如果i 等于region_schools.length说明本次循环中没有相同的学校本人不支持报名
try {
this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`);
} catch (e) {
}
this.Getdataheader();
return
}
}
} catch (e) {
}
if (this.props.user.is_teacher === true) { if (this.props.user.is_teacher === true) {
@ -814,11 +877,11 @@ class Registration extends React.Component {
<div style={{marginBottom: '12px'}}> <div style={{marginBottom: '12px'}}>
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item><Link to={"/newcompetitions"}>在线竞赛</Link></Breadcrumb.Item> <Breadcrumb.Item><Link to={"/competitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item><Link <Breadcrumb.Item><Link
to={`/newcompetitions/${this.props.match.params.identifier}/common_header`}>{competition_name === undefined || competition_name === null || competition_name === "" ? "全国高校计算机大赛" : competition_name}</Link></Breadcrumb.Item> to={`/competitions/${this.props.match.params.identifier}/common_header`}>{competition_name === undefined || competition_name === null || competition_name === "" ? "全国高校计算机大赛" : competition_name}</Link></Breadcrumb.Item>
{/*<Breadcrumb.Item*/} {/*<Breadcrumb.Item*/}
{/* href={`/newcompetitions/${this.props.match.params.identifier}/common_header`}></Breadcrumb.Item>*/} {/* href={`/competitions/${this.props.match.params.identifier}/common_header`}></Breadcrumb.Item>*/}
<Breadcrumb.Item>报名</Breadcrumb.Item> <Breadcrumb.Item>报名</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
</div> </div>

@ -524,7 +524,7 @@ class PersonModal extends Component {
getdatacpersondiv1Items2 = (object) => { getdatacpersondiv1Items2 = (object) => {
// //
try { try {
if (this.props.GetenrollmentAPI.teacher_staff.mutiple_limited === true) { if (this.props.GetenrollmentAPI.member_staff.mutiple_limited === true) {
if (object.enrollable === false) { if (object.enrollable === false) {
myabool2 = false; myabool2 = false;
return return
@ -534,6 +534,7 @@ class PersonModal extends Component {
} catch (e) { } catch (e) {
myabool2 = true; myabool2 = true;
} }
myabool2 = true; myabool2 = true;
var datas = { var datas = {
enrollable: object.enrollable, enrollable: object.enrollable,

@ -304,7 +304,7 @@ class PersonalCompetititem extends React.Component {
> >
<div className="regitemimgs555"> <div className="regitemimgs555">
<a <a
href={`/newcompetitions/${this.props.match.params.identifier}/competition_teams/${item.id}`} href={`/competitions/${this.props.match.params.identifier}/competition_teams/${item.id}`}
style={{ style={{
color: "#459be5", color: "#459be5",
width: "100%", width: "100%",
@ -364,7 +364,7 @@ class PersonalCompetititem extends React.Component {
> >
<div className="regitemimgs555"> <div className="regitemimgs555">
<a <a
href={`/newcompetitions/${this.props.match.params.identifier}/competition_teams/${item.id}`} href={`/competitions/${this.props.match.params.identifier}/competition_teams/${item.id}`}
style={{ style={{
color: "#459be5", color: "#459be5",
width: "100%", width: "100%",

@ -124,7 +124,7 @@ class CompetitionsIndex extends Component{
size="large" size="large"
dataSource={datas&&datas} dataSource={datas&&datas}
renderItem={(item,key) => ( renderItem={(item,key) => (
<a href={item.competition_status==="ended"?`/newcompetitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null} <a target="_blank" href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"? className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"} this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}
> >
@ -181,8 +181,8 @@ class CompetitionsIndex extends Component{
<List.Item.Meta <List.Item.Meta
title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"? title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}> this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<a className={"competitionstitles"} <a target="_blank" className={"competitionstitles"}
href={item.competition_status==="ended"?`/newcompetitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null} href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
>{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a> >{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a>
{/*<span>{item.sub_title===null?"":*/} {/*<span>{item.sub_title===null?"":*/}
{/*<Tag className="competitionsrelative" color="#87d068">{item.sub_title}</Tag>}*/} {/*<Tag className="competitionsrelative" color="#87d068">{item.sub_title}</Tag>}*/}

@ -241,8 +241,8 @@ class Competitionteams extends Component{
<div className={"educontent clearfix mt20 "}> <div className={"educontent clearfix mt20 "}>
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item><Link to={"/newcompetitions"}>{data&&data.name}</Link></Breadcrumb.Item> <Breadcrumb.Item><Link to={"/competitions"}>{data&&data.name}</Link></Breadcrumb.Item>
<Breadcrumb.Item><Link to={`/newcompetitions/${this.props.match.params.identifier}/enroll`}>报名</Link></Breadcrumb.Item> <Breadcrumb.Item><Link to={`/competitions/${this.props.match.params.identifier}/enroll`}>报名</Link></Breadcrumb.Item>
<Breadcrumb.Item>战队详情</Breadcrumb.Item> <Breadcrumb.Item>战队详情</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>

@ -31,6 +31,9 @@ class CompetitionCommon extends Component{
window.document.title = '竞赛'; window.document.title = '竞赛';
if(this.props.match.params.identifier!=null){ if(this.props.match.params.identifier!=null){
this.getbannerdata(); this.getbannerdata();
// this.setState({
// thiskeys:this.props.location.search.replace('?menu=', '')
// })
// let url=`/competitions/${this.props.match.params.identifier}.json`; // let url=`/competitions/${this.props.match.params.identifier}.json`;
// axios.get(url).then((response) => { // axios.get(url).then((response) => {
// if(response.status===200){ // if(response.status===200){
@ -45,19 +48,34 @@ class CompetitionCommon extends Component{
} }
getbannerdata=()=>{ getbannerdata=()=>{
let menuid=this.props.location.search.replace('?menu=', '');
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`; let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response.status===200){ if(response.status===200){
this.setState({ this.setState({
data:response.data, data:response.data,
thiskeys:response.data.competition_modules[0].id thiskeys:menuid===undefined||menuid===""?response.data.competition_modules[0].id:menuid
}) })
this.getrightdata( if(menuid===undefined||menuid===""){
response.data.competition_modules[0].id, this.getrightdata(
response.data.competition_modules[0].module_type, response.data.competition_modules[0].id,
response.data.competition_modules[0].module_url, response.data.competition_modules[0].module_type,
response.data.competition_modules[0].has_url response.data.competition_modules[0].module_url,
) response.data.competition_modules[0].has_url
)
}else{
let newlist=response.data.competition_modules;
newlist.map((item,key)=>{
if(`${item.id}`===`${menuid}`){
this.getrightdata(
item.id,
item.module_type,
item.module_url,
item.has_url
)
}
})
}
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -83,6 +101,7 @@ class CompetitionCommon extends Component{
getrightdatas=(e)=>{ getrightdatas=(e)=>{
let keys=parseInt(e.key); let keys=parseInt(e.key);
this.getlistdata(keys) this.getlistdata(keys)
this.props.history.replace(`?menu=${keys}`);
} }
getlistdata=(keys,listkey)=>{ getlistdata=(keys,listkey)=>{
@ -109,7 +128,7 @@ class CompetitionCommon extends Component{
if(response.status===200){ if(response.status===200){
this.setState({ this.setState({
chart_rules:response.data, chart_rules:response.data,
tabkey:tabkey===undefined?response.data.stages[0].id===null?"0":`${response.data.stages[0].id}`:tabkey tabkey:tabkey===undefined?response.data.stages[0].id===null?"0":`${response.data.stages[0].id}`:tabkey
}) })
@ -121,8 +140,9 @@ class CompetitionCommon extends Component{
} }
getrightdata=(id,typeid,module_url,has_url,listkey)=>{ getrightdata=(id,typeid,module_url,has_url,listkey)=>{
// if(typeid==="enroll"){ // if(typeid==="enroll"){
// this.props.history.replace(`/newcompetitions/${this.props.match.params.identifier}/enroll`); // this.props.history.replace(`/competitions/${this.props.match.params.identifier}/enroll`);
// return // return
// } // }
@ -234,13 +254,13 @@ class CompetitionCommon extends Component{
} }
render() { render() {
let {data,has_url,module_type,Competitionedittype,mdContentdata}=this.state; let {data,thiskeys,Competitionedittype}=this.state;
return ( return (
data===undefined?"":<div className={"educontent clearfix mt20 "}> data===undefined?"":<div className={"educontent clearfix mt20 "}>
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item><Link to={"/newcompetitions"}>在线竞赛</Link></Breadcrumb.Item> <Breadcrumb.Item><Link to={"/competitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item>{data&&data.name}</Breadcrumb.Item> <Breadcrumb.Item>{data&&data.name}</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
@ -284,7 +304,7 @@ class CompetitionCommon extends Component{
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status==="nearly_published"?"--":data&&data.visits_count}</div> <div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status==="nearly_published"?"--":data&&data.visits_count}</div>
</Col> </Col>
<Col className="gutter-row rankbeicenter" span={6}> <Col className="gutter-row rankbeicenter" span={6}>
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516" onClick={data.competition_status==="nearly_published"?"":()=>this.gotocourse(`/newcompetitions/${this.props.match.params.identifier}/enroll`)}>{data.competition_status==="nearly_published"?"--":data&&data.member_count}</div> <div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516" onClick={data.competition_status==="nearly_published"?"":()=>this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}>{data.competition_status==="nearly_published"?"--":data&&data.member_count}</div>
</Col> </Col>
</Row> </Row>
</Col> </Col>
@ -317,7 +337,7 @@ class CompetitionCommon extends Component{
报名截止 报名截止
</Button>: </Button>:
data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}> data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}>
{data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/newcompetitions/${this.props.match.params.identifier}/enroll`)}></a>} {data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}></a>}
</Button>:""} </Button>:""}
</Col> </Col>
<Col className={"mt10 Competitionfontsize16"}>{data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`}</Col> <Col className={"mt10 Competitionfontsize16"}>{data&&data.enroll_end_time===null?"":`报名截止时间:${data&&data.enroll_end_time}`}</Col>
@ -327,7 +347,7 @@ class CompetitionCommon extends Component{
<Layout className={'teamsLayout mt40'}> <Layout className={'teamsLayout mt40'}>
<Sider> <Sider>
<Menu mode="inline" className="CompetitionMenu" defaultSelectedKeys={[`${this.state.thiskeys}`]} onClick={(e)=>this.getrightdatas(e)}> <Menu mode="inline" className="CompetitionMenu" selectedKeys={[`${this.state.thiskeys}`]} onClick={(e)=>this.getrightdatas(e)}>
{data&&data.competition_modules.map((item,key)=>{ {data&&data.competition_modules.map((item,key)=>{
if(item.module_type!="enroll"){ if(item.module_type!="enroll"){
return( return(

@ -9,20 +9,19 @@ class CompetitionContents extends Component{
constructor(props) { constructor(props) {
super(props) super(props)
this.state={ this.state={
hash:undefined
} }
} }
componentDidMount(){ componentDidMount(){
window.document.title = '竞赛'; window.document.title = '竞赛';
this.props.MdifHasAnchorJustScorll();
} }
render() { render() {
let{mdContentdata}=this.props; let{mdContentdata}=this.props;
// //mdhash滚动
this.props.MdifHasAnchorJustScorll();
return ( return (
<div className={"fr"}> <div className={"fr"}>

@ -30,6 +30,7 @@ class CompetitionContents extends Component{
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
this.props.MdifHasAnchorJustScorll();
} }
derivefun=(url)=>{ derivefun=(url)=>{
@ -65,6 +66,7 @@ class CompetitionContents extends Component{
}); });
} }
render() { render() {
this.props.MdifHasAnchorJustScorll();
const operations = <div> const operations = <div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button> <Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost> <Button className={"fr mr20"} type="primary" ghost>
@ -76,40 +78,40 @@ class CompetitionContents extends Component{
title: 'usersum', title: 'usersum',
dataIndex: 'usersum', dataIndex: 'usersum',
key: 'name', key: 'name',
render: text => <a className={"color-blue"}>{text}</a>, render: text => <span className={"color-blue"}>{text}</span>,
}, },
{ {
title: 'userimg', title: 'userimg',
dataIndex: 'userimg', dataIndex: 'userimg',
key: 'userimg', key: 'userimg',
render: (text, record) =>( render: (text, record) =>(
<a href={`/users/${record.user_login}`} className="color-dark"> <span href={`/users/${record.user_login}`} className="color-dark">
<img className={"Competitionuserimg"} src={getImageUrl(`images/${record.userimg===null?`avatars/User/0?1442652658`:record.userimg}`)}/> <img className={"Competitionuserimg"} src={getImageUrl(`images/${record.userimg===null?`avatars/User/0?1442652658`:record.userimg}`)}/>
</a>), </span>),
}, },
{ {
title: 'username', title: 'username',
dataIndex: 'username', dataIndex: 'username',
key: 'username', key: 'username',
render: text => <a title={text}>{text}</a>, render: text => <span title={text}>{text}</span>,
}, },
{ {
title: 'school', title: 'school',
dataIndex: 'school', dataIndex: 'school',
key: 'school', key: 'school',
render: text => <a title={text}>{text}</a>, render: text => <span title={text}>{text}</span>,
}, },
{ {
title: 'spendtime', title: 'spendtime',
dataIndex: 'spendtime', dataIndex: 'spendtime',
key: 'spendtime', key: 'spendtime',
render: text => <a>{text}</a>, render: text => <span>{text}</span>,
}, },
{ {
title: 'score', title: 'score',
dataIndex: 'score', dataIndex: 'score',
key: 'score', key: 'score',
render: text => <a className={"color-blue"}>{text}</a>, render: text => <span className={"color-blue"}>{text}</span>,
}, },
]; ];
@ -317,23 +319,27 @@ class CompetitionContents extends Component{
{ {
` `
.ant-table-tbody > tr > td:nth-last-child(4){ .ant-table-tbody > tr > td:nth-last-child(4){
line-height: 63px; // line-height: 63px;
width: 300px; // width: 300px;
height: 96px; // height: 96px;
display: inline-block; // // display: inline-flex;
overflow: hidden; // overflow: hidden;
text-overflow: ellipsis; // text-overflow: ellipsis;
white-space: nowrap; // white-space: nowrap;
width: 150px;
} }
.ant-table-tbody > tr > td:nth-last-child(3){ .ant-table-tbody > tr > td:nth-last-child(3){
line-height: 63px; // line-height: 63px;
width: 305px; // width: 290px;
height: 96px; // height: 96px;
display: inline-block; // display: inline-block;
overflow: hidden; // overflow: hidden;
text-overflow: ellipsis; // text-overflow: ellipsis;
white-space: nowrap; // white-space: nowrap;
} }
.ant-table-tbody>tr>td, .ant-table-thead>tr>th {
padding: 5px;
}
` `
} }
</style> </style>

@ -53,7 +53,7 @@ class Competitions extends Component {
<Switch> <Switch>
{/*新版竞赛战队详情*/} {/*新版竞赛战队详情*/}
<Route path="/newcompetitions/:identifier/competition_teams/:competition_team_id" <Route path="/competitions/:identifier/competition_teams/:competition_team_id"
render={ render={
(props) => (<CompetitionTeams {...this.props} {...props} {...this.state} />) (props) => (<CompetitionTeams {...this.props} {...props} {...this.state} />)
} }
@ -62,21 +62,21 @@ class Competitions extends Component {
{/*新版竞赛报名*/} {/*新版竞赛报名*/}
<Route <Route
path="/newcompetitions/:identifier/enroll" path="/competitions/:identifier/enroll"
render={ render={
(props) => (<Registration {...this.props} {...props} {...this.state}/>) (props) => (<Registration {...this.props} {...props} {...this.state}/>)
} }
/> />
{/*新版竞赛详情页面*/} {/*新版竞赛详情页面*/}
<Route path="/newcompetitions/:identifier/common_header" <Route path="/competitions/:identifier/common_header"
render={ render={
(props) => (<CompetitionCommon {...this.props} {...props} {...this.state} />) (props) => (<CompetitionCommon {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/*新版竞赛首页*/} {/*新版竞赛首页*/}
<Route path="/newcompetitions" <Route path="/competitions"
render={ render={
(props) => (<CompetitionsIndex {...this.props} {...props} {...this.state} />) (props) => (<CompetitionsIndex {...this.props} {...props} {...this.state} />)
} }

@ -477,8 +477,9 @@ class CoursesBanner extends Component {
render() { render() {
let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype,modalstrsvalue} = this.state; let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype,modalstrsvalue} = this.state;
const isCourseEnd = this.props.isCourseEnd()
document.title=coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":coursedata.name; const isCourseEnd = this.props.isCourseEnd();
document.title=coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":coursedata.name;
return ( return (
<div> <div>
{/*{*/} {/*{*/}
@ -705,18 +706,29 @@ class CoursesBanner extends Component {
`} `}
</style> </style>
<Breadcrumb separator="|" className={"mt5"}> <Breadcrumb separator="|" className={"mt5"}>
<Breadcrumb.Item onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")} className={"pointer"}>
<span className="color-grey-c font-16"><span className={"mr10"}>教师</span> <span className={"mr10"}>{coursedata.teacher_count}</span></span> <Breadcrumb.Item className={"pointer"}>
<Tooltip visible={coursedata.teacher_applies_count===undefined?false:coursedata.teacher_applies_count>0?true:false}
placement="topLeft"
title={<pre>{coursedata.teacher_applies_count===undefined?"":coursedata.teacher_applies_count>0?<span>您有{coursedata.teacher_applies_count}条新的加入申请<a className={"daishenp"} onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers?tab=2")}>待审批</a></span>:""}</pre>}>
<span className="color-grey-c font-16" onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}>
<span className={"mr10"}>教师</span>
<span className={"mr10"}>{coursedata.teacher_count}</span>
</span>
</Tooltip>
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item <Breadcrumb.Item
className={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?"pointer":"":"pointer"} className={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?"pointer":"":"pointer"}
onClick={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students"):"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")} onClick={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students"):"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")}
> >
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span> <span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span>
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item>{coursedata.credit===null?"": <Breadcrumb.Item>{coursedata.credit===null?"":
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学分</span> <span className={"mr10"}>{coursedata.credit}</span></span> <span className="color-grey-c font-16"><span className={"mr10 ml10"}>学分</span> <span className={"mr10"}>{coursedata.credit}</span></span>
}</Breadcrumb.Item> }</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
{/*<li className={"mt7 teachersbox"} >*/} {/*<li className={"mt7 teachersbox"} >*/}

@ -391,9 +391,8 @@ class OneSelfOrderModal extends Component{
{this.props.modaltype===undefined||this.props.modaltype===2 {this.props.modaltype===undefined||this.props.modaltype===2
|| this.props.usingCheckBeforePost ?"":<div className="clearfix edu-txt-center lineh-40 F4FAFF"> || this.props.usingCheckBeforePost ?"":<div className="clearfix edu-txt-center lineh-40 F4FAFF">
<li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}> <li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}>
<span style={{"float":"left","color":"#05101A"}} className="task-hide color-grey-name ml50">分班名称</span> <span style={{"float":"left","color":"#05101A"}} className="task-hide color-grey-name color-grey-9">分班名称</span>
<span style={{"float":"right","color":"#05101A","margin-right": "145px"}} className="task-hide color-grey-name color-grey-9">截止时间</span>
<span style={{"float":"right","color":"#05101A"}} className="task-hide color-grey-name mr70">截止时间</span>
</li> </li>
</div>} </div>}
{this.props.modaltype===undefined||this.props.modaltype===2 {this.props.modaltype===undefined||this.props.modaltype===2

@ -1744,4 +1744,9 @@ input.ant-input-number-input:focus {
line-height: 62px; line-height: 62px;
color: #fff; color: #fff;
margin: 0 auto; margin: 0 auto;
}
.daishenp{
color: #F79946 !important;
text-decoration: underline !important;
} }

@ -542,6 +542,7 @@ class Exercise extends Component{
{...this.props} {...this.props}
{...this.state} {...this.state}
style="grey" style="grey"
single={true}
checkBoxValues={this.state.checkBoxValues} checkBoxValues={this.state.checkBoxValues}
action={this.reloadList} action={this.reloadList}
></ImmediatelyEnd> ></ImmediatelyEnd>

@ -421,8 +421,8 @@ class Testpapersettinghomepage extends Component{
className={"btn fr color-blue font-16 mt20 mr20"} className={"btn fr color-blue font-16 mt20 mr20"}
checkBoxValues={[parseInt(this.props.match.params.Id)]} checkBoxValues={[parseInt(this.props.match.params.Id)]}
Exercisetype={"exercise"} Exercisetype={"exercise"}
// single={true}
action={this.Commonheadofthetestpaper} action={this.Commonheadofthetestpaper}
single={true}
></ImmediatelyEnd>:"":""} ></ImmediatelyEnd>:"":""}
{isAdmin === true?Commonheadofthetestpaper!==undefined&&Commonheadofthetestpaper.user_permission.exercise_unpublish_count>0? <ImmediatelyPublish {isAdmin === true?Commonheadofthetestpaper!==undefined&&Commonheadofthetestpaper.user_permission.exercise_unpublish_count>0? <ImmediatelyPublish
{...this.props} {...this.props}

@ -50,10 +50,14 @@ function CourseGroupChooserModal({ course_groups = [], isAdminOrCreator, item, i
application_id: record.application_id, application_id: record.application_id,
approval: approval, approval: approval,
group_id: arg_course_groups group_id: arg_course_groups
}) }).then((result) => {
props.showNotification(`${approval == 1? '同意' : '拒绝'}`) if (result.data.status === 0) {
fetchAll(1) props.showNotification(`${approval == 1? '同意' : '拒绝'}`)
modalEl.current.setVisible(false) fetchAll(1)
modalEl.current.setVisible(false)
window.location.reload();
}})
} }
return ( return (
<ModalWrapper <ModalWrapper

@ -258,7 +258,7 @@ class studentsList extends Component{
// approval 2 - 拒绝 // approval 2 - 拒绝
onAgree = (record, approval = 1) => { onAgree = (record, approval = 1) => {
const isAdminOrCreator = this.props.isAdminOrCreator() const isAdminOrCreator = this.props.isAdminOrCreator()
const { course_groups } = this.state const { course_groups ,filterKey} = this.state
if (approval == 1 && isAdminOrCreator && course_groups && course_groups.length) { if (approval == 1 && isAdminOrCreator && course_groups && course_groups.length) {
this.setState({ clickRecord: record}, () => { this.setState({ clickRecord: record}, () => {
this.setGroupChooserModalVisible(true) this.setGroupChooserModalVisible(true)
@ -280,7 +280,7 @@ class studentsList extends Component{
.then((response) => { .then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showNotification(`${approval == 1? '同意' : '拒绝'}`) this.props.showNotification(`${approval == 1? '同意' : '拒绝'}`)
this.fetchAll(1) this.fetchAll(1,filterKey)
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -299,7 +299,20 @@ class studentsList extends Component{
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
this.fetchAll(1); let newmenuid=this.props.location.search.replace('?tab=', '');
if(newmenuid===undefined||newmenuid===""||newmenuid==="1"||newmenuid===1){
this.setState({
filterKey:'1'
})
this.fetchAll(1,'1');
}else{
this.setState({
filterKey:'2'
})
this.fetchAll(1,'2');
}
const isAdminOrTeacher = this.props.isAdminOrTeacher() const isAdminOrTeacher = this.props.isAdminOrTeacher()
const isAdmin = this.props.isAdmin() const isAdmin = this.props.isAdmin()
@ -319,10 +332,11 @@ class studentsList extends Component{
this.getCourseGroups() this.getCourseGroups()
} }
addTeacherSuccessListener = (e, data) => { addTeacherSuccessListener = (e, data) => {
// const params = JSON.parse(data) // const params = JSON.parse(data)
// const coursesId = this.props.match.params.coursesId // const coursesId = this.props.match.params.coursesId
if (window.location.pathname.endsWith('teachers')) { if (window.location.pathname.endsWith('teachers')) {
this.fetchAll(1) this.fetchAll(1,this.state.filterKey)
} else { } else {
// this.props.history.push(`/courses/${coursesId}/teachers`) // this.props.history.push(`/courses/${coursesId}/teachers`)
} }
@ -382,9 +396,11 @@ class studentsList extends Component{
}); });
} }
onChangeRoleSuccess = () => { onChangeRoleSuccess = () => {
this.fetchAll() this.fetchAll(undefined,this.state.filterKey)
} }
fetchAll = async (argPage) => { fetchAll = async (argPage,filterKey) => {
let { searchValue }=this.state
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
@ -395,7 +411,7 @@ class studentsList extends Component{
const sortedInfo = this.state.sortedInfo; const sortedInfo = this.state.sortedInfo;
let page = argPage || this.state.page let page = argPage || this.state.page
let { searchValue, filterKey }=this.state
let order = 1; let order = 1;
if (sortedInfo.columnKey == 'role') { if (sortedInfo.columnKey == 'role') {
order = 1; order = 1;
@ -463,8 +479,8 @@ class studentsList extends Component{
// join_graduation_group // join_graduation_group
joinGraduationGroup = (graduation_group_id) => { joinGraduationGroup = (graduation_group_id) => {
const courseId = this.props.match.params.coursesId const courseId = this.props.match.params.coursesId
let { filterKey }=this.state
let url= `/courses/${courseId}/join_graduation_group.json`; let url= `/courses/${courseId}/join_graduation_group.json`;
axios.post(url, { axios.post(url, {
course_member_list: this.state.checkBoxValues.map (item => { return { course_member_id: item } }), course_member_list: this.state.checkBoxValues.map (item => { return { course_member_id: item } }),
@ -472,7 +488,7 @@ class studentsList extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.data.status==0){ if(result.data.status==0){
this.props.showNotification('操作成功。') this.props.showNotification('操作成功。')
this.fetchAll() this.fetchAll(undefined,filterKey)
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
@ -480,6 +496,7 @@ class studentsList extends Component{
} }
onInputSearchChange = (e) => { onInputSearchChange = (e) => {
let {filterKey}=this.state;
this.setState({ this.setState({
searchValue: e.target.value searchValue: e.target.value
}) })
@ -488,12 +505,12 @@ class studentsList extends Component{
clearTimeout(this.timeoutHandler) clearTimeout(this.timeoutHandler)
} }
this.timeoutHandler = setTimeout(() => { this.timeoutHandler = setTimeout(() => {
this.fetchAll(1) this.fetchAll(1,filterKey)
}, 1200) }, 1200)
} }
onPressEnter = (e) => { onPressEnter = (e) => {
this.fetchAll(1) this.fetchAll(1,this.state.filterKey)
} }
@ -530,7 +547,7 @@ class studentsList extends Component{
changeRole = (member, role) => { changeRole = (member, role) => {
const courseId = this.props.match.params.coursesId const courseId = this.props.match.params.coursesId
let {filterKey}=this.state;
let url= `/courses/${courseId}/change_course_teacher.json`; let url= `/courses/${courseId}/change_course_teacher.json`;
axios.post(url, { axios.post(url, {
course_member_id: member.course_member_id course_member_id: member.course_member_id
@ -543,7 +560,7 @@ class studentsList extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.data.status==0){ if(result.data.status==0){
this.props.showNotification('操作成功。') this.props.showNotification('操作成功。')
this.fetchAll() this.fetchAll(undefined,filterKey)
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
@ -559,9 +576,11 @@ class studentsList extends Component{
this.refs.addAdminModal.setVisible(true) this.refs.addAdminModal.setVisible(true)
} }
changeAdminSuccess = () => { changeAdminSuccess = () => {
this.fetchAll() let {filterKey}=this.state;
this.fetchAll(undefined,filterKey)
} }
onDelete = (member) => { onDelete = (member) => {
let {filterKey}=this.state;
this.props.confirm({ this.props.confirm({
content: `确认要将“${member.name}”从教师列表中移除吗?`, content: `确认要将“${member.name}”从教师列表中移除吗?`,
onOk: () => { onOk: () => {
@ -577,7 +596,7 @@ class studentsList extends Component{
// {"status":1,"message":"删除成功"} // {"status":1,"message":"删除成功"}
this.props.showNotification('删除成功') this.props.showNotification('删除成功')
trigger('updatabanner') trigger('updatabanner')
this.fetchAll() this.fetchAll(undefined,filterKey)
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -602,12 +621,13 @@ class studentsList extends Component{
} }
onTableChange = (pagination, filters, sorter) => { onTableChange = (pagination, filters, sorter) => {
let {filterKey}=this.state;
console.log('Various parameters', pagination, filters, sorter); console.log('Various parameters', pagination, filters, sorter);
this.setState({ this.setState({
page: pagination.current, page: pagination.current,
sortedInfo: sorter, sortedInfo: sorter,
}, () => { }, () => {
this.fetchAll() this.fetchAll(undefined,filterKey)
}); });
}; };
clearSelection = () => { clearSelection = () => {
@ -620,7 +640,7 @@ class studentsList extends Component{
page:1, page:1,
isSpin:true isSpin:true
}, () => { }, () => {
this.fetchAll(); this.fetchAll(undefined,e.key);
}) })
} }
setGroupChooserModalVisible = (visible) => { setGroupChooserModalVisible = (visible) => {
@ -654,7 +674,9 @@ class studentsList extends Component{
const isSuperAdmin = this.props.isSuperAdmin() const isSuperAdmin = this.props.isSuperAdmin()
const hasGraduationModule = this.hasGraduationModule() const hasGraduationModule = this.hasGraduationModule()
const coursesId = this.props.match.params.coursesId const coursesId = this.props.match.params.coursesId
return( return(
<React.Fragment> <React.Fragment>
{/* <AddTeacherModal ref="addTeacherModal" {/* <AddTeacherModal ref="addTeacherModal"
@ -693,7 +715,7 @@ class studentsList extends Component{
} }
secondRowLeft={ secondRowLeft={
isAdminOrTeacher ? <div className="fl mt6 task_menu_ul " style={{ width: '600px' }}> isAdminOrTeacher ? <div className="fl mt6 task_menu_ul " style={{ width: '600px' }}>
<Menu mode="horizontal" defaultSelectedKeys="1" onClick={this.selectedStatus}> <Menu mode="horizontal" selectedKeys={[`${this.state.filterKey}`]} onClick={this.selectedStatus}>
<Menu.Item key="1">已审批({total_count})</Menu.Item> <Menu.Item key="1">已审批({total_count})</Menu.Item>
<Menu.Item key="2">待审批({apply_size})</Menu.Item> <Menu.Item key="2">待审批({apply_size})</Menu.Item>
</Menu> </Menu>
@ -740,9 +762,11 @@ class studentsList extends Component{
<div className="mt20 edu-back-white padding20 teacherList"> <div className="mt20 edu-back-white padding20 teacherList">
{ course_groups && !!course_groups.length && <CourseGroupChooserModal { course_groups && !!course_groups.length && <CourseGroupChooserModal
{...this.state}
{...this.props}
props={{match: this.props.match, showNotification: this.props.showNotification}} props={{match: this.props.match, showNotification: this.props.showNotification}}
record={this.state.clickRecord} record={this.state.clickRecord}
fetchAll={this.fetchAll} fetchAll={(e)=>this.fetchAll(e,this.state.filterKey)}
course_groups={course_groups} course_groups={course_groups}
visible={this.state.groupChooserModalVisible} visible={this.state.groupChooserModalVisible}
setVisible={this.setGroupChooserModalVisible} setVisible={this.setGroupChooserModalVisible}

@ -563,6 +563,7 @@ class Poll extends Component{
{...this.props} {...this.props}
{...this.state} {...this.state}
style="grey" style="grey"
single={true}
checkBoxValues={this.state.checkBoxValues} checkBoxValues={this.state.checkBoxValues}
action={this.successFun} action={this.successFun}
></ImmediatelyEnd> ></ImmediatelyEnd>

@ -202,7 +202,7 @@ class PollDetailIndex extends Component{
className={"font-16"} className={"font-16"}
checkBoxValues={[this.props.match.params.pollId]} checkBoxValues={[this.props.match.params.pollId]}
action={this.getPollInfo} action={this.getPollInfo}
single={true} // single={true}
></ImmediatelyEnd> ></ImmediatelyEnd>
</li> </li>
:"" :""

@ -14,6 +14,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
imageSrc: '' imageSrc: ''
} }
} }
onDelegateClick = (event) => { onDelegateClick = (event) => {
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href') const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
// 判断imageSrc是否是图片 // 判断imageSrc是否是图片
@ -35,6 +36,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
return false; return false;
} }
} }
// jQuery._data( $('.newMain')[0], "events" ) // jQuery._data( $('.newMain')[0], "events" )
componentDidMount() { componentDidMount() {
this.props.wrappedComponentRef && this.props.wrappedComponentRef(this.refs['wrappedComponentRef']) this.props.wrappedComponentRef && this.props.wrappedComponentRef(this.refs['wrappedComponentRef'])
@ -45,6 +47,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
.delegate(options.imgSelector || ".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img","click", this.onDelegateClick); .delegate(options.imgSelector || ".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img","click", this.onDelegateClick);
}, 1200) }, 1200)
} }
componentWillUnmount() { componentWillUnmount() {
$(options.parentSelector || ".commentsDelegateParent", 'click', this.onDelegateClick) $(options.parentSelector || ".commentsDelegateParent", 'click', this.onDelegateClick)
} }
@ -55,9 +58,24 @@ export function ImageLayerOfCommentHOC(options = {}) {
imageSrc: '', imageSrc: '',
}) })
} }
MdifHasAnchorJustScorll=()=>{
//mdhash滚动
let anchor = decodeURI(this.props.location.hash).replace('#', '');
// 对应id的话, 滚动到相应位置
if (!!anchor) {
let anchorElement = document.getElementsByName(anchor);
if (anchorElement) {
if (anchorElement.length!=0) {
anchorElement[anchorElement.length-1].scrollIntoView();
}
}
}
}
render() { render() {
this.MdifHasAnchorJustScorll();
return ( return (
<React.Fragment> <React.Fragment>
<ImageLayer {...this.state} onImageLayerClose={this.onImageLayerClose}></ImageLayer> <ImageLayer {...this.state} onImageLayerClose={this.onImageLayerClose}></ImageLayer>

@ -609,6 +609,21 @@ export function TPMIndexHOC(WrappedComponent) {
hideGlobalLoading = () => { hideGlobalLoading = () => {
this.setState({ globalLoading: false }) this.setState({ globalLoading: false })
} }
MdifHasAnchorJustScorll=()=>{
//mdhash滚动
let anchor = decodeURI(this.props.location.hash).replace('#', '');
// 对应id的话, 滚动到相应位置
if (!!anchor) {
let anchorElement = document.getElementsByName(anchor);
if (anchorElement) {
if (anchorElement.length>0){
anchorElement[anchorElement.length-1].scrollIntoView();
}
}
}
}
render() { render() {
let{Headertop,Footerdown, isRender, AccountProfiletype,mygetHelmetapi}=this.state; let{Headertop,Footerdown, isRender, AccountProfiletype,mygetHelmetapi}=this.state;
const common = { const common = {
@ -643,6 +658,7 @@ export function TPMIndexHOC(WrappedComponent) {
hideGlobalLoading: this.hideGlobalLoading, hideGlobalLoading: this.hideGlobalLoading,
yslslowCheckresults:this.yslslowCheckresults, yslslowCheckresults:this.yslslowCheckresults,
yslslowCheckresultsNo:this.yslslowCheckresultsNo, yslslowCheckresultsNo:this.yslslowCheckresultsNo,
MdifHasAnchorJustScorll:this.MdifHasAnchorJustScorll
}; };
// console.log("this.props.mygetHelmetapi"); // console.log("this.props.mygetHelmetapi");

Loading…
Cancel
Save