Merge branches 'dev_aliyun', 'yslcompetition' and 'ysm1' of https://bdgit.educoder.net/Hjqreturn/educoder into ysm1

dev_sync_trustie
杨树明 5 years ago
commit dd4ce9cf20

@ -9,7 +9,7 @@ $(document).on('turbolinks:load', function(){
};
var timeOptions = {
// autoclose: true,
autoclose: 1,
language: 'zh-CN',
format: 'yyyy-mm-dd hh:ii:ss',
minuteStep: 30
@ -23,18 +23,9 @@ $(document).on('turbolinks:load', function(){
$(element).find('.end-date').datepicker('setStartDate', e.date);
});
};
$(".competition-start-end-date .start-date").datetimepicker(timeOptions);
var defineTimeRangeSelect = function (element) {
// var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, timeOptions);
$(".start-date").datetimepicker(timeOptions);
$(element).find('.start-date').datetimepicker().on('changeDate', function (e) {
$(element).find('.end-date').datetimepicker('setStartDate', e.date);
});
};
$(".competition-start-end-date .start-date").datetimepicker();
$(".competition-start-end-date .end-date").datetimepicker();
$(".competition-start-end-date .end-date").datetimepicker(timeOptions);
defineDateRangeSelect('.teaching-mode-date');
// defineTimeRangeSelect('.competition-start-end-date');
@ -62,13 +53,13 @@ $(document).on('turbolinks:load', function(){
if ($("input[name='mode']:checked").val() == 2) {
var $courseId = $("input[name='course_id'");
if ($courseId.val() === undefined || $course_id.val().length === 0) {
if ($courseId.val() === undefined || $courseId.val().length === 0) {
$courseId.addClass('danger text-danger');
valid = false;
} else {
$courseId.removeClass('danger text-danger');
}
} else if ($("input[name='mode']:checked").val() == 4) {
} else if ($("input[name='mode']:checked").val() == 3) {
var $techStartTime = $("input[name='teach_start_time'");
var $techEndTime = $("input[name='teach_end_time'");
if ($techStartTime.val() === undefined || $techStartTime.val().length === 0) {
@ -84,6 +75,10 @@ $(document).on('turbolinks:load', function(){
} else {
$techEndTime.removeClass('danger text-danger');
}
} else {
$("input[name='course_id'").removeClass('danger text-danger');
$("input[name='teach_start_time'").removeClass('danger text-danger');
$("input[name='teach_end_time'").removeClass('danger text-danger');
}
if (!valid) return;
@ -113,81 +108,80 @@ $(document).on('turbolinks:load', function(){
$(function () {
//MD编辑
$("#MD_typeFrom").on("click",".add_MD_type",function () {
var length=$(".MD_type").find(".add_MD_type").length + 1;
var html='<div class="row MD_type mt-2">\n' +
' <div class="col-1 text-right">\n' +
' <label class="checkbox checkbox-primary mt-1">\n' +
' <input id="checkbox_MD_'+length+'" type="checkbox" name="checkbox_MD_'+length+'">\n' +
' <label for="checkbox_MD_'+length+'">&nbsp;</label>\n' +
' </label>\n' +
' </div>\n' +
' <div class="col-md-4"><input type="text" class="form-control" name="MD_type_value_'+length+'" placeholder="导航名称"></div>\n' +
' <div class="col-md-1"><input type="text" class="form-control" name="MD_type_index_'+length+'" /></div>\n' +
' <button class="btn btn-primary waves-effect waves-light btn-xs setBtn_s add_MD_type">+</button>\n' +
' <button class="btn btn-icon waves-effect btn-default waves-light setBtn_s ml10 del_MD_type">×</button>\n' +
' </div>';
$("#MD_typeFrom").append(html);
})
$("#MD_typeFrom").on("click",".del_MD_type",function () {
$(this).parents(".MD_type").remove();
})
// $("#MD_typeFrom").on("click",".add_MD_type",function () {
//
// var length=$(".MD_type").find(".add_MD_type").length + 1;
// var html='<div class="row MD_type mt-2">\n' +
// ' <div class="col-1 text-right">\n' +
// ' <label class="checkbox checkbox-primary mt-1">\n' +
// ' <input id="checkbox_MD_'+length+'" type="checkbox" name="checkbox_MD_'+length+'">\n' +
// ' <label for="checkbox_MD_'+length+'">&nbsp;</label>\n' +
// ' </label>\n' +
// ' </div>\n' +
// ' <div class="col-md-4"><input type="text" class="form-control" name="MD_type_value_'+length+'" placeholder="导航名称"></div>\n' +
// ' <div class="col-md-1"><input type="text" class="form-control" name="MD_type_index_'+length+'" /></div>\n' +
// ' <button class="btn btn-primary waves-effect waves-light btn-xs setBtn_s add_MD_type">+</button>\n' +
// ' <button class="btn btn-icon waves-effect btn-default waves-light setBtn_s ml10 del_MD_type">×</button>\n' +
// ' </div>';
// $("#MD_typeFrom").append(html);
// })
// $("#MD_typeFrom").on("click",".del_MD_type",function () {
// $(this).parents(".MD_type").remove();
// })
//链接
$(".nav-setting-form").on("click",".add_linkBtn",function () {
var length=$(".nav-setting-form").find(".linkFormItem").length + 1;
var html='<div class="row mt-2 lineFromItem">\n' +
var html='<div class="row mt-2 align-items-center linkFormItem">\n' +
' <div class="col-1 text-right">\n' +
' <label class="checkbox checkbox-primary mt-1">\n' +
' <input id="link_'+length+'" type="checkbox" name="link_'+length+'" />\n' +
' <label for="link_'+length+'">&nbsp;</label>\n' +
' <input type="checkbox" name="navbar[][hidden]" value="0" class="font-16" checked="checked">\n' +
' </label>\n' +
' </div>\n' +
' <div class="col-md-label mt-1"><input type="text" name="link_name_'+length+'" class="form-control"></div>\n' +
' <div class="col-md-1 mt-1"><input type="text" name="link_index_'+length+'" class="form-control"></div>\n' +
' <div class="col-md-3 mt-1"><input type="text" name="link_info_'+length+'" class="form-control"></div>\n' +
' <button class="mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn">+</button>\n' +
' <button class="mt-1 btn btn-icon waves-effect btn-default waves-light setBtn_s ml10 del_linkBtn">×</button>\n' +
' <div class="col-md-label mt-1"><input type="hidden" value="md" name="navbar[][module_type]">\n' +
' <input type="text" name="navbar[][name]" value="" class="form-control" placeholder="模块名称"></div>\n' +
' <div class="col-md-1 mt-1"><input type="text" name="navbar[][position]" value="" class="form-control" placeholder="位置"></div>\n' +
' <div class="col-md-3 mt-1"><input type="text" name="navbar[][url]" value="" class="form-control" placeholder="请输入资料下载地址"></div>\n' +
' <a class="mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn" href="javascript:void(0)">+</a>\n' +
' <a class="mt-1 btn btn-icon waves-effect btn-default waves-light setBtn_s ml10 del_linkBtn" href="javascript:void(0)">×</a>\n' +
' </div>';
$(this).parents(".lineFromItem").insertAfter(html);
$(this).parents(".linkFormItem").after(html);
});
$(".nav-setting-form").on("click",".del_linkBtn",function () {
$(this).parents(".lineFromItem").remove();
$(".nav-setting-form").on("click", ".del_linkBtn", function () {
$(this).parents(".linkFormItem").remove();
});
//有关报名要求
$("#addRequireBtn").on("click",function () {
$(".addRequireBtn").on("click",function () {
var length=$("#requireForm").find(".requireForm_item").length + 1;
var html='<div class="row mt-2 mb-4 requireForm_item">\n' +
' <div class="col-1 text-right">&nbsp;&nbsp;</div>\n' +
' <div class="col-1 text-left mt-1">\n' +
' <input type="text" class="form-control" name="min_'+length+'" />\n' +
' <input type="text" class="form-control" name="competition_staffs[][minimum]" value="0">\n' +
' </div>\n' +
' <span class="mt-2">~</span>\n' +
' <div class="col-1 mt-1">\n' +
' <input type="text" class="form-control" name="max_'+length+'" />\n' +
' <input type="text" class="form-control" name="competition_staffs[][maximum]" value="1">\n' +
' </div>\n' +
' <span class="mt-2">人</span>\n' +
' <div class="col-2 mt-1">\n' +
' <select class="form-control" name="choice_'+length+'" >\n' +
' <option>不限</option>\n' +
' <option>教师</option>\n' +
' <option>学生</option>\n' +
' <option>专业人士</option>\n' +
' <select class="form-control" name="competition_staffs[][category]">\n' +
' <option value="all">不限</option>\n' +
' <option value="teacher">教师</option>\n' +
' <option value="student">学生</option>\n' +
' <option value="profession">专业人士</option>\n' +
' </select>\n' +
' </div>\n' +
' <div class="col-2 mt-1">\n' +
' <label class="radio checkbox-primary mt-1" value="require_'+length+'_1">\n' +
' <input id="require_'+length+'_1" name="require_1" type="radio">\n' +
' <input id="require_'+length+'_1" class="mutiple-limited-radio" value="false" checked name="competition_staffs[][mutiple_limited]" type="checkbox">\n' +
' <label for="require_'+length+'_1">可多次报名</label>\n' +
' </label>\n' +
' </div>\n' +
' <div class="col-2 mt-1">\n' +
' <label class="radio checkbox-primary mt-1" value="require_'+length+'_2">\n' +
' <input id="require_'+length+'_2" name="require_1" type="radio">\n' +
' <input id="require_'+length+'_2" class="mutiple-limited-radio" value="true" name="competition_staffs[][mutiple_limited]" type="checkbox">\n' +
' <label for="require_'+length+'_2">不可多次报名</label>\n' +
' </label>\n' +
' <a href="javascript:void(0)" class="ml20 delRequrieBtn">\n' +
@ -209,5 +203,33 @@ $(function () {
} else {
radio.parent().parent().siblings().find('.mutiple-limited-radio').attr('checked', true)
}
})
});
var $navForm = $('form.nav-setting-form');
$navForm.on('click', ".submit-btn", function () {
$navForm.find('.submit-btn').attr('disabled', 'disabled');
$navForm.find('.error').html('');
var valid = $navForm.valid();
if (!valid) return;
$.ajax({
method: 'POST',
dataType: 'json',
url: $navForm.attr('action'),
data: new FormData($navForm[0]),
processData: false,
contentType: false,
success: function (data) {
$.notify({message: '保存成功'});
// window.location.reload();
},
error: function (res) {
var data = res.responseJSON;
$navForm.find('.error').html(data.message);
},
complete: function () {
$navForm.find('.submit-btn').attr('disabled', false);
}
});
});
});

@ -15,15 +15,19 @@ $(document).on('turbolinks:load', function(){
var $unlockAction = $lockAction.siblings('.unlock-action');
var userId = $lockAction.data('id');
$.ajax({
url: '/admins/users/' + userId + '/lock',
method: 'POST',
dataType: 'json',
success: function() {
showSuccessNotify();
$lockAction.hide();
$unlockAction.show();
customConfirm({
content: '确认加锁吗?',
ok: function(){
$.ajax({
url: '/admins/users/' + userId + '/lock',
method: 'POST',
dataType: 'json',
success: function() {
showSuccessNotify();
$lockAction.hide();
$unlockAction.show();
}
});
}
});
});
@ -34,17 +38,21 @@ $(document).on('turbolinks:load', function(){
var $lockAction = $unlockAction.siblings('.lock-action');
var userId = $unlockAction.data('id');
$.ajax({
url: '/admins/users/' + userId + '/unlock',
method: 'POST',
dataType: 'json',
success: function() {
showSuccessNotify();
$lockAction.show();
$unlockAction.hide();
customConfirm({
content: '确认解锁吗?',
ok: function () {
$.ajax({
url: '/admins/users/' + userId + '/unlock',
method: 'POST',
dataType: 'json',
success: function() {
showSuccessNotify();
$lockAction.show();
$unlockAction.hide();
}
});
}
});
})
});
// active user
@ -54,18 +62,22 @@ $(document).on('turbolinks:load', function(){
var $lockAction = $activeAction.siblings('.lock-action');
var userId = $activeAction.data('id');
$.ajax({
url: '/admins/users/' + userId + '/unlock',
method: 'POST',
dataType: 'json',
success: function() {
showSuccessNotify();
$activeAction.hide();
$lockAction.show();
$unlockAction.hide();
customConfirm({
content: '确认激活吗?',
ok: function () {
$.ajax({
url: '/admins/users/' + userId + '/unlock',
method: 'POST',
dataType: 'json',
success: function() {
showSuccessNotify();
$activeAction.hide();
$lockAction.show();
$unlockAction.hide();
}
});
}
});
})
});
// ***************** reward grade modal *****************

File diff suppressed because it is too large Load Diff

@ -0,0 +1,16 @@
/**
* Simplified Chinese translation for bootstrap-datetimepicker
* Yuan Cheung <advanimal@gmail.com>
*/
;(function($){
$.fn.datetimepicker.dates['zh-CN'] = {
days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
today: "今天",
suffix: [],
meridiem: ["上午", "下午"]
};
}(jQuery));

@ -7,6 +7,7 @@
@import "bootstrap-datepicker.standalone";
@import "jquery.mloading";
@import "jquery-confirm.min";
@import "bootstrap-datetimepicker.min";
@import "codemirror/lib/codemirror";
@import "editormd/css/editormd.min";

File diff suppressed because one or more lines are too long

@ -32,13 +32,13 @@ class Admins::UsersController < Admins::BaseController
end
def lock
User.find(params[:user_id]).lock!
User.find(params[:id]).lock!
render_ok
end
def unlock
User.find(params[:user_id]).activate!
User.find(params[:id]).activate!
render_ok
end

@ -84,8 +84,8 @@ class Competitions::CompetitionsController < Competitions::BaseController
def chart_rules
@competition = current_competition
@stages = @competition.competition_stages
@rule_contents = @competition.chart_rules
com_module = @competition.competition_modules.find_by(module_type: "chart")
@rule_contents = com_module&.competition_module_md_contents
end
def update_chart_rules

@ -86,6 +86,7 @@ class Competitions::SaveTeamForm
# 创建者是否能多次报名
def check_creator_multiple_enrollable
return unless team.new_record? # 编辑战队时不需要校验
return unless competition.enrolled?(creator)
if (creator.is_teacher? && competition.teacher_multiple_limited?) || (!creator.is_teacher? && competition.member_multiple_limited?)

@ -37,7 +37,7 @@ module CompetitionsHelper
def chart_stages competition
stages = []
statistic_stages = competition.competition_stages.where("rate > 0")
statistic_stages = competition.competition_stages.where("score_rate > 0")
if competition.end_time && competition.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

@ -3,22 +3,16 @@ class CompetitionModule < ApplicationRecord
belongs_to :competition
has_one :competition_module_md_content, dependent: :destroy
has_many :competition_module_md_contents, dependent: :destroy
def module_url
case module_type
when "home"
"/competitions/#{competition.identifier}"
when "inform"
"/competitions/#{competition.identifier}/informs?status=1"
when "manual"
"/competitions/#{competition.identifier}/informs?status=2"
when "chart"
"/competitions/#{competition.identifier}/charts"
when "enroll"
"/competitions/#{competition.identifier}/competition_teams"
else
url || "/competitions/#{competition.identifier}/md_content?md_content_id=#{competition_module_md_content&.id}"
end
result_url = url.present? ? url : case module_type
when "chart"
"/competitions/#{competition.identifier}/charts.json"
when "enroll"
"/competitions/#{competition.identifier}/competition_teams.json"
else
"/competitions/#{competition.identifier}/competition_modules/#{id}.json"
end
end
end

@ -3,6 +3,6 @@ class CompetitionModuleMdContent < ApplicationRecord
has_many :attachments, as: :container, dependent: :destroy
validates :name, presence: true
# validates :name, presence: true
validates :content, presence: true
end

@ -666,6 +666,10 @@ class User < ApplicationRecord
if password.present? && password.size < MIX_PASSWORD_LIMIT && !User.current.admin?
raise("密码长度不能低于#{MIX_PASSWORD_LIMIT}")
end
if password.present? && password.size > 16
raise('密码长度不能超过16位')
end
end
end

@ -21,7 +21,7 @@ class Admins::CompetitionBasicSettingService < ApplicationService
competition.save!
if competition.mode == 1 || competition.mode == 4
competition.competition_mode_setting.destroy
competition.competition_mode_setting&.destroy
else
setting = competition.competition_mode_setting || CompetitionModeSetting.create!(competition_id: competition.id)
if competition.mode == 2

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

@ -160,7 +160,8 @@
<div class="row MD_type">
<div class="col-1 text-right">
<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="0" hidden class="font-16" checked="checked">
<input type="checkbox" disabled="disabled" class="font-16" checked="checked">
</label>
</div>
<div class="col-md-4">
@ -200,7 +201,7 @@
报名要求
</div>
<div class="col-md-3">
<button class="btn btn-primary waves-effect waves-light btn-xs setBtn_s" id="addRequireBtn">+</button>
<%= javascript_void_link '+', class: 'btn btn-primary waves-effect waves-light btn-xs setBtn_s addRequireBtn' %>
</div>
</div>
@ -213,7 +214,7 @@
</div>
<span class="mt-2">~</span>
<div class="col-1 mt-1">
<input type="text" class="form-control"name="competition_staffs[][maximum]" value="<%= staff.maximum %>" />
<input type="text" class="form-control" name="competition_staffs[][maximum]" value="<%= staff.maximum %>" />
</div>
<span class="mt-2">人</span>
<div class="col-2 mt-1">
@ -244,7 +245,7 @@
</div>
<% when 'inform', 'chart', 'resource' %>
<div class="row mt-2 new_module_div">
<div class="row mt-2 new_module_div linkFormItem">
<div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1">
<%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %>
@ -262,7 +263,7 @@
<div class="col-md-3 mt-1">
<%= text_field_tag('navbar[][url]', com_module.url, id: nil, class: 'form-control', placeholder: '请输入资料下载地址') %>
</div>
<button class="mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn">+</button>
<%= javascript_void_link '+', class: 'mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn' %>
<% end %>
</div>
<% else %>
@ -282,8 +283,8 @@
<div class="col-md-3 mt-1">
<%= text_field_tag('navbar[][url]', com_module.url, id: nil, class: 'form-control', placeholder: '请输入资料下载地址') %>
</div>
<button class="mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn">+</button>
<button class="mt-1 btn btn-icon waves-effect btn-default waves-light setBtn_s ml10 del_linkBtn">×</button>
<%= javascript_void_link '+', class: 'mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn' %>
<%= javascript_void_link '×', class: 'mt-1 btn btn-icon waves-effect btn-default waves-light setBtn_s ml10 del_linkBtn' %>
</div>
<% end %>
<% end %>
@ -298,12 +299,13 @@
<!-- <div class="col-md-label mt-2">获奖证书</div>-->
<!-- </div>-->
<div class="error my-2 danger text-danger"></div>
<div class="row mt-2 mb-4">
<div class="col-1 text-right">
</div>
<div class="col-md-label mt-2"><%= javascript_void_link '保存', class: 'btn btn-primary submit-btn' %></div>
</div>
</div>
<% end %>
</div>

@ -33,14 +33,14 @@
<%= 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, confirm: '确认解锁吗?' }, style: user.locked? ? '' : 'display: none;' %>
<%= javascript_void_link '解锁', class: 'action unlock-action', data: { id: user.id }, style: user.locked? ? '' : 'display: none;' %>
<% if user.registered? %>
<%= javascript_void_link '激活', class: 'action active-action', data: { id: user.id, confirm: '确认激活吗?' } %>
<%= javascript_void_link '激活', class: 'action active-action', data: { id: user.id } %>
<% end %>
<% if user.id != current_user.id %>
<%= javascript_void_link '加锁', class: 'action lock-action', data: { id: user.id, confirm: '确认加锁吗?' }, 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 %>
<%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'delete-user-action' %>

@ -1,7 +1,7 @@
json.extract! @module, :id, :name, :position, :url, :md_edit
json.extract! @module, :id, :name, :position, :url
md = @module.competition_module_md_content
if md.present?
mds = @module.competition_module_md_contents
json.md_contents mds.each do |md|
json.md_name md.name
json.md_content md.content
json.created_at md.created_at.strftime('%Y-%m-%d %H:%M:%S')

@ -12,14 +12,15 @@
competitions/save_team_form:
attributes:
creator:
enrolled: "您已经报名过该竞赛了"
teacher_enroll_forbidden: "本竞赛的参赛者限定为:学生"
member_enroll_forbidden: "本竞赛的参赛者限定为:教师"
teacher_ids:
enroll_forbidden: "本竞赛的参赛者限定为:学生"
invalid_count: "教师数量应为%{minimum}~%{maximum}人"
enrolled: "教师 ${names} 已加入其它战队了"
enrolled: "教师 %{names} 已加入其它战队了"
member_ids:
enroll_forbidden: "本竞赛的参赛者限定为:教师"
invalid_count: "队员数量应为%{minimum}~%{maximum}人"
enrolled: "队员 ${names} 已加入其它战队了"
enrolled: "队员 %{names} 已加入其它战队了"

@ -0,0 +1,5 @@
class MigrateCompetitionModuleManual < ActiveRecord::Migration[5.2]
def change
CompetitionModule.where(module_type: "manual").update_all(module_type: "md")
end
end

@ -0,0 +1,17 @@
class MigrateCompetitionModuleContent < ActiveRecord::Migration[5.2]
def change
Competition.all.each do |competition|
competition.informs.each do |inform|
if inform.status == 1
com_module = competition.competition_modules.find_by(module_type: "inform")
elsif inform.status == 2
com_module = competition.competition_modules.find_by(name: "参赛手册")
end
if com_module
new_md = CompetitionModuleMdContent.create!(competition_module_id: com_module.id, content: inform.description, name: inform.name)
Attachment.where(container_id: inform.id, container_type: "Inform").update_all(container_id: new_md.id, container_type: "CompetitionModuleMdContent")
end
end
end
end
end

@ -0,0 +1,14 @@
class MigrateCompetitionChartRules < ActiveRecord::Migration[5.2]
def change
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

File diff suppressed because one or more lines are too long

@ -19161,6 +19161,362 @@ body[class*=jconfirm-no-scroll-] {
transform: scale(1);
}
/*!
* Datetimepicker for Bootstrap
*
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker {
padding: 4px;
margin-top: 1px;
border-radius: 4px;
direction: ltr;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker-inline {
width: 220px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker.datetimepicker-rtl {
direction: rtl;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker.datetimepicker-rtl table tr td span {
float: right;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker-dropdown, .datetimepicker-dropdown-left {
top: 0;
left: 0;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
[class*=" datetimepicker-dropdown"]:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
[class*=" datetimepicker-dropdown"]:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
position: absolute;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
[class*=" datetimepicker-dropdown-top"]:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-top: 7px solid #ccc;
border-top-color: rgba(0, 0, 0, 0.2);
border-bottom: 0;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
[class*=" datetimepicker-dropdown-top"]:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #fff;
border-bottom: 0;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker-dropdown-bottom-left:before {
top: -7px;
right: 6px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker-dropdown-bottom-left:after {
top: -6px;
right: 7px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker-dropdown-bottom-right:before {
top: -7px;
left: 6px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker-dropdown-bottom-right:after {
top: -6px;
left: 7px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker-dropdown-top-left:before {
bottom: -7px;
right: 6px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker-dropdown-top-left:after {
bottom: -6px;
right: 7px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker-dropdown-top-right:before {
bottom: -7px;
left: 6px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker-dropdown-top-right:after {
bottom: -6px;
left: 7px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker > div {
display: none;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker.minutes div.datetimepicker-minutes {
display: block;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker.hours div.datetimepicker-hours {
display: block;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker.days div.datetimepicker-days {
display: block;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker.months div.datetimepicker-months {
display: block;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker.years div.datetimepicker-years {
display: block;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table {
margin: 0;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker td, .datetimepicker th {
text-align: center;
width: 20px;
height: 20px;
border-radius: 4px;
border: 0;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.table-striped .datetimepicker table tr td, .table-striped .datetimepicker table tr th {
background-color: transparent;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td.minute:hover {
background: #eee;
cursor: pointer;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td.hour:hover {
background: #eee;
cursor: pointer;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td.day:hover {
background: #eee;
cursor: pointer;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td.old, .datetimepicker table tr td.new {
color: #999;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td.disabled, .datetimepicker table tr td.disabled:hover {
background: 0;
color: #999;
cursor: default;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td.today, .datetimepicker table tr td.today:hover, .datetimepicker table tr td.today.disabled, .datetimepicker table tr td.today.disabled:hover {
background-color: #fde19a;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fdd49a), to(#fdf59a));
background-image: linear-gradient(to bottom, #fdd49a, #fdf59a);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a',endColorstr='#fdf59a',GradientType=0);
border-color: #fdf59a #fdf59a #fbed50;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td.today:hover, .datetimepicker table tr td.today:hover:hover, .datetimepicker table tr td.today.disabled:hover, .datetimepicker table tr td.today.disabled:hover:hover, .datetimepicker table tr td.today:active, .datetimepicker table tr td.today:hover:active, .datetimepicker table tr td.today.disabled:active, .datetimepicker table tr td.today.disabled:hover:active, .datetimepicker table tr td.today.active, .datetimepicker table tr td.today:hover.active, .datetimepicker table tr td.today.disabled.active, .datetimepicker table tr td.today.disabled:hover.active, .datetimepicker table tr td.today.disabled, .datetimepicker table tr td.today:hover.disabled, .datetimepicker table tr td.today.disabled.disabled, .datetimepicker table tr td.today.disabled:hover.disabled, .datetimepicker table tr td.today[disabled], .datetimepicker table tr td.today:hover[disabled], .datetimepicker table tr td.today.disabled[disabled], .datetimepicker table tr td.today.disabled:hover[disabled] {
background-color: #fdf59a;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td.today:active, .datetimepicker table tr td.today:hover:active, .datetimepicker table tr td.today.disabled:active, .datetimepicker table tr td.today.disabled:hover:active, .datetimepicker table tr td.today.active, .datetimepicker table tr td.today:hover.active, .datetimepicker table tr td.today.disabled.active, .datetimepicker table tr td.today.disabled:hover.active {
background-color: #fbf069;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td.active, .datetimepicker table tr td.active:hover, .datetimepicker table tr td.active.disabled, .datetimepicker table tr td.active.disabled:hover {
background-color: #006dcc;
background-image: -webkit-gradient(linear, left top, left bottom, from(#08c), to(#04c));
background-image: linear-gradient(to bottom, #08c, #04c);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0044cc',GradientType=0);
border-color: #04c #04c #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td.active:hover, .datetimepicker table tr td.active:hover:hover, .datetimepicker table tr td.active.disabled:hover, .datetimepicker table tr td.active.disabled:hover:hover, .datetimepicker table tr td.active:active, .datetimepicker table tr td.active:hover:active, .datetimepicker table tr td.active.disabled:active, .datetimepicker table tr td.active.disabled:hover:active, .datetimepicker table tr td.active.active, .datetimepicker table tr td.active:hover.active, .datetimepicker table tr td.active.disabled.active, .datetimepicker table tr td.active.disabled:hover.active, .datetimepicker table tr td.active.disabled, .datetimepicker table tr td.active:hover.disabled, .datetimepicker table tr td.active.disabled.disabled, .datetimepicker table tr td.active.disabled:hover.disabled, .datetimepicker table tr td.active[disabled], .datetimepicker table tr td.active:hover[disabled], .datetimepicker table tr td.active.disabled[disabled], .datetimepicker table tr td.active.disabled:hover[disabled] {
background-color: #04c;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td.active:active, .datetimepicker table tr td.active:hover:active, .datetimepicker table tr td.active.disabled:active, .datetimepicker table tr td.active.disabled:hover:active, .datetimepicker table tr td.active.active, .datetimepicker table tr td.active:hover.active, .datetimepicker table tr td.active.disabled.active, .datetimepicker table tr td.active.disabled:hover.active {
background-color: #039;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td span {
display: block;
width: 23%;
height: 54px;
line-height: 54px;
float: left;
margin: 1%;
cursor: pointer;
border-radius: 4px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker .datetimepicker-hours span {
height: 26px;
line-height: 26px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker .datetimepicker-hours table tr td span.hour_am, .datetimepicker .datetimepicker-hours table tr td span.hour_pm {
width: 14.6%;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker .datetimepicker-hours fieldset legend, .datetimepicker .datetimepicker-minutes fieldset legend {
margin-bottom: inherit;
line-height: 30px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker .datetimepicker-minutes span {
height: 26px;
line-height: 26px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td span:hover {
background: #eee;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td span.disabled, .datetimepicker table tr td span.disabled:hover {
background: 0;
color: #999;
cursor: default;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td span.active, .datetimepicker table tr td span.active:hover, .datetimepicker table tr td span.active.disabled, .datetimepicker table tr td span.active.disabled:hover {
background-color: #006dcc;
background-image: -webkit-gradient(linear, left top, left bottom, from(#08c), to(#04c));
background-image: linear-gradient(to bottom, #08c, #04c);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0044cc',GradientType=0);
border-color: #04c #04c #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td span.active:hover, .datetimepicker table tr td span.active:hover:hover, .datetimepicker table tr td span.active.disabled:hover, .datetimepicker table tr td span.active.disabled:hover:hover, .datetimepicker table tr td span.active:active, .datetimepicker table tr td span.active:hover:active, .datetimepicker table tr td span.active.disabled:active, .datetimepicker table tr td span.active.disabled:hover:active, .datetimepicker table tr td span.active.active, .datetimepicker table tr td span.active:hover.active, .datetimepicker table tr td span.active.disabled.active, .datetimepicker table tr td span.active.disabled:hover.active, .datetimepicker table tr td span.active.disabled, .datetimepicker table tr td span.active:hover.disabled, .datetimepicker table tr td span.active.disabled.disabled, .datetimepicker table tr td span.active.disabled:hover.disabled, .datetimepicker table tr td span.active[disabled], .datetimepicker table tr td span.active:hover[disabled], .datetimepicker table tr td span.active.disabled[disabled], .datetimepicker table tr td span.active.disabled:hover[disabled] {
background-color: #04c;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td span.active:active, .datetimepicker table tr td span.active:hover:active, .datetimepicker table tr td span.active.disabled:active, .datetimepicker table tr td span.active.disabled:hover:active, .datetimepicker table tr td span.active.active, .datetimepicker table tr td span.active:hover.active, .datetimepicker table tr td span.active.disabled.active, .datetimepicker table tr td span.active.disabled:hover.active {
background-color: #039;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker table tr td span.old {
color: #999;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker th.switch {
width: 145px;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker th span.glyphicon {
pointer-events: none;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker thead tr:first-child th, .datetimepicker tfoot th {
cursor: pointer;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.datetimepicker thead tr:first-child th:hover, .datetimepicker tfoot th:hover {
background: #eee;
}
/* line 9, app/assets/stylesheets/bootstrap-datetimepicker.min.css */
.input-append.date .add-on i, .input-prepend.date .add-on i, .input-group.date .input-group-addon span {
cursor: pointer;
width: 14px;
height: 14px;
}
/* BASICS */
/* line 3, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror {
@ -26125,7 +26481,7 @@ input.form-control {
flex: 3;
}
/* line 18, app/assets/stylesheets/admin.scss */
/* line 19, app/assets/stylesheets/admin.scss */
body {
width: 100vw;
height: 100vh;
@ -26140,28 +26496,28 @@ body {
overflow: hidden;
}
/* line 32, app/assets/stylesheets/admin.scss */
/* line 33, app/assets/stylesheets/admin.scss */
.simple_form .form-group .collection_radio_buttons {
margin-bottom: 0px;
}
/* line 36, app/assets/stylesheets/admin.scss */
/* line 37, app/assets/stylesheets/admin.scss */
.simple_form .form-group .form-check-inline {
height: calc(1.5em + 0.75rem + 2px);
}
/* line 42, app/assets/stylesheets/admin.scss */
/* line 43, app/assets/stylesheets/admin.scss */
input.form-control {
font-size: 14px;
}
/* line 46, app/assets/stylesheets/admin.scss */
/* line 47, app/assets/stylesheets/admin.scss */
.btn-default {
color: #666;
background: #e1e1e1 !important;
}
/* line 50, app/assets/stylesheets/admin.scss */
/* line 51, app/assets/stylesheets/admin.scss */
.export-absolute {
right: 20px;
position: absolute;

@ -16,9 +16,6 @@ class CompetitionMaxImg extends React.Component {
componentDidUpdate = (prevProps) => {
if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) {
// ////console.log("团队竞赛报名大图componentDidUpdate");
// ////console.log(this.props);
// ////console.log(this.props.GetenrollmentAPI);
this.setState({
GetenrollmentAPI: this.props.GetenrollmentAPI,
})

@ -62,13 +62,14 @@ class Registration extends React.Component {
itemid: undefined,
itemiddata: [],
pint: 0,
competition_name: undefined,
mutiple_limited: false,
}
}
componentDidMount() {
console.log(this.props);
// console.log(this.props);
// //////console.log("componentDidMount Registration");
// //// //////console.log("调用子组件 ");
@ -87,8 +88,8 @@ class Registration extends React.Component {
componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) {
console.log("componentDidUpdate");
console.log(this.props);
// console.log("componentDidUpdate");
// console.log(this.props);
////console.log("Registration");
////console.log("componentDidUpdate");
////console.log(this.props.user.admin);
@ -101,6 +102,7 @@ class Registration extends React.Component {
//获取报名配置API
GetenrollmentAPI = () => {
// console.log("调用了GetenrollmentAPI");
const url = `/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get((url)).then((result) => {
if (result) {
@ -114,6 +116,7 @@ class Registration extends React.Component {
enrolled: result.data.enrolled,
teacher_staff: result.data.teacher_staff,
member_staff: result.data.member_staff,
mutiple_limited: result.data.member_staff.mutiple_limited,
})
if (result.data.enroll_ended === true) {
this.setState({
@ -161,6 +164,7 @@ class Registration extends React.Component {
data: result.data.my_teams,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
} else {
//普通账号
@ -170,6 +174,7 @@ class Registration extends React.Component {
data: result.data.my_teams,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
}
} else {
@ -183,6 +188,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
} else {
@ -192,6 +198,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
}
@ -203,6 +210,7 @@ class Registration extends React.Component {
data: result.data.my_teams,
count: result.data.count,
personal: result.data.personal,
competition_name: result.data.competition_name
})
} else {
@ -212,6 +220,7 @@ class Registration extends React.Component {
data: result.data.my_teams,
count: result.data.count,
personal: result.data.personal,
competition_name: result.data.competition_name
})
}
@ -225,6 +234,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
@ -291,6 +301,7 @@ class Registration extends React.Component {
competition_teams: result.data.competition_teams,
data: result.data.my_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
} else {
@ -304,7 +315,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
} else {
@ -316,6 +327,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
}
@ -330,6 +342,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
}
@ -556,7 +569,7 @@ class Registration extends React.Component {
messageexitol: true
})
let url = `/competitions/${"gcc-task-2020"}/competition_teams/${this.state.itemid}/leave.json`;
let url = `/competitions/${this.props.match.params.identifier}/competition_teams/${this.state.itemid}/leave.json`;
axios.post(url).then((response) => {
if (response) {
if (response.data) {
@ -618,10 +631,10 @@ class Registration extends React.Component {
render() {
const {page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint} = this.state;
const {page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint, competition_name, mutiple_limited} = this.state;
return (
<div className="newMain clearfix ">
<div className="newMain clearfix newMainybot">
<div className={"educontent mb20 persmstyle"} style={{width: "1200px", marginTop: "26px"}}>
<style>
@ -645,8 +658,11 @@ class Registration extends React.Component {
{
tmodalsType === true ?
<PersonModal modalsType={tmodalsType} {...this.props} {...this.state} Newtit={Newtit}
mutiple_limited={mutiple_limited}
itemiddata={itemiddata} GetenrollmentAPI={GetenrollmentAPI}
Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}></PersonModal>
Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}
GetenrollmentAPIopens={() => this.GetenrollmentAPI()}
></PersonModal>
:
""
}
@ -664,21 +680,13 @@ class Registration extends React.Component {
: ""
}
{/*<div className="educontent mb20 ">*/}
{/* <p className="clearfix mb20 mt10">*/}
{/* <a className="btn colorgrey fl hovercolorblue ">在线竞赛</a>*/}
{/* <span className="color-grey-9 fl ml3 mr3">&gt;</span>*/}
{/* <a*/}
{/* className=" btn colorgrey fl hovercolorblue ">全国高校计算机大赛-项目挑战</a>*/}
{/* <span className="color-grey-9 fl ml3 mr3">&gt;</span>*/}
{/* <WordsBtn className="fl">报名</WordsBtn>*/}
{/* </p>*/}
{/*</div>*/}
<div style={{marginBottom: '12px'}}>
<Breadcrumb separator=">">
<Breadcrumb.Item href="/newcompetitions">在线竞赛</Breadcrumb.Item>
<Breadcrumb.Item href="">全国高校计算机大赛</Breadcrumb.Item>
<Breadcrumb.Item href="">报名</Breadcrumb.Item>
<Breadcrumb.Item
href={`/newcompetitions/${this.props.match.params.identifier}/common_header`}>{competition_name === undefined || competition_name === null || competition_name === "" ? "全国高校计算机大赛" : competition_name}</Breadcrumb.Item>
<Breadcrumb.Item>报名</Breadcrumb.Item>
</Breadcrumb>
</div>
{/*大图*/}

@ -6,6 +6,10 @@
.borders2 {
border: 1px solid #D9D9D9;
}
.newMainybot {
padding-bottom: 0px !important;
}
/*All*/
/*Registration.js*/
/*.registrationback {*/
@ -411,7 +415,7 @@
height: 22px;
width: 22px;
font-size: 21px !important;
margin-top: 21px;
margin-top: 19px;
color: #1C91E8;
}
@ -478,6 +482,7 @@
.packinputs button {
background: #459BE5;
width: 100% !important;
}
.packinputs {
@ -510,6 +515,13 @@
flex-direction: initial;
}
.reglistviewdivss2c {
display: flex;
flex-direction: initial;
cursor: not-allowed;
}
.reglistviewdivss2p {
width: 90px;
font-size: 12px;

@ -50,7 +50,8 @@ class PersonModal extends Component {
myteaherdata: [],
myshtudentdata: [],
Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
Thecurrentnumberstu: "",
}
@ -110,30 +111,30 @@ class PersonModal extends Component {
}
componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) {
////console.log("Registration.js componentDidUpdate");
////console.log(this.props);
// ////console.log(prevProps);
//identity职场称
//user_school学校
//real_name姓名
//type 类型
var data = [];
var datas = {
enrollable: false,
id: undefined,
name: this.props.user.real_name,
school_name: this.props.user.user_school,
student_id: null,
identity: this.props.user.user_identity,
type: "导师",
};
data.push(datas);
this.setState({
myuser: this.props.user,
mydatas: data,
})
}
// if (prevProps.user != this.props.user) {
// ////console.log("Registration.js componentDidUpdate");
// ////console.log(this.props);
// // ////console.log(prevProps);
// //identity职场称
// //user_school学校
// //real_name姓名
// //type 类型
// var data = [];
// var datas = {
// enrollable: false,
// id: undefined,
// name: this.props.user.real_name,
// school_name: this.props.user.user_school,
// student_id: null,
// identity: this.props.user.user_identity,
// type: "导师",
// };
// data.push(datas);
// this.setState({
// myuser: this.props.user,
// mydatas: data,
// })
// }
if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) {
////console.log("Registration.js GetenrollmentAPIcomponentDidUpdate");
@ -151,6 +152,7 @@ class PersonModal extends Component {
var myteaherdata = [];
var myshtudentdata = [];
var i = 0;
var s = 0;
for (var a = 0; a < mydatas.length; a++) {
if (mydatas[a].type === "导师") {
i++;
@ -163,6 +165,7 @@ class PersonModal extends Component {
// }
myteaherdata.push(mydatas[a].id);
} else if (mydatas[a].type === "队员") {
s++;
// var objectts = {
// enrollable: mydatas[a].enrollable,
// id: mydatas[a].id,
@ -174,7 +177,7 @@ class PersonModal extends Component {
}
}
//确认的时候 去确认老师人数是否符合
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.teacher_staff) {
@ -202,6 +205,35 @@ class PersonModal extends Component {
}
//确认的时候 去确认学生人数是否符合
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.member_staff) {
if (GetenrollmentAPI.member_staff.minimum > s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.member_staff.maximum < s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
}
}
}
} catch (e) {
}
// Thecurrentnumber
if (this.props.Newtit === true) {
//创建新的战队
@ -306,7 +338,8 @@ class PersonModal extends Component {
this.setState({
keywordteachers: e.target.value,
booltech: false,
Thecurrentnumberbool: false
Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
})
// try {
// if (e.target.value.length > 0) {
@ -345,8 +378,10 @@ class PersonModal extends Component {
this.setState({
keywordstudents: e.target.value,
boolstud: false,
Thecurrentnumberbool: false
Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
});
// try {
// if (e.target.value.length > 0) {
// this.setState({
@ -421,6 +456,19 @@ class PersonModal extends Component {
}
//点击获取学生数据2
getdatacpersondiv1Items2 = (object) => {
//
try {
if (this.props.GetenrollmentAPI.teacher_staff.mutiple_limited === true) {
if (object.enrollable === false) {
return
}
}
} catch (e) {
}
var datas = {
enrollable: object.enrollable,
id: object.id,
@ -627,7 +675,7 @@ class PersonModal extends Component {
})
}
deletedata = (item) => {
var {mydatas} = this.state;
var {mydatas, GetenrollmentAPI} = this.state;
if (item) {
var pos = mydatas.indexOf(item);
// ////console.log("deletedata");
@ -641,14 +689,118 @@ class PersonModal extends Component {
mydatas: mydatas,
})
}
var myteaherdata = [];
var myshtudentdata = [];
var i = 0;
var s = 0;
try {
for (var a = 0; a < mydatas.length; a++) {
if (mydatas[a].type === "导师") {
i = i + 1;
// var objectt = {
// enrollable: mydatas[a].enrollable,
// id: mydatas[a].id,
// identity: mydatas[a].identity,
// name: mydatas[a].name,
// school_name: mydatas[a].school_name,
// }
myteaherdata.push(mydatas[a].id);
} else if (mydatas[a].type === "队员") {
s = s + 1;
// var objectts = {
// enrollable: mydatas[a].enrollable,
// id: mydatas[a].id,
// name: mydatas[a].name,
// school_name: mydatas[a].school_name,
// student_id: mydatas[a].student_id,
// }
myshtudentdata.push(mydatas[a].id);
}
}
} catch (e) {
}
// console.log("deletedata");
// console.log(i);
//删除老师的时候判断是否符合人数
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.teacher_staff) {
if (GetenrollmentAPI.teacher_staff.minimum > i) {
this.setState({
Thecurrentnumberbool: true,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.teacher_staff.maximum < i) {
this.setState({
Thecurrentnumberbool: true,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
return
}
this.setState({
Thecurrentnumberbool: false,
Thecurrentnumber: i,
})
}
}
} catch (e) {
}
// debugger
//删除学生的时候判断是否符合人数
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.member_staff) {
if (GetenrollmentAPI.member_staff.minimum > s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.member_staff.maximum < s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
}
this.setState({
Thecurrentnumberboolstu: false,
Thecurrentnumberstu: s,
})
}
}
} catch (e) {
}
}
render() {
// console.log('Registration.js');
// console.log(this.props.mutiple_limited);
const {
addonAfter, Numberofteammentors, Thecurrentnumber, person1, person2,
keywordteachers, team_idteachers, teacher_ids,
keywordstudents, team_idstudents, student_ids,
member_ids, mydatas, booltech, boolstud, GetenrollmentAPI, Thecurrentnumberbool
member_ids, mydatas, booltech, boolstud, GetenrollmentAPI, Thecurrentnumberbool,
Thecurrentnumberboolstu, Thecurrentnumberstu
} = this.state;
//Modal
//keyboard是否支持键盘 esc 关闭
@ -778,14 +930,16 @@ class PersonModal extends Component {
var persondiv2Items = [];
if (member_ids) {
persondiv2Items = member_ids.map((item, index) =>
<a className="reglistviewdivss2 " key={index} style={{
<a
className={this.props.mutiple_limited === undefined || this.props.mutiple_limited === null ? "reglistviewdivss2 " : (this.props.mutiple_limited === true && item.enrollable === false ? "reglistviewdivss2c" : "reglistviewdivss2 ")}
key={index} style={{
width: "100%",
display: "flex",
justifyContent: " space-around",
alignItems: "center",
height: "40px",
}}
onClick={() => this.getdatacpersondiv1Items2(item)}
onClick={() => this.getdatacpersondiv1Items2(item)}
>
<p className=" cpersondiv1Items"
style={{
@ -805,13 +959,37 @@ class PersonModal extends Component {
width: "110px"
}}
>{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</p>
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
color: "#FF6800",
width: "87px"
}}
>{item.enrollable === false ? "" : "已加入其他战队"}</p>
{
this.props.mutiple_limited === undefined || this.props.mutiple_limited === null ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}}
>{""}</p>
:
(
this.props.mutiple_limited === true ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
color: "#FF6800",
width: "87px"
}}
>{item.enrollable === false ? "已加入其他战队" : ""}</p>
:
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}}
>{""}</p>
)
}
</a>
);
}
@ -1114,8 +1292,21 @@ class PersonModal extends Component {
) :
""
}
{
GetenrollmentAPI && GetenrollmentAPI.member_staff ?
(
Thecurrentnumberboolstu === true ?
<p style={{
marginLeft: "53px",
color: "#D0021B",
fontSize: "12px",
marginTop: "9px"
}}>战队队员为{GetenrollmentAPI.member_staff.minimum}-{GetenrollmentAPI.member_staff.maximum},现在为{Thecurrentnumberstu}</p>
: ""
) :
""
}
<div style={{
marginTop: "24px",

@ -16,6 +16,14 @@ function jsCopy() {
e.select();
document.execCommand("Copy");
codesuccess()
// const range=document.createRange();
// window.getSelection().removeAllRanges();
// range.selectNode(e.target);
// window.getSelection().addRange(range);
// const successful =document.execCommand('copy');
// if(successful){
// codesuccess()
// }
}
function codesuccess() {
@ -80,7 +88,7 @@ class PersonalCompetititem extends React.Component {
marginTop: "29px",
marginLeft: "37px"
}}>
<p style={{
<p className="maxnamewidth160" style={{
color: "#05101A",
fontSize: "16px",
@ -138,21 +146,22 @@ class PersonalCompetititem extends React.Component {
<div className=" " style={{
marginLeft: "37px",
}}>
<div style={{marginTop: "23px",}}>
<div style={{marginTop: "23px", width: '113px'}}>
<span style={{
color: "#05101A",
fontSize: "16px",
}}>邀请码</span>
<span
style={{
color: "#05101A",
color: "#05101A",
fontSize: "16px",
}}>{data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}</span>
</div>
<div style={{
overflow: 'hidden',
height: "0px",
width: "0px"
height: "1px",
width: "1px"
}}>
<input id="copy_invite_code"
value={data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}/>

Loading…
Cancel
Save