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

dev_auth
SylorHuang 5 years ago
commit 167c98daa2

@ -9,6 +9,7 @@
//= require bootstrap-notify //= require bootstrap-notify
//= require jquery.cookie.min //= require jquery.cookie.min
//= require select2 //= require select2
//= require moment.min
//= require jquery.cxselect //= require jquery.cxselect
//= require bootstrap-datepicker //= require bootstrap-datepicker
//= require bootstrap-datetimepicker //= require bootstrap-datetimepicker

@ -9,9 +9,9 @@ $(document).on('turbolinks:load', function(){
}; };
var timeOptions = { var timeOptions = {
autoclose: true, autoclose: 1,
language: 'zh-CN', language: 'zh-CN',
format: 'yyyy-mm-dd hh:ii:ss', format: 'yyyy-mm-dd hh:ii',
minuteStep: 30 minuteStep: 30
}; };
@ -23,18 +23,17 @@ $(document).on('turbolinks:load', function(){
$(element).find('.end-date').datepicker('setStartDate', e.date); $(element).find('.end-date').datepicker('setStartDate', e.date);
}); });
}; };
$(".competition-start-end-date .start-date").datetimepicker(timeOptions);
$(".competition-start-end-date .end-date").datetimepicker(timeOptions);
$(".nav-setting-form .enroll_end_time").datetimepicker(timeOptions);
// var defineTimeRangeSelect = function (element) { $(".stage-update-form .section-start-time").datetimepicker(timeOptions);
// var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, timeOptions); $(".stage-update-form .section-end-time").datetimepicker(timeOptions);
// $(element).datetimepicker(options);
//
// $(element).find('.start-date').datetimepicker().on('changeDate', function (e) {
// $(element).find('.end-date').datetimepicker('setStartDate', e.date);
// });
// };
defineDateRangeSelect('.teaching-mode-date'); defineDateRangeSelect('.teaching-mode-date');
defineDateRangeSelect('.competition-start-end-date'); // defineTimeRangeSelect('.competition-start-end-date');
var $basicForm = $('form.basic-setting-form'); var $basicForm = $('form.basic-setting-form');
@ -59,13 +58,13 @@ $(document).on('turbolinks:load', function(){
if ($("input[name='mode']:checked").val() == 2) { if ($("input[name='mode']:checked").val() == 2) {
var $courseId = $("input[name='course_id'"); 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'); $courseId.addClass('danger text-danger');
valid = false; valid = false;
} else { } else {
$courseId.removeClass('danger text-danger'); $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 $techStartTime = $("input[name='teach_start_time'");
var $techEndTime = $("input[name='teach_end_time'"); var $techEndTime = $("input[name='teach_end_time'");
if ($techStartTime.val() === undefined || $techStartTime.val().length === 0) { if ($techStartTime.val() === undefined || $techStartTime.val().length === 0) {
@ -81,6 +80,10 @@ $(document).on('turbolinks:load', function(){
} else { } else {
$techEndTime.removeClass('danger text-danger'); $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; if (!valid) return;
@ -104,97 +107,614 @@ $(document).on('turbolinks:load', function(){
} }
}); });
}); });
var selectOptions = {
theme: 'bootstrap4',
placeholder: '请输入要添加的单位名称',
multiple: true,
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/api/schools/for_option.json',
dataType: 'json',
data: function(params){
return { keyword: params.term };
},
processResults: function(data){
return { results: data.schools }
}
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return item.name || item.text;
},
templateSelection: function(item){
return item.name || item.text;
}
};
$('.sponsor-select').select2(selectOptions);
$('.allow-school-select').select2(selectOptions);
// 排行榜
//链接
$(".nav-setting-form").on("click",".add_linkBtn",function () {
var length=$(".nav-setting-form").find(".linkFormItem").length + 1;
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 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="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(".linkFormItem").after(html);
});
$(".nav-setting-form").on("click", ".del_linkBtn", function () {
$(this).parents(".linkFormItem").remove();
});
//有关报名要求
$(".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="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="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="competition_staffs[][category]">\n' +
' <option value="student">学生</option>\n' +
' <option value="teacher">教师</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" 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" 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' +
' <i class="fa fa-times-circle font-20 color-grey-c"></i>\n' +
' </a>\n' +
' </div>\n' +
' </div>';
$("#requireForm").append(html);
});
$("#requireForm").on("click",".delRequrieBtn",function () {
$(this).parents(".requireForm_item").remove();
});
$('.competition-staff-settings').on('click', '.mutiple-limited-radio', function(){
var radio = $(this);
if (radio.is(':checked')) {
radio.parent().parent().siblings().find('.mutiple-limited-radio').attr('checked', false)
} 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);
}
});
});
// 排行榜设置
//删除小阶段
$("#large_panel").on("click",".small_panel_item_del",function () {
var list = $(this).parents(".small_panel");
$(this).parents(".small_panel_item").remove();
for(var i=0;i < $(list).find(".subName").length;i++){
console.log(i);
$(list).find(".subName").eq(i).html("第"+parseInt(i+1)+"阶段");
}
});
// $('form.stage-update-form').validate({
// errorElement: 'span',
// errorClass: 'danger text-danger',
// rules: {
// stage_name: "required",
// "stage[][start_time]": "required",
// "stage[][end_time]": "required",
// "stage[][mission_count]": {
// required: true,
// min: 1
// },
// "stage[][entry]": {
// required: true,
// min: 1
// },
// score_rate: {
// required: true,
// range: [0, 100]
// }
// },
// messages: {
// "stage[][mission_count]": {
// min: ">=1"
// },
// "stage[][entry]": {
// min: ">=1"
// },
// }
// });
$('.competition-chart-setting').on('click', ".update-stage", function () {
var updateForm = $(this).parents("form");
$(this).attr('disabled', 'disabled');
updateForm.find('.error').html('');
// var valid = updateForm.valid();
var valid = true;
var $stageName = updateForm.find('input[name="stage_name"]');
if($stageName.val() === undefined || $stageName.val().length === 0){
$stageName.addClass('danger text-danger');
valid = false;
} else {
$stageName.removeClass('danger text-danger');
}
var $scoreRate = updateForm.find('input[name="score_rate"]');
if($scoreRate.val() === undefined || $scoreRate.val().length === 0){
$scoreRate.addClass('danger text-danger');
valid = false;
} else if (parseInt($scoreRate.val()) > 100 || parseInt($scoreRate.val()) < 0) {
$scoreRate.addClass('danger text-danger');
$scoreRate.after('<span class="danger text-danger">0-100之间的数值</span>');
valid = false;
} else {
$scoreRate.removeClass('danger text-danger');
$scoreRate.siblings().remove();
}
updateForm.find('input[name="stage[][start_time]"]').each(function(_, e){
var $ele = $(e);
if($ele.val() === undefined || $ele.val().length === 0){
$ele.addClass('danger text-danger');
valid = false;
} else {
$ele.removeClass('danger text-danger');
}
});
updateForm.find('input[name="stage[][end_time]"]').each(function(_, e){
var $ele = $(e);
if($ele.val() === undefined || $ele.val().length === 0){
$ele.addClass('danger text-danger');
valid = false;
} else {
$ele.removeClass('danger text-danger');
}
});
updateForm.find('input[name="stage[][mission_count]"]').each(function(i, e){
var $ele = $(e);
var $entry = updateForm.find('input[name="stage[][entry]"]').eq(i);
if($ele.val() === undefined || $ele.val().length === 0){
$ele.addClass('danger text-danger');
valid = false;
} else if (parseInt($ele.val()) < 1) {
$ele.addClass('danger text-danger');
$ele.after('<span class="danger text-danger">大于等于1</span>');
valid = false;
} else if (parseInt($ele.val()) > parseInt($entry.val())) {
$ele.addClass('danger text-danger');
$ele.after('<span class="danger text-danger">不能大于总任务数</span>');
valid = false;
} else {
$ele.removeClass('danger text-danger');
$ele.siblings().remove();
}
});
updateForm.find('input[name="stage[][entry]"]').each(function(_, e){
var $ele = $(e);
if($ele.val() === undefined || $ele.val().length === 0){
$ele.addClass('danger text-danger');
valid = false;
} else if (parseInt($ele.val()) < 1) {
$ele.addClass('danger text-danger');
$ele.after('<span class="danger text-danger">大于等于1</span>');
valid = false;
} else {
$ele.removeClass('danger text-danger');
$ele.siblings().remove();
}
});
updateForm.find('input[name="stage[][identifiers][]"]').each(function(_, e){
var $ele = $(e);
if($ele.val() === undefined || $ele.val().length === 0){
$ele.addClass('danger text-danger');
valid = false;
} else {
$ele.removeClass('danger text-danger');
}
});
if (!valid) return;
updateForm.find('input[name="stage[][mission_count]"]').each(function(_, e){
var $missionCount = $(e);
var $entryCount = $(e).parents("div.row").find('input[name="stage[][mission_count]"]');
if(parseInt($missionCount.val()) > parseInt($entryCount.val()) ){
$missionCount.addClass('danger text-danger');
$missionCount.after('<span class="danger text-danger">不能大于总任务数</span>');
valid = false;
} else {
$missionCount.removeClass('danger text-danger');
$missionCount.siblings().remove();
}
});
$.ajax({
method: 'POST',
dataType: 'json',
url: updateForm.attr('action'),
data: new FormData(updateForm[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);
}
});
});
$(".competition-chart-stages").on("click", ".add-new-tab", function () {
if($(".new-stage-form").length > 0){
alert("请先保存上一个tab");
} else {
var count = parseInt($("#large_panel").find(".large_panel_part").length)+1;
var html = '<form class="stage-update-form new-stage-form flex-1" action="/admins/competitions/'+$(this).attr("data-competition-id")+'/competition_stages" accept-charset="UTF-8" data-remote="true" method="post">' +
'<div class="large_panel_part" attr_line="'+count+'"><div class="row d-flex mt-3">\n' +
' <span class="col-1 mt-2">tab标题</span>\n' +
' <div class="col-2 no_padding">\n' +
' <input type="text" class="form-control" name="stage_name"/>\n' +
' </div>\n' +
' <span class="col-1 text-right mt-2 no_padding">总排行榜占比:</span>\n' +
' <div class="col-1 no_padding">\n' +
' <input type="number" class="form-control" name="score_rate" value="100"/>\n' +
' </div><span class=" mt-2">%</span>\n' +
' <div class="flex-1">\n' +
' <a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add-task-sub">新增子阶段</a>\n' +
' </div>\n' +
' <a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>\n' +
' <a href="javascript:void(0)" class="btn btn-outline-primary update-stage export-action ml20">保存</a>\n' +
' </div>\n' +
' <div id="small_panel_'+count+'" class="small_panel">\n' +
' <div class="row d-flex small_panel_item" attr_line="sub_new_new" count="1">\n' +
' <span class="col-1 mt-2 subName">第1阶段</span>\n' +
' <div class="flex-1">\n' +
' <div class="row">\n' +
' <span class="mt-2 ml20">有效时间:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <input type="text" name="stage[][start_time]" id="stage__start_time" value="" autocomplete="off" class="section-start-time form-control" placeholder="有效开始时间">\n' +
' </div>\n' +
' <span class="mt-2">~</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <input type="text" name="stage[][end_time]" id="stage__end_time" value="" autocomplete="off" class="section-end-time form-control" placeholder="有效结束时间">\n' +
' </div>\n' +
' <span class="col-2 text-right mt-2 no_padding">任务完成要求:</span>\n' +
' <div class="col-1 no_padding input_small">\n' +
' <input type="number" class="form-control" name="stage[][mission_count]" value="1">\n' +
' </div>\n' +
' <span class="mt-2 ml10 mr10">/</span>\n' +
' <div class="col-1 no_padding input_small">\n' +
' <input type="number" class="form-control task_all" onchange="change_total(this)" value="3" name="stage[][entry]">\n' +
' </div>\n' +
' <span class=" mt-2">(总任务)</span>\n' +
' <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <select class="form-control" name="stage[][score_source]">\n' +
' <option value="0">经验值</option>\n' +
' <option value="1">预测准确率</option>\n' +
' </select>\n' +
' </div>\n' +
' </div>\n' +
' <div class="row mt-2" id="task_Input_sub_new_new">\n' +
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务1</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务2</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务3</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' <span>\n' +
' <a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a>\n' +
' </span>\n' +
' </div>\n' +
'</div></div></form>';
$("#large_panel").append(html);
$(".stage-update-form .section-start-time").datetimepicker(timeOptions);
$(".stage-update-form .section-end-time").datetimepicker(timeOptions);
}
});
//新增子阶段
$(".competition-chart-stages").on("click", ".add-task-sub", function () {
var index = $(this).parents(".large_panel_part").attr("attr_line");
var count= 0;
console.log("sdfsf");
console.log($("#small_panel_"+index).find(".small_panel_item").length > 0);
if($("#small_panel_"+index).find(".small_panel_item").length > 0){
count = parseInt($("#small_panel_"+index).find(".small_panel_item").last().attr("count")) + 1;
console.log($("#small_panel_"+index).find(".small_panel_item").last().attr("count"));
}else{
count = 1;
}
var showCount=parseInt($("#small_panel_"+index).find(".small_panel_item").length) + 1;
var html='<div class="row d-flex small_panel_item" attr_line="sub_'+index+'_'+count+'" count="'+count+'">\n' +
' <span class="col-1 mt-2 subName">第'+showCount+'阶段</span>\n' +
' <div class="flex-1">\n' +
' <div class="row">\n' +
' <span class="mt-2 ml20">有效时间:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <input type="text" name="stage[][start_time]" id="stage__start_time" value="" autocomplete="off" class="section-start-time form-control" placeholder="有效开始时间">\n' +
' </div>\n' +
' <span class="mt-2">~</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <input type="text" name="stage[][end_time]" id="stage__end_time" value="" autocomplete="off" class="section-end-time form-control" placeholder="有效结束时间">\n' +
' </div>\n' +
' <span class="col-2 text-right mt-2 no_padding">任务完成要求:</span>\n' +
' <div class="col-1 no_padding input_small">\n' +
' <input type="number" class="form-control" name="stage[][mission_count]" value="1">\n' +
' </div>\n' +
' <span class="mt-2 ml10 mr10">/</span>\n' +
' <div class="col-1 no_padding input_small">\n' +
' <input type="number" class="form-control task_all" onchange="change_total(this)" value="3" name="stage[][entry]">\n' +
' </div>\n' +
' <span class=" mt-2">(总任务)</span>\n' +
' <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <select class="form-control" name="stage[][score_source]">\n' +
' <option value="0">经验值</option>\n' +
' <option value="1">预测准确率</option>\n' +
' </select>\n' +
' </div>\n' +
' </div>\n' +
' <div class="row mt-2" id="task_Input_sub_'+index+'_'+count+'">\n'+
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务1</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务2</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务3</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' <span>\n' +
' <a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a>\n' +
' </span>\n' +
' </div>';
$("#small_panel_"+index).append(html);
$(".stage-update-form .section-start-time").datetimepicker(timeOptions);
$(".stage-update-form .section-end-time").datetimepicker(timeOptions);
});
} }
}); });
//添加主办方或者开放范围
function addSponsor(item){
var html='<div class="sponsor_label">\n' +
' <input type="hidden" value="school_id" />\n' +
' <span>caicai</span>\n' +
' <a href="javascript:void(0)" onclick="del_sponsor(this)">×</a>\n' +
' </div>';
$(item).parents(".sponsorPanel").append(html);
}
//删除
function del_sponsor(item){
$(item).parents(".sponsor_label").remove();
}
$(function () { // 小阶段修改总任务数
//MD编辑 function change_total(item) {
$("#MD_typeFrom").on("click",".add_MD_type",function () { var count=parseInt($(item).val());
var length=$(".MD_type").find(".add_MD_type").length + 1;
var html='<div class="row MD_type mt-2">\n' + var index = $(item).parents(".small_panel_item").attr("attr_line");
' <div class="col-1 text-right">\n' + var indexLarge = $(item).parents(".large_panel_part").attr("attr_line");
' <label class="checkbox checkbox-primary mt-1">\n' + console.log(indexLarge);
' <input id="checkbox_MD_'+length+'" type="checkbox" name="checkbox_MD_'+length+'">\n' + console.log(index);
' <label for="checkbox_MD_'+length+'">&nbsp;</label>\n' +
' </label>\n' + var divCount=parseInt($("#task_Input_"+index).find(".task_Input_div").length);
' </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' + var html = "";
' <button class="btn btn-primary waves-effect waves-light btn-xs setBtn_s add_MD_type">+</button>\n' + if(count > divCount){
' <button class="btn btn-icon waves-effect btn-default waves-light setBtn_s ml10 del_MD_type">×</button>\n' + for(var i=0;i < count-divCount ;i++){
' </div>'; html+='<div class="col-4 row task_Input_div"><span class="col-3 text-center mt-3">任务'+(divCount+i+1)+'</span>\n' +
$("#MD_typeFrom").append(html); '<div class="col-8">\n' +
}) '<input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
$("#MD_typeFrom").on("click",".del_MD_type",function () { '</div>\n' +
$(this).parents(".MD_type").remove(); '</div>';
}) }
$("#task_Input_"+index).append(html);
}else{
//链接 var delCount = divCount - count ;
$("#linkForm").on("click",".add_linkBtn",function () { console.log(divCount);
var length=$("#linkForm").find(".linkFormItem").length + 1; console.log(count);
var html='<div class="row mt-2 lineFromItem">\n' + var _max=parseInt($("#task_Input_"+index).find(".task_Input_div:last").index());
' <div class="col-1 text-right">\n' +
' <label class="checkbox checkbox-primary mt-1">\n' + console.log(_max);
' <input id="link_'+length+'" type="checkbox" name="link_'+length+'" />\n' + var _get= _max - delCount;
' <label for="link_'+length+'">&nbsp;</label>\n' +
' </label>\n' + console.log(_get);
' </div>\n' + if(count == 0){
' <div class="col-md-label mt-1"><input type="text" name="link_name_'+length+'" class="form-control"></div>\n' + $("#task_Input_"+index).empty();
' <div class="col-md-1 mt-1"><input type="text" name="link_index_'+length+'" class="form-control"></div>\n' + }else{
' <div class="col-md-3 mt-1"><input type="text" name="link_info_'+length+'" class="form-control"></div>\n' + $("#task_Input_"+index).find(".task_Input_div:gt("+_get+")").remove();
' <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>' }
$("#linkForm").append(html)
}) }
$("#linkForm").on("click",".del_linkBtn",function () {
$(this).parents(".lineFromItem").remove(); //删除tab
}) function Del_tab(item) {
$(item).parents(".large_panel_part").remove();
//有关报名要求 }
$("#addRequireBtn").on("click",function () { //新增tab
var length=$("#requireForm").find(".requireForm_item").length + 1; function addNewTab(competition_id) {
var html='<div class="row mt-2 mb-4 requireForm_item">\n' + if($(".new-stage-form").length > 0){
' <div class="col-1 text-right">&nbsp;&nbsp;</div>\n' + alert("请先保存上一个tab");
' <div class="col-1 text-left mt-1">\n' + } else {
' <input type="text" class="form-control" name="min_'+length+'" />\n' + var count = parseInt($("#large_panel").find(".large_panel_part").length)+1;
' </div>\n' + var html = '<form class="stage-update-form new-stage-form flex-1" action="/admins/competitions/'+competition_id+'/competition_stages" accept-charset="UTF-8" data-remote="true" method="post">' +
' <span class="mt-2">~</span>\n' + '<div class="large_panel_part" attr_line="'+count+'"><div class="row d-flex mt-3">\n' +
' <div class="col-1 mt-1">\n' + ' <span class="col-1 mt-2">tab标题</span>\n' +
' <input type="text" class="form-control" name="max_'+length+'" />\n' + ' <div class="col-2 no_padding">\n' +
' </div>\n' + ' <input type="text" class="form-control" name="stage_name"/>\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>\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' +
' <label for="require_'+length+'_1">可多次报名</label>\n' +
' </label>\n' +
' </div>\n' + ' </div>\n' +
' <div class="col-2 mt-1">\n' + ' <span class="col-1 text-right mt-2 no_padding">总排行榜占比:</span>\n' +
' <label class="radio checkbox-primary mt-1" value="require_'+length+'_2">\n' + ' <div class="col-1 no_padding">\n' +
' <input id="require_'+length+'_2" name="require_1" type="radio">\n' + ' <input type="number" class="form-control" name="score_rate" value="100"/>\n' +
' <label for="require_'+length+'_2">不可多次报名</label>\n' + ' </div><span class=" mt-2">%</span>\n' +
' </label>\n' + ' <div class="flex-1">\n' +
' <a href="javascript:void(0)" class="ml20 delRequrieBtn">\n' + ' <a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add-task-sub">新增子阶段</a>\n' +
' <i class="fa fa-times-circle font-20 color-grey-c"></i>\n' +
' </a>\n' +
' </div>\n' + ' </div>\n' +
' </div>'; ' <a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>\n' +
$("#requireForm").append(html); ' <a href="javascript:void(0)" class="btn btn-outline-primary update-stage export-action ml20">保存</a>\n' +
}) ' </div>\n' +
' <div id="small_panel_'+count+'" class="small_panel">\n' +
$("#requireForm").on("click",".delRequrieBtn",function () { ' <div class="row d-flex small_panel_item" attr_line="sub_new_new" count="1">\n' +
$(this).parents(".requireForm_item").remove(); ' <span class="col-1 mt-2 subName">第1阶段</span>\n' +
}) ' <div class="flex-1">\n' +
}) ' <div class="row">\n' +
' <span class="mt-2 ml20">有效时间:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <input type="text" name="stage[][start_time]" id="stage__start_time" value="" autocomplete="off" class="section-start-time form-control" placeholder="有效开始时间">\n' +
' </div>\n' +
' <span class="mt-2">~</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <input type="text" name="stage[][end_time]" id="stage__end_time" value="" autocomplete="off" class="section-end-time form-control" placeholder="有效结束时间">\n' +
' </div>\n' +
' <span class="col-2 text-right mt-2 no_padding">任务完成要求:</span>\n' +
' <div class="col-1 no_padding input_small">\n' +
' <input type="number" class="form-control" name="stage[][mission_count]" value="1">\n' +
' </div>\n' +
' <span class="mt-2 ml10 mr10">/</span>\n' +
' <div class="col-1 no_padding input_small">\n' +
' <input type="number" class="form-control task_all" onchange="change_total(this)" value="3" name="stage[][entry]">\n' +
' </div>\n' +
' <span class=" mt-2">(总任务)</span>\n' +
' <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' <select class="form-control" name="stage[][score_source]">\n' +
' <option value="0">经验值</option>\n' +
' <option value="1">预测准确率</option>\n' +
' </select>\n' +
' </div>\n' +
' </div>\n' +
' <div class="row mt-2" id="task_Input_sub_new_new">\n' +
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务1</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务2</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
' <div class="col-4 row task_Input_div">\n' +
' <span class="col-3 text-center mt-3">任务3</span>\n' +
' <div class="col-8">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' <span>\n' +
' <a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a>\n' +
' </span>\n' +
' </div>\n' +
'</div></div></form>';
$("#large_panel").append(html);
}
}

@ -1,6 +1,6 @@
$(document).on('turbolinks:load', function() { $(document).on('turbolinks:load', function() {
if($('body.admins-enroll-lists-index-page').length > 0){ if($('body.admins-enroll-lists-index-page').length > 0){
let search_form = $(".search-form"); var search_form = $(".search-form");
//导出 //导出
$(".competition-enroll-list-form").on("click","#enroll-lists-export",function () { $(".competition-enroll-list-form").on("click","#enroll-lists-export",function () {
window.location.href = "/admins/competitions/"+$(this).attr("data-competition-id")+"/enroll_lists/export.xlsx?" + search_form.serialize(); window.location.href = "/admins/competitions/"+$(this).attr("data-competition-id")+"/enroll_lists/export.xlsx?" + search_form.serialize();

@ -135,7 +135,7 @@ $(document).on('turbolinks:load', function() {
}, },
templateResult: function (item) { templateResult: function (item) {
if(!item.id || item.id === '') return item.text; if(!item.id || item.id === '') return item.text;
return item.real_name; return $("<span>" + item.real_name + " <span class='font-12'>" + item.school_name + ' ' + item.hidden_phone + "</span></span>");
}, },
templateSelection: function(item){ templateSelection: function(item){
if (item.id) { if (item.id) {

@ -5,7 +5,7 @@ $(document).on('turbolinks:load', function() {
allowClear: true allowClear: true
}); });
let search_form = $(".search-form"); var search_form = $(".search-form");
//导出 //导出
$(".shixuns-list-form").on("click","#shixuns-export",function () { $(".shixuns-list-form").on("click","#shixuns-export",function () {
window.location.href = "/admins/shixuns.xls?" + search_form.serialize(); window.location.href = "/admins/shixuns.xls?" + search_form.serialize();

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

File diff suppressed because it is too large Load Diff

@ -11,6 +11,7 @@
//= require select2 //= require select2
//= require jquery.cxselect //= require jquery.cxselect
//= require bootstrap-datepicker //= require bootstrap-datepicker
//= require bootstrap-datetimepicker
//= require bootstrap.viewer //= require bootstrap.viewer
//= require jquery.mloading //= require jquery.mloading
//= require jquery-confirm.min //= require jquery-confirm.min

@ -27,7 +27,7 @@ $(document).on('turbolinks:load', function() {
}, },
templateResult: function (item) { templateResult: function (item) {
if(!item.id || item.id === '') return item.text; if(!item.id || item.id === '') return item.text;
return item.real_name + "--" + item.identity; return $("<span>" + item.real_name + " <span class='font-12'>" + item.school_name + ' ' + item.hidden_phone + "</span></span>");
}, },
templateSelection: function(item){ templateSelection: function(item){
if (item.id) { if (item.id) {

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

File diff suppressed because one or more lines are too long

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

@ -37,6 +37,55 @@
} }
.setBtn_s{ .setBtn_s{
height: 35px; height: 35px;
line-height: 5px; line-height: 20px;
}
.sponsor_label{
border:1px solid #4CACFF;
border-radius: 5px;
background-color: rgba(76,172,255,0.3);
color: #333;
padding:0px 4px;
height: 30px;
line-height: 30px;
float: left;
margin: 4px 5px;
span{
display: block;
float: left;
height: 28px;
line-height: 28px;
margin-right: 5px;
}
a{
font-size: 18px;
float: left;
height: 28px;
line-height: 28px;
}
}
.large_panel{
padding:0px 15px;
.large_panel_part{
border-top: 1px solid #eaeaea;
}
.large_panel_part:first-child{
border:none;
}
.large_panel_part >.row ,.small_panel >.row{
border-bottom: 1px solid #eaeaea;
padding:20px 0px;
}
.small_panel{
margin-left: 20px;
}
.row:last-child{
border:none;
}
} }
} }

File diff suppressed because one or more lines are too long

@ -29,7 +29,8 @@ input.form-control {
.flex-1 { .flex-1 {
flex: 1; flex: 1;
} }
.fl{float: left}
.no_padding{padding: 0px!important;}
.font-12 { font-size: 12px !important; } .font-12 { font-size: 12px !important; }
.font-14 { font-size: 14px !important; } .font-14 { font-size: 14px !important; }
.font-16 { font-size: 16px !important; } .font-16 { font-size: 16px !important; }
@ -48,6 +49,10 @@ input.form-control {
.position-r{position:relative;} .position-r{position:relative;}
.color-grey-c{color:#ccc} .color-grey-c{color:#ccc}
.color-blue{color:#4CACFF} .color-blue{color:#4CACFF}
.color-orange{color: #ff6800}
.inline-block{display:inline-block;} .inline-block{display:inline-block;}
.hide{display: none;} .hide{display: none;}
.show{display: block;} .show{display: block;}
.input_small{flex: 0 0 6%!important;}
.input_middle{flex:0 0 13%!important;}

@ -20,10 +20,14 @@ class Admins::CompetitionSettingsController < Admins::BaseController
end end
def basic_form_params def basic_form_params
params.permit(:identifier, :name, :sub_title, :start_time, :end_time, :mode, :identifier, :bonus, :awards_count, :description, :course_id, :teach_start_time, :teach_end_time) params.permit(:identifier, :name, :sub_title, :start_time, :end_time, :mode,
:identifier, :bonus, :awards_count, :description, :course_id, :teach_start_time,
:teach_end_time, sponsor_schools: [], region_schools: [])
end end
def nav_form_params def nav_form_params
params.permit(:enroll_end_time, competition_staffs: %i[category minimum maximum mutiple_limited], nav_module: %i[module_type name hidden position url]) params.permit(:enroll_end_time,
competition_staffs: %i[category minimum maximum mutiple_limited],
navbar: %i[module_type name hidden position url])
end end
end end

@ -1,76 +1,46 @@
class Admins::CompetitionStagesController < Admins::BaseController class Admins::CompetitionStagesController < Admins::BaseController
def create def create
if @competition.competition_stages.exists?(name: params[:stage_name]) Admins::CompetitionStageCreateService.call(current_competition, update_form_params)
render_error "已存在同名的阶段" render_ok
else
@competition.competition_stages << CompetitionStage.new(name: params[:stage_name])
render_ok
end
end end
def update def update
current_stage.update_attributes!(name: params[:stage_name], score_rate: params[:score_rate]) Admins::CompetitionStageUpdateService.call(current_competition, update_form_params, current_stage)
render_ok render_ok
end end
def destroy def destroy
current_stage.destroy! current_stage.destroy!
render_ok
end end
def create_stage_section def calculate_stage_score
ActiveRecord::Base.transaction do if current_stage.max_end_time && current_stage.max_end_time < Time.now
new_section = CompetitionStageSection.create!(competition_id: current_stage.competition_id, competition_stage_id: current_stage.id,
start_time: params[:new_start_time], end_time: params[:new_end_time], else
entry: params[:entry], mission_count: params[:mission_count], score_source: params[:score_source]) render_error("#{current_stage.name}还未结束")
unless params[:shixun_identifiers].blank?
params[:shixun_identifiers].each do |identifier|
new_section.competition_entries << CompetitionEntry.new(competition_stage_id: current_stage.id, shixun_identifier: identifier)
end
end
render_ok
end end
end end
def update_stage_section def send_message
ActiveRecord::Base.transaction do if current_stage.max_end_time && current_stage.max_end_time > Time.now
section = current_stage.competition_stage_sections.find_by!(id: params[:section_id]) User.where(id: TeamMember.where(competition_team_id: current_competition.competition_teams.pluck(:id)).pluck(:user_id).uniq).each do |user|
if section.present? name = current_competition.name + "#{current_competition.sub_title}#{stage.name}"
section_entries = section.competition_entries begin
if !params[:shixun_identifiers] if user.phone.present?
section_entries.destroy_all Educoder::Sms.send(mobile: user.phone.to_s, code: '1', send_type:'competition_start', user_name:user.show_name,
else name:name, result:section.start_time.strftime('%Y-%m-%d %H:%M:%S'))
if params[:shixun_identifiers].length < section_entries.size
section_entries[params[:shixun_identifiers].length, section_entries.size - 1].each(&:destroy)
end
params[:shixun_identifiers].each_with_index do |identifier, index|
entry = section_entries[index]
if entry.present?
entry.update_attributes!(shixun_identifier: identifier)
else
section.competition_entries << CompetitionEntry.new(competition_stage_id: current_stage.id, shixun_identifier: identifier)
end
end end
rescue => e
logger_error(e)
render_error("发送验证码出错")
end end
section.update_attributes!(start_time: params[:new_start_time], end_time: params[:new_end_time],
entry: params[:entry], mission_count: params[:mission_count], score_source: params[:score_source])
render_ok
end end
else
render_error("#{current_stage.name}已结束")
end end
end end
def destroy_stage_section
section = current_stage.competition_stage_sections.find_by!(id: params[:section_id])
section.destroy!
render_ok
end
def calculate_stage_score
end
private private
def current_competition def current_competition
@ -78,6 +48,11 @@ class Admins::CompetitionStagesController < Admins::BaseController
end end
def current_stage def current_stage
@_current_stage ||= CompetitionStage.find_by!(competition_id: params[:competition_id], id: params[:stage_id]) @_current_stage ||= CompetitionStage.find_by!(competition_id: params[:competition_id], id: params[:id])
end end
def update_form_params
params.permit(:stage_name, :score_rate, stage: [:start_time, :end_time, :mission_count, :entry, :score_source, identifiers: []])
end
end end

@ -1,11 +1,10 @@
class Admins::CompetitionsController < Admins::BaseController class Admins::CompetitionsController < Admins::BaseController
include CustomSortable
before_action :find_competition, except: [:index] before_action :find_competition, except: [:index]
def index def index
params[:sort_by] = params[:sort_by].presence || 'created_on' # params[:sort_by] = params[:sort_by].presence || 'created_at'
params[:sort_direction] = params[:sort_direction].presence || 'desc' # params[:sort_direction] = params[:sort_direction].presence || 'desc'
@competitions = custom_sort Competition.all, params[:sort_by], params[:sort_direction] @competitions = Competition.all.order("created_at desc")
@params_page = params[:page] || 1 @params_page = params[:page] || 1
@competitions = paginate @competitions @competitions = paginate @competitions
ids = @competitions.map(&:id) ids = @competitions.map(&:id)

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

@ -59,6 +59,7 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController
end end
def index def index
@competition = current_competition
@personal = current_competition.personal? @personal = current_competition.personal?
if admin_or_business? if admin_or_business?
all_competition_teams all_competition_teams
@ -115,11 +116,13 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController
keyword = params[:keyword].to_s.strip keyword = params[:keyword].to_s.strip
if keyword.present? if keyword.present?
teams = teams.joins(users: { user_extension: :school }).where('schools.name LIKE ?', "%#{keyword}%") teams = teams.joins(user: { user_extension: :school })
.where('competition_teams.name LIKE :keyword OR schools.name LIKE :keyword', keyword: "%#{keyword}%")
end end
@all_count = teams.count @all_count = teams.count
@all_teams = paginate(teams.includes(:user, users: { user_extension: :school })) @all_teams = paginate(teams.includes(:user, users: { user_extension: :school }))
@all_member_count = teams.joins(:team_members).count
end end
def user_competition_teams def user_competition_teams
@ -135,7 +138,7 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController
def tech_mode def tech_mode
# render_not_found if current_competition.mode != 3 # render_not_found if current_competition.mode != 3
@team = current_competition.competition_teams.find_by(id: params[:id]) @team = current_competition.competition_teams.find_by!(id: params[:id])
end end
def get_valid_myshixun_count(ids) def get_valid_myshixun_count(ids)

@ -13,7 +13,7 @@ class Competitions::CompetitionsController < Competitions::BaseController
competitions = competitions =
case params[:category] case params[:category]
when 'nearly_published' then competitions.where(status: false) when 'nearly_published' then competitions.where(status: false)
when 'progressing' then competitions.where('end_time > NOW()') when 'progressing' then competitions.where('status = 1 and end_time > NOW()')
when 'ended' then competitions.where('end_time < NOW()') when 'ended' then competitions.where('end_time < NOW()')
else competitions else competitions
end end
@ -30,6 +30,8 @@ class Competitions::CompetitionsController < Competitions::BaseController
def show def show
@competition = current_competition @competition = current_competition
current_competition.increment(:visits)
end end
def update def update
@ -69,13 +71,16 @@ class Competitions::CompetitionsController < Competitions::BaseController
end end
def update_md_content def update_md_content
tip_exception("标题和内容不能为空") if params[:name].blank? || params[:content].blank? tip_exception("内容不能为空") if params[:content].blank?
tip_exception("缺少competition_module_id") if params[:competition_module_id].blank?
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
com_module = current_competition.competition_modules.find_by!(id: params[:competition_module_id])
if params[:md_content_id] if params[:md_content_id]
md_content = CompetitionModuleMdContent.find_by!(id: params[:md_content_id]) md_content = CompetitionModuleMdContent.find_by!(id: params[:md_content_id], competition_module_id: com_module.id)
md_content.update_attributes!(name: params[:name], content: params[:content]) md_content.update_attributes!(name: params[:name], content: params[:content])
else else
md_content = CompetitionModuleMdContent.create!(name: params[:name], content: params[:content]) stage = current_competition.competition_stages.find_by(id: params[:stage_id]) if params[:stage_id]
md_content = CompetitionModuleMdContent.create!(name: params[:name], content: params[:content], competition_module_id: com_module.id, competition_stage_id: stage&.id.to_i)
end end
Attachment.associate_container(params[:attachment_ids], md_content.id, md_content.class) if params[:attachment_ids] Attachment.associate_container(params[:attachment_ids], md_content.id, md_content.class) if params[:attachment_ids]
normal_status("更新成功") normal_status("更新成功")
@ -84,8 +89,8 @@ class Competitions::CompetitionsController < Competitions::BaseController
def chart_rules def chart_rules
@competition = current_competition @competition = current_competition
@stages = @competition.competition_stages com_module = @competition.competition_modules.find_by(module_type: "chart")
@rule_contents = @competition.chart_rules @rule_contents = com_module&.competition_module_md_contents
end end
def update_chart_rules def update_chart_rules

@ -7,6 +7,7 @@ class Competitions::StudentsController < Competitions::BaseController
end end
students = User.joins(:user_extension).where(status: 1, user_extensions: { identity: 1 }) students = User.joins(:user_extension).where(status: 1, user_extensions: { identity: 1 })
students = students.where(user_extensions: { school_id: current_competition.region_schools.pluck(:school_id) }) if current_competition.region_schools.size > 0
students = students.where.not(id: params[:student_ids]) if params[:student_ids].present? students = students.where.not(id: params[:student_ids]) if params[:student_ids].present?
students = students.where('LOWER(CONCAT(lastname, firstname, login, nickname)) LIKE ?', "%#{keyword}%") students = students.where('LOWER(CONCAT(lastname, firstname, login, nickname)) LIKE ?', "%#{keyword}%")
@students = students.includes(user_extension: :school).limit(20) @students = students.includes(user_extension: :school).limit(20)

@ -7,6 +7,7 @@ class Competitions::TeachersController < Competitions::BaseController
end end
teachers = User.joins(:user_extension).where(status: 1, user_extensions: { identity: 0 }) teachers = User.joins(:user_extension).where(status: 1, user_extensions: { identity: 0 })
teachers = teachers.where(user_extensions: { school_id: current_competition.region_schools.pluck(:school_id) }) if current_competition.region_schools.size > 0
teachers = teachers.where.not(id: params[:teacher_ids]) if params[:teacher_ids].present? teachers = teachers.where.not(id: params[:teacher_ids]) if params[:teacher_ids].present?
teachers = teachers.where('LOWER(CONCAT(lastname, firstname, login, nickname)) LIKE ?', "%#{keyword}%") teachers = teachers.where('LOWER(CONCAT(lastname, firstname, login, nickname)) LIKE ?', "%#{keyword}%")
@teachers = teachers.includes(user_extension: :school).limit(10) @teachers = teachers.includes(user_extension: :school).limit(10)

@ -2,9 +2,14 @@ class Cooperative::UsersController < Cooperative::BaseController
def index def index
params[:sort_by] = params[:sort_by].presence || 'created_on' params[:sort_by] = params[:sort_by].presence || 'created_on'
params[:sort_direction] = params[:sort_direction].presence || 'desc' params[:sort_direction] = params[:sort_direction].presence || 'desc'
params[:school_id] = current_laboratory.school_id
users = Admins::UserQuery.call(params) users = Admins::UserQuery.call(search_params)
@users = paginate users.includes(user_extension: :school) @users = paginate users.includes(user_extension: :school)
end end
private
def search_params
params.permit(:name, :sort_by, :sort_direction)
end
end end

@ -1363,7 +1363,7 @@ class PollsController < ApplicationController
poll_ques_titles = poll_questions.pluck(:question_title).map {|k| ActionController::Base.helpers.strip_tags(k) if k.present?} poll_ques_titles = poll_questions.pluck(:question_title).map {|k| ActionController::Base.helpers.strip_tags(k) if k.present?}
poll_un_anony = poll.un_anonymous poll_un_anony = poll.un_anonymous
if poll_un_anony #是否匿名默认为false if poll_un_anony #是否匿名默认为false
user_info = %w(登陆名 真实姓名 邮箱 学号 学员单位) user_info = %w(登陆名 真实姓名 分班 邮箱 学号 学员单位)
else else
user_info = [] user_info = []
end end
@ -1436,9 +1436,10 @@ class PollsController < ApplicationController
if poll_un_anony if poll_un_anony
user_login = u_user.login user_login = u_user.login
user_name = u_user.real_name.present? ? u_user.real_name : "--" user_name = u_user.real_name.present? ? u_user.real_name : "--"
user_class = poll.course.user_group_name(u_user.id)
user_student_id = u_user.student_id.present? ? u_user.student_id : "--" user_student_id = u_user.student_id.present? ? u_user.student_id : "--"
user_school_name = u_user.school_name.present? ? u_user.school_name : "--" user_school_name = u_user.school_name.present? ? u_user.school_name : "--"
user_cell += [user_login,user_name, u_user.mail, user_student_id, user_school_name] user_cell += [user_login,user_name, user_class, u_user.mail, user_student_id, user_school_name]
end end
all_user_cell = user_cell + user_answer_array all_user_cell = user_cell + user_answer_array
user_commit.push(all_user_cell) user_commit.push(all_user_cell)

@ -25,6 +25,8 @@ class Weapps::CodeSessionsController < Weapps::BaseController
end end
set_session_unionid(user_info['unionId']) set_session_unionid(user_info['unionId'])
user_info['nickname'] = user_info['nickName']
session[:wechat_user_extra] = user_info
end end
set_session_openid(result['openid']) set_session_openid(result['openid'])

@ -16,7 +16,7 @@ class Weapps::SessionsController < Weapps::BaseController
end end
# 绑定微信号 # 绑定微信号
OpenUsers::Wechat.create!(user: user, uid: session_unionid) if user.wechat_open_user.blank? OpenUsers::Wechat.create!(user: user, uid: session_unionid, extra: session[:wechat_user_extra]) if user.wechat_open_user.blank?
successful_authentication(user) successful_authentication(user)
end end

@ -0,0 +1,51 @@
class Weapps::VerificationCodesController < Weapps::BaseController
before_action :require_wechat_login!
def create
params[:type] == 'register' ? check_can_register : check_can_reset_password
end
private
def check_can_register
login = params[:login].to_s.strip
if login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
user = User.find_by(mail: login)
return render_error('该邮箱已注册') if user.present?
elsif login =~ /^1\d{10}$/
user = User.find_by(phone: params[:login])
return render_error('该手机号已注册') if user.present?
else
return render_error('请输入正确的邮箱或手机号')
end
code = %W(0 1 2 3 4 5 6 7 8 9)
verification_code = code.sample(6).join
send_type = login =~ /^1\d{10}$/ ? 1 : 8
# 记录验证码
check_verification_code(verification_code, send_type, login)
render_ok
end
def check_can_reset_password
login = params[:login].to_s.strip
if login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
user = User.find_by(mail: login)
return render_error('该邮箱尚未注册') if user.blank?
elsif login =~ /^1\d{10}$/
user = User.find_by(phone: login)
return render_error('该手机号尚未注册') if user.blank?
else
return render_error('请输入正确的邮箱或手机号')
end
code = %W(0 1 2 3 4 5 6 7 8 9)
verification_code = code.sample(6).join
send_type = login =~ /^1\d{10}$/ ? 2 : 3
# 记录验证码
check_verification_code(verification_code, send_type, login)
render_ok
end
end

@ -86,6 +86,7 @@ class Competitions::SaveTeamForm
# 创建者是否能多次报名 # 创建者是否能多次报名
def check_creator_multiple_enrollable def check_creator_multiple_enrollable
return unless team.new_record? # 编辑战队时不需要校验
return unless competition.enrolled?(creator) return unless competition.enrolled?(creator)
if (creator.is_teacher? && competition.teacher_multiple_limited?) || (!creator.is_teacher? && competition.member_multiple_limited?) 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 def chart_stages competition
stages = [] 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 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} stages << {id: nil, name: "总排行榜", rate: 1.0, start_time: competition.start_time, end_time: competition.end_time}
end end

@ -244,11 +244,7 @@ module CoursesHelper
course_group_ids = course.group_course_power(user_id) course_group_ids = course.group_course_power(user_id)
course_groups = course_groups =
if course_group_ids.present? if course_group_ids.present?
sql = %Q{ course.course_groups.where(id: course_group_ids).includes(:course_members)
SELECT * FROM course_groups WHERE id in(SELECT course_group_id FROM teacher_course_groups WHERE id
IN(#{course_group_ids.join(",")})) order by position ASC
}
CourseGroup.find_by_sql(sql)
else else
course.course_groups.includes(:course_members) course.course_groups.includes(:course_members)
end end

@ -300,8 +300,7 @@ module ExportHelper
export_ex_users.includes(user: :user_extension).each_with_index do |e_user,index| export_ex_users.includes(user: :user_extension).each_with_index do |e_user,index|
user_info = e_user.user user_info = e_user.user
member = course.students.find_by_user_id(e_user.user_id) user_course = course.user_group_name(e_user.user_id)
user_course = member.try(:course_group_name)
user_obj_score = e_user.objective_score < 0.0 ? 0.0 : e_user.objective_score.round(1).to_s user_obj_score = e_user.objective_score < 0.0 ? 0.0 : e_user.objective_score.round(1).to_s
user_suj_score = e_user.subjective_score < 0.0 ? 0.0 : e_user.subjective_score.round(1).to_s user_suj_score = e_user.subjective_score < 0.0 ? 0.0 : e_user.subjective_score.round(1).to_s
user_score = e_user.score.present? ? e_user.score.round(1).to_s : 0.0 user_score = e_user.score.present? ? e_user.score.round(1).to_s : 0.0

@ -60,7 +60,7 @@ module Util
return if str.blank? return if str.blank?
case type case type
when :phone then "#{str[0..2]}***#{str[-3..-1]}" when :phone then "#{str[0..2]}****#{str[-4..-1]}"
when :email then "#{str[0]}***#{str[(str.rindex('@')-1)..-1]}" when :email then "#{str[0]}***#{str[(str.rindex('@')-1)..-1]}"
else "#{str[0..2]}***#{str[-3..-1]}" else "#{str[0..2]}***#{str[-3..-1]}"
end end

@ -22,6 +22,9 @@ class Competition < ApplicationRecord
has_many :attachments, as: :container, dependent: :destroy has_many :attachments, as: :container, dependent: :destroy
has_many :competition_awards, dependent: :destroy has_many :competition_awards, dependent: :destroy
has_many :competition_schools, dependent: :destroy
has_many :sponsor_schools, -> { where(source: :sponsor) }, class_name: 'CompetitionSchool' # 主办方
has_many :region_schools, -> { where(source: :region) }, class_name: 'CompetitionSchool' # 开放范围
after_create :create_competition_modules after_create :create_competition_modules
@ -66,7 +69,7 @@ class Competition < ApplicationRecord
# 是否为个人赛 # 是否为个人赛
def personal? def personal?
competition_staffs.maximum(:maximum) == 1 || max_num == 1 competition_staffs.sum(:maximum).to_i == 1 || (competition_staffs.nil? && max_num == 1)
end end
# 报名是否结束 # 报名是否结束
@ -79,6 +82,12 @@ class Competition < ApplicationRecord
team_members.exists?(user_id: user.id) team_members.exists?(user_id: user.id)
end end
# 是否开放
def open?(user)
user_school_id = user.user_extension&.school_id.to_i
region_schools.size == 0 || region_schools.exists?(school_id: user_school_id)
end
# 是否禁止教师报名 # 是否禁止教师报名
def teacher_enroll_forbidden? def teacher_enroll_forbidden?
teacher_staff.blank? || teacher_staff.maximum.zero? teacher_staff.blank? || teacher_staff.maximum.zero?

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

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

@ -0,0 +1,5 @@
class CompetitionSchool < ApplicationRecord
# source sponsor: 主办方, region开放范围
belongs_to :competition
belongs_to :school
end

@ -5,6 +5,7 @@ class CompetitionStage < ApplicationRecord
has_many :competition_entries, dependent: :destroy has_many :competition_entries, dependent: :destroy
has_many :competition_scores, dependent: :destroy has_many :competition_scores, dependent: :destroy
has_one :competition_module_md_content, dependent: :destroy
has_one :chart_rule, dependent: :destroy has_one :chart_rule, dependent: :destroy
def min_start_time def min_start_time

@ -1,4 +1,5 @@
class CompetitionStageSection < ApplicationRecord class CompetitionStageSection < ApplicationRecord
# score_source 0: 经验值, 1预测准确率
belongs_to :competition belongs_to :competition
belongs_to :competition_stage belongs_to :competition_stage

@ -130,6 +130,10 @@ class Course < ApplicationRecord
course_members.find_by(user_id: user_id, role: %i(STUDENT)) course_members.find_by(user_id: user_id, role: %i(STUDENT))
end end
def user_group_name(user_id)
students.find_by(user_id: user_id)&.course_group_name
end
def teacher_group(user_id) def teacher_group(user_id)
data = data =

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

@ -1,2 +1,3 @@
class WeappSettings::Advert < WeappSetting class WeappSettings::Advert < WeappSetting
default_scope { order(position: :asc) }
end end

@ -20,8 +20,9 @@ class Admins::CompetitionBasicSettingService < ApplicationService
competition.save! competition.save!
# 竞赛模式相关设置
if competition.mode == 1 || competition.mode == 4 if competition.mode == 1 || competition.mode == 4
competition.competition_mode_setting.destroy competition.competition_mode_setting&.destroy
else else
setting = competition.competition_mode_setting || CompetitionModeSetting.create!(competition_id: competition.id) setting = competition.competition_mode_setting || CompetitionModeSetting.create!(competition_id: competition.id)
if competition.mode == 2 if competition.mode == 2
@ -33,6 +34,26 @@ class Admins::CompetitionBasicSettingService < ApplicationService
setting.save! setting.save!
end end
# 主办方设置
params[:sponsor_schools] = Array.wrap(params[:sponsor_schools]).map(&:to_i)
new_sponsor_school_ids = competition.sponsor_schools.pluck(:school_id)
new_school_ids = params[:sponsor_schools] - new_sponsor_school_ids
delete_school_ids = new_sponsor_school_ids - params[:sponsor_schools]
new_school_ids.each do |school_id|
CompetitionSchool.create!(competition_id: competition.id, school_id: school_id, source: 'sponsor')
end
competition.sponsor_schools.where(school_id: delete_school_ids).destroy_all
# 开放范围设置
params[:region_schools] = Array.wrap(params[:region_schools]).map(&:to_i)
old_region_school_ids = competition.region_schools.pluck(:school_id)
new_region_school_ids = params[:region_schools] - old_region_school_ids
delete_region_school_ids = old_region_school_ids - params[:region_schools]
new_region_school_ids.each do |school_id|
CompetitionSchool.create!(competition_id: competition.id, school_id: school_id, source: 'region')
end
competition.region_schools.where(school_id: delete_region_school_ids).destroy_all unless delete_region_school_ids.length == 0
competition competition
end end
end end

@ -13,16 +13,17 @@ class Admins::CompetitionNavSettingService < ApplicationService
# hidden_module_type = competition.all_module_types - params[:module_type] # hidden_module_type = competition.all_module_types - params[:module_type]
# competition.competition_modules.where(module_type: hidden_module_type).update_all(hidden: 1) # competition.competition_modules.where(module_type: hidden_module_type).update_all(hidden: 1)
params[:nav_module].each do |nav| params[:navbar].each do |nav|
module_type = nav["module_type"] module_type = nav["module_type"]
if competition.all_module_types.include?(module_type) if competition.all_module_types.include?(module_type)
com_module = competition.competition_modules.find_by(module_type: module_type) com_module = competition.competition_modules.find_by(module_type: module_type)
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"], 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 end
competition.update_attributes!(enroll_end_time: params[:enroll_end_time])
if params[:competition_staffs].present? if params[:competition_staffs].present?
competition.competition_staffs.delete_all competition.competition_staffs.delete_all
params[:competition_staffs].each_with_index do |staff_params, index| params[:competition_staffs].each_with_index do |staff_params, index|

@ -0,0 +1,27 @@
class Admins::CompetitionStageCreateService < ApplicationService
attr_reader :competition, :params
def initialize(competition, params)
@params = params
@competition = competition
end
def call
ActiveRecord::Base.transaction do
stage = CompetitionStage.create!(competition_id: competition.id, name: params[:stage_name], score_rate: (params[:score_rate].to_i / 100).round(2))
params[:stage].each do |section|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
start_time: section["start_time"], end_time: section["end_time"],
mission_count: section["mission_count"], entry: section["entry"],
score_source: section["score_source"])
section["identifiers"].each do |identifier|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
shixun_identifier: identifier)
end
end
stage
end
end
end

@ -0,0 +1,30 @@
class Admins::CompetitionStageUpdateService < ApplicationService
attr_reader :competition, :params, :stage
def initialize(competition, params, stage)
@params = params
@competition = competition
@stage = stage
end
def call
ActiveRecord::Base.transaction do
stage.update_attributes!(name: params[:stage_name], score_rate: (params[:score_rate].to_i / 100.0).round(2))
stage.competition_stage_sections.destroy_all
params[:stage].each do |section|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
start_time: section["start_time"], end_time: section["end_time"],
mission_count: section["mission_count"], entry: section["entry"],
score_source: section["score_source"])
section["identifiers"].each do |identifier|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
shixun_identifier: identifier)
end
end
stage
end
end
end

@ -9,22 +9,22 @@ class Admins::DragWeappAdvertService < ApplicationService
def call def call
return if move.position + 1 == after&.position # 未移动 return if move.position + 1 == after&.position # 未移动
carousels = WeappSettings::Advert.all adverts = WeappSettings::Advert.all
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
if after.blank? || move.id == after.id # 移动至末尾 if after.blank? || move.id == after.id # 移动至末尾
total = carousels.count total = adverts.count
carousels.where('position > ?', move.position).update_all('position = position - 1') adverts.where('position > ?', move.position).update_all('position = position - 1')
move.update!(position: total) move.update!(position: total)
return return
end end
if move.position > after.position # 前移 if move.position > after.position # 前移
carousels.where('position >= ? AND position < ?', after.position, move.position).update_all('position = position + 1') adverts.where('position >= ? AND position < ?', after.position, move.position).update_all('position = position + 1')
move.update!(position: after.position) move.update!(position: after.position)
else # 后移 else # 后移
carousels.where('position > ? AND position < ?', move.position, after.position).update_all('position = position - 1') adverts.where('position > ? AND position < ?', move.position, after.position).update_all('position = position - 1')
move.update!(position: after.position - 1) move.update!(position: after.position - 1)
end end
end end

@ -11,6 +11,8 @@ class Competitions::CreatePersonalTeamService < ApplicationService
def call def call
raise Error, '个人赛才能报名' unless competition.personal? raise Error, '个人赛才能报名' unless competition.personal?
raise Error, '本竞赛只面向部分学校/单位开放,你暂时没有参赛资格' unless competition.open?(user)
is_teacher = user.is_teacher? is_teacher = user.is_teacher?
raise Error, '本竞赛的参赛者限定为:学生' if is_teacher && competition.teacher_enroll_forbidden? raise Error, '本竞赛的参赛者限定为:学生' if is_teacher && competition.teacher_enroll_forbidden?
raise Error, '本竞赛的参赛者限定为:教师' if !is_teacher && competition.member_enroll_forbidden? raise Error, '本竞赛的参赛者限定为:教师' if !is_teacher && competition.member_enroll_forbidden?

@ -13,6 +13,8 @@ class Competitions::JoinTeamService < ApplicationService
invite_code = params[:invite_code].to_s.strip invite_code = params[:invite_code].to_s.strip
raise Error, '战队邀请码不能为空' if invite_code.blank? raise Error, '战队邀请码不能为空' if invite_code.blank?
raise Error, '本竞赛只面向部分学校/单位开放,你暂时没有参赛资格' unless competition.open?(user)
is_teacher = user.is_teacher? is_teacher = user.is_teacher?
raise Error, '本竞赛的参赛者限定为:学生' if is_teacher && competition.teacher_enroll_forbidden? raise Error, '本竞赛的参赛者限定为:学生' if is_teacher && competition.teacher_enroll_forbidden?
raise Error, '本竞赛的参赛者限定为:教师' if !is_teacher && competition.member_enroll_forbidden? raise Error, '本竞赛的参赛者限定为:教师' if !is_teacher && competition.member_enroll_forbidden?
@ -22,7 +24,7 @@ class Competitions::JoinTeamService < ApplicationService
raise Error, '您已加入该战队' if team.team_members.exists?(user_id: user.id) raise Error, '您已加入该战队' if team.team_members.exists?(user_id: user.id)
enrolled = competition.team_members.exists?(user_id: user.id) enrolled = competition.team_members.exists?(user_id: user.id)
if enrolled && (is_teacher && competition.teacher_multiple_limited?) || (!is_teacher && competition.member_multiple_limited?) if enrolled && ((is_teacher && competition.teacher_multiple_limited?) || (!is_teacher && competition.member_multiple_limited?))
raise Error, '您已加入其它战队' raise Error, '您已加入其它战队'
end end
@ -30,6 +32,6 @@ class Competitions::JoinTeamService < ApplicationService
raise Error, '该战队队员人数已满' if !is_teacher && team.members.count == competition.member_staff.maximum raise Error, '该战队队员人数已满' if !is_teacher && team.members.count == competition.member_staff.maximum
role = is_teacher ? 3 : 2 role = is_teacher ? 3 : 2
team.team_members.create!(competition_id: competition.id, user_id: user, role: role, is_teacher: is_teacher) team.team_members.create!(competition_id: competition.id, user_id: user.id, role: role, is_teacher: is_teacher)
end end
end end

@ -35,8 +35,8 @@
起止时间 起止时间
</div> </div>
<div class="col-5 competition-start-end-date d-flex"> <div class="col-5 competition-start-end-date d-flex">
<%= text_field_tag :start_time, @competition.start_time&.strftime('%Y-%m-%d'), autocomplete: 'off', class: 'form-control start-date mx-0 mr-2', placeholder: '竞赛开始时间' %> <%= text_field_tag :start_time, @competition.start_time&.strftime('%Y-%m-%d %H:%M'), autocomplete: 'off', class: 'form-control start-date mx-0 mr-2', placeholder: '竞赛开始时间' %>
<%= text_field_tag :end_time, @competition.end_time&.strftime('%Y-%m-%d'), autocomplete: 'off', class: 'form-control end-date mx-0', placeholder: '竞赛截止时间' %> <%= text_field_tag :end_time, @competition.end_time&.strftime('%Y-%m-%d %H:%M'), autocomplete: 'off', class: 'form-control end-date mx-0', placeholder: '竞赛截止时间' %>
</div> </div>
</div> </div>
@ -93,12 +93,23 @@
</div> </div>
</div> </div>
<div class="row align-items-center mb-2"> <div class="row align-items-center d-flex mb-2">
<div class="col-1 text-right"> <div class="col-1 text-right">
主办方 主办方
</div> </div>
<div class="col-5 text-left"> <div class="col-5 text-left sponsorPanel">
<% sponsor_data = @competition.sponsor_schools.map { |s| [s.school.name, s.school.id] } %>
<%= select_tag :sponsor_schools, options_for_select(sponsor_data, @competition.sponsor_schools.map(&:school_id)), class: 'form-control sponsor-select', multiple: true %>
</div>
</div>
<div class="row align-items-center d-flex mb-2">
<div class="col-1 text-right">
开放范围
</div>
<div class="col-5 text-left sponsorPanel">
<% region_data = @competition.region_schools.map { |s| [s.school.name, s.school.id] } %>
<%= select_tag :region_schools, options_for_select(region_data, @competition.region_schools.map(&:school_id)), class: 'form-control allow-school-select', multiple: true %>
</div> </div>
</div> </div>
@ -151,134 +162,335 @@
<span class="flex-1">导航设置</span> <span class="flex-1">导航设置</span>
</div> </div>
<div class="card-body row"> <div class="card-body row">
<div class="container competition-mode-container"> <%= form_tag(nav_setting_admins_competition_competition_settings_path(@competition), method: :post, class: 'nav-setting-form flex-1', remote: true) do %>
<% @competition.competition_modules.each do |com_module| %> <div class="container competition-mode-container">
<% case com_module.module_type %> <% @competition.competition_modules.each do |com_module| %>
<% case com_module.module_type %>
<% when 'home' %> <% when 'home' %>
<div id="MD_typeFrom"> <div class="mt-3" id="MD_typeFrom">
<div class="row MD_type"> <div class="row MD_type">
<div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1">
<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">
<%= text_field_tag('navbar[][name]', com_module.name, id: nil, class: 'form-control', placeholder: '首页') %>
<input type="hidden" value="<%= com_module.module_type %>" name="navbar[][module_type]">
</div>
<div class="col-md-1">
<%= text_field_tag('navbar[][position]', com_module.position, id: nil, class: 'form-control', placeholder: '位置') %>
</div>
</div>
</div>
<% when 'enroll' %>
<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') %> <%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %>
</label> </label>
</div> </div>
<div class="col-md-4"> <div class="col-md-8 color-blue mt-1">
<%= text_field_tag('navbar[][name]', com_module.name, id: nil, class: 'form-control', placeholder: '首页') %>
<input type="hidden" value="<%= com_module.module_type %>" name="navbar[][module_type]"> <input type="hidden" value="<%= com_module.module_type %>" name="navbar[][module_type]">
<input type="hidden" value="报名" name="navbar[][name]">
报名
</div> </div>
<div class="col-md-1"> </div>
<%= text_field_tag('navbar[][position]', com_module.position, id: nil, class: 'form-control', placeholder: '位置') %> <div class="row mt-2 align-items-center">
<div class="col-1 text-right">&nbsp;&nbsp;</div>
<div class="col-1 text-left" style="max-width: 120px;flex: 0 0 120px;">
报名截止时间
</div>
<div class="col-md-3">
<%= text_field_tag :enroll_end_time, @competition.enroll_end_time&.strftime('%Y-%m-%d %H:%M'), autocomplete: 'off', class: 'form-control enroll_end_time', placeholder: '报名截止时间' %>
</div>
</div>
<div class="row mt-2">
<div class="col-1 text-right">&nbsp;&nbsp;</div>
<div class="col-1 text-left mt-1">
报名要求
</div>
<div class="col-md-3">
<%= javascript_void_link '+', class: 'btn btn-primary waves-effect waves-light btn-xs setBtn_s addRequireBtn' %>
</div> </div>
</div> </div>
</div>
<% end %>
<% end %>
<div class="row mt-2"> <div id="requireForm" class="competition-staff-settings">
<div class="col-1 text-right"> <% @competition.competition_staffs.each do |staff| %>
<label class="checkbox checkbox-primary mt-1"> <div class="row mt-2 mb-4 requireForm_item">
<input id="checkbox2" type="checkbox"> <div class="col-1 text-right">&nbsp;&nbsp;</div>
<label for="checkbox2">&nbsp;</label> <div class="col-1 text-left mt-1">
</label> <input type="text" class="form-control" name="competition_staffs[][minimum]" value="<%= staff.minimum %>" />
</div> </div>
<div class="col-md-8 color-blue mt-1"> <span class="mt-2">~</span>
报名 <div class="col-1 mt-1">
</div> <input type="text" class="form-control" name="competition_staffs[][maximum]" value="<%= staff.maximum %>" />
</div> </div>
<div class="row mt-2"> <span class="mt-2">人</span>
<div class="col-1 text-right">&nbsp;&nbsp;</div> <div class="col-2 mt-1">
<div class="col-1 text-left" style="max-width: 120px;flex: 0 0 120px;"> <select class="form-control" name="competition_staffs[][category]">
报名截止时间 <option value="student" <%= staff.category == "student" ? "selected='selected'" : "" %>>学生</option>
</div> <option value="teacher" <%= staff.category == "teacher" ? "selected='selected'" : "" %>>教师</option>
<div class="col-md-3"><input type="text" class="form-control" /></div> </select>
</div> </div>
<div class="row mt-2"> <div class="col-2 mt-1">
<div class="col-1 text-right">&nbsp;&nbsp;</div> <label class="radio checkbox-primary mt-1" value="require_1_1">
<div class="col-1 text-left mt-1"> <input id="require_1_<%= staff.id %>" <%= staff.mutiple_limited? ? '' : 'checked="checked"' %> class="mutiple-limited-radio" value="false" name="competition_staffs[][mutiple_limited]" type="checkbox">
报名要求 <label for="require_1_<%= staff.id %>">可多次报名</label>
</div> </label>
<div class="col-md-3"> </div>
<button class="btn btn-primary waves-effect waves-light btn-xs setBtn_s" id="addRequireBtn">+</button> <div class="col-2 mt-1">
</div> <label class="radio checkbox-primary mt-1" value="require_1_2">
</div> <input id="require_2_<%= staff.id %>" <%= staff.mutiple_limited? ? 'checked="checked"' : '' %> class="mutiple-limited-radio" value="true" name="competition_staffs[][mutiple_limited]" type="checkbox">
<label for="require_2_<%= staff.id %>">不可多次报名</label>
</label>
<a href="javascript:void(0)" class="ml20 delRequrieBtn">
<i class="fa fa-times-circle font-20 color-grey-c"></i>
</a>
</div>
</div>
<% end %>
</div>
<div id="requireForm"> <% when 'inform', 'chart', 'resource' %>
<div class="row mt-2 mb-4 requireForm_item"> <div class="row mt-2 new_module_div linkFormItem">
<div class="col-1 text-right">&nbsp;&nbsp;</div> <div class="col-1 text-right">
<div class="col-1 text-left mt-1"> <label class="checkbox checkbox-primary mt-1">
<input type="text" class="form-control" name="min_1" /> <%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %>
</div> </label>
<span class="mt-2">~</span> </div>
<div class="col-1 mt-1"> <div class="col-md-label mt-2">
<input type="text" class="form-control" name="max_1" /> <input type="hidden" value="<%= com_module.module_type %>" name="navbar[][module_type]">
</div> <input type="hidden" value="<%= com_module.name %>" name="navbar[][name]">
<span class="mt-2">人</span> <%= com_module.name %>
<div class="col-2 mt-1"> </div>
<select class="form-control" name="choice_1" > <div class="col-md-1 mt-1">
<option>不限</option> <%= text_field_tag('navbar[][position]', com_module.position, id: nil, class: 'form-control', placeholder: '位置') %>
<option>教师</option> </div>
<option>学生</option> <% if com_module.module_type == "resource" %>
<option>专业人士</option> <div class="col-md-3 mt-1">
</select> <%= text_field_tag('navbar[][url]', com_module.url, id: nil, class: 'form-control', placeholder: '请输入资料下载地址') %>
</div> </div>
<div class="col-2 mt-1"> <%= javascript_void_link '+', class: 'mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn' %>
<label class="radio checkbox-primary mt-1" value="require_1_1"> <% end %>
<input id="require_1_1" name="require_1" type="radio"> </div>
<label for="require_1_1">可多次报名</label> <% else %>
</label> <div class="row mt-2 align-items-center linkFormItem">
</div> <div class="col-1 text-right">
<div class="col-2 mt-1"> <label class="checkbox checkbox-primary mt-1">
<label class="radio checkbox-primary mt-1" value="require_1_2"> <%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %>
<input id="require_1_2" name="require_1" type="radio"> </label>
<label for="require_1_2">不可多次报名</label> </div>
</label> <div class="col-md-label mt-1">
</div> <input type="hidden" value="<%= com_module.module_type %>" name="navbar[][module_type]">
</div> <%= text_field_tag('navbar[][name]', com_module.name, id: nil, class: 'form-control', placeholder: '请输入模块名称') %>
</div>
<div class="col-md-1 mt-1">
<%= text_field_tag('navbar[][position]', com_module.position, id: nil, class: 'form-control', placeholder: '位置') %>
</div>
<div class="col-md-3 mt-1">
<%= text_field_tag('navbar[][url]', com_module.url, id: nil, class: 'form-control', placeholder: '请输入资料下载地址') %>
</div>
<%= 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 %>
</div> <!-- <div class="row mt-2">-->
<!-- <div class="col-1 text-right">-->
<!-- <label class="checkbox checkbox-primary mt-1">-->
<!-- <input id="checkbox2" type="checkbox">-->
<!-- <label for="checkbox2">&nbsp;</label>-->
<!-- </label>-->
<!-- </div>-->
<!-- <div class="col-md-label mt-2">获奖证书</div>-->
<!-- </div>-->
<div class="error my-2 danger text-danger"></div>
<div class="row mt-2"> <div class="row mt-2 mb-4">
<div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1">
<input id="checkbox2" type="checkbox">
<label for="checkbox2">&nbsp;</label>
</label>
</div>
<div class="col-md-label mt-2">排行榜</div>
<div class="col-md-1 mt-1"><input type="text" class="form-control"></div>
</div>
<div id="linkForm">
<div class="row mt-2 linkFormItem">
<div class="col-1 text-right"> <div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1">
<input id="link_1" type="checkbox" name="link_1" />
<label for="link_1">&nbsp;</label>
</label>
</div> </div>
<div class="col-md-label mt-2">资料下载</div> <div class="col-md-label mt-2"><%= javascript_void_link '保存', class: 'btn btn-primary submit-btn' %></div>
<div class="col-md-1 mt-1"><input type="text" name="link_index_1" class="form-control"></div>
<div class="col-md-3 mt-1"><input type="text" name="link_info_1" class="form-control"></div>
<button class="mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn">+</button>
</div>
</div>
<div class="row mt-2">
<div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1">
<input id="checkbox2" type="checkbox">
<label for="checkbox2">&nbsp;</label>
</label>
</div> </div>
<div class="col-md-label mt-2">获奖证书</div>
</div> </div>
<% end %>
</div>
</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>
<% if @competition.mode == 1 %>
<div class="card mb-5 competition-chart-stages">
<div class="card-header d-flex justify-content-between align-items-center">
<span>排行榜设置</span>
<a href="javascript:void(0)" class="btn btn-primary btn-custom waves-effect add-new-tab waves-light ml20" data-competition-id="<%= @competition.id %>">+ 新增tab</a>
<span class="flex-1 text-right color-orange">实训ID填写示例实训地址为https://www.educoder.net/shixuns/u5plmgka/challenges则填写“u5plmgka”</span>
</div> </div>
</div>
</div>
<div class="card-body">
<div id="large_panel" class="large_panel competition-chart-setting">
<% if @competition.competition_stages.count > 0 %>
<% @competition.competition_stages.includes(competition_stage_sections: :competition_entries).each_with_index do |stage, index| %>
<%= form_tag(admins_competition_competition_stage_path(competition_id: @competition.id, id: stage.id), method: :put, class: 'stage-update-form flex-1', remote: true) do %>
<div class="large_panel_part" attr_line="<%= index + 1 %>">
<div class="row d-flex">
<span class="col-1 mt-2">tab标题</span>
<div class="col-2 no_padding">
<input type="text" class="form-control" name="stage_name" value="<%= stage.name %>" />
</div>
<span class="col-1 text-right mt-2 no_padding">总排行榜占比:</span>
<div class="col-1 no_padding">
<input type="number" class="form-control" name="score_rate" value="<%= (stage.score_rate * 100).to_i %>"/>
</div><span class=" mt-2">%</span>
<div class="flex-1">
<a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add-task-sub">新增子阶段</a>
<% if stage.max_end_time > Time.now %>
<%= agree_link '发送短信提醒', send_message_admins_competition_competition_stage_path(@competition, stage, element: ".send-message-#{stage.id}"),
class: 'btn btn-outline-primary ml20', 'data-confirm': '确认执行发送短信操作?' %>
<% end %>
<% if stage.max_end_time < Time.now %>
<%= agree_link '计算成绩', calculate_stage_score_admins_competition_competition_stage_path(@competition, stage, element: ".calculate-score-#{stage.id}"),
class: 'btn btn-outline-primary ml20', 'data-confirm': '确认执行计算成绩操作?' %>
<% end %>
</div>
<%= delete_link '删除', admins_competition_competition_stage_path(competition_id: @competition.id, id: stage.id), class: 'btn btn-default delete-stage ml20' %>
<a href="javascript:void(0)" class="btn btn-outline-primary export-action update-stage ml20">保存</a>
</div>
<div id="small_panel_<%= index + 1 %>" class="small_panel">
<% stage.competition_stage_sections.each_with_index do |section, j| %>
<div class="row d-flex small_panel_item" attr_line="sub_<%= index %>_<%= j %>" count="<%= j + 1 %>">
<span class="col-1 mt-2 subName">第<%= j + 1 %>阶段</span>
<div class="flex-1">
<div class="row">
<span class="mt-2 ml20">有效时间:</span>
<div class="col-2 no_padding input_middle">
<%= text_field_tag 'stage[][start_time]', section.start_time&.strftime('%Y-%m-%d %H:%M'), autocomplete: 'off', class: 'section-start-time form-control', placeholder: '有效开始时间' %>
</div>
<span class="mt-2">~</span>
<div class="col-2 no_padding input_middle">
<%= text_field_tag 'stage[][end_time]', section.end_time&.strftime('%Y-%m-%d %H:%M'), autocomplete: 'off', class: 'section-end-time form-control', placeholder: '有效结束时间' %>
</div>
<span class="col-2 text-right mt-2 no_padding">任务完成要求:</span>
<div class="col-1 no_padding input_small">
<input type="number" class="form-control" value="<%= section.mission_count %>" name="stage[][mission_count]"/>
</div>
<span class="mt-2 ml10 mr10">/</span>
<div class="col-1 no_padding input_small">
<input type="number" class="form-control task_all" value="<%= section.entry %>" onchange="change_total(this)" name="stage[][entry]"/>
</div>
<span class=" mt-2">(总任务)</span>
<span class="col-1 text-right mt-2 no_padding">成绩来源:</span>
<div class="col-2 no_padding input_middle">
<select class="form-control" name="stage[][score_source]">
<option value="0" <%= section.score_source == 0 ? "selected='selected'" : "" %>>经验值</option>
<option value="1" <%= section.score_source == 1 ? "selected='selected'" : "" %>>预测准确率</option>
</select>
</div>
</div>
<div class="row mt-2" id="task_Input_sub_<%= index %>_<%= j %>">
<% section.competition_entries.each_with_index do |entry, z| %>
<div class="col-4 row task_Input_div">
<span class="col-3 text-center mt-3">任务<%= z+1 %></span>
<div class="col-8">
<input type="text" class="form-control mt-2" value="<%= entry.shixun_identifier %>" name="stage[][identifiers][]" placeholder="请填写实训ID">
</div>
</div>
<% end %>
</div>
</div>
<span>
<a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a>
</span>
</div>
<% end %>
</div>
<div class="error my-2 danger text-danger"></div>
</div>
<% end %>
<% end %>
<% else %>
<%= form_tag(admins_competition_competition_stages_path(competition_id: @competition.id), method: :post, class: 'stage-update-form new-stage-form flex-1', remote: true) do %>
<div class="large_panel_part" attr_line="1">
<div class="row d-flex">
<span class="col-1 mt-2">tab标题</span>
<div class="col-2 no_padding">
<input type="text" class="form-control" name="stage_name"/>
</div>
<span class="col-1 text-right mt-2 no_padding">总排行榜占比:</span>
<div class="col-1 no_padding">
<input type="number" class="form-control" name="score_rate" value="100"/>
</div><span class=" mt-2">%</span>
<div class="flex-1">
<a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add_task_sub" onclick="add_task_sub(this)">新增子阶段</a>
</div>
<a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>
<a href="javascript:void(0)" class="btn btn-outline-primary update-stage export-action ml20">保存</a>
</div>
<div id="small_panel_1" class="small_panel">
<div class="row d-flex small_panel_item" attr_line="sub_new_new" count="1">
<span class="col-1 mt-2 subName">第1阶段</span>
<div class="flex-1">
<div class="row">
<span class="mt-2 ml20">有效时间:</span>
<div class="col-2 no_padding input_middle">
<%= text_field_tag 'stage[][start_time]', '', autocomplete: 'off', class: 'section-start-time form-control', placeholder: '有效开始时间' %>
</div>
<span class="mt-2">~</span>
<div class="col-2 no_padding input_middle">
<%= text_field_tag 'stage[][end_time]', '', autocomplete: 'off', class: 'section-end-time form-control', placeholder: '有效结束时间' %>
</div>
<span class="col-2 text-right mt-2 no_padding">任务完成要求:</span>
<div class="col-1 no_padding input_small">
<input type="number" class="form-control" name="stage[][mission_count]" value="1"/>
</div>
<span class="mt-2 ml10 mr10">/</span>
<div class="col-1 no_padding input_small">
<input type="number" class="form-control task_all" onchange="change_total(this)" value="3" name="stage[][entry]"/>
</div>
<span class=" mt-2">(总任务)</span>
<span class="col-1 text-right mt-2 no_padding">成绩来源:</span>
<div class="col-2 no_padding input_middle">
<select class="form-control" name="stage[][score_source]">
<option value="0">经验值</option>
<option value="1">预测准确率</option>
</select>
</div>
</div>
<div class="row mt-2" id="task_Input_sub_new_new">
<div class="col-4 row task_Input_div">
<span class="col-3 text-center mt-3">任务1</span>
<div class="col-8">
<input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">
</div>
</div>
<div class="col-4 row task_Input_div">
<span class="col-3 text-center mt-3">任务2</span>
<div class="col-8">
<input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">
</div>
</div>
<div class="col-4 row task_Input_div">
<span class="col-3 text-center mt-3">任务3</span>
<div class="col-8">
<input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">
</div>
</div>
</div>
</div>
<span>
<a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a>
</span>
</div>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
</div>
<div style="margin-bottom: 8.5rem;"></div>
<% end %>

@ -1,6 +1,6 @@
json.count @users.total_count json.count @users.total_count
json.users do json.users do
json.array! @users.each do |user| json.array! @users.each do |user|
json.extract! user, :id, :login, :real_name, :identity, :school_name json.extract! user, :id, :login, :real_name, :identity, :school_name, :hidden_phone
end end
end end

@ -5,11 +5,12 @@
<th width="16%">邮件地址</th> <th width="16%">邮件地址</th>
<th width="10%">手机号码</th> <th width="10%">手机号码</th>
<th width="14%">单位</th> <th width="14%">单位</th>
<th width="8%">角色</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="20%">操作</th> <th width="12%">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -24,6 +25,7 @@
<td><%= overflow_hidden_span display_text(user.mail), width: 150 %></td> <td><%= overflow_hidden_span display_text(user.mail), width: 150 %></td>
<td><%= overflow_hidden_span display_text(user.phone), width: 100 %></td> <td><%= overflow_hidden_span display_text(user.phone), width: 100 %></td>
<td><%= overflow_hidden_span display_text(user.school_name), width: 150 %></td> <td><%= overflow_hidden_span display_text(user.school_name), width: 150 %></td>
<td><%= user.identity %></td>
<td><%= display_text(user.created_on&.strftime('%Y-%m-%d %H:%M')) %></td> <td><%= display_text(user.created_on&.strftime('%Y-%m-%d %H:%M')) %></td>
<td><%= display_text(user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %></td> <td><%= display_text(user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %></td>
<td><%= user.experience.to_i %></td> <td><%= user.experience.to_i %></td>
@ -33,14 +35,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 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? %> <% 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 %> <% end %>
<% if user.id != current_user.id %> <% 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 %> <% end %>
<%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'delete-user-action' %> <%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'delete-user-action' %>

@ -1,9 +1,11 @@
json.extract! @module, :id, :name, :position, :url, :md_edit json.extract! @module, :id, :name, :position, :url
md = @module.competition_module_md_content md = @module.competition_module_md_contents.take
if md.present? if md.present?
json.md_id md.id
json.md_name md.name json.md_name md.name
json.md_content md.content json.md_content md.content
json.competition_stage_id md.competition_stage_id
json.created_at md.created_at.strftime('%Y-%m-%d %H:%M:%S') json.created_at md.created_at.strftime('%Y-%m-%d %H:%M:%S')
json.attachments do json.attachments do
json.array! md.attachments, partial: 'attachments/attachment_simple', as: :attachment json.array! md.attachments, partial: 'attachments/attachment_simple', as: :attachment

@ -1,5 +1,7 @@
json.count @all_count json.count @all_count
json.members_count @all_member_count
json.personal @personal json.personal @personal
json.competition_name @competition.name
json.competition_teams do json.competition_teams do
json.array! @all_teams&.each do |team| json.array! @all_teams&.each do |team|
json.extract! team, :id, :name, :invite_code json.extract! team, :id, :name, :invite_code

@ -21,6 +21,7 @@ json.stages
if @competition.mode == 2 if @competition.mode == 2
json.course_id @competition.competition_mode_setting&.course_id json.course_id @competition.competition_mode_setting&.course_id
json.invite_code @competition.competition_mode_setting&.course&.invite_code
json.member_of_course @user.member_of_course?(@competition.competition_mode_setting&.course) json.member_of_course @user.member_of_course?(@competition.competition_mode_setting&.course)
end end

@ -1,6 +1,6 @@
json.count @users.total_count json.count @users.total_count
json.users do json.users do
json.array! @users.each do |user| json.array! @users.each do |user|
json.extract! user, :id, :login, :real_name, :identity, :school_name json.extract! user, :id, :login, :real_name, :identity, :school_name, :hidden_phone
end end
end end

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

@ -852,6 +852,7 @@ Rails.application.routes.draw do
resource :home, only: [:show] resource :home, only: [:show]
resource :session, only: [:create] resource :session, only: [:create]
resource :register, only: [:create] resource :register, only: [:create]
resource :verification_code, only: [:create]
resource :code_session, only: [:create] resource :code_session, only: [:create]
resource :verify, only: [:create] resource :verify, only: [:create]
resource :check_account, only: [:create] resource :check_account, only: [:create]
@ -1025,6 +1026,7 @@ Rails.application.routes.draw do
resources :competition_settings, only: [:index] do resources :competition_settings, only: [:index] do
post :basic_setting, on: :collection post :basic_setting, on: :collection
post :nav_setting, on: :collection
end end
resources :enroll_lists, only: [:index] do resources :enroll_lists, only: [:index] do
@ -1032,10 +1034,9 @@ Rails.application.routes.draw do
end end
resources :competition_stages, only: [:create, :update, :destroy] do resources :competition_stages, only: [:create, :update, :destroy] do
collection do member do
post :create_stage_section post :send_message
post :update_stage_section post :calculate_stage_score
delete :destroy_stage_section
end end
end end
end end

@ -16,7 +16,7 @@ class MigrateCompetitionModuleType < ActiveRecord::Migration[5.2]
mod_type = "manual" mod_type = "manual"
when '排行榜' when '排行榜'
mod_type = "chart" mod_type = "chart"
when '资料下载 ' when '资料下载'
mod_type = "resource" mod_type = "resource"
else else
mod_type = "md" mod_type = "md"

@ -1,10 +0,0 @@
class AddColumnToStageSections < ActiveRecord::Migration[5.2]
def change
def change
add_column :competition_stage_sections, :mission_count, :integer, default: 0
add_column :competition_stage_sections, :score_source, :integer, default: 0
add_column :competition_entries, :shixun_identifier, :string
end
end
end

@ -0,0 +1,26 @@
class MigrateComModuleResource < ActiveRecord::Migration[5.2]
def change
Competition.all.each do |competition|
competition.competition_modules.each do |com_module|
mod_type = ""
case com_module.name.strip
when '首页'
mod_type = "home"
when '报名'
mod_type = "enroll"
when '通知公告'
mod_type = "inform"
when '参赛手册'
mod_type = "manual"
when '排行榜'
mod_type = "chart"
when '资料下载'
mod_type = "resource"
else
mod_type = "md"
end
com_module.update_attributes!(module_type: mod_type)
end
end
end
end

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

@ -0,0 +1,11 @@
class CreateCompetitionSchools < ActiveRecord::Migration[5.2]
def change
create_table :competition_schools do |t|
t.references :competition, index: true
t.references :school, index: true
t.string :source
t.timestamps
end
end
end

@ -0,0 +1,8 @@
class AddColumnToStageSections < ActiveRecord::Migration[5.2]
def change
add_column :competition_stage_sections, :mission_count, :integer, default: 0
add_column :competition_stage_sections, :score_source, :integer, default: 0
add_column :competition_entries, :shixun_identifier, :string
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); 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 */ /* BASICS */
/* line 3, vendor/assets/codemirror/lib/codemirror.css */ /* line 3, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror { .CodeMirror {
@ -24775,93 +25131,145 @@ input.form-control {
flex: 1; flex: 1;
} }
/* line 32, app/assets/stylesheets/common.scss */
.fl {
float: left;
}
/* line 33, app/assets/stylesheets/common.scss */ /* line 33, app/assets/stylesheets/common.scss */
.no_padding {
padding: 0px !important;
}
/* line 34, app/assets/stylesheets/common.scss */
.font-12 { .font-12 {
font-size: 12px !important; font-size: 12px !important;
} }
/* line 34, app/assets/stylesheets/common.scss */ /* line 35, app/assets/stylesheets/common.scss */
.font-14 { .font-14 {
font-size: 14px !important; font-size: 14px !important;
} }
/* line 35, app/assets/stylesheets/common.scss */ /* line 36, app/assets/stylesheets/common.scss */
.font-16 { .font-16 {
font-size: 16px !important; font-size: 16px !important;
} }
/* line 36, app/assets/stylesheets/common.scss */ /* line 37, app/assets/stylesheets/common.scss */
.font-18 { .font-18 {
font-size: 18px !important; font-size: 18px !important;
} }
/* line 37, app/assets/stylesheets/common.scss */ /* line 38, app/assets/stylesheets/common.scss */
.font-20 {
font-size: 20px !important;
}
/* line 39, app/assets/stylesheets/common.scss */
.font-24 {
font-size: 24px !important;
}
/* line 40, app/assets/stylesheets/common.scss */
.padding10-5 { .padding10-5 {
padding: 10px 5px; padding: 10px 5px;
} }
/* line 38, app/assets/stylesheets/common.scss */ /* line 41, app/assets/stylesheets/common.scss */
.width100 { .width100 {
width: 100%; width: 100%;
} }
/* line 39, app/assets/stylesheets/common.scss */ /* line 42, app/assets/stylesheets/common.scss */
.mb10 { .mb10 {
margin-bottom: 10px; margin-bottom: 10px;
} }
/* line 40, app/assets/stylesheets/common.scss */ /* line 43, app/assets/stylesheets/common.scss */
.mt10 { .mt10 {
margin-top: 10px; margin-top: 10px;
} }
/* line 41, app/assets/stylesheets/common.scss */ /* line 44, app/assets/stylesheets/common.scss */
.mr10 { .mr10 {
margin-right: 10px; margin-right: 10px;
} }
/* line 42, app/assets/stylesheets/common.scss */ /* line 45, app/assets/stylesheets/common.scss */
.ml10 {
margin-left: 10px;
}
/* line 45, app/assets/stylesheets/common.scss */
.ml20 {
margin-left: 20px;
}
/* line 46, app/assets/stylesheets/common.scss */
.textarea-width-100 { .textarea-width-100 {
width: 100%; width: 100%;
resize: none; resize: none;
border: 1px solid #ccc; border: 1px solid #ccc;
} }
/* line 43, app/assets/stylesheets/common.scss */ /* line 47, app/assets/stylesheets/common.scss */
.padding10 { .padding10 {
padding: 10px; padding: 10px;
} }
/* line 44, app/assets/stylesheets/common.scss */ /* line 48, app/assets/stylesheets/common.scss */
.padding5-10 { .padding5-10 {
padding: 5px 10px; padding: 5px 10px;
} }
/* line 45, app/assets/stylesheets/common.scss */ /* line 49, app/assets/stylesheets/common.scss */
.position-r { .position-r {
position: relative; position: relative;
} }
/* line 46, app/assets/stylesheets/common.scss */ /* line 50, app/assets/stylesheets/common.scss */
.color-grey-c { .color-grey-c {
color: #ccc; color: #ccc;
} }
/* line 47, app/assets/stylesheets/common.scss */ /* line 51, app/assets/stylesheets/common.scss */
.color-blue {
color: #4CACFF;
}
/* line 52, app/assets/stylesheets/common.scss */
.color-orange {
color: #ff6800;
}
/* line 53, app/assets/stylesheets/common.scss */
.inline-block { .inline-block {
display: inline-block; display: inline-block;
} }
/* line 48, app/assets/stylesheets/common.scss */ /* line 54, app/assets/stylesheets/common.scss */
.hide { .hide {
display: none; display: none;
} }
/* line 49, app/assets/stylesheets/common.scss */ /* line 55, app/assets/stylesheets/common.scss */
.show { .show {
display: block; display: block;
} }
/* line 57, app/assets/stylesheets/common.scss */
.input_small {
-webkit-box-flex: 0 !important;
flex: 0 0 6% !important;
}
/* line 58, app/assets/stylesheets/common.scss */
.input_middle {
-webkit-box-flex: 0 !important;
flex: 0 0 13% !important;
}
/* line 2, app/assets/stylesheets/admins/auth_schools.scss */ /* line 2, app/assets/stylesheets/admins/auth_schools.scss */
.admins-auth-schools-index-page .list-item-title { .admins-auth-schools-index-page .list-item-title {
padding-bottom: 5px; padding-bottom: 5px;
@ -25171,6 +25579,108 @@ input.form-control {
background: #fff; background: #fff;
} }
/* line 3, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .competition-mode-container .row {
height: 35px;
}
/* line 7, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .competition-mode-container .des-row {
height: auto;
}
/* line 11, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .competition-mode-container .form-control {
font-size: 14px;
}
/* line 22, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .col-md-label {
-webkit-box-flex: 0;
flex: 0 0 10%;
max-width: 10%;
min-width: 30px;
padding-right: 15px;
padding-left: 15px;
position: relative;
}
/* line 31, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .col-md-label-s {
-webkit-box-flex: 0;
flex: 0 0 30px;
padding-right: 15px;
padding-left: 15px;
position: relative;
}
/* line 38, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .setBtn_s {
height: 35px;
line-height: 20px;
}
/* line 43, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .sponsor_label {
border: 1px solid #4CACFF;
border-radius: 5px;
background-color: rgba(76, 172, 255, 0.3);
color: #333;
padding: 0px 4px;
height: 30px;
line-height: 30px;
float: left;
margin: 4px 5px;
}
/* line 54, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .sponsor_label span {
display: block;
float: left;
height: 28px;
line-height: 28px;
margin-right: 5px;
}
/* line 62, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .sponsor_label a {
font-size: 18px;
float: left;
height: 28px;
line-height: 28px;
}
/* line 70, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel {
padding: 0px 15px;
}
/* line 73, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .large_panel_part {
border-top: 1px solid #eaeaea;
}
/* line 76, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .large_panel_part:first-child {
border: none;
}
/* line 80, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .large_panel_part > .row, .admins-competition-settings-index-page .large_panel .small_panel > .row {
border-bottom: 1px solid #eaeaea;
padding: 20px 0px;
}
/* line 84, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .small_panel {
margin-left: 20px;
}
/* line 87, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .row:last-child {
border: none;
}
/* line 4, app/assets/stylesheets/admins/cooperatives.scss */ /* line 4, app/assets/stylesheets/admins/cooperatives.scss */
.admins-cooperatives-index-page .coo-img-card .coo-img-item > .drag { .admins-cooperatives-index-page .coo-img-card .coo-img-item > .drag {
cursor: move; cursor: move;
@ -26059,7 +26569,7 @@ input.form-control {
flex: 3; flex: 3;
} }
/* line 18, app/assets/stylesheets/admin.scss */ /* line 19, app/assets/stylesheets/admin.scss */
body { body {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
@ -26074,28 +26584,28 @@ body {
overflow: hidden; overflow: hidden;
} }
/* line 32, app/assets/stylesheets/admin.scss */ /* line 33, app/assets/stylesheets/admin.scss */
.simple_form .form-group .collection_radio_buttons { .simple_form .form-group .collection_radio_buttons {
margin-bottom: 0px; margin-bottom: 0px;
} }
/* line 36, app/assets/stylesheets/admin.scss */ /* line 37, app/assets/stylesheets/admin.scss */
.simple_form .form-group .form-check-inline { .simple_form .form-group .form-check-inline {
height: calc(1.5em + 0.75rem + 2px); height: calc(1.5em + 0.75rem + 2px);
} }
/* line 42, app/assets/stylesheets/admin.scss */ /* line 43, app/assets/stylesheets/admin.scss */
input.form-control { input.form-control {
font-size: 14px; font-size: 14px;
} }
/* line 46, app/assets/stylesheets/admin.scss */ /* line 47, app/assets/stylesheets/admin.scss */
.btn-default { .btn-default {
color: #666; color: #666;
background: #e1e1e1 !important; background: #e1e1e1 !important;
} }
/* line 50, app/assets/stylesheets/admin.scss */ /* line 51, app/assets/stylesheets/admin.scss */
.export-absolute { .export-absolute {
right: 20px; right: 20px;
position: absolute; position: absolute;

File diff suppressed because one or more lines are too long

@ -15767,93 +15767,145 @@ input.form-control {
flex: 1; flex: 1;
} }
/* line 32, app/assets/stylesheets/common.scss */
.fl {
float: left;
}
/* line 33, app/assets/stylesheets/common.scss */ /* line 33, app/assets/stylesheets/common.scss */
.no_padding {
padding: 0px !important;
}
/* line 34, app/assets/stylesheets/common.scss */
.font-12 { .font-12 {
font-size: 12px !important; font-size: 12px !important;
} }
/* line 34, app/assets/stylesheets/common.scss */ /* line 35, app/assets/stylesheets/common.scss */
.font-14 { .font-14 {
font-size: 14px !important; font-size: 14px !important;
} }
/* line 35, app/assets/stylesheets/common.scss */ /* line 36, app/assets/stylesheets/common.scss */
.font-16 { .font-16 {
font-size: 16px !important; font-size: 16px !important;
} }
/* line 36, app/assets/stylesheets/common.scss */ /* line 37, app/assets/stylesheets/common.scss */
.font-18 { .font-18 {
font-size: 18px !important; font-size: 18px !important;
} }
/* line 37, app/assets/stylesheets/common.scss */ /* line 38, app/assets/stylesheets/common.scss */
.font-20 {
font-size: 20px !important;
}
/* line 39, app/assets/stylesheets/common.scss */
.font-24 {
font-size: 24px !important;
}
/* line 40, app/assets/stylesheets/common.scss */
.padding10-5 { .padding10-5 {
padding: 10px 5px; padding: 10px 5px;
} }
/* line 38, app/assets/stylesheets/common.scss */ /* line 41, app/assets/stylesheets/common.scss */
.width100 { .width100 {
width: 100%; width: 100%;
} }
/* line 39, app/assets/stylesheets/common.scss */ /* line 42, app/assets/stylesheets/common.scss */
.mb10 { .mb10 {
margin-bottom: 10px; margin-bottom: 10px;
} }
/* line 40, app/assets/stylesheets/common.scss */ /* line 43, app/assets/stylesheets/common.scss */
.mt10 { .mt10 {
margin-top: 10px; margin-top: 10px;
} }
/* line 41, app/assets/stylesheets/common.scss */ /* line 44, app/assets/stylesheets/common.scss */
.mr10 { .mr10 {
margin-right: 10px; margin-right: 10px;
} }
/* line 42, app/assets/stylesheets/common.scss */ /* line 45, app/assets/stylesheets/common.scss */
.ml10 {
margin-left: 10px;
}
/* line 45, app/assets/stylesheets/common.scss */
.ml20 {
margin-left: 20px;
}
/* line 46, app/assets/stylesheets/common.scss */
.textarea-width-100 { .textarea-width-100 {
width: 100%; width: 100%;
resize: none; resize: none;
border: 1px solid #ccc; border: 1px solid #ccc;
} }
/* line 43, app/assets/stylesheets/common.scss */ /* line 47, app/assets/stylesheets/common.scss */
.padding10 { .padding10 {
padding: 10px; padding: 10px;
} }
/* line 44, app/assets/stylesheets/common.scss */ /* line 48, app/assets/stylesheets/common.scss */
.padding5-10 { .padding5-10 {
padding: 5px 10px; padding: 5px 10px;
} }
/* line 45, app/assets/stylesheets/common.scss */ /* line 49, app/assets/stylesheets/common.scss */
.position-r { .position-r {
position: relative; position: relative;
} }
/* line 46, app/assets/stylesheets/common.scss */ /* line 50, app/assets/stylesheets/common.scss */
.color-grey-c { .color-grey-c {
color: #ccc; color: #ccc;
} }
/* line 47, app/assets/stylesheets/common.scss */ /* line 51, app/assets/stylesheets/common.scss */
.color-blue {
color: #4CACFF;
}
/* line 52, app/assets/stylesheets/common.scss */
.color-orange {
color: #ff6800;
}
/* line 53, app/assets/stylesheets/common.scss */
.inline-block { .inline-block {
display: inline-block; display: inline-block;
} }
/* line 48, app/assets/stylesheets/common.scss */ /* line 54, app/assets/stylesheets/common.scss */
.hide { .hide {
display: none; display: none;
} }
/* line 49, app/assets/stylesheets/common.scss */ /* line 55, app/assets/stylesheets/common.scss */
.show { .show {
display: block; display: block;
} }
/* line 57, app/assets/stylesheets/common.scss */
.input_small {
-webkit-box-flex: 0 !important;
flex: 0 0 6% !important;
}
/* line 58, app/assets/stylesheets/common.scss */
.input_middle {
-webkit-box-flex: 0 !important;
flex: 0 0 13% !important;
}
/* line 3, app/assets/stylesheets/colleges/statistic.scss */ /* line 3, app/assets/stylesheets/colleges/statistic.scss */
.colleges-statistics-page .college-body-container .statistic-header { .colleges-statistics-page .college-body-container .statistic-header {
width: 100%; width: 100%;

@ -24775,93 +24775,145 @@ input.form-control {
flex: 1; flex: 1;
} }
/* line 32, app/assets/stylesheets/common.scss */
.fl {
float: left;
}
/* line 33, app/assets/stylesheets/common.scss */ /* line 33, app/assets/stylesheets/common.scss */
.no_padding {
padding: 0px !important;
}
/* line 34, app/assets/stylesheets/common.scss */
.font-12 { .font-12 {
font-size: 12px !important; font-size: 12px !important;
} }
/* line 34, app/assets/stylesheets/common.scss */ /* line 35, app/assets/stylesheets/common.scss */
.font-14 { .font-14 {
font-size: 14px !important; font-size: 14px !important;
} }
/* line 35, app/assets/stylesheets/common.scss */ /* line 36, app/assets/stylesheets/common.scss */
.font-16 { .font-16 {
font-size: 16px !important; font-size: 16px !important;
} }
/* line 36, app/assets/stylesheets/common.scss */ /* line 37, app/assets/stylesheets/common.scss */
.font-18 { .font-18 {
font-size: 18px !important; font-size: 18px !important;
} }
/* line 37, app/assets/stylesheets/common.scss */ /* line 38, app/assets/stylesheets/common.scss */
.font-20 {
font-size: 20px !important;
}
/* line 39, app/assets/stylesheets/common.scss */
.font-24 {
font-size: 24px !important;
}
/* line 40, app/assets/stylesheets/common.scss */
.padding10-5 { .padding10-5 {
padding: 10px 5px; padding: 10px 5px;
} }
/* line 38, app/assets/stylesheets/common.scss */ /* line 41, app/assets/stylesheets/common.scss */
.width100 { .width100 {
width: 100%; width: 100%;
} }
/* line 39, app/assets/stylesheets/common.scss */ /* line 42, app/assets/stylesheets/common.scss */
.mb10 { .mb10 {
margin-bottom: 10px; margin-bottom: 10px;
} }
/* line 40, app/assets/stylesheets/common.scss */ /* line 43, app/assets/stylesheets/common.scss */
.mt10 { .mt10 {
margin-top: 10px; margin-top: 10px;
} }
/* line 41, app/assets/stylesheets/common.scss */ /* line 44, app/assets/stylesheets/common.scss */
.mr10 { .mr10 {
margin-right: 10px; margin-right: 10px;
} }
/* line 42, app/assets/stylesheets/common.scss */ /* line 45, app/assets/stylesheets/common.scss */
.ml10 {
margin-left: 10px;
}
/* line 45, app/assets/stylesheets/common.scss */
.ml20 {
margin-left: 20px;
}
/* line 46, app/assets/stylesheets/common.scss */
.textarea-width-100 { .textarea-width-100 {
width: 100%; width: 100%;
resize: none; resize: none;
border: 1px solid #ccc; border: 1px solid #ccc;
} }
/* line 43, app/assets/stylesheets/common.scss */ /* line 47, app/assets/stylesheets/common.scss */
.padding10 { .padding10 {
padding: 10px; padding: 10px;
} }
/* line 44, app/assets/stylesheets/common.scss */ /* line 48, app/assets/stylesheets/common.scss */
.padding5-10 { .padding5-10 {
padding: 5px 10px; padding: 5px 10px;
} }
/* line 45, app/assets/stylesheets/common.scss */ /* line 49, app/assets/stylesheets/common.scss */
.position-r { .position-r {
position: relative; position: relative;
} }
/* line 46, app/assets/stylesheets/common.scss */ /* line 50, app/assets/stylesheets/common.scss */
.color-grey-c { .color-grey-c {
color: #ccc; color: #ccc;
} }
/* line 47, app/assets/stylesheets/common.scss */ /* line 51, app/assets/stylesheets/common.scss */
.color-blue {
color: #4CACFF;
}
/* line 52, app/assets/stylesheets/common.scss */
.color-orange {
color: #ff6800;
}
/* line 53, app/assets/stylesheets/common.scss */
.inline-block { .inline-block {
display: inline-block; display: inline-block;
} }
/* line 48, app/assets/stylesheets/common.scss */ /* line 54, app/assets/stylesheets/common.scss */
.hide { .hide {
display: none; display: none;
} }
/* line 49, app/assets/stylesheets/common.scss */ /* line 55, app/assets/stylesheets/common.scss */
.show { .show {
display: block; display: block;
} }
/* line 57, app/assets/stylesheets/common.scss */
.input_small {
-webkit-box-flex: 0 !important;
flex: 0 0 6% !important;
}
/* line 58, app/assets/stylesheets/common.scss */
.input_middle {
-webkit-box-flex: 0 !important;
flex: 0 0 13% !important;
}
/* line 4, app/assets/stylesheets/cooperative/carousels.scss */ /* line 4, app/assets/stylesheets/cooperative/carousels.scss */
.cooperative-carousels-index-page .carousels-card .custom-carousel-item > .drag { .cooperative-carousels-index-page .carousels-card .custom-carousel-item > .drag {
cursor: move; cursor: move;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -321,7 +321,7 @@ module.exports = {
}, },
compress: { compress: {
drop_debugger: true, drop_debugger: true,
drop_console: true drop_console: false
} }
} }
}), }),

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

@ -43,11 +43,11 @@ class RegisListviewdata extends React.Component {
<img className="regitemimg2" src={getImageUrl("images/" + item.creator.image_url)}> <img className="regitemimg2" src={getImageUrl("images/" + item.creator.image_url)}>
</img> </img>
<p style={{ <a className="maxnamewidth78" title={item.creator.name} style={{
color: "#999999", fontSize: "14px", color: "#999999", fontSize: "14px",
width: "78px", width: "78px",
textAlign: "center" textAlign: "center"
}}>{item.creator.name}</p> }}>{item.creator.name}</a>
</div> </div>
<div style={{ <div style={{
marginTop: "29px", marginTop: "29px",

@ -2,7 +2,8 @@ import React, {Component} from 'react';
import { import {
BrowserRouter as Router, BrowserRouter as Router,
Route, Route,
Switch Switch,
Link
} from 'react-router-dom'; } from 'react-router-dom';
import axios from 'axios'; import axios from 'axios';
import moment from 'moment'; import moment from 'moment';
@ -62,13 +63,17 @@ class Registration extends React.Component {
itemid: undefined, itemid: undefined,
itemiddata: [], itemiddata: [],
pint: 0, pint: 0,
competition_name: undefined,
mutiple_limited: false,
teamutiple_limited: false,
members_count: 0,
mode: 0
} }
} }
componentDidMount() { componentDidMount() {
console.log(this.props); // console.log(this.props);
// //////console.log("componentDidMount Registration"); // //////console.log("componentDidMount Registration");
// //// //////console.log("调用子组件 "); // //// //////console.log("调用子组件 ");
@ -83,24 +88,47 @@ class Registration extends React.Component {
// this.Getdata(keyword, page, per_page, this.props.isAdmin()); // this.Getdata(keyword, page, per_page, this.props.isAdmin());
// this.GetenrollmentAPI(); // this.GetenrollmentAPI();
} }
//取模式
this.Getdataheader();
} }
componentDidUpdate = (prevProps) => { componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) { if (prevProps.user != this.props.user) {
console.log("componentDidUpdate"); // console.log("componentDidUpdate");
console.log(this.props); // console.log(this.props);
////console.log("Registration"); ////console.log("Registration");
////console.log("componentDidUpdate"); ////console.log("componentDidUpdate");
////console.log(this.props.user.admin); ////console.log(this.props.user.admin);
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();
} }
} }
// 获取数据头部
Getdataheader = () => {
const url = `/competitions/${this.props.match.params.identifier}/common_header.json`;
axios.get((url)).then((result) => {
if (result) {
if (result.data) {
this.setState({
mode: result.data.mode,
})
}
}
}).catch((error) => {
})
}
//获取报名配置API //获取报名配置API
GetenrollmentAPI = () => { GetenrollmentAPI = () => {
// console.log("调用了GetenrollmentAPI");
const url = `/competitions/${this.props.match.params.identifier}/competition_staff.json`; const url = `/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get((url)).then((result) => { axios.get((url)).then((result) => {
if (result) { if (result) {
@ -112,26 +140,59 @@ class Registration extends React.Component {
personal: result.data.personal, personal: result.data.personal,
enroll_ended: result.data.enroll_ended, enroll_ended: result.data.enroll_ended,
enrolled: result.data.enrolled, enrolled: result.data.enrolled,
teacher_staff: result.data.teacher_staff, teacher_staff: result.data.teacher_staff === undefined || result.data.teacher_staff === null ? null : result.data.teacher_staff,
member_staff: result.data.member_staff, member_staff: result.data.member_staff === undefined || result.data.member_staff === null ? null : result.data.member_staff,
}) })
if (result.data.enroll_ended === true) {
this.setState({ try {
pint: 0 //获取学生是否被限制多次报名
}) if (result.data.member_staff) {
} else if (result.data.enrolled === true) { this.setState({
this.setState({ mutiple_limited: result.data.member_staff.mutiple_limited,
pint: 2
}) })
} else if (result.data.enrolled === false) { }
this.setState({
pint: 1
}) } catch (e) {
}
try {
//获取老师是否被限制多次报名
if (result.data.teacher_staff) {
this.setState({
teamutiple_limited: result.data.teacher_staff.mutiple_limited
})
}
} catch (e) {
}
//是否是个人赛做处理
if (result.data.personal === true) {
if (result.data.enroll_ended === true) {
this.setState({
pint: 0
})
} else if (result.data.enrolled === true) {
this.setState({
pint: 2
})
} else if (result.data.enrolled === false) {
this.setState({
pint: 1
})
}
} }
} }
} }
}).catch((error) => { }).catch((error) => {
//// //////console.log(error); console.log("GetenrollmentAPI");
console.log(error);
}) })
} }
@ -155,13 +216,28 @@ class Registration extends React.Component {
// 没有创建数据的 // 没有创建数据的
if (admin === true) { if (admin === true) {
//管理员 //管理员
this.setState({ try {
type: 4, this.setState({
count: result.data.count, type: result.data.competition_teams.length === 0 ? 1 : 4,
data: result.data.my_teams, count: result.data.count,
competition_teams: result.data.competition_teams, data: result.data.my_teams,
personal: result.data.personal, competition_teams: result.data.competition_teams,
}) personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
})
} catch (e) {
this.setState({
type: 4,
count: result.data.count,
data: result.data.my_teams,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
})
}
} else { } else {
//普通账号 //普通账号
this.setState({ this.setState({
@ -170,6 +246,8 @@ class Registration extends React.Component {
data: result.data.my_teams, data: result.data.my_teams,
competition_teams: result.data.competition_teams, competition_teams: result.data.competition_teams,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
} }
} else { } else {
@ -183,6 +261,9 @@ class Registration extends React.Component {
count: result.data.count, count: result.data.count,
competition_teams: result.data.competition_teams, competition_teams: result.data.competition_teams,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
} else { } else {
@ -192,6 +273,9 @@ class Registration extends React.Component {
count: result.data.count, count: result.data.count,
competition_teams: result.data.competition_teams, competition_teams: result.data.competition_teams,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
} }
@ -203,6 +287,9 @@ class Registration extends React.Component {
data: result.data.my_teams, data: result.data.my_teams,
count: result.data.count, count: result.data.count,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
} else { } else {
@ -212,6 +299,9 @@ class Registration extends React.Component {
data: result.data.my_teams, data: result.data.my_teams,
count: result.data.count, count: result.data.count,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
} }
@ -225,6 +315,9 @@ class Registration extends React.Component {
count: result.data.count, count: result.data.count,
competition_teams: result.data.competition_teams, competition_teams: result.data.competition_teams,
personal: result.data.personal, personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
}) })
@ -258,109 +351,120 @@ class Registration extends React.Component {
} }
Getdatatype5 = (keyword, page, per_page, admin) => { // Getdatatype5 = (keyword, page, per_page, admin) => {
//搜索关键字 keyword // //搜索关键字 keyword
//页数 page // //页数 page
//分页 per_page // //分页 per_page
const datas = { // const datas = {
keyword: keyword, // keyword: keyword,
page: page, // page: page,
per_page: per_page, // per_page: per_page,
}; // };
let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`; // let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`;
axios.get((url), {params: datas}).then((result) => { // axios.get((url), {params: datas}).then((result) => {
this.setState({ // this.setState({
loadingstate: false, // loadingstate: false,
}) // })
if (result) { // if (result) {
if (result.data) { // if (result.data) {
//// //////console.log(result); // //// //////console.log(result);
if (result.data.personal === false) { // if (result.data.personal === false) {
//不是个人赛 // //不是个人赛
////console.log("Getdatatype5"); // ////console.log("Getdatatype5");
////console.log(result.data.my_teams.length); // ////console.log(result.data.my_teams.length);
if (result.data.my_teams.length === 0) { // if (result.data.my_teams.length === 0) {
// 没有创建数据的 // // 没有创建数据的
//管理员 // //管理员
////console.log("a"); // ////console.log("a");
////console.log(this.state.competition_teams); // ////console.log(this.state.competition_teams);
////console.log(result.data.competition_teams); // ////console.log(result.data.competition_teams);
this.setState({ // this.setState({
type: 4, // type: 4,
count: result.data.count, // count: result.data.count,
competition_teams: result.data.competition_teams, // competition_teams: result.data.competition_teams,
data: result.data.my_teams, // data: result.data.my_teams,
personal: result.data.personal, // personal: result.data.personal,
// competition_name: result.data.competition_name,
}) // members_count:result.data.members_count
} else { //
//有数据的 //
////console.log("b"); // })
// } else {
if (result.data.my_teams[0].manage_permission === true) { // //有数据的
this.setState({ // ////console.log("b");
type: 5, //
data: result.data.my_teams, // if (result.data.my_teams[0].manage_permission === true) {
count: result.data.count, // this.setState({
competition_teams: result.data.competition_teams, // type: 5,
personal: result.data.personal, // data: result.data.my_teams,
// count: result.data.count,
// competition_teams: result.data.competition_teams,
}) // personal: result.data.personal,
} else { // competition_name: result.data.competition_name,
////console.log("c"); // members_count:result.data.members_count
//
this.setState({ //
type: 4, // })
data: result.data.my_teams, // } else {
count: result.data.count, // ////console.log("c");
competition_teams: result.data.competition_teams, //
personal: result.data.personal, // this.setState({
// type: 4,
}) // data: result.data.my_teams,
} // count: result.data.count,
} // competition_teams: result.data.competition_teams,
} else { // personal: result.data.personal,
//团队赛 // competition_name: result.data.competition_name,
//////console.log("d"); // members_count:result.data.members_count
//
this.setState({ //
type: 6, // })
data: result.data.my_teams, // }
count: result.data.count, // }
competition_teams: result.data.competition_teams, // } else {
personal: result.data.personal, // //团队赛
// //////console.log("d");
}) //
} // this.setState({
// type: 6,
} // data: result.data.my_teams,
} // count: result.data.count,
// competition_teams: result.data.competition_teams,
}).catch((error) => { // personal: result.data.personal,
////console.log("k"); // competition_name: result.data.competition_name,
// members_count:result.data.members_count
////console.log(error); //
////console.log("报错了"); //
if (admin === true) { // })
//管理员 // }
this.setState({ //
count: 0, // }
competition_teams: [], // }
data: [], //
loadingstate: false, // }).catch((error) => {
}) // ////console.log("k");
} else { //
//普通账号 // ////console.log(error);
this.setState({ // ////console.log("报错了");
count: 0, // if (admin === true) {
competition_teams: [], // //管理员
data: [], // this.setState({
loadingstate: false, // count: 0,
}) // competition_teams: [],
} // data: [],
}) // loadingstate: false,
} // })
// } else {
// //普通账号
// this.setState({
// count: 0,
// competition_teams: [],
// data: [],
// loadingstate: false,
// })
// }
// })
// }
//团队竞赛翻页 //团队竞赛翻页
@ -370,21 +474,53 @@ class Registration extends React.Component {
loadingstate: true, loadingstate: true,
}) })
const {keyword, per_page} = this.state; const {keyword, per_page} = this.state;
this.Getdatatype5(keyword, pageNumber, per_page, this.props.user.admin); this.Getdata(keyword, pageNumber, per_page, this.props.user.admin);
}; };
/** /**
* 加入战队 * 加入战队
* */ * */
Jointheteam = () => { Jointheteam = () => {
if (this.state.enrolled === true) { if (this.props.checkIfLogin() === false) {
//已经报名 this.props.showLoginDialog()
this.setState({ return
messagePerbool: true, }
intpermessages: "您已报名,无需重复报"
})
return; if (this.props.user.is_teacher === true) {
try {
if (this.state.teamutiple_limited === true) {
if (this.state.enrolled === true) {
//已经报名
this.setState({
messagePerbool: true,
intpermessages: "你已经报名,不能重复报名"
})
return;
}
}
} catch (e) {
}
} else {
try {
if (this.state.mutiple_limited === true) {
if (this.state.enrolled === true) {
//已经报名
this.setState({
messagePerbool: true,
intpermessages: "你已经报名,不能重复报名"
})
return;
}
}
} catch (e) {
}
} }
if (this.state.enroll_ended === true) { if (this.state.enroll_ended === true) {
//报名截止 //报名截止
this.setState({ this.setState({
@ -393,7 +529,9 @@ class Registration extends React.Component {
}) })
return return
} }
if (this.props.user.admin === true) {
if (this.props.user.is_teacher === true) {
//老师 //老师
if (this.state.teacher_staff === null) { if (this.state.teacher_staff === null) {
//禁止老师 //禁止老师
@ -430,14 +568,44 @@ class Registration extends React.Component {
* 创建战队 * 创建战队
**/ **/
Createateam = () => { Createateam = () => {
// if (this.props.checkIfLogin() === false) {
if (this.state.enrolled === true) { this.props.showLoginDialog()
//已经报名 return
this.setState({ }
messagePerbool: true,
intpermessages: "您已报名,无需重复报"
})
return; if (this.props.user.is_teacher === true) {
try {
if (this.state.teamutiple_limited === true) {
if (this.state.enrolled === true) {
//已经报名
this.setState({
messagePerbool: true,
intpermessages: "你已经报名,不能重复报名"
})
return;
}
}
} catch (e) {
}
} else {
try {
if (this.state.mutiple_limited === true) {
if (this.state.enrolled === true) {
//已经报名
this.setState({
messagePerbool: true,
intpermessages: "你已经报名,不能重复报名"
})
return;
}
}
} catch (e) {
}
} }
if (this.state.enroll_ended === true) { if (this.state.enroll_ended === true) {
//报名截止 //报名截止
@ -447,7 +615,8 @@ class Registration extends React.Component {
}) })
return return
} }
if (this.props.user.admin === true) {
if (this.props.user.is_teacher === true) {
//老师 //老师
if (this.state.teacher_staff === null) { if (this.state.teacher_staff === null) {
//禁止老师 //禁止老师
@ -493,7 +662,7 @@ class Registration extends React.Component {
}) })
if (bool) { if (bool) {
//确认 //确认
this.Refreshteam();
} else { } else {
//取消 //取消
@ -556,7 +725,7 @@ class Registration extends React.Component {
messageexitol: true 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) => { axios.post(url).then((response) => {
if (response) { if (response) {
if (response.data) { if (response.data) {
@ -587,13 +756,19 @@ class Registration extends React.Component {
pages: 1, pages: 1,
limit: 20, limit: 20,
}) })
this.Getdatatype5(value, 1, 20, this.props.user.admin); this.Getdata(value, 1, 20, this.props.user.admin);
} }
//个人竞赛 //个人竞赛
// /competitions/:identifier/competition_teams.json // /competitions/:identifier/competition_teams.json
Personalregistration = () => { Personalregistration = () => {
let {teacher_staff, member_staff, data, enroll_ended, enrolled} = this.state; let {teacher_staff, member_staff, data, enroll_ended, enrolled} = this.state;
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog();
return
}
if (enroll_ended === true) { if (enroll_ended === true) {
//已截止 //已截止
this.props.showNotification(`报名已截止`); this.props.showNotification(`报名已截止`);
@ -618,10 +793,10 @@ class Registration extends React.Component {
render() { render() {
const {page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint} = this.state; const {page, mode, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint, competition_name, mutiple_limited, teamutiple_limited, members_count} = this.state;
return ( return (
<div className="newMain clearfix "> <div className="newMain clearfix newMainybot">
<div className={"educontent mb20 persmstyle"} style={{width: "1200px", marginTop: "26px"}}> <div className={"educontent mb20 persmstyle"} style={{width: "1200px", marginTop: "26px"}}>
<style> <style>
@ -645,8 +820,12 @@ class Registration extends React.Component {
{ {
tmodalsType === true ? tmodalsType === true ?
<PersonModal modalsType={tmodalsType} {...this.props} {...this.state} Newtit={Newtit} <PersonModal modalsType={tmodalsType} {...this.props} {...this.state} Newtit={Newtit}
mutiple_limited={mutiple_limited}
teamutiple_limited={teamutiple_limited}
itemiddata={itemiddata} GetenrollmentAPI={GetenrollmentAPI} itemiddata={itemiddata} GetenrollmentAPI={GetenrollmentAPI}
Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}></PersonModal> Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}
GetenrollmentAPIopens={() => this.GetenrollmentAPI()}
></PersonModal>
: :
"" ""
} }
@ -664,21 +843,15 @@ 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'}}> <div style={{marginBottom: '12px'}}>
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item href="/newcompetitions">在线竞赛</Breadcrumb.Item> <Breadcrumb.Item><Link to={"/newcompetitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item href="">全国高校计算机大赛</Breadcrumb.Item> <Breadcrumb.Item><Link
<Breadcrumb.Item href="">报名</Breadcrumb.Item> to={`/newcompetitions/${this.props.match.params.identifier}/common_header`}>{competition_name === undefined || competition_name === null || competition_name === "" ? "全国高校计算机大赛" : competition_name}</Link></Breadcrumb.Item>
{/*<Breadcrumb.Item*/}
{/* href={`/newcompetitions/${this.props.match.params.identifier}/common_header`}></Breadcrumb.Item>*/}
<Breadcrumb.Item>报名</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
</div> </div>
{/*大图*/} {/*大图*/}
@ -695,7 +868,7 @@ class Registration extends React.Component {
<div style={{ <div style={{
marginTop: "22px" marginTop: "22px"
}}> }}>
<p>参赛总人数<span style={{color: "#459BE5"}}>{data === null || data === undefined ? 0 : data.length}</span><span <p>参赛总人数<span style={{color: "#459BE5"}}>{members_count}</span><span
style={{marginLeft: "5px"}}></span> style={{marginLeft: "5px"}}></span>
</p> </p>
</div> </div>
@ -730,9 +903,16 @@ class Registration extends React.Component {
{/*普通账号出现单人 战队弹框*/} {/*普通账号出现单人 战队弹框*/}
{ {
type === 2 || type === 3 || type === 5 ? type === 2 || type === 3 || type === 5 ?
<PersonalCompetititem type={type} data={data} (
Exittheteamshow={(itemid) => this.Exittheteamshow(itemid)} data && data.map((item, index) => {
Createateamedit={(itemid) => this.Createateamedit(itemid)}></PersonalCompetititem> return (
<PersonalCompetititem key={index} type={type} item={item} index={index} mode={mode}
Exittheteamshow={(itemid) => this.Exittheteamshow(itemid)}
Createateamedit={(itemid) => this.Createateamedit(itemid)}></PersonalCompetititem>
)
})
)
: "" : ""
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save