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

dev_auth
杨树明 5 years ago
commit 9ac8efcc1f

@ -154,7 +154,7 @@ $(document).on('turbolinks:load', function(){
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return $("<div class='row px-0'><span class='col-3'>" + item.real_name + "</span><span class='col-5 font-12'>" + item.school_name + "</span><span class='col-4 font-12'>" + item.hidden_phone + "</span></div>");
return $("<div class='row px-0'><span class='col-3'>" + item.real_name + "</span><span class='col-5 font-12'>" + item.school_name + "</span><span class='col-4 font-12'>" + item.hidden_phone + "</span></div>");
},
templateSelection: function(item){
if (item.id) {
@ -471,45 +471,45 @@ $(document).on('turbolinks:load', function(){
' </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' +
' <span class="mt-2 subName mr10">第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' +
' <div class="row col-6"><span class="mt-2 ml20">有效时间:</span>\n' +
' <div class="col-4 no_padding">\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' +
' <div class="col-4 no_padding ">\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' +
' </div></div>\n' +
' <div class="row col-3"><span class="col-4 text-right mt-2 no_padding">总任务数:</span>\n' +
' <div class="col-6 no_padding ">\n' +
' <input type="number" class="form-control" onchange="change_total(this)" value="3" name="stage[][entry]">\n' +
' </div>\n' +
' <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' </div></div>\n' +
' <div class="row col-4"><span class="col-3 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-7 no_padding ">\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></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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务1</span>\n' +
' <div class="col-6 no_padding">\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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务2</span>\n' +
' <div class="col-6 no_padding">\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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务3</span>\n' +
' <div class="col-6 no_padding">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
@ -547,45 +547,45 @@ $(document).on('turbolinks:load', function(){
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' +
' <span class="mr10 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' +
' <div class="row col-6"><span class="mt-2 ml20 mr10">有效时间:</span>\n' +
' <div class="col-4 no_padding ">\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' +
' <div class="col-4 no_padding ">\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' +
' </div></div>\n' +
' <div class="row col-3"><span class="col-4 text-right mt-2 no_padding mr10">总任务数:</span>\n' +
' <div class="col-6 no_padding ">\n' +
' <input type="number" class="form-control" onchange="change_total(this)" value="3" name="stage[][entry]">\n' +
' </div>\n' +
' <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' </div></div>\n' +
' <div class="row col-4"><span class="col-3 mr10 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-7 no_padding ">\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></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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务1</span>\n' +
' <div class="col-6 no_padding">\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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务2</span>\n' +
' <div class="col-6 no_padding">\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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务3</span>\n' +
' <div class="col-6 no_padding">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
@ -600,6 +600,67 @@ $(document).on('turbolinks:load', function(){
$(".stage-update-form .section-start-time").datetimepicker(timeOptions);
$(".stage-update-form .section-end-time").datetimepicker(timeOptions);
});
// 奖项设置
var $prizeContainer = $('#competition-prize-card');
var competitionId = $prizeContainer.data('id');
$(document).on('prize.save.success', function(){
$.ajax({
method: 'GET',
url: '/admins/competitions/' + competitionId + '/competition_prizes',
dataType: 'script'
})
});
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $imageElement;
if(data.suffix === '_member'){
$imageElement = $('.prize-member-image-' + data.source_id);
} else if(data.suffix === '_team'){
$imageElement = $('.prize-team-image-' + data.source_id);
} else {
$imageElement = $('.prize-teacher-image-' + data.source_id);
}
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
// 生成获奖记录
$prizeContainer.on('click', '.generate-prize-user-action', function(){
var $link = $(this);
var generateRequest = function(){
return $.ajax({
method: 'POST',
url: '/admins/competitions/' + competitionId + '/competition_prize_users',
dataType: 'json',
success: function(data){
if(data && data.status === 0){
show_success_flash();
$link.remove();
} else {
showErrorNotify(data.message);
}
},
error: function(res){
var data = res.responseJSON;
showErrorNotify(data.message);
}
})
}
customConfirm({
content: '确认生成吗?',
ok: function () {
customLoading({
ajax: generateRequest
})
}
})
});
} else {
$(document).unbind('prize.save.success');
}
});
@ -633,8 +694,8 @@ function change_total(item) {
var html = "";
if(count > divCount){
for(var i=0;i < count-divCount ;i++){
html+='<div class="col-4 row task_Input_div"><span class="col-3 text-center mt-3">任务'+(divCount+i+1)+'</span>\n' +
'<div class="col-8">\n' +
html+='<div class="col-4 row task_Input_div"><span class="col-4 text-right mt-3 no_padding mr10">任务'+(divCount+i+1)+'</span>\n' +
'<div class="col-6 no_padding">\n' +
'<input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
'</div>\n' +
'</div>';
@ -688,45 +749,45 @@ function addNewTab(competition_id) {
' </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' +
' <span class="mt-2 subName mr10">第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' +
' <div class="row col-6"><span class="mt-2 ml20 mr10">有效时间:</span>\n' +
' <div class="col-4 no_padding ">\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' +
' <div class="col-4 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' +
' </div></div>\n' +
' <div class="row col-3"><span class="col-4 text-right mt-2 no_padding mr10">总任务数:</span>\n' +
' <div class="col-6 no_padding ">\n' +
' <input type="number" class="form-control" onchange="change_total(this)" value="3" name="stage[][entry]">\n' +
' </div>\n' +
' <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' </div></div>\n' +
' <div class="row col-4"><span class="col-3 text-right mt-2 no_padding mr10">成绩来源:</span>\n' +
' <div class="col-7 no_padding ">\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></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' +
' <span class="col-3 text-right mt-3 no_padding mr10">任务1</span>\n' +
' <div class="col-8 no_padding">\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' +
' <span class="col-3 text-right mt-3 no_padding mr10">任务2</span>\n' +
' <div class="col-8 no_padding">\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' +
' <span class="col-3 text-right no_padding mr10 mt-3">任务3</span>\n' +
' <div class="col-8 no_padding">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
@ -739,4 +800,4 @@ function addNewTab(competition_id) {
'</div></div></form>';
$("#large_panel").append(html);
}
}
}

@ -1,18 +1,18 @@
$(document).on('turbolinks:load', function() {
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-subject-modal', function(){
var $modal = $('.modal.admin-edit-subject-modal');
var $form = $modal.find('form.admin-edit-subject-form');
$(document).on('turbolinks:load', function () {
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-subject-modal', function () {
var $modal = $('.modal.admin-edit-subject-modal');
var $form = $modal.find('form.admin-edit-subject-form');
$modal.on('click', '.submit-btn', function(){
$form.find('.error').html('');
var url = $form.attr('action');
$modal.on('click', '.submit-btn', function () {
$form.find('.error').html('');
var url = $form.attr('action');
$.ajax({
method: 'PATCH',
dataType: 'script',
url: url,
data: $form.serialize()
});
});
})
});
$.ajax({
method: 'PATCH',
dataType: 'script',
url: url,
data: $form.serialize()
});
});
})
});

@ -0,0 +1,46 @@
$(document).on('turbolinks:load', function() {
$('.admin-modal-container').on('show.bs.modal', '.admin-save-competition-prize-modal', function(event){
var $modal = $('.modal.admin-save-competition-prize-modal');
var $form = $modal.find('form.admin-save-competition-prize-form');
$form.validate({
errorElement: 'span',
errorClass: 'danger text-danger',
rules: {
'competition_prize[name]': {
required: true,
maxlength: 10
},
'competition_prize[num]': {
required: true,
digits: true,
min: 1
}
}
});
$modal.on('click', '.submit-btn', function(){
$form.find('.error').html('');
var url = $form.attr('action');
var formMethod = $form.data('form-method')
if ($form.valid()) {
$.ajax({
method: formMethod,
dataType: 'json',
url: url,
data: $form.serialize(),
success: function(data){
if(data && data.status === 0) {
show_success_flash();
$(document).trigger('prize.save.success');
$modal.modal('hide');
} else {
$modal.find('.error').html(data.message)
}
}
});
}
});
})
});

@ -1,107 +1,107 @@
$(document).on('turbolinks:load', function() {
if ($('body.admins-subjects-index-page').length > 0) {
var $form = $('.subject-list-form');
$(document).on('turbolinks:load', function () {
if ($('body.admins-subjects-index-page').length > 0) {
var $form = $('.subject-list-form');
// ************** 学校选择 *************
$form.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
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;
},
templateSelection: function(item){
if (item.id) {
}
return item.name || item.text;
}
});
// ************** 学校选择 *************
$form.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
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;
},
templateSelection: function (item) {
if (item.id) {
}
return item.name || item.text;
}
});
// 清空
$form.on('click', '.clear-btn', function(){
$form.find('select[name="status"]').val('');
$form.find('.school-select').val('').trigger('change');
$form.find('input[name="keyword"]').val('');
$form.find('#homepage_show').attr('checked', false);
$form.find('#excellent').attr('checked', false);
$form.find('input[type="submit"]').trigger('click');
})
// 清空
$form.on('click', '.clear-btn', function () {
$form.find('select[name="status"]').val('');
$form.find('.school-select').val('').trigger('change');
$form.find('input[name="keyword"]').val('');
$form.find('#homepage_show').attr('checked', false);
$form.find('#excellent').attr('checked', false);
$form.find('input[type="submit"]').trigger('click');
})
// 上传图片
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $imageElement = $('.subject-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
// 上传图片
$('.modal.admin-upload-file-modal').on('upload:success', function (e, data) {
var $imageElement = $('.subject-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
// 定义状态切换监听事件
var defineStatusChangeFunc = function(doElement, undoElement, url, callback){
$('.subject-list-container').on('click', doElement, function(){
var $doAction = $(this);
var $undoAction = $doAction.siblings(undoElement);
// 定义状态切换监听事件
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
$('.subject-list-container').on('click', doElement, function () {
var $doAction = $(this);
var $undoAction = $doAction.siblings(undoElement);
var subjectId = $doAction.data('id');
customConfirm({
content: '确认进行该操作吗?',
ok: function(){
$.ajax({
url: '/admins/subjects/' + subjectId + url,
method: 'POST',
dataType: 'json',
success: function() {
show_success_flash();
$doAction.hide();
$undoAction.show();
if(callback && typeof callback === "function"){
callback(subjectId, url);
}
}
});
}
});
});
}
// 隐藏与取消隐藏
defineStatusChangeFunc('.hide-action', '.active-action', '/hide');
defineStatusChangeFunc('.active-action', '.hide-action', '/cancel_hide');
var subjectId = $doAction.data('id');
customConfirm({
content: '确认进行该操作吗?',
ok: function () {
$.ajax({
url: '/admins/subjects/' + subjectId + url,
method: 'POST',
dataType: 'json',
success: function () {
show_success_flash();
$doAction.hide();
$undoAction.show();
if (callback && typeof callback === "function") {
callback(subjectId, url);
}
}
});
}
});
});
}
// 隐藏与取消隐藏
defineStatusChangeFunc('.hide-action', '.active-action', '/hide');
defineStatusChangeFunc('.active-action', '.hide-action', '/cancel_hide');
// 首页展示与取消首页展示
var homepageShowCallback = function(subjectId, url){
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
// 首页展示与取消首页展示
var homepageShowCallback = function (subjectId, url) {
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
if(url === '/homepage_show'){
$subjectItem.find('.homepage-show-badge').show();
} else {
$subjectItem.find('.homepage-show-badge').hide();
}
}
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage_show', homepageShowCallback);
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage_show', homepageShowCallback);
if (url === '/homepage_show') {
$subjectItem.find('.homepage-show-badge').show();
} else {
$subjectItem.find('.homepage-show-badge').hide();
}
}
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage_show', homepageShowCallback);
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage_show', homepageShowCallback);
// 设为金课与取消金课
var excellentCallback = function(subjectId, url){
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
// 设为金课与取消金课
var excellentCallback = function (subjectId, url) {
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
if(url === '/excellent'){
$subjectItem.find('.excellent-badge').show();
} else {
$subjectItem.find('.excellent-badge').hide();
}
}
defineStatusChangeFunc('.excellent-action', '.cancel-excellent-action', '/excellent', excellentCallback);
defineStatusChangeFunc('.cancel-excellent-action', '.excellent-action', '/cancel_excellent', excellentCallback);
}
});
if (url === '/excellent') {
$subjectItem.find('.excellent-badge').show();
} else {
$subjectItem.find('.excellent-badge').hide();
}
}
defineStatusChangeFunc('.excellent-action', '.cancel-excellent-action', '/excellent', excellentCallback);
defineStatusChangeFunc('.cancel-excellent-action', '.excellent-action', '/cancel_excellent', excellentCallback);
}
});

@ -66,10 +66,32 @@ function customConfirm(opts){
return $.confirm($.extend({}, defaultOpts, opts))
}
function customLoading(opts) {
var loading;
var defaultOpts = {
content: opts.ajax,
contentLoaded: function(){
setTimeout(function(){
loading.close()
}, 200);
}
}
loading = $.confirm($.extend({}, defaultOpts, opts));
return loading;
}
function show_success_flash(message){
$.notify({
message: message || '操作成功'
message: message || '操作成功'
},{
type: 'success'
});
}
}
function showErrorNotify(message){
$.notify({
message: message || '操作失败'
},{
type: 'danger'
});
}

@ -87,5 +87,30 @@
.row:last-child{
border:none;
}
.task_Input_div:nth-child(3n-2) > span.col-4{
flex: 0 0 81px;
max-width: 81px;
}
.task_Input_div:nth-child(3n-2){
flex: 0 0 50%;
max-width: 50%;
}
.task_Input_div:nth-child(3n-1){
flex: 0 0 25%;
max-width: 25%;
}
.task_Input_div:nth-child(3n){
flex: 0 0 33.3%;
max-width: 33.3%;
}
.task_Input_div:nth-child(3n) > span.col-4{
flex: 0 0 25%;
max-width: 25%;
}
.task_Input_div:nth-child(3n) > div.col-6{
flex: 0 0 58.3%;
max-width: 58.3%;
}
}
}

@ -0,0 +1,41 @@
class Admins::CompetitionPrizeUsersController < Admins::BaseController
def index
@competition = current_competition
prize_users = Admins::CompetitionPrizeUserQuery.call(params.merge(competition_id: current_competition.id))
include_class = [:competition_team, :competition_prize, :approver,
user: [:process_real_name_apply, :process_professional_apply, user_extension: :school]]
@prize_users = paginate(prize_users.preload(include_class))
end
def create
Admins::CreateCompetitionPrizeUsersService.call(current_competition)
render_ok
rescue ApplicationService::Error => ex
render_error(ex.message)
end
def approve
Admins::ApproveCompetitionPrizeUserService.call(current_prize_user, current_user)
@prize_user = current_prize_user
rescue ApplicationService::Error => ex
render_js_error(ex.message, type: :notify)
end
def unapprove
Admins::UnapproveCompetitionPrizeUserService.call(current_prize_user, current_user)
@prize_user = current_prize_user
rescue ApplicationService::Error => ex
render_js_error(ex.message, type: :notify)
end
private
def current_prize_user
@_current_prize_user ||= current_competition.competition_prize_users.find(params[:id])
end
def current_competition
@_current_competition ||= Competition.find(params[:competition_id])
end
end

@ -0,0 +1,43 @@
class Admins::CompetitionPrizesController < Admins::BaseController
def index
@competition = current_competition
end
def new
@prize = current_competition.competition_prizes.new
end
def create
@prize = current_competition.competition_prizes.create!(save_params)
render_ok
end
def edit
@prize = current_competition_prize
end
def update
current_competition_prize.update!(save_params)
render_ok
end
def destroy
current_competition_prize.destroy!
render_delete_success
end
private
def current_competition_prize
@_current_competition_prize ||= current_competition.competition_prizes.find(params[:id])
end
def current_competition
@_current_competition ||= Competition.find(params[:competition_id])
end
def save_params
params.require(:competition_prize).permit(:name, :category, :num)
end
end

@ -0,0 +1,23 @@
class Competitions::CertificatesController < Competitions::BaseController
def personal
prize_user = CompetitionPrizeUser.find_by!(user: current_user, id: params[:id])
return render_not_found unless prize_user.certificate_exist?
team = prize_user.competition_team
prize = prize_user.competition_prize
filename = "#{current_competition.name}-#{prize.name}-#{team.name}-#{prize_user.user.real_name}.pdf"
send_file prize_user.certificate_path, filename: filename
end
def team
team = CompetitionTeam.find(id: params[:id])
return render_forbidden unless team.team_members.exists?(user_id: current_user.id)
return render_not_found unless team.certificate_exist?
prize = team.competition_prize_users.first.competition_prize
filename = "#{current_competition.name}-#{prize.name}-#{team.name}.pdf"
send_file team.certificate_path, filename: filename
end
end

@ -5,6 +5,11 @@ class Competitions::CompetitionModulesController < Competitions::BaseController
def index
@modules = current_competition.unhidden_competition_modules.order(position: :asc)
# 未登录、未获奖用户,不展示获奖证书栏目
if !current_user.logged? || !current_competition.competition_prize_users.exists?(user: current_user)
@modules = @modules.select { |mod| mod.name != '获奖证书' }
end
end
def show

@ -22,7 +22,7 @@ class Competitions::CompetitionsController < Competitions::BaseController
@count = competitions.count
competitions = competitions.order(published_at: :desc, online_time: :desc)
@competitions = paginate(competitions.includes(sponsor_schools: :school, current_stage_section: :competition_stage))
@competitions = paginate(competitions.includes(:competition_mode_setting, sponsor_schools: :school, current_stage_section: :competition_stage))
ids = @competitions.map(&:id)
@member_count_map = TeamMember.where(competition_id: ids).group(:competition_id).count

@ -0,0 +1,25 @@
class Competitions::PrizeLeaderAccountsController < Competitions::BaseController
before_action :require_prize_team_leader!
def update
Competitions::SavePrizeTeamAccountService.call(current_competition, current_user, update_params)
render_ok
rescue ApplicationService::Error => ex
render_error(ex.message)
end
private
def require_prize_team_leader!
prize_user = current_competition.competition_prize_users.joins(:competition_prize)
.where(competition_prizes: { category: :bonus })
.find_by(leader: true, user_id: current_user.id)
return if prize_user.present?
render_forbidden
end
def update_params
params.permit(:bank, :second_bank, :card_no)
end
end

@ -0,0 +1,26 @@
class Competitions::PrizesController < Competitions::BaseController
before_action :require_prize_user!
def show
self_prizes = current_competition.competition_prize_users.where(user_id: current_user.id).includes(:competition_team)
@leader = self_prizes.any?(&:leader?) # 是否为队长
@bank_account = self_prizes.find(&:leader?).extra if @leader
@self_prizes = self_prizes.select(&:certificate_exist?) # 个人证书quit
@team_prizes = self_prizes.map(&:competition_team).uniq.select(&:certificate_exists?) # 团队证书
prize_users = current_competition.competition_prize_users.where(competition_team_id: self_prizes.map(&:competition_team_id))
.includes(:competition_team, user: [:user_extension, :process_real_name_apply, :process_professional_apply])
@prize_user_map = prize_users.group_by(&:competition_team)
end
private
def require_prize_user!
return if current_competition.competition_prize_users.exists?(user: current_user)
render_forbidden
end
end

@ -257,8 +257,8 @@ class CoursesController < ApplicationController
user_ids = all_members.map(&:user_id)
rank = user_ids.index(current_user.id).to_i + 1
if rank > 10
current_member = all_members.select{|member| member.user_id == current_user.id}
@course_members << current_member
current_member = all_members.select{|member| member.user_id == current_user.id}.first
@course_members << current_member if current_member.present?
end
end
end

@ -605,6 +605,21 @@ class ExercisesController < ApplicationController
end
end
# 对未提交的用户进行调分
def adjust_score
exercise_user = @exercise.exercise_users.find_by!(user_id: params[:user_id])
tip_exception("已提交的作品请去评阅页进行调分") if exercise_user.commit_status == 1
tip_exception("分数不能为空") if params[:score].blank?
tip_exception("分数不能超过0-#{@exercise.question_scores}") if params[:score].to_f < 0 || params[:score].to_f.round(1) > @exercise.question_scores.round(1)
ActiveRecord::Base.transaction do
start_at_time = exercise_user.start_at || Time.now
exercise_user.update_attributes!(start_at: start_at_time, end_at: Time.now, status: 1, commit_status: 1, score: params[:score].to_f.round(2), commit_method: 5)
ExerciseUserScore.create!(exercise_id: @exercise.id, exercise_user_id: exercise_user.id, score: params[:score], comment: params[:comment])
normal_status("操作成功")
end
end
#我的题库
def my_exercises
ActiveRecord::Base.transaction do

@ -125,7 +125,7 @@ class HomeworkCommonsController < ApplicationController
# 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段
if @work&.work_status.to_i > 0 && (@homework.work_public || @homework.score_open) &&
((!@homework.anonymous_comment && @homework.end_or_late) || (@homework_detail_manual.comment_status > 4 && @homework.end_or_late))
@student_works = student_works.where("user_id != #{@work.user_id}")
@student_works = student_works.where("student_works.user_id != #{@work.user_id}")
# 匿评、申诉阶段只能看到分配给自己的匿评作品
elsif @work&.work_status.to_i > 0 && @homework.anonymous_comment && @homework_detail_manual.comment_status > 2 && @homework_detail_manual.comment_status <= 4
@ -572,10 +572,13 @@ class HomeworkCommonsController < ApplicationController
if @homework.homework_type == "practice"
# 实训作业的评分设置
tip_exception("总分值不能为空") if params[:total_score].blank?
tip_exception("总分值不能小于0") if params[:total_score].to_i < 0
tip_exception("缺少answer_open_evaluation参数") if params[:answer_open_evaluation].nil?
tip_exception("缺少work_efficiency参数") if params[:work_efficiency].nil?
tip_exception("缺少eff_score参数") if params[:work_efficiency] && params[:eff_score].blank?
tip_exception("效率分不能小于等于0") if params[:eff_score] && params[:eff_score].to_i <= 0
tip_exception("效率分不能大于总分值") if params[:eff_score] && params[:eff_score].to_i > params[:total_score].to_i
tip_exception("缺少shixun_evaluation参数") if params[:shixun_evaluation].blank?
tip_exception("缺少challenge_settings参数") if params[:challenge_settings].blank?
# tip_exception("缺少challenge_id参数") if params[:challenge_settings][:challenge_id].blank?
@ -584,6 +587,7 @@ class HomeworkCommonsController < ApplicationController
# params[:challenge_settings][:challenge_score].length != params[:challenge_settings][:challenge_id].length
current_eff_score = @homework.eff_score
@homework.total_score = params[:total_score]
@homework.work_efficiency = params[:work_efficiency]
@homework.eff_score = params[:work_efficiency] ? params[:eff_score].to_i : 0

@ -534,7 +534,9 @@ class StudentWorksController < ApplicationController
# 作品调分
def adjust_score
tip_exception("分数不能为空") if params[:score].blank?
tip_exception("分数不能超过0-100") if params[:score].to_f < 0 || params[:score].to_f > 100
tip_exception("分数不能超过0-100") if @homework.homework_type != "practice" && (params[:score].to_f < 0 || params[:score].to_f.round(1) > 100.round(1))
tip_exception("已提交的作品请去评阅页进行调分") if @homework.homework_type == "practice" && @work.work_status > 0
tip_exception("分数不能超过总分值#{@homework.total_score}") if @homework.homework_type == "practice" && (params[:score].to_f < 0 || params[:score].to_f.round(1) > @homework.total_score.round(1))
ActiveRecord::Base.transaction do
begin
# 分数不为空的历史评阅都置为失效

@ -4,10 +4,16 @@ class Users::AuthenticationAppliesController < Users::BaseAccountController
def create
Users::ApplyAuthenticationService.call(observed_user, create_params)
render_ok
rescue Users::ApplyAuthenticationService::Error => ex
rescue ApplicationService::Error => ex
render_error(ex.message)
end
def destroy
return render_error('已认证后不能撤销') if observed_user.authentication?
observed_user.process_real_name_apply&.revoke!
render_ok
end
private
def create_params

@ -8,6 +8,12 @@ class Users::ProfessionalAuthAppliesController < Users::BaseAccountController
render_error(ex.message)
end
def destroy
return render_error('已认证后不能撤销') if observed_user.professional_certification?
observed_user.process_professional_apply&.revoke!
render_ok
end
private
def create_params

@ -0,0 +1,9 @@
class Competitions::SavePrizeTeamAccountForm
include ActiveModel::Model
attr_accessor :bank, :second_bank, :card_no
validates :bank, presence: true
validates :second_bank, presence: true
validates :card_no, presence: true
end

@ -0,0 +1,10 @@
module Admins::CompetitionPrizeUsersHelper
def display_auth_state(flag, other = false, success: nil, normal: nil, error: nil)
success ||= '<i class="fa fa-check text-success font-16"/>'.html_safe
normal ||= '--'
error ||= '<i class="fa fa-close text-secondary font-16"/>'.html_safe
return success if flag
other ? normal : error
end
end

@ -63,6 +63,8 @@ module CoursesHelper
"/courses/#{course.id}/boards/#{course_board.id}"
when "course_group"
"/courses/#{course.id}/course_groups"
when "statistics"
"/courses/#{course.id}/statistics"
end
end

@ -29,6 +29,9 @@ class Competition < ApplicationRecord
has_many :competition_managers, dependent: :destroy
has_many :managers, through: :competition_managers, source: :user
has_many :competition_prizes, dependent: :destroy
has_many :competition_prize_users, dependent: :destroy
after_create :create_competition_modules
def mode_type
@ -46,6 +49,12 @@ class Competition < ApplicationRecord
end
end
# 报名数
def team_member_count
course = competition_mode_setting&.course if mode == 2
course ? course.students.count : team_members.count
end
def sponsor_schools_name
sponsor_schools.map{|sponsor| sponsor.school.name}
end
@ -131,7 +140,7 @@ class Competition < ApplicationRecord
end
def all_module_types
%w[home enroll inform chart resource]
%w[home enroll inform chart resource certificate]
end
def max_stage_end_time
@ -146,6 +155,10 @@ class Competition < ApplicationRecord
user && competition_managers.exists?(user_id: user.id)
end
def finished?
end_time.blank? || end_time < Time.now
end
private
def get_module_name type
@ -155,6 +168,7 @@ class Competition < ApplicationRecord
when 'inform' then '通知公告'
when 'chart' then '排行榜'
when 'resource' then '资料下载'
when 'certificate' then '获奖证书'
else ''
end
end

@ -0,0 +1,21 @@
class CompetitionPrize < ApplicationRecord
extend Enumerize
belongs_to :competition
has_many :competition_prize_users, dependent: :destroy
enumerize :category, in: %i[bonus unset]
def self.member_suffix
'_member'
end
def self.teacher_suffix
'_teacher'
end
def self.team_suffix
'_team'
end
end

@ -0,0 +1,48 @@
class CompetitionPrizeUser < ApplicationRecord
include AASM
belongs_to :competition
belongs_to :competition_team
belongs_to :competition_prize
belongs_to :user
belongs_to :approver, class_name: 'User', optional: true # 审批人
serialize :extra, JSON
aasm(:status) do
state :pending, initial: true
state :approved
event :approve do
transitions from: [:pending], to: :approved, guard: :user_certified?
end
event :unapprove do
transitions from: [:approved], to: :pending
end
end
delegate :bank, :second_bank, :card_no, to: :extra, allow_nil: true
def user_certified?
user.certification? && user.professional_certification?
end
def certificate_exist?
Util::FileManage.exists?(self)
end
def certificate_url
Util::FileManage.source_disk_file_url(self)
end
def certificate_path
Util::FileManage.source_disk_filename(self)
end
def role_text
return '队长' if leader?
user.is_teacher? ? '教师' : '队员'
end
end

@ -11,6 +11,8 @@ class CompetitionTeam < ApplicationRecord
has_many :members, -> { without_teachers }, class_name: 'TeamMember'
has_many :teachers, -> { only_teachers }, class_name: 'TeamMember'
has_many :competition_prize_users, dependent: :destroy
def group_team_type?
team_type.zero?
end
@ -48,4 +50,24 @@ class CompetitionTeam < ApplicationRecord
def members_name
members.map{|member| member.user.real_name}.join(",")
end
def all_prize_approved?
!competition_prize_users.exists?(status: :pending)
end
def certificate_exists?
Util::FileManage.exists?(self, self.class.certificate_suffix)
end
def certificate_url
Util::FileManage.source_disk_file_url(self, self.class.certificate_suffix)
end
def certificate_path
Util::FileManage.source_disk_filename(self, self.class.certificate_suffix)
end
def self.certificate_suffix
'_CERT'
end
end

@ -1,8 +1,10 @@
class ExerciseUser < ApplicationRecord
# commit_method 0 为默认, 1为学生的手动提交2为倒计时结束后自动提交3为试卷定时截止的自动提交, 4为教师手动的立即截止
# commit_method 0 为默认, 1为学生的手动提交2为倒计时结束后自动提交3为试卷定时截止的自动提交, 4为教师手动的立即截止, 5为老师调分
belongs_to :user
belongs_to :exercise
has_many :exercise_user_scores, dependent: :destroy
scope :commit_exercise_by_status, lambda { |s| where(commit_status: s) }
scope :exercise_user_committed, -> {where("commit_status != ?",0) }
scope :current_exercise_user, lambda { |user_id,exercise_id| where(user_id: user_id,exercise_id:exercise_id)}

@ -0,0 +1,5 @@
class ExerciseUserScore < ApplicationRecord
belongs_to :exercise
belongs_to :exercise_user
belongs_to :user
end

@ -503,6 +503,10 @@ class User < ApplicationRecord
phone.present?
end
def email_binded?
mail.present?
end
def self.current=(user)
Thread.current[:current_user] = user
end

@ -0,0 +1,77 @@
class Admins::CompetitionPrizeUserQuery < ApplicationQuery
include CustomSortable
attr_reader :params
sort_columns :rank, default_by: :rank, default_direction: :asc
def initialize(params)
@params = params
end
def call
records = CompetitionPrizeUser.all
# 竞赛过滤
records = records.where(competition_id: params[:competition_id]) if params[:competition_id].present?
# 关键字检索
keyword = params[:keyword].to_s.strip
if keyword.present?
like_sql = 'competition_teams.name LIKE :keyword OR schools.name LIKE :keyword'
records = records.left_joins(:competition_team, user: { user_extension: :school })
.where(like_sql, keyword: "%#{keyword}%")
end
# 奖项过滤
records = records.where(competition_prize_id: params[:prize_id]) if params[:prize_id].present?
# 审批状态过滤
records = records.where(status: params[:status]) if params[:status].present?
# 职业过滤
if params[:identity].present?
records = records.left_joins(user: :user_extension).where(user_extensions: { identity: params[:identity] })
end
# 实名认证过滤
records = real_name_auth_filter(records) if params[:real_name_auth].present?
# 职业认证过滤
records = professional_auth_filter(records) if params[:professional_auth].present?
custom_sort(records, params[:sort_by], params[:sort_direction])
end
private
def real_name_auth_filter(records)
records = records.left_joins(:user)
sql = ApplyUserAuthentication.real_name_auth.processing.where('apply_user_authentications.user_id = users.id').to_sql
case params[:real_name_auth]
when 'authed' then
records.where(users: { authentication: true })
when 'not_authed' then
records.where(users: { authentication: false }).where("NOT EXISTS (#{sql})")
when 'authing' then
records.where(users: { authentication: false }).where("EXISTS (#{sql})")
else records
end
end
def professional_auth_filter(records)
records = records.left_joins(:user)
sql = ApplyUserAuthentication.professional_auth.processing.where('apply_user_authentications.user_id = users.id').to_sql
case params[:professional_auth]
when 'authed' then
records.where(users: { professional_certification: true })
when 'not_authed' then
records.where(users: { professional_certification: false }).where("NOT EXISTS (#{sql})")
when 'authing' then
records.where(users: { professional_certification: false }).where("EXISTS (#{sql})")
else records
end
end
end

@ -0,0 +1,26 @@
class Admins::ApproveCompetitionPrizeUserService < ApplicationService
attr_reader :prize_user, :approver
def initialize(prize_user, approver)
@prize_user = prize_user
@approver = approver
end
def call
raise Error, '请勿重复审批' if prize_user.approved?
raise Error, '该用户未认证完成' unless prize_user.user_certified?
ActiveRecord::Base.transaction do
prize_user.approve
prize_user.approver = approver
prize_user.approved_at = Time.now
prize_user.save!
if prize_user.competition_team.all_prize_approved?
# TODO: 生成团队证书
end
# TODO: 生成个人证书
end
end
end

@ -0,0 +1,70 @@
class Admins::CreateCompetitionPrizeUsersService < ApplicationService
attr_reader :competition
def initialize(competition)
@competition = competition
end
def call
raise Error, '竞赛还未结束' unless competition.finished?
raise Error, '请勿重复生成' if competition.competition_prize_users.exists?
raise Error, '请先设置奖项' if prizes.blank?
raise Error, '无获奖队伍' if prize_teams.blank?
ActiveRecord::Base.transaction do
columns = %i[competition_id competition_team_id competition_prize_id user_id
status rank leader created_at updated_at]
CompetitionPrizeUser.bulk_insert(*columns) do |worker|
prize_teams.each_with_index do |team, index|
rank = index + 1
prize = team_prize(rank) # 根据排名获取当前队伍奖项
team.team_members.each do |member|
attr = {
competition_id: competition.id,
competition_team_id: team.id,
competition_prize_id: prize.id,
user_id: member.user_id,
leader: member.creator?,
status: :pending,
rank: rank
}
worker.add(attr)
end
end
end
end
end
private
def prizes
@_prizes ||= competition.competition_prizes.order(id: :asc).to_a
end
def team_prize(rank)
current = 0
prizes.each do |prize|
return prize if rank > current && rank <= current + prize.num
current += prize.num
end
end
def prize_teams
@_prize_teams ||= begin
prize_num_total = prizes.sum(&:num)
# 只有一个阶段则成绩为该阶段成绩否则为stage ID为0的总成绩
stage_id = competition.competition_stages.count == 1 ? competition.competition_stages.first.id : 0
competition.competition_teams.joins(:competition_scores)
.where(competition_scores: { competition_stage_id: stage_id })
.order("competition_scores.score desc, competition_scores.cost_time desc")
.includes(:team_members)
.limit(prize_num_total)
end
end
end

@ -0,0 +1,27 @@
class Admins::UnapproveCompetitionPrizeUserService < ApplicationService
attr_reader :prize_user, :approver
def initialize(prize_user, approver)
@prize_user = prize_user
@approver = approver
end
def call
raise Error, '状态有误' if prize_user.pending?
ActiveRecord::Base.transaction do
prize_user.unapprove
prize_user.approver = approver
prize_user.approved_at = nil
prize_user.save!
# 删除团队证书
team_certificate_path = Util::FileManage.source_disk_filename(prize_user.competition_team, CompetitionTeam.certificate_suffix)
File.delete(team_certificate_path) if File.exist?(team_certificate_path)
# 删除个人证书
user_certificate_path = Util::FileManage.source_disk_filename(prize_user)
File.delete(user_certificate_path) if File.exist?(user_certificate_path)
end
end
end

@ -0,0 +1,19 @@
class Competitions::SavePrizeTeamAccountService < ApplicationService
attr_reader :competition, :user, :params
def initialize(competition, user, params)
@competition = competition
@user = user
@params = params
end
def call
Competitions::SavePrizeTeamAccountForm.new(params).validate!
prize_leaders = competition.competition_prize_users.where(competition.competition_prize_users)
raise Error, '审批通过后不能修改' if prize_leaders.exists?(status: :approved)
prize_leaders.update_all(extra: params)
end
end

@ -1,6 +1,4 @@
class Users::ApplyAuthenticationService < ApplicationService
Error = Class.new(StandardError)
attr_reader :user, :params
def initialize(user, params)

@ -220,6 +220,11 @@ a.color-blue:hover,a.color-blue_4C:hover{color: #459BE6!important;}
/*橙色*/
.color-orange{color: #ff6800!important;}/*辅助文字*/
.color-orange-tip{color: #FF954C!important;}/*提示文字*/
.color-orange-tips {
color: #FF8204 !important;
}
/*提示文字*/
a.color-orange:hover,a.color-orange-tip:hover{color: #F06200!important;}
/*黄色*/
.color-yellow{color: #EFC003!important;}
@ -778,4 +783,4 @@ html>body #ajax-indicator { position: fixed; }
}
.yslminHeigth{
min-height: 400px;
}
}

@ -0,0 +1 @@
$('.competition-prize-user-list-container .competition-prize-user-item-<%= @prize_user.id %>').html("<%= j( render partial: 'admins/competition_prize_users/shared/tr', locals: { prize_user: @prize_user } ) %>");

@ -0,0 +1,58 @@
<%
define_admin_breadcrumbs do
add_admin_breadcrumb('竞赛列表', admins_competitions_path)
add_admin_breadcrumb(@competition.name)
end
%>
<div class="box search-form-container flex-column mb-0 pb-0 competition-prize-user-form">
<ul class="nav nav-tabs w-100 search-form-tabs">
<li class="nav-item">
<%= link_to '报名列表', admins_competition_enroll_lists_path(@competition), class: "nav-link search-form-tab" %>
</li>
<li class="nav-item">
<%= link_to '获奖证书审批', admins_competition_competition_prize_users_path(@competition), class: "nav-link search-form-tab active" %>
</li>
</ul>
<div class="d-flex">
<%= form_tag(admins_competition_competition_prize_users_path(unsafe_params), method: :get, class: 'search-form mt-3 flex-1 d-flex align-items-end', remote: true) do %>
<div class="form-group mb-0 mr-3">
<label for="status">奖项:</label>
<% prize_options = [['不限', '']] + @competition.competition_prizes.map{ |p| [p.name, p.id] } %>
<%= select_tag(:prize_id, options_for_select(prize_options), class: 'form-control') %>
</div>
<% auth_options = [['不限', ''], %w(未认证 not_authed), %w(待认证 authing), %w(已认证 authed)] %>
<div class="form-group mb-0 mr-3">
<label for="status">实名认证状态:</label>
<%= select_tag(:real_name_auth, options_for_select(auth_options), class: 'form-control') %>
</div>
<div class="form-group mb-0 mr-3">
<label for="status">职业认证状态:</label>
<%= select_tag(:professional_auth, options_for_select(auth_options), class: 'form-control') %>
</div>
<div class="form-group mb-0 mr-3">
<label for="status">职业:</label>
<%- identity_options = [['不限', ''], %w(教师 0), %w(学生 1)] %>
<%= select_tag(:identity, options_for_select(identity_options), class: 'form-control') %>
</div>
<div class="form-group mb-0 mr-3">
<label for="status">审批状态:</label>
<%- status_options = [['不限', ''], %w(未审批 pending), %w(已审批 approved)] %>
<%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
</div>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '战队/学校名称检索') %>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<%= link_to '清除', admins_competition_competition_prize_users_path(@competition), class: "btn btn-default",'data-disable-with': '清除中...' %>
<% end %>
</div>
</div>
<div class="box competition-prize-user-list-container">
<%= render(partial: 'admins/competition_prize_users/shared/list', locals: { prize_users: @prize_users }) %>
</div>

@ -0,0 +1 @@
$('.competition-prize-user-list-container').html("<%= j( render partial: 'admins/competition_prize_users/shared/list', locals: { prize_users: @prize_users } ) %>");

@ -0,0 +1,33 @@
<table class="table table-hover text-center competition-prize-user-list-table">
<thead class="thead-light">
<tr>
<th width="6%">奖项</th>
<th width="5%">排名</th>
<th width="10%" class="text-left">战队名称</th>
<th width="8%">真实姓名</th>
<th width="5%">职业</th>
<th width="8%">学号</th>
<th width="10%">单位</th>
<th width="5%">实名</th>
<th width="5%">职业</th>
<th width="5%">手机</th>
<th width="5%">队长</th>
<th width="10%">审批时间</th>
<th width="8%">审批人</th>
<th width="10%">操作</th>
</tr>
</thead>
<tbody style="overflow-wrap:break-word;">
<% if prize_users.present? %>
<% prize_users.each do |prize_user| %>
<tr class="competition-prize-user-item-<%= prize_user.id %>">
<%= render('admins/competition_prize_users/shared/tr', prize_user: prize_user) %>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'admins/shared/paginate', locals: { objects: prize_users } %>

@ -0,0 +1,26 @@
<%- user = prize_user.user -%>
<td><%= prize_user.competition_prize.name %></td>
<td><%= prize_user.rank %></td>
<td class="text-left"><%= prize_user.competition_team.name %></td>
<td><%= user.real_name %></td>
<td><%= user.identity %></td>
<td><%= user.is_teacher? ? user.user_extension.technical_title : user.user_extension.student_id %></td>
<td><%= user.school_name %></td>
<td><%= display_auth_state(user.authentication?, user.process_real_name_apply.present?) %></td>
<td><%= display_auth_state(user.professional_certification?, user.process_professional_apply.present?) %></td>
<td><%= display_auth_state user.phone_binded? %></td>
<td><%= display_auth_state prize_user.leader?, error: '' %></td>
<td><%= display_text prize_user.approved_at&.strftime('%Y-%m-%d %H:%M') %></td>
<td><%= display_text prize_user.approver&.real_name %></td>
<td class="action-container">
<% if prize_user.pending? %>
<%= link_to('审批通过', approve_admins_competition_competition_prize_user_path(prize_user.competition, prize_user),
data: { confirm: '确认审批通过吗?' },
remote: true, method: :post, class: 'approve-action') %>
<% else %>
<%= link_to('撤销审批', unapprove_admins_competition_competition_prize_user_path(prize_user.competition, prize_user),
data: { confirm: '确认撤销审批吗?' },
remote: true, method: :post, class: 'approve-action') %>
<% end %>
</td>

@ -0,0 +1 @@
$('.competition-prize-user-list-container .competition-prize-user-item-<%= @prize_user.id %>').html("<%= j( render partial: 'admins/competition_prize_users/shared/tr', locals: { prize_user: @prize_user } ) %>");

@ -0,0 +1,2 @@
$('.admin-modal-container').html("<%= j( render partial: 'admins/competition_prizes/shared/save_competition_prize_modal', locals: { prize: @prize, title: '编辑奖项', form_method: 'PATCH' } ) %>");
$('.modal.admin-save-competition-prize-modal').modal('show');

@ -0,0 +1 @@
$('#competition-prize-card .competition-prize-table tbody').html("<%= j( render partial: 'admins/competition_settings/shared/competition_prizes', locals: { competition: @competition } ) %>");

@ -0,0 +1,2 @@
$('.admin-modal-container').html("<%= j( render partial: 'admins/competition_prizes/shared/save_competition_prize_modal', locals: { prize: @prize, title: '新建奖项', form_method: 'POST' } ) %>");
$('.modal.admin-save-competition-prize-modal').modal('show');

@ -0,0 +1,29 @@
<div class="modal fade admin-save-competition-prize-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><%= title ||= '保存奖项设置' %></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<%= simple_form_for([:admins, prize.competition, prize], data: { form_method: form_method }, html: { class: 'admin-save-competition-prize-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
<%= f.input :name, label: '奖项名称:', placeholder: '请输入奖项名称' %>
<%= f.input :num, as: :integer, label: '数量:', placeholder: '请输入数量', input_html: { min: 1 } %>
<%= f.input :category, label: '奖励类型:' do %>
<%= f.select :category, [%w(奖金 bonus), %w(无 unset)], {}, class: 'form-control' %>
<% end %>
<div class="error text-danger"></div>
<% end %>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary submit-btn">确认</button>
</div>
</div>
</div>
</div>

@ -266,7 +266,7 @@
<% end %>
</div>
<% when 'inform', 'chart', 'resource' %>
<% when 'inform', 'chart', 'resource', 'certificate' %>
<div class="row mt-2 new_module_div linkFormItem">
<div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1">
@ -315,16 +315,6 @@
<% end %>
<% end %>
<!-- <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 mb-4">
@ -386,34 +376,40 @@
<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>
<span class="mt-2 subName mr10">第<%= 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 class="row col-6">
<span class="ml20 mt-2 mr10">有效时间:</span>
<div class="col-4 no_padding">
<%= 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-4 no_padding">
<%= 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>
</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 task_all" value="<%= section.entry %>" onchange="change_total(this)" name="stage[][entry]"/>
<div class="row col-3">
<span class="col-4 text-right mt-2 no_padding mr10">总任务数:</span>
<div class="col-6 no_padding">
<input type="number" class="form-control task_all" value="<%= section.entry %>" onchange="change_total(this)" name="stage[][entry]"/>
</div>
</div>
<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 class="row col-4">
<span class="col-3 text-right mt-2 no_padding mr10">成绩来源:</span>
<div class="col-7 no_padding">
<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>
<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">
<span class="col-4 text-right mt-3 no_padding mr10">任务<%= z+1 %></span>
<div class="col-6 no_padding">
<input type="text" class="form-control mt-2" value="<%= entry.shixun_identifier %>" name="stage[][identifiers][]" placeholder="请填写实训ID">
</div>
</div>
@ -450,45 +446,51 @@
</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>
<span class="mt-2 subName mr10">第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 class="row col-6">
<span class="mt-2 ml20 mr10">有效时间:</span>
<div class="col-4 no_padding">
<%= text_field_tag 'stage[][start_time]', '', autocomplete: 'off', class: 'section-start-time form-control', placeholder: '有效开始时间' %>
</div>
<span class="mt-2">~</span>
<div class="col-4 no_padding">
<%= text_field_tag 'stage[][end_time]', '', autocomplete: 'off', class: 'section-end-time form-control', placeholder: '有效结束时间' %>
</div>
</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 task_all" onchange="change_total(this)" value="3" name="stage[][entry]"/>
<div class="row col-3">
<span class="col-4 text-right mt-2 no_padding mr10">总任务数:</span>
<div class="col-6 no_padding">
<input type="number" class="form-control task_all" onchange="change_total(this)" value="3" name="stage[][entry]"/>
</div>
</div>
<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 class="row col-4">
<span class="col-3 text-right mt-2 no_padding mr10">成绩来源:</span>
<div class="col-7 no_padding">
<select class="form-control" name="stage[][score_source]">
<option value="0">经验值</option>
<option value="1">预测准确率</option>
</select>
</div>
</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">
<span class="col-4 text-right mt-3 no_padding mr10">任务1</span>
<div class="col-6 no_padding">
<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">
<span class="col-4 text-right mt-3 no_padding mr10">任务2</span>
<div class="col-6 no_padding">
<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">
<span class="col-4 text-right mt-3 no_padding mr10">任务3</span>
<div class="col-6 no_padding">
<input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">
</div>
</div>
@ -506,5 +508,36 @@
</div>
</div>
</div>
<div class="card mb-5" id="competition-prize-card" data-id="<%= @competition.id %>">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="flex-1">奖项配置</span>
<%= link_to '新增奖项', new_admins_competition_competition_prize_path(@competition), remote: true, class: 'btn btn-primary btn-sm add-competition-prize-btn' %>
<% if @competition.finished? && !@competition.competition_prize_users.exists? %>
<%= javascript_void_link '生成获奖记录', class: 'btn btn-primary btn-sm ml-2 generate-prize-user-action' %>
<% end %>
</div>
<div class="card-body row pt-0">
<table class="table text-center competition-prize-table">
<thead>
<th width="8%">序号</th>
<th width="10%">奖项名称</th>
<th width="10%">数量</th>
<th width="10%">奖励类型</th>
<th width="16%">队员个人证书模板</th>
<th width="16%">团队证书模板</th>
<th width="16%">指导老师证书模板</th>
<th width="14%">操作</th>
</thead>
<tbody>
<%= render 'admins/competition_settings/shared/competition_prizes', competition: @competition %>
</tbody>
</table>
</div>
</div>
<div style="margin-bottom: 8.5rem;"></div>
<%# end %>
<%# end %>
<%= render partial: 'admins/shared/modal/upload_file_modal', locals: { title: '上传证书模板', accept: 'image/*' } %>

@ -0,0 +1,27 @@
<% competition.competition_prizes.each_with_index do |prize, index| %>
<tr class="competition-prize-item-<%= prize.id %>">
<td><%= index + 1 %></td>
<td><%= prize.name %></td>
<td><%= prize.num %></td>
<td><%= prize.category_text %></td>
<td>
<% member_image_exists = Util::FileManage.exists?(prize, CompetitionPrize.member_suffix) %>
<%= image_tag(member_image_exists ? Util::FileManage.source_disk_file_url(prize, CompetitionPrize.member_suffix) : '', height: 60, class: "w-100 preview-image prize-member-image-#{prize.id}", style: member_image_exists ? '' : 'display:none') %>
<%= javascript_void_link member_image_exists ? '重新上传' : '上传模板', class: 'action upload-prize-member-image-action', data: { source_id: prize.id, source_type: 'CompetitionPrize', suffix: CompetitionPrize.member_suffix, toggle: 'modal', target: '.admin-upload-file-modal' } %>
</td>
<td>
<% team_image_exists = Util::FileManage.exists?(prize, CompetitionPrize.team_suffix) %>
<%= image_tag(team_image_exists ? Util::FileManage.source_disk_file_url(prize, CompetitionPrize.team_suffix) : '', height: 60, class: "w-100 preview-image prize-team-image-#{prize.id}", style: team_image_exists ? '' : 'display:none') %>
<%= javascript_void_link team_image_exists ? '重新上传' : '上传模板', class: 'action upload-prize-team-image-action', data: { source_id: prize.id, source_type: 'CompetitionPrize', suffix: CompetitionPrize.team_suffix, toggle: 'modal', target: '.admin-upload-file-modal' } %>
</td>
<td>
<% teacher_image_exists = Util::FileManage.exists?(prize, CompetitionPrize.teacher_suffix) %>
<%= image_tag(teacher_image_exists ? Util::FileManage.source_disk_file_url(prize, CompetitionPrize.teacher_suffix) : '', height: 60, class: "w-100 preview-image prize-teacher-image-#{prize.id}", style: teacher_image_exists ? '' : 'display:none') %>
<%= javascript_void_link teacher_image_exists ? '重新上传' : '上传模板', class: 'action upload-prize-teacher-image-action', data: { source_id: prize.id, source_type: 'CompetitionPrize', suffix: CompetitionPrize.teacher_suffix, toggle: 'modal', target: '.admin-upload-file-modal' } %>
</td>
<td class="action-container">
<%= link_to '编辑', edit_admins_competition_competition_prize_path(competition, prize), remote: true, class: 'action edit-competition-prize-action' %>
<%= delete_link '删除', admins_competition_competition_prize_path(competition, prize, element: ".competition-prize-item-#{prize.id}"), class: 'action delete-competition-prize-action' %>
</td>
</tr>
<% end %>

@ -11,7 +11,7 @@
<%= link_to '报名列表', admins_competition_enroll_lists_path(@competition), class: "nav-link search-form-tab active" %>
</li>
<li class="nav-item">
<%= link_to '获奖证书审批', admins_competition_enroll_lists_path(@competition), class: "nav-link search-form-tab" %>
<%= link_to '获奖证书审批', admins_competition_competition_prize_users_path(@competition), class: "nav-link search-form-tab" %>
</li>
</ul>

@ -36,4 +36,6 @@
<div class="box subject-list-container">
<%= render partial: 'admins/subjects/shared/list', locals: { subjects: @subjects } %>
</div>
</div>
<%= render partial: 'admins/shared/modal/upload_file_modal', locals: { title: '上传图片', accept: 'image/*' } %>

@ -69,5 +69,4 @@
</tbody>
</table>
<%= render partial: 'admins/shared/paginate', locals: { objects: subjects } %>
<%= render partial: 'admins/shared/modal/upload_file_modal', locals: { title: '上传图片', accept: 'image/*' } %>
<%= render partial: 'admins/shared/paginate', locals: { objects: subjects } %>

@ -1,6 +1,6 @@
json.extract! @competition, :id, :name, :sub_title, :identifier, :bonus, :mode
json.visits_count @competition.visits
member_count = @competition.team_members.count
member_count = @competition.team_member_count
json.member_count member_count.zero? ? 268 : member_count
json.start_time @competition.start_time&.strftime("%Y-%m-%d")

@ -5,7 +5,8 @@ json.competitions do
json.competition_status competition.competition_status
json.visits_count competition.visits
member_count = @member_count_map&.fetch(competition.id, 0) || competition.team_members.count
course = competition.competition_mode_setting&.course if competition.mode == 2
member_count = course ? course.students.count : (@member_count_map&.fetch(competition.id, 0) || competition.team_members.count)
json.member_count member_count.zero? ? 268 : member_count
json.image url_to_avatar(competition)

@ -0,0 +1,55 @@
json.leader @leader
json.bank_account @bank_account if @leader
json.personal_certifications do
json.array! @self_prizes do |prize_user|
json.url personal_competitions_certificate_path(current_competition, prize_user)
end
end
json.team_certifications do
json.array! @team_prizes do |team|
json.url team_competitions_certificate_path(current_competition, team)
end
end
json.teams do
json.array! @prize_user_map do |team, prize_users|
json.extract! team, :id, :name
json.bank_account prize_users.find(&:leader?).extra
json.team_members do
json.array! prize_users do |prize_user|
user = prize_user.user
json.role prize_user.role_text
json.name user.real_name
real_name_auth =
if user.authentication?
'authed'
elsif user.process_real_name_apply.present?
'authing'
else
'not_authed'
end
json.real_name_auth real_name_auth
professional_auth =
if user.professional_certification?
'authed'
elsif user.process_professional_apply.present?
'authing'
else
'not_authed'
end
json.professional_auth professional_auth
json.phone_binded user.phone_binded?
json.email_binded user.email_binded?
end
end
end
end

@ -1,7 +1,7 @@
json.course_members @course_members.each do |member|
user = member.user
json.user_login user.login
json.user_name user.real_name
json.user_login user&.login
json.user_name user&.real_name
# json.course_group member.course_group_name
json.total_score member.score
end

@ -5,7 +5,7 @@ json.partial! "homework_btn_check", locals: {identity: @user_course_identity, ho
json.partial! "student_btn_check", locals: {identity: @user_course_identity, homework: @homework, work: @work}
json.(@homework, :unified_setting, :publish_time, :end_time, :late_penalty, :allow_late, :late_time, :work_public,
:score_open, :answer_public)
:score_open, :answer_public, :total_score)
json.group_settings @course_groups do |group|
json.group_id group.id

@ -86,7 +86,7 @@ if @homework.homework_type == "practice"
json.work_efficiency @homework.work_efficiency
json.student_works @student_works.each do |work|
json.(work, :id, :work_status, :update_time, :ultimate_score)
json.(work, :id, :work_status, :update_time, :ultimate_score, :myshixun_id)
json.late_penalty work.late_penalty if @homework.allow_late
json.work_score work_score_format(work.work_score, @current_user == work.user, @score_open)

@ -10,6 +10,7 @@ json.user_identity @user.identity
json.tidding_count 0
json.user_phone_binded @user.phone.present?
json.phone @user.phone
json.email @user.mail
json.profile_completed @user.profile_completed?
json.professional_certification @user.professional_certification
if @course

@ -1,4 +1,6 @@
admins-mirror_scripts: 'admins-mirror_repositories'
admins-laboratory_settings: 'admins-laboratories'
admins-carousels: 'admins-laboratories'
admins-competition_settings: 'admins-competitions'
admins-competition_settings: 'admins-competitions'
admins-enroll_lists: 'admins-competitions'
admins-competition_prize_users: 'admins-competitions'

@ -0,0 +1,6 @@
zh-CN:
enumerize:
competition_prize:
category:
bonus: '奖金'
unset: '无'

@ -0,0 +1,8 @@
'zh-CN':
activemodel:
attributes:
competitions/save_prize_team_account_form:
bank: '开户行'
second_bank: '支行'
card_no: '卡号'

@ -114,8 +114,8 @@ Rails.application.routes.draw do
resource :password, only: [:update]
resource :avatar, only: [:update]
resource :auth_attachment, only: [:create]
resource :authentication_apply, only: [:create]
resource :professional_auth_apply, only: [:create]
resource :authentication_apply, only: [:create, :destroy]
resource :professional_auth_apply, only: [:create, :destroy]
resources :open_users, only: [:destroy]
end
end
@ -510,7 +510,7 @@ Rails.application.routes.draw do
post :join_exercise_banks # 加入习题集
post :publish # 立即发布
post :end_exercise # 立即截止
``
end
end
@ -626,6 +626,7 @@ Rails.application.routes.draw do
post :cancel_exercise
get :begin_commit #提交前的弹窗
get :publish_groups
post :adjust_score
end
resources :exercise_questions,only:[:new,:create,:index]
end
@ -809,6 +810,14 @@ Rails.application.routes.draw do
get :chart_rules
post :update_chart_rules
end
resource :prize_leader_account, only: [:update]
resource :prize, only: [:show]
resources :certificates, only: [] do
member do
get :personal
get :team
end
end
end
end
@ -1043,6 +1052,14 @@ Rails.application.routes.draw do
post :calculate_stage_score
end
end
resources :competition_prizes, only: [:index, :new, :create, :edit, :update, :destroy]
resources :competition_prize_users, only: [:index, :create] do
member do
post :approve
post :unapprove
end
end
end
resources :weapp_carousels, only: [:index, :create, :update, :destroy] do

@ -0,0 +1,5 @@
class AddTotalScoreToHomeworkCommons < ActiveRecord::Migration[5.2]
def change
add_column :homework_commons, :total_score, :float, default: 100
end
end

@ -0,0 +1,10 @@
class InitCompetitionCertificateModuleData < ActiveRecord::Migration[5.2]
def change
Competition.find_each do |competition|
competition.competition_modules.where(module_type: 'certificate').delete_all
position = competition.competition_modules.maximum(:position) + 1
competition.competition_modules.create(module_type: 'certificate', position: position, name: '获奖证书', hidden: true)
end
end
end

@ -0,0 +1,13 @@
class CreateCompetitionPrizes < ActiveRecord::Migration[5.2]
def change
create_table :competition_prizes do |t|
t.references :competition
t.string :name
t.string :category
t.integer :num
t.timestamps
end
end
end

@ -0,0 +1,20 @@
class CreateCompetitionPrizeUsers < ActiveRecord::Migration[5.2]
def change
create_table :competition_prize_users do |t|
t.references :competition
t.references :competition_team
t.references :competition_prize
t.references :user
t.references :approver
t.string :status
t.integer :rank
t.boolean :leader, default: false
t.text :extra
t.datetime :approved_at
t.timestamps
end
end
end

@ -0,0 +1,13 @@
class CreateExerciseUserScores < ActiveRecord::Migration[5.2]
def change
create_table :exercise_user_scores do |t|
t.references :exercise, index: true
t.references :exercise_user, index: true
t.float :score
t.text :comment
t.references :user, index: true
t.timestamps
end
end
end

File diff suppressed because one or more lines are too long

@ -29898,13 +29898,35 @@ function customConfirm(opts){
return $.confirm($.extend({}, defaultOpts, opts))
}
function customLoading(opts) {
var loading;
var defaultOpts = {
content: opts.ajax,
contentLoaded: function(){
setTimeout(function(){
loading.close()
}, 200);
}
}
loading = $.confirm($.extend({}, defaultOpts, opts));
return loading;
}
function show_success_flash(message){
$.notify({
message: message || '操作成功'
message: message || '操作成功'
},{
type: 'success'
});
}
function showErrorNotify(message){
$.notify({
message: message || '操作失败'
},{
type: 'danger'
});
}
;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@ -136202,7 +136224,7 @@ $(document).on('turbolinks:load', function(){
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return $("<div class='row px-0'><span class='col-3'>" + item.real_name + "</span><span class='col-5 font-12'>" + item.school_name + "</span><span class='col-4 font-12'>" + item.hidden_phone + "</span></div>");
return $("<div class='row px-0'><span class='col-3'>" + item.real_name + "</span><span class='col-5 font-12'>" + item.school_name + "</span><span class='col-4 font-12'>" + item.hidden_phone + "</span></div>");
},
templateSelection: function(item){
if (item.id) {
@ -136519,45 +136541,45 @@ $(document).on('turbolinks:load', function(){
' </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' +
' <span class="mt-2 subName mr10">第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' +
' <div class="row col-6"><span class="mt-2 ml20">有效时间:</span>\n' +
' <div class="col-4 no_padding">\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' +
' <div class="col-4 no_padding ">\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' +
' </div></div>\n' +
' <div class="row col-3"><span class="col-4 text-right mt-2 no_padding">总任务数:</span>\n' +
' <div class="col-6 no_padding ">\n' +
' <input type="number" class="form-control" onchange="change_total(this)" value="3" name="stage[][entry]">\n' +
' </div>\n' +
' <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' </div></div>\n' +
' <div class="row col-4"><span class="col-3 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-7 no_padding ">\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></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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务1</span>\n' +
' <div class="col-6 no_padding">\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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务2</span>\n' +
' <div class="col-6 no_padding">\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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务3</span>\n' +
' <div class="col-6 no_padding">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
@ -136595,45 +136617,45 @@ $(document).on('turbolinks:load', function(){
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' +
' <span class="mr10 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' +
' <div class="row col-6"><span class="mt-2 ml20 mr10">有效时间:</span>\n' +
' <div class="col-4 no_padding ">\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' +
' <div class="col-4 no_padding ">\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' +
' </div></div>\n' +
' <div class="row col-3"><span class="col-4 text-right mt-2 no_padding mr10">总任务数:</span>\n' +
' <div class="col-6 no_padding ">\n' +
' <input type="number" class="form-control" onchange="change_total(this)" value="3" name="stage[][entry]">\n' +
' </div>\n' +
' <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' </div></div>\n' +
' <div class="row col-4"><span class="col-3 mr10 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-7 no_padding ">\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></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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务1</span>\n' +
' <div class="col-6 no_padding">\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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务2</span>\n' +
' <div class="col-6 no_padding">\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' +
' <span class="col-4 text-right mt-3 no_padding mr10">任务3</span>\n' +
' <div class="col-6 no_padding">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
@ -136648,6 +136670,67 @@ $(document).on('turbolinks:load', function(){
$(".stage-update-form .section-start-time").datetimepicker(timeOptions);
$(".stage-update-form .section-end-time").datetimepicker(timeOptions);
});
// 奖项设置
var $prizeContainer = $('#competition-prize-card');
var competitionId = $prizeContainer.data('id');
$(document).on('prize.save.success', function(){
$.ajax({
method: 'GET',
url: '/admins/competitions/' + competitionId + '/competition_prizes',
dataType: 'script'
})
});
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $imageElement;
if(data.suffix === '_member'){
$imageElement = $('.prize-member-image-' + data.source_id);
} else if(data.suffix === '_team'){
$imageElement = $('.prize-team-image-' + data.source_id);
} else {
$imageElement = $('.prize-teacher-image-' + data.source_id);
}
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
// 生成获奖记录
$prizeContainer.on('click', '.generate-prize-user-action', function(){
var $link = $(this);
var generateRequest = function(){
return $.ajax({
method: 'POST',
url: '/admins/competitions/' + competitionId + '/competition_prize_users',
dataType: 'json',
success: function(data){
if(data && data.status === 0){
show_success_flash();
$link.remove();
} else {
showErrorNotify(data.message);
}
},
error: function(res){
var data = res.responseJSON;
showErrorNotify(data.message);
}
})
}
customConfirm({
content: '确认生成吗?',
ok: function () {
customLoading({
ajax: generateRequest
})
}
})
});
} else {
$(document).unbind('prize.save.success');
}
});
@ -136681,8 +136764,8 @@ function change_total(item) {
var html = "";
if(count > divCount){
for(var i=0;i < count-divCount ;i++){
html+='<div class="col-4 row task_Input_div"><span class="col-3 text-center mt-3">任务'+(divCount+i+1)+'</span>\n' +
'<div class="col-8">\n' +
html+='<div class="col-4 row task_Input_div"><span class="col-4 text-right mt-3 no_padding mr10">任务'+(divCount+i+1)+'</span>\n' +
'<div class="col-6 no_padding">\n' +
'<input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
'</div>\n' +
'</div>';
@ -136736,45 +136819,45 @@ function addNewTab(competition_id) {
' </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' +
' <span class="mt-2 subName mr10">第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' +
' <div class="row col-6"><span class="mt-2 ml20 mr10">有效时间:</span>\n' +
' <div class="col-4 no_padding ">\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' +
' <div class="col-4 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' +
' </div></div>\n' +
' <div class="row col-3"><span class="col-4 text-right mt-2 no_padding mr10">总任务数:</span>\n' +
' <div class="col-6 no_padding ">\n' +
' <input type="number" class="form-control" onchange="change_total(this)" value="3" name="stage[][entry]">\n' +
' </div>\n' +
' <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>\n' +
' <div class="col-2 no_padding input_middle">\n' +
' </div></div>\n' +
' <div class="row col-4"><span class="col-3 text-right mt-2 no_padding mr10">成绩来源:</span>\n' +
' <div class="col-7 no_padding ">\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></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' +
' <span class="col-3 text-right mt-3 no_padding mr10">任务1</span>\n' +
' <div class="col-8 no_padding">\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' +
' <span class="col-3 text-right mt-3 no_padding mr10">任务2</span>\n' +
' <div class="col-8 no_padding">\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' +
' <span class="col-3 text-right no_padding mr10 mt-3">任务3</span>\n' +
' <div class="col-8 no_padding">\n' +
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
' </div>\n' +
' </div>\n' +
@ -137789,23 +137872,23 @@ $(document).on('turbolinks:load', function() {
});
})
});
$(document).on('turbolinks:load', function() {
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-subject-modal', function(){
var $modal = $('.modal.admin-edit-subject-modal');
var $form = $modal.find('form.admin-edit-subject-form');
$modal.on('click', '.submit-btn', function(){
$form.find('.error').html('');
var url = $form.attr('action');
$.ajax({
method: 'PATCH',
dataType: 'script',
url: url,
data: $form.serialize()
});
});
})
$(document).on('turbolinks:load', function () {
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-subject-modal', function () {
var $modal = $('.modal.admin-edit-subject-modal');
var $form = $modal.find('form.admin-edit-subject-form');
$modal.on('click', '.submit-btn', function () {
$form.find('.error').html('');
var url = $form.attr('action');
$.ajax({
method: 'PATCH',
dataType: 'script',
url: url,
data: $form.serialize()
});
});
})
});
$(document).on('turbolinks:load', function() {
var $modal = $('.modal.admin-import-course-member-modal');
@ -138085,6 +138168,52 @@ $(document).on('turbolinks:load', function() {
});
}
});
$(document).on('turbolinks:load', function() {
$('.admin-modal-container').on('show.bs.modal', '.admin-save-competition-prize-modal', function(event){
var $modal = $('.modal.admin-save-competition-prize-modal');
var $form = $modal.find('form.admin-save-competition-prize-form');
$form.validate({
errorElement: 'span',
errorClass: 'danger text-danger',
rules: {
'competition_prize[name]': {
required: true,
maxlength: 10
},
'competition_prize[num]': {
required: true,
digits: true,
min: 1
}
}
});
$modal.on('click', '.submit-btn', function(){
$form.find('.error').html('');
var url = $form.attr('action');
var formMethod = $form.data('form-method')
if ($form.valid()) {
$.ajax({
method: formMethod,
dataType: 'json',
url: url,
data: $form.serialize(),
success: function(data){
if(data && data.status === 0) {
show_success_flash();
$(document).trigger('prize.save.success');
$modal.modal('hide');
} else {
$modal.find('.error').html(data.message)
}
}
});
}
});
})
});
$(document).on('turbolinks:load', function() {
var $modal = $('.modal.admin-upload-file-modal');
if ($modal.length > 0) {
@ -138496,112 +138625,112 @@ $(document).on('turbolinks:load', function() {
}
})
;
$(document).on('turbolinks:load', function() {
if ($('body.admins-subjects-index-page').length > 0) {
var $form = $('.subject-list-form');
// ************** 学校选择 *************
$form.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
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;
},
templateSelection: function(item){
if (item.id) {
}
return item.name || item.text;
}
});
// 清空
$form.on('click', '.clear-btn', function(){
$form.find('select[name="status"]').val('');
$form.find('.school-select').val('').trigger('change');
$form.find('input[name="keyword"]').val('');
$form.find('#homepage_show').attr('checked', false);
$form.find('#excellent').attr('checked', false);
$form.find('input[type="submit"]').trigger('click');
})
$(document).on('turbolinks:load', function () {
if ($('body.admins-subjects-index-page').length > 0) {
var $form = $('.subject-list-form');
// ************** 学校选择 *************
$form.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
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;
},
templateSelection: function (item) {
if (item.id) {
}
return item.name || item.text;
}
});
// 上传图片
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $imageElement = $('.subject-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
// 清空
$form.on('click', '.clear-btn', function () {
$form.find('select[name="status"]').val('');
$form.find('.school-select').val('').trigger('change');
$form.find('input[name="keyword"]').val('');
$form.find('#homepage_show').attr('checked', false);
$form.find('#excellent').attr('checked', false);
$form.find('input[type="submit"]').trigger('click');
})
// 定义状态切换监听事件
var defineStatusChangeFunc = function(doElement, undoElement, url, callback){
$('.subject-list-container').on('click', doElement, function(){
var $doAction = $(this);
var $undoAction = $doAction.siblings(undoElement);
// 上传图片
$('.modal.admin-upload-file-modal').on('upload:success', function (e, data) {
var $imageElement = $('.subject-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
var subjectId = $doAction.data('id');
customConfirm({
content: '确认进行该操作吗?',
ok: function(){
$.ajax({
url: '/admins/subjects/' + subjectId + url,
method: 'POST',
dataType: 'json',
success: function() {
show_success_flash();
$doAction.hide();
$undoAction.show();
if(callback && typeof callback === "function"){
callback(subjectId, url);
}
}
});
}
});
});
}
// 隐藏与取消隐藏
defineStatusChangeFunc('.hide-action', '.active-action', '/hide');
defineStatusChangeFunc('.active-action', '.hide-action', '/cancel_hide');
// 定义状态切换监听事件
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
$('.subject-list-container').on('click', doElement, function () {
var $doAction = $(this);
var $undoAction = $doAction.siblings(undoElement);
var subjectId = $doAction.data('id');
customConfirm({
content: '确认进行该操作吗?',
ok: function () {
$.ajax({
url: '/admins/subjects/' + subjectId + url,
method: 'POST',
dataType: 'json',
success: function () {
show_success_flash();
$doAction.hide();
$undoAction.show();
if (callback && typeof callback === "function") {
callback(subjectId, url);
}
}
});
}
});
});
}
// 隐藏与取消隐藏
defineStatusChangeFunc('.hide-action', '.active-action', '/hide');
defineStatusChangeFunc('.active-action', '.hide-action', '/cancel_hide');
// 首页展示与取消首页展示
var homepageShowCallback = function(subjectId, url){
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
// 首页展示与取消首页展示
var homepageShowCallback = function (subjectId, url) {
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
if(url === '/homepage_show'){
$subjectItem.find('.homepage-show-badge').show();
} else {
$subjectItem.find('.homepage-show-badge').hide();
}
}
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage_show', homepageShowCallback);
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage_show', homepageShowCallback);
if (url === '/homepage_show') {
$subjectItem.find('.homepage-show-badge').show();
} else {
$subjectItem.find('.homepage-show-badge').hide();
}
}
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage_show', homepageShowCallback);
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage_show', homepageShowCallback);
// 设为金课与取消金课
var excellentCallback = function(subjectId, url){
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
// 设为金课与取消金课
var excellentCallback = function (subjectId, url) {
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
if(url === '/excellent'){
$subjectItem.find('.excellent-badge').show();
} else {
$subjectItem.find('.excellent-badge').hide();
}
}
defineStatusChangeFunc('.excellent-action', '.cancel-excellent-action', '/excellent', excellentCallback);
defineStatusChangeFunc('.cancel-excellent-action', '.excellent-action', '/cancel_excellent', excellentCallback);
}
if (url === '/excellent') {
$subjectItem.find('.excellent-badge').show();
} else {
$subjectItem.find('.excellent-badge').hide();
}
}
defineStatusChangeFunc('.excellent-action', '.cancel-excellent-action', '/excellent', excellentCallback);
defineStatusChangeFunc('.cancel-excellent-action', '.excellent-action', '/cancel_excellent', excellentCallback);
}
});
$(document).on('turbolinks:load', function() {
if ($('body.admins-user-statistics-index-page').length > 0) {

@ -25681,6 +25681,48 @@ input.form-control {
border: none;
}
/* line 91, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n-2) > span.col-4 {
-webkit-box-flex: 0;
flex: 0 0 81px;
max-width: 81px;
}
/* line 95, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n-2) {
-webkit-box-flex: 0;
flex: 0 0 50%;
max-width: 50%;
}
/* line 99, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n-1) {
-webkit-box-flex: 0;
flex: 0 0 25%;
max-width: 25%;
}
/* line 103, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n) {
-webkit-box-flex: 0;
flex: 0 0 33.3%;
max-width: 33.3%;
}
/* line 107, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n) > span.col-4 {
-webkit-box-flex: 0;
flex: 0 0 25%;
max-width: 25%;
}
/* line 111, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .task_Input_div:nth-child(3n) > div.col-6 {
-webkit-box-flex: 0;
flex: 0 0 58.3%;
max-width: 58.3%;
}
/* line 4, app/assets/stylesheets/admins/cooperatives.scss */
.admins-cooperatives-index-page .coo-img-card .coo-img-item > .drag {
cursor: move;

@ -29891,13 +29891,35 @@ function customConfirm(opts){
return $.confirm($.extend({}, defaultOpts, opts))
}
function customLoading(opts) {
var loading;
var defaultOpts = {
content: opts.ajax,
contentLoaded: function(){
setTimeout(function(){
loading.close()
}, 200);
}
}
loading = $.confirm($.extend({}, defaultOpts, opts));
return loading;
}
function show_success_flash(message){
$.notify({
message: message || '操作成功'
message: message || '操作成功'
},{
type: 'success'
});
}
function showErrorNotify(message){
$.notify({
message: message || '操作失败'
},{
type: 'danger'
});
}
;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -960,7 +960,7 @@ class Registration extends React.Component {
<Breadcrumb separator=">">
<Breadcrumb.Item><Link to={"/competitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item><Link
to={`/competitions/${this.props.match.params.identifier}/common_header`}>{competition_name === undefined || competition_name === null || competition_name === "" ? "全国高校计算机大赛" : competition_name}</Link></Breadcrumb.Item>
to={`/competitions/${this.props.match.params.identifier}`}>{competition_name === undefined || competition_name === null || competition_name === "" ? "全国高校计算机大赛" : competition_name}</Link></Breadcrumb.Item>
{/*<Breadcrumb.Item*/}
{/* href={`/competitions/${this.props.match.params.identifier}/common_header`}></Breadcrumb.Item>*/}
<Breadcrumb.Item>报名</Breadcrumb.Item>

@ -54,11 +54,11 @@ class RegistrationSearch extends React.Component {
/>
<p style={{
width: "300px",
width: "583px",
color: "#07140E",
fontSize: '16px',
marginTop: " 7px",
marginLeft: "583px",
marginLeft: "300px",
textAlign: "right",
lineHeight: " 24px"
}}>战队总数<span

@ -117,7 +117,7 @@ class CompetitionsIndex extends Component{
size="large"
dataSource={datas&&datas}
renderItem={(item,key) => (
<a target="_blank" href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"?item.permission.editable==true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
<a target="_blank" href={item.competition_status==="ended"?`/competitions/${item.identifier}`:item.competition_status==="nearly_published"?item.permission.editable==true?`/competitions/${item.identifier}`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}`:null}
className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
item.permission.editable==true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}
>
@ -175,7 +175,7 @@ class CompetitionsIndex extends Component{
title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
item.permission.editable==true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<a target="_blank" className={"competitionstitles"}
href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? item.permission.editable==true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
href={item.competition_status==="ended"?`/competitions/${item.identifier}`:item.competition_status==="nearly_published"? item.permission.editable==true?`/competitions/${item.identifier}`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}`:null}
>{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a>
{/*<span>{item.sub_title===null?"":*/}
{/*<Tag className="competitionsrelative" color="#87d068">{item.sub_title}</Tag>}*/}
@ -219,4 +219,4 @@ class CompetitionsIndex extends Component{
)
}
}
export default CompetitionsIndex;
export default CompetitionsIndex;

@ -3,7 +3,6 @@ import { Breadcrumb,Layout,Table, Divider, Tag,Badge,Tooltip} from 'antd';
import { Link } from 'react-router-dom';
import axios from 'axios';
import NoneData from "../../courses/shixunHomework/shixunHomework";
import './Competitionteams.css';
const { Content } = Layout;

@ -3,11 +3,9 @@ import { Breadcrumb,Layout,Table, Divider, Tag,Badge,Row, Col,Button, Menu, Icon
import { Link } from 'react-router-dom';
import axios from 'axios';
import {markdownToHTML,getImageUrl} from 'educoder';
import CompetitionContents from './CompetitionCommonChild/CompetitionContents';
import CompetitionContentsChart from './CompetitionCommonChild/CompetitionContentsChart';
import CompetitionContentsMd from './CompetitionCommonChild/CompetitionContentsMd';
import CompetitionContentspdf from './CompetitionCommonChild/CompetitionContentspdf';
import NoneData from "../../courses/shixunHomework/shixunHomework";
import CompetitionContents from './CompetitionContents';
import CompetitionContentsChart from './CompetitionContentsChart';
import CompetitionContentsMd from './CompetitionContentsMd';
import './CompetitionCommon.css';
@ -254,13 +252,6 @@ class CompetitionCommon extends Component{
}
isdownloadpdf=()=>{
this.setState({
isdownloadpdftype:true
})
}
render() {
let {data,thiskeys,Competitionedittype}=this.state;
@ -273,10 +264,11 @@ class CompetitionCommon extends Component{
</Breadcrumb>
<div className={"mt10 relative"}>
<Row className={"CompetitionCommonbanner"}>
{data.competition_status==="nearly_published"?
data&&data.permission.editable===true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
data && data.permission.editable === true ? "" :
<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div> : ""}
<img className={"Commonimg"}
src={data.competition_status==="ended"?getImageUrl(`images/educoder/competitions/groups1.png`):data.competition_status==="nearly_published"?getImageUrl(`images/educoder/competitions/groups2.png`):data.competition_status==="progressing"?getImageUrl(`images/educoder/competitions/groups3.png`):""} />
<Col span={15} className={"Commonimgbox"}>
@ -342,7 +334,7 @@ class CompetitionCommon extends Component{
<Button type="primary" block className={"Competitionfontsize22"} disabled={true}>
已结束
</Button>:data.enroll_end===true?<Button type="primary" block className={"Competitionfontsize22"} disabled={true}>
{data.competition_status==="nearly_published"?"未发布":"报名截止"}
{data.competition_status === "nearly_published" ? "未发布" : "报名截止"}
</Button>:
data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}>
{data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}></a>}
@ -373,15 +365,9 @@ class CompetitionCommon extends Component{
}
})}
</Menu>
<Menu mode="inline" className="CompetitionMenu" onClick={(e)=>this.isdownloadpdf(e)}>
<Menu.Item>
<a>证书下载</a>
</Menu.Item>
</Menu>
</Sider>
{this.state.isdownloadpdftype===true?"":<Layout className={"teamsLayoutleft CompetitionContents mb30"}>
<Layout className={"teamsLayoutleft CompetitionContents mb30"}>
{this.state.module_type==="chart"?Competitionedittype===false?<CompetitionContentsChart
{...this.props}
{...this.state}
@ -403,14 +389,8 @@ class CompetitionCommon extends Component{
{...this.props}
{...this.state}
/>:""}
</Layout>}
{this.state.isdownloadpdftype===true?<Layout className={"teamsLayoutleft CompetitionContents mb30"}>
<CompetitionContentspdf
{...this.props}
{...this.state}
/>
</Layout>:""}
</Layout>
</Layout>
</div>
@ -418,4 +398,4 @@ class CompetitionCommon extends Component{
)
}
}
export default CompetitionCommon;
export default CompetitionCommon;

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import {Button,Layout} from 'antd';
import axios from 'axios';
import {markdownToHTML,getImageUrl,AttachmentList} from 'educoder';
// import NoneData from "../../../courses/shixunHomework/shixunHomework";
const { Header, Footer, Sider, Content } = Layout;
class CompetitionContents extends Component{
@ -19,13 +19,14 @@ class CompetitionContents extends Component{
}
render() {
let{mdContentdata,data}=this.props;
let {mdContentdata, data} = this.props;
//mdhash滚动
this.props.MdifHasAnchorJustScorll();
return (
<div className={"fr"}>
{data&&data.permission.editable===true?this.props.Competitionedittype===false?this.props.has_url===false?<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>
{data && data.permission.editable === true ? this.props.Competitionedittype === false ? this.props.has_url === false ?
<Button className={"fr"} type="primary" ghost onClick={() => this.props.Competitionedit()}>
编辑
</Button>:"":"":""}
<div className={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?"mt50 mb100 ":"mb100 "}>
@ -41,4 +42,4 @@ class CompetitionContents extends Component{
)
}
}
export default CompetitionContents;
export default CompetitionContents;

@ -2,7 +2,6 @@ import React, { Component } from 'react';
import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd';
import {markdownToHTML,getImageUrl} from 'educoder';
import axios from 'axios';
// import NoneData from "../../../courses/shixunHomework/shixunHomework";
const { Content } = Layout;
const { TabPane } = Tabs;
@ -116,7 +115,7 @@ class CompetitionContents extends Component{
];
const datas = [];
let {chart_rules,chartdata,data}=this.props;
let {chart_rules, chartdata, data} = this.props;
let {personal}=this.state;
chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<3?"":chartdata.teams.map((item,key)=>{
@ -139,7 +138,9 @@ class CompetitionContents extends Component{
//console.log(chartdata&&chartdata.teams)
return (
<div>
{chart_rules===undefined?"":<Tabs onChange={(e)=>this.props.Competitioncallback(e)} activeKey={this.props.tabkey} tabBarExtraContent={data&&data.permission.editable===true?this.props.Competitionedittype===false?this.props.has_url===false?operations:"":"":""}>
{chart_rules === undefined ? "" :
<Tabs onChange={(e) => this.props.Competitioncallback(e)} activeKey={this.props.tabkey}
tabBarExtraContent={data && data.permission.editable === true ? this.props.Competitionedittype === false ? this.props.has_url === false ? operations : "" : "" : ""}>
{chart_rules.stages.map((item,key)=>{
return(
<TabPane tab={item.name} key={item.id===null?0:item.id}>
@ -343,7 +344,9 @@ class CompetitionContents extends Component{
`
}
</style>
{chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<4?"":<Table className="Competitiontransparent" columns={columns} dataSource={datas} showHeader={false} pagination={false}/>}
{chartdata === undefined ? "" : chartdata.teams.length === 0 || chartdata.teams.length < 4 ? "" :
<Table className="Competitiontransparent" columns={columns} dataSource={datas} showHeader={false}
pagination={false}/>}
</Row>
@ -352,4 +355,4 @@ class CompetitionContents extends Component{
)
}
}
export default CompetitionContents;
export default CompetitionContents;

@ -1,8 +1,8 @@
import React, { Component } from 'react';
import {Button,Layout} from 'antd';
import {Button,Layout,Input} from 'antd';
import axios from 'axios';
import {getImageUrl} from 'educoder';
// import NoneData from "../../../courses/shixunHomework/shixunHomework";
import mycompetotionchild from './mycompetotionchild.css';
class CompetitionContentspdfpeopledata extends Component{
constructor(props) {
@ -14,17 +14,106 @@ class CompetitionContentspdfpeopledata extends Component{
componentDidMount(){
window.document.title = '竞赛';
console.log(this.props.match.params.identifier)
}
render() {
console.log(this.props)
return (
<div>
123123
<div className="flexdidirectionss mt17">
<div className="flexdirections ">
<p className="fontcolorsyslhei font-16 w98"><span className="fontcolorsysl font-16">*</span><span></span></p>
<p className="fontcolorsyslhui font-14 w200">通过实名认证后才能获得证书</p>
<p className="fontcolorsysllan font-14 ml3">立即认证</p>
</div>
<div className="flexdirections ml38 mt23">
<p className="fontcolorsyslhui1">姓名</p>
<p className="fontcolorsyslhei flexdirections">胡志勇 <p className="iconfont icon-wancheng colorgreenlight font-14 ml20"></p><p className="colorgreenlight font-14 ml6"></p> <p className="iconfont icon-tishi colorgreenorg font-14 ml20"></p><p className="colorgreenorg font-14 ml6"></p><p className="fontcolorsysllan borcolors font-12 w64"></p></p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1">性别</p>
<p className="fontcolorsyslhei"></p>
</div>
<div className="flexdirections mt36 ">
<p className="fontcolorsyslhei font-16 w98"><span className="fontcolorsysl font-16">*</span><span></span></p>
<p className="fontcolorsyslhui font-14 w200">通过职业认证后才能获得证书</p>
<p className="fontcolorsysllan font-14 ml3">立即认证</p>
</div>
<div className="flexdirections ml38 mt23">
<p className="fontcolorsyslhui1">职业</p>
<p className="fontcolorsyslhei flexdirections">教师 <p className="iconfont icon-wancheng colorgreenlight font-14 ml20"></p><p className="colorgreenlight font-14 ml6"></p><p className="iconfont icon-tishi colorgreenorg font-14 ml20"></p><p className="colorgreenorg font-14 ml6"></p><p className="fontcolorsysllan borcolors font-12 w64"></p></p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1">职称</p>
<p className="fontcolorsyslhei">副教授</p>
</div>
<div className="flexdirections ml38 mt19" >
<p className="fontcolorsyslhui1">学校</p>
<p className="fontcolorsyslhei">国防科技大学</p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1">院系</p>
<p className="fontcolorsyslhei">计算机学院</p>
</div>
<div className="flexdirections mt36 ">
<p className="fontcolorsyslhei font-16 w98"><span className="fontcolorsysl font-16">*</span><span></span></p>
</div>
<div className="flexdirections ml38 mt23">
<p className="fontcolorsyslhui1 w60 ">手机号</p>
<p className="fontcolorsysljin w200 ">未绑定</p>
<p className="fontcolorsysllan">立即绑定</p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1 w60">Email</p>
<p className="fontcolorsyslhei w200">163@163.com</p>
<p className="fontcolorsysllan">更换</p>
</div>
<div className="flexdirections mt36">
<p className="fontcolorsyslhei font-16">//开户行及银行卡号</p>
<p className="fontcolorsyslhui font-14 ml11">为保障奖金的及时发放请队长如实填写你名下的银行卡信息</p>
</div>
<style>
{
`
.yslzxueshi .ant-input{
height: 40px !important;
width: 276px !important
}
`
}
</style>
<div className="flexdirections yslzxueshi ml38 mt23">
<p className="fontcolorsyslhui1 font-14 w60 myysllineheight">开户行</p>
<Input placeholder="例如:中国工商银行" />
</div>
<div className="flexdirections yslzxueshi ml38 mt19">
<p className="fontcolorsyslhui1 font-14 w60 myysllineheight">支行</p>
<Input placeholder="例如:长沙天河支行" />
</div>
<div className="flexdirections yslzxueshi ml38 mt19">
<p className="fontcolorsyslhui1 font-14 w60 myysllineheight">账号</p>
<Input placeholder="请填写银行卡账号" />
</div>
<div className="flexdirections yslzxueshi ml38 mt34">
<p className="fontcolorsyslhui1 font-14 w60 myysllineheight myyslminwidth"></p>
<div className="myyslminwidth276 flexdirections">
<div className="buttongo"><p className="fontwenzi">取消</p></div>
<div className="buttongo2 ml20"><p className="fontwenzi">确认</p></div>
</div>
</div>
</div>
)
}
}
export default CompetitionContentspdfpeopledata;
export default CompetitionContentspdfpeopledata;

@ -0,0 +1,183 @@
/*
*/
.flexdirectionjust{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.directstwebkitflex{
display: flex;
display: -webkit-flex;
flex-direction: column;
align-items: center;
}
.diredisplayitflex{
display: flex;
display: -webkit-flex;
align-items: center;
}
/*垂直布局*/
/*
*/
.flexdirection{
display: flex;
flex-direction:row;
}
.flexdirections{
display: flex;
flex-direction:initial;
}
/*
*/
/*靠右侧八 七 六 五 四 三 二 一*/
.flexdirectionss{
display: flex;
flex-direction:row-reverse;
}
/*
*/
.flexdidirectionss{
display: flex;
flex-direction:column;
}
/*
*/
.flexdidireverses{
display: flex;
flex-direction:column-reverse;
}
.fontcolorsysl{
color:#FF0000
}
.fontcolorsyslhei{
color:#000000
}
.fontcolorsyslhui{
color:#888888
}
.fontcolorsyslhui1{
color:#666666;
}
.fontcolorsysllan{
color:#4CACFF
}
.fontcolorsysljin{
color:#DD7600
}
.w200{
width: 200px;
}
.w64{
width: 64px;
}
.w60{
width: 60px;
}
.w98{
width: 98px;
}
.myysllineheight{
line-height: 40px;
}
.myyslminwidth{
min-width: 60px;
}
.myyslminwidth276{
width: 276px;
}
.buttongo{
background: #E7E7E7;
border: 1px solid #E7E7E7;
width: 60px;
height: 30px;
border-radius: 4px;
color: #999999;
font-size: 16px;
}
.buttongo2{
background: #4CACFF;
border: 1px solid #4CACFF;
width: 60px;
height: 30px;
border-radius: 4px;
color: #FFFFFF;
font-size: 16px;
}
.fontwenzi{
text-align: center;
line-height: 30px;
}
.mt17{
margin-top: 17px;
}
.mt36{
margin-top: 36px;
}
.mt23{
margin-top: 23px;
}
.mt19{
margin-top: 19px;
}
.mt23{
margin-top: 23px;
}
.mt34{
margin-top: 34px;
}
.ml11{
margin-left: 11px;
}
.ml38{
margin-left: 38px;
}
.ml7{
margin-left: 7px;
}
.colorgreenlight{
color:#6EC76E
}
.colorgreenorg{
color: #FF7300;
}
.borcolors{
border: 1px solid #4CACFF;
text-align: center;
}

@ -69,7 +69,7 @@ class Competitions extends Component {
/>
{/*新版竞赛详情页面*/}
<Route path="/competitions/:identifier/common_header"
<Route path="/competitions/:identifier"
render={
(props) => (<CompetitionCommon {...this.props} {...props} {...this.state} />)
}

@ -97,7 +97,7 @@ function buildColumns(that, student_works, studentData) {
}} title={text && text.length > 5 ? text : ''}>
{/* <Tooltip placement="bottom" title={text}>
</Tooltip> */}
{record.is_leader ?
{record.is_leader ?
<div style={{ display: 'flex', 'flex-direction': 'column', 'align-items': 'center'}}>
<div >{text}</div>
<LeaderIcon></LeaderIcon>
@ -117,8 +117,14 @@ function buildColumns(that, student_works, studentData) {
render: (text, record) => (
<span>
<a href="javascript:;"
title={text && text.length > 12 ? text : ''}
style={{color:'#9A9A9A', 'text-overflow': 'ellipsis', 'white-space': 'nowrap', 'width': '98px', display: 'block', overflow: 'hidden'
title={text && text.length > 12 ? text : ''}
style={{
color: '#9A9A9A',
'text-overflow': 'ellipsis',
'white-space': 'nowrap',
'width': '98px',
display: 'block',
overflow: 'hidden'
, margin: '0 auto', cursor: 'default'}}
>{record.student_id}</a>
</span>
@ -163,9 +169,14 @@ function buildColumns(that, student_works, studentData) {
render: (project_info, record) => (
<span>
{project_info && project_info.name &&
<a href={project_info.id == -1 ? 'javascript:void(0)' : `/projects/${project_info.id}`}
target={ project_info.id == -1 ? '' : "_blank" }
className="overflowHidden1" style={{color:'#4CACFF', width: that.state.anonymous_comment ? '80px' : '130px', margin: '0 auto', display: 'block'}} title={project_info.name}
<a href={project_info.id == -1 ? 'javascript:void(0)' : `/projects/${project_info.id}`}
target={project_info.id == -1 ? '' : "_blank"}
className="overflowHidden1" style={{
color: '#4CACFF',
width: that.state.anonymous_comment ? '80px' : '130px',
margin: '0 auto',
display: 'block'
}} title={project_info.name}
>{project_info.name}</a>}
</span>
),
@ -203,14 +214,14 @@ function buildColumns(that, student_works, studentData) {
dataIndex: 'update_time',
key: 'update_time',
sorter: true,
defaultSortOrder: 'descend',
defaultSortOrder: 'descend',
sortDirections: sortDirections,
render: (update_time, record) => (
<span>
<a href="javascript:;" style={{color:'#989898', cursor: 'default'}}>{update_time ? moment(update_time).format('YYYY-MM-DD HH:mm') : '--'}</a>
</span>
),
}])
}])
if (!niPingAndIsStudent) {
columns.push({
width: 70,
@ -236,7 +247,7 @@ function buildColumns(that, student_works, studentData) {
/**
* 2名助教进行了评分
平均分85.0
*
*
*/
render: (teaching_asistant_score, record) => (
<span>
@ -256,9 +267,9 @@ function buildColumns(that, student_works, studentData) {
}
if (that.state.anonymous_comment) {
/**
开启了匿评的才显示此列悬浮TIP示例
if (that.state.anonymous_comment) {
/**
开启了匿评的才显示此列悬浮TIP示例
3名学生进行了匿评
有效平均分80.0
*/
@ -284,7 +295,7 @@ function buildColumns(that, student_works, studentData) {
</span>
),
})
}
}
if (that.state.anonymous_appeal) {
columns.push({
@ -321,8 +332,8 @@ function buildColumns(that, student_works, studentData) {
getScoreTip(work_score,
<div>
<div>{`${record.user_name}${record.user_login}`}</div>
{record.ultimate_score ?
<div>最终调整成绩{record.work_score}</div> :
{record.ultimate_score ?
<div>最终调整成绩{record.work_score}</div> :
<div>
{ record.final_score && <div>作业评分{record.final_score}</div> }
{ record.late_penalty >= 0 && <div>迟交扣分{record.late_penalty}</div>}
@ -330,7 +341,7 @@ function buildColumns(that, student_works, studentData) {
{ record.appeal_penalty >= 0 && <div>违规匿评扣分{record.appeal_penalty}</div>}
<div>最终成绩{record.work_score}</div>
</div> }
</div>)
</div>)
}>
{ renderScore(work_score) }
</Tooltip>
@ -392,7 +403,7 @@ class CommonWorkList extends Component{
task_status: [],
teacher_comment: [],
course_group_info: [],
arg_work_status: [],
arg_work_status: [],
arg_teacher_comment: [],
arg_course_group: [],
order: 'update_time',
@ -429,13 +440,13 @@ class CommonWorkList extends Component{
}
componentWillUnmount() {
off('commonwork_fetch_all', this.fetchAllListener)
off('commonwork_fetch_all', this.fetchAllListener)
}
fetchAllListener = () => {
this.fetchList()
}
_getRequestParams() {
_getRequestParams() {
const {search, arg_work_status, arg_teacher_comment, arg_course_group, order, page, arg_member_work, b_order} = this.state
return {
page,
@ -626,10 +637,10 @@ class CommonWorkList extends Component{
modulationModalVisible, work_statuses,
id, user_name, user_login, student_id, group_name, work_status, update_time, teacher_score, teaching_asistant_score, student_score,
ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count,
ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count,
late_penalty, absence_penalty, appeal_penalty
, end_immediately, publish_immediately
, end_immediately, publish_immediately
, homework_id, visible, work_group, project_info, is_leader
} =this.state;
@ -710,7 +721,7 @@ class CommonWorkList extends Component{
const hasData = this.state.homework_status && this.state.homework_status.indexOf("未发布") == -1 // student_works && !!student_works.length && page == 1 &&
// console.log(StudentData)
// console.log(StudentData)
// console.log(student_works)
return(
<React.Fragment>
@ -719,7 +730,7 @@ class CommonWorkList extends Component{
{...this.props}
></CheckCodeModal>
<AccessoryModal
<AccessoryModal
{...this.props}
modalname={"补交附件"}
visible={visible}
@ -742,7 +753,7 @@ class CommonWorkList extends Component{
/>
{/* 内容区 */}
{/* 内容区 */}
<style>{`
.ant-table-thead > tr > th, .ant-table-tbody > tr > td {
text-align: center;
@ -797,11 +808,11 @@ class CommonWorkList extends Component{
</span>}
</div>
</div>
</div> }
<style>{`
<style>{`
.workListContent .ant-table-thead > tr > th {
border-bottom: none;
}
@ -840,14 +851,14 @@ class CommonWorkList extends Component{
<div id="forum_list" className="forum_table">
<div className="mh650 edu-back-white">
<NoneData></NoneData>
<NoneData></NoneData>
</div>
</div>
</Spin>
:
<React.Fragment>
<Table
<Table
className="stageTable"
dataSource={student_works}
columns={columns}
@ -862,7 +873,7 @@ class CommonWorkList extends Component{
</div>
</div>
{work_count > PAGE_SIZE && <Pagination
{work_count > PAGE_SIZE && <Pagination
style={{ textAlign: 'center', marginBottom: '20px' }}
showQuickJumper pageSize={PAGE_SIZE} onChange={this.onTablePagination} current={page} total={work_count} />}

@ -649,7 +649,7 @@ class Coursesleftnav extends Component{
updatadeleteSecondary=(url)=>{
this.props.updataleftNavfun();
// this.setState({
@ -1017,41 +1017,40 @@ class Coursesleftnav extends Component{
return(
<div key={key} >
<a>
{item.type!="statistics"?
<li title={item.name.length<7?"":item.name} onClick={(e)=>this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={this.props.mainurl===item.category_url&&this.props.location.pathname===item.category_url?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}>
<a onClick={(e)=>this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}>
{
item.type==="announcement"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-xiaoxi1 mr10 fl":"iconfont icon-xiaoxi1 mr10 fl"}></i>:
item.type==="online_learning"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-kecheng mr10 fl font-16":"iconfont icon-kecheng mr10 fl font-16"}></i>:
item.type==="shixun_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-daima mr10 fl":"iconfont icon-daima mr10 fl"}></i>:
item.type==="common_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-putongzuoye mr10 fl":"iconfont icon-putongzuoye mr10 fl"}></i>:
item.type==="group_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenzuzuoye mr10 fl":"iconfont icon-fenzuzuoye mr10 fl"}></i>:
item.type==="graduation"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-biyezhuanhuan mr10 fl":"iconfont icon-biyezhuanhuan mr10 fl"}></i>:
item.type==="exercise"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-shijuan mr10 fl":"iconfont icon-shijuan mr10 fl"}></i>:
item.type==="poll"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-wenjuan mr10 fl":"iconfont icon-wenjuan mr10 fl"}></i>:
item.type==="attachment"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-ziyuan mr10 fl":"iconfont icon-ziyuan mr10 fl"} ></i>:
item.type==="board"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-taolun mr10 fl":"iconfont icon-taolun mr10 fl"} ></i>:
item.type==="course_group"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenban mr10 fl":"iconfont icon-fenban mr10 fl"} ></i>:
item.type==="statistics"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-tongji mr10 fl":"iconfont icon-tongji mr10 fl"} ></i>:""
}
{/*||this.props.location.pathname===this.state.url&&key===this.state.indexs*/}
<span className={this.props.location.pathname===item.category_url?"color-blue task-hide activity-left-name":"task-hide activity-left-name"}
onClick={(e)=>this.selectnavid(e,key,item.id,item.type,item.category_url)}
>{item.name}</span>
{/*className={sandiantype===undefined?item.task_count===0?"fr mr10 colortransparent":"fr mr10 color999 font-14":sandiantype===key?"none":item.task_count===0?"none":"fr mr10 color999 font-14"}*/}
<span className={this.state.sandiantypes===key?"none":this.props.location.pathname===item.category_url?"color-blue fr mr25 font-14":"fr mr25 color999 font-14"} >{item.task_count===0?"":item.task_count}</span>
{/*<i className={this.state.sandiantypes===key?"iconfont icon-sandian mr5 fr color999":"none"} onMouseEnter={(e)=>this.sandianshow(e,key)}></i> */}
{this.state.sandiantypes===key?<Popover placement="right" content={this.maincontent(item,key)} trigger="hover" key={key}>
<i className={"iconfont icon-sandian mr20 fr color999"}></i>
</Popover>:""}
</a>
</li>:""}
<li title={item.name.length<7?"":item.name} onClick={(e)=>this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={this.props.mainurl===item.category_url&&this.props.location.pathname===item.category_url?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}>
<a onClick={(e)=>this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}>
{
item.type==="announcement"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-xiaoxi1 mr10 fl":"iconfont icon-xiaoxi1 mr10 fl"}></i>:
item.type==="online_learning"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-kecheng mr10 fl font-16":"iconfont icon-kecheng mr10 fl font-16"}></i>:
item.type==="shixun_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-daima mr10 fl":"iconfont icon-daima mr10 fl"}></i>:
item.type==="common_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-putongzuoye mr10 fl":"iconfont icon-putongzuoye mr10 fl"}></i>:
item.type==="group_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenzuzuoye mr10 fl":"iconfont icon-fenzuzuoye mr10 fl"}></i>:
item.type==="graduation"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-biyezhuanhuan mr10 fl":"iconfont icon-biyezhuanhuan mr10 fl"}></i>:
item.type==="exercise"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-shijuan mr10 fl":"iconfont icon-shijuan mr10 fl"}></i>:
item.type==="poll"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-wenjuan mr10 fl":"iconfont icon-wenjuan mr10 fl"}></i>:
item.type==="attachment"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-ziyuan mr10 fl":"iconfont icon-ziyuan mr10 fl"} ></i>:
item.type==="board"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-taolun mr10 fl":"iconfont icon-taolun mr10 fl"} ></i>:
item.type==="course_group"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenban mr10 fl":"iconfont icon-fenban mr10 fl"} ></i>:
item.type==="statistics"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-tongji mr10 fl":"iconfont icon-tongji mr10 fl"} ></i>:""
}
{/*||this.props.location.pathname===this.state.url&&key===this.state.indexs*/}
<span className={this.props.location.pathname===item.category_url?"color-blue task-hide activity-left-name":"task-hide activity-left-name"}
onClick={(e)=>this.selectnavid(e,key,item.id,item.type,item.category_url)}
>{item.name}</span>
{/*className={sandiantype===undefined?item.task_count===0?"fr mr10 colortransparent":"fr mr10 color999 font-14":sandiantype===key?"none":item.task_count===0?"none":"fr mr10 color999 font-14"}*/}
<span className={this.state.sandiantypes===key?"none":this.props.location.pathname===item.category_url?"color-blue fr mr25 font-14":"fr mr25 color999 font-14"} >{item.task_count===0?"":item.task_count}</span>
{/*<i className={this.state.sandiantypes===key?"iconfont icon-sandian mr5 fr color999":"none"} onMouseEnter={(e)=>this.sandianshow(e,key)}></i> */}
{this.state.sandiantypes===key?<Popover placement="right" content={this.maincontent(item,key)} trigger="hover" key={key}>
<i className={"iconfont icon-sandian mr20 fr color999"}></i>
</Popover>:""}
</a>
</li>
{/*下拉列表*/}
@ -1154,32 +1153,33 @@ class Coursesleftnav extends Component{
return(
<div key={key}>
{/*<Tooltip placement="bottom" title={"点击空白处展开二级菜单,点击模块名字跳转到对应模块"}>*/}
<a >
{item.type!="statistics"?
<li className={this.props.mainurl===item.category_url&&this.props.location.pathname===item.category_url?"liactive":"clearfix active"}
onClick={(e)=>this.setnavid(e,key,item.id,item.type,item.category_url)} onMouseEnter={(e)=>this.showsandian(e,key)}
title={item.name.length<7?"":item.name}
>
<a className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}>
{
item.type==="announcement"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-xiaoxi1 mr10 fl":"iconfont icon-xiaoxi1 mr10 fl"}></i>:
item.type==="online_learning"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-kecheng mr10 fl font-16":"iconfont icon-kecheng mr10 fl font-16"}></i>:
item.type==="shixun_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-daima mr10 fl":"iconfont icon-daima mr10 fl"}></i>:
item.type==="common_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-putongzuoye mr10 fl":"iconfont icon-putongzuoye mr10 fl"}></i>:
item.type==="group_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenzuzuoye mr10 fl":"iconfont icon-fenzuzuoye mr10 fl"}></i>:
item.type==="graduation"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-biyezhuanhuan mr10 fl":"iconfont icon-biyezhuanhuan mr10 fl"}></i>:
item.type==="exercise"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-shijuan mr10 fl":"iconfont icon-shijuan mr10 fl"}></i>:
item.type==="poll"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-wenjuan mr10 fl":"iconfont icon-wenjuan mr10 fl"}></i>:
item.type==="attachment"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-ziyuan mr10 fl":"iconfont icon-ziyuan mr10 fl"} ></i>:
item.type==="board"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-taolun mr10 fl":"iconfont icon-taolun mr10 fl"} ></i>:
item.type==="course_group"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenban mr10 fl":"iconfont icon-fenban mr10 fl"} ></i>:""
}
<span className={this.props.location.pathname===item.category_url?"color-blue task-hide activity-left-name":"task-hide activity-left-name"} onClick={(e)=>this.selectnavid(e,key,item.id,item.type,item.category_url)}>{item.name}</span>
<span className={this.props.location.pathname===item.category_url?"color-blue fr mr20 font-14":"fr mr20 color999 font-14"}>{item.task_count===0?"":item.task_count}</span>
</a>
</li>:""}
<a>
<li className={this.props.mainurl===item.category_url&&this.props.location.pathname===item.category_url?"liactive":"clearfix active"}
onClick={(e)=>this.setnavid(e,key,item.id,item.type,item.category_url)} onMouseEnter={(e)=>this.showsandian(e,key)}
title={item.name.length<7?"":item.name}
>
<a className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}>
{
item.type==="announcement"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-xiaoxi1 mr10 fl":"iconfont icon-xiaoxi1 mr10 fl"}></i>:
item.type==="online_learning"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-kecheng mr10 fl font-16":"iconfont icon-kecheng mr10 fl font-16"}></i>:
item.type==="shixun_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-daima mr10 fl":"iconfont icon-daima mr10 fl"}></i>:
item.type==="common_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-putongzuoye mr10 fl":"iconfont icon-putongzuoye mr10 fl"}></i>:
item.type==="group_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenzuzuoye mr10 fl":"iconfont icon-fenzuzuoye mr10 fl"}></i>:
item.type==="graduation"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-biyezhuanhuan mr10 fl":"iconfont icon-biyezhuanhuan mr10 fl"}></i>:
item.type==="exercise"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-shijuan mr10 fl":"iconfont icon-shijuan mr10 fl"}></i>:
item.type==="poll"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-wenjuan mr10 fl":"iconfont icon-wenjuan mr10 fl"}></i>:
item.type==="attachment"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-ziyuan mr10 fl":"iconfont icon-ziyuan mr10 fl"} ></i>:
item.type==="board"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-taolun mr10 fl":"iconfont icon-taolun mr10 fl"} ></i>:
item.type==="course_group"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenban mr10 fl":"iconfont icon-fenban mr10 fl"} ></i>:
item.type==="statistics"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-tongji mr10 fl":"iconfont icon-tongji mr10 fl"} ></i>:""
}
<span className={this.props.location.pathname===item.category_url?"color-blue task-hide activity-left-name":"task-hide activity-left-name"} onClick={(e)=>this.selectnavid(e,key,item.id,item.type,item.category_url)}>{item.name}</span>
<span className={this.props.location.pathname===item.category_url?"color-blue fr mr20 font-14":"fr mr20 color999 font-14"}>{item.task_count===0?"":item.task_count}</span>
</a>
</li>
</a>
<ul style={{display:key===this.props.indexs?"":"none"}} class="droppableul">

@ -99,12 +99,12 @@ class Exercisestatisticalresult extends Component {
this.updatefun(sort,checkedValues,page,limit)
}
alldatalist=()=>{
let{sort,page,limit}=this.state;
alldatalist = () => {
let {sort, page, limit} = this.state;
this.setState({
exercise_group_id:[]
exercise_group_id: []
})
this.updatefun(sort,[],page,limit)
this.updatefun(sort, [], page, limit)
}
PaginationCourse=(pageNumber)=>{
let{sort,exercise_group_id,limit}=this.state;
@ -142,7 +142,9 @@ class Exercisestatisticalresult extends Component {
<li className="clearfix mt10">
<span className="fl mr10 color-grey-8">分班情况</span>
<span className="fl ">
<a id="graduation_comment_no_limit" className={this.state.exercise_group_id.length===0?"pl10 pr10 mr20 check_on":"pl10 pr10 mr20" } onClick={()=>this.alldatalist()}>不限</a>
<a id="graduation_comment_no_limit"
className={this.state.exercise_group_id.length === 0 ? "pl10 pr10 mr20 check_on" : "pl10 pr10 mr20"}
onClick={() => this.alldatalist()}>不限</a>
</span>
<CheckboxGroup onChange={(e)=>this.funtaskstatustwo(e,data&&data.course_groups)} value={this.state.exercise_group_id} style={{width:'87%',paddingTop: '4px'}}>
{ data&&data.course_groups.map((item, key) => {
@ -208,7 +210,7 @@ class Exercisestatisticalresult extends Component {
</sapn>
</li>
</div>
<style>
{`
@ -291,11 +293,12 @@ class Exercisestatisticalresult extends Component {
<div className="stud-class-set mb20 exerciseTable" key={key}>
<div className="clearfix edu-back-white poll_list" style={{padding: '20px'}}>
<div className="font-16 shixunreporttitle fl" style={{width:"1050px"}}>
<span className="C3333">{item.ques_position+"."}{item.ques_type===0?"单选":item.ques_type===1?"多选":item.ques_type===2?"判断":item.ques_type===3?"填空":item.ques_type===4?"主观":item.ques_type===5?"实训":""}</span>
<span
className="C3333">{item.ques_position + "."}{item.ques_type === 0 ? "单选" : item.ques_type === 1 ? "多选" : item.ques_type === 2 ? "判断" : item.ques_type === 3 ? "填空" : item.ques_type === 4 ? "主观" : item.ques_type === 5 ? "实训" : ""}</span>
<div>
{/*Q{item.ques_position}*/}
{/* <div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML1(item.ques_title).replace(/▁/g,"▁▁▁")}}></div> */}
<MarkdownToHtml content={item.ques_title} selector={'ques_title_' + key}
<MarkdownToHtml content={item.ques_title} selector={'ques_title_' + key}
className=""
></MarkdownToHtml>
{/*<span className="markdown-body" dangerouslySetInnerHTML={createMarkup(item.ques_title)}></span>*/}
@ -337,7 +340,7 @@ class Exercisestatisticalresult extends Component {
</div>
{
data && data.questions_count > 10 &&
data && data.questions_count > 10 &&
<div className="mb40 edu-txt-center padding20-30">
<Pagination
showQuickJumper
@ -349,7 +352,7 @@ class Exercisestatisticalresult extends Component {
/>
</div>
}
</div>

@ -881,6 +881,7 @@ class CoursesNew extends Component {
<Checkbox value={"attachment"} className="fl">资源</Checkbox>
<Checkbox value={"board"} className="fl">讨论</Checkbox>
<Checkbox value={"course_group"} className="fl">分班</Checkbox>
<Checkbox value={"statistics"} className="fl">统计</Checkbox>
</Checkbox.Group>
)}
</Form.Item>

@ -1002,6 +1002,7 @@ class Goldsubject extends Component {
<Checkbox value={"attachment"} className="fl">资源</Checkbox>
<Checkbox value={"board"} className="fl">讨论</Checkbox>
<Checkbox value={"course_group"} className="fl">分班</Checkbox>
<Checkbox value={"statistics"} className="fl">统计</Checkbox>
</Checkbox.Group>
)}
</Form.Item>

@ -344,7 +344,7 @@ textarea:read-only{
width: 60px!important;height: 30px!important;box-sizing: border-box;
text-align: center!important;
background: #F8F8F8;
color:#666;
color:#666;
}
.setScoreInput:focus{
background: #fff;
@ -373,8 +373,8 @@ textarea:read-only{
min-width:1200px
}
.zexercisetitle{
.zexercisetitle {
font-size: 16px;
color: rgba(51,51,51,1);
color: rgba(51, 51, 51, 1);
min-width: 95px;
}
}

@ -3171,7 +3171,7 @@ class Listofworksstudentone extends Component {
}
daochuzuoye = () => {
let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?group_id=${this.state.checkedValuesineinfo === undefined || this.state.checkedValuesineinfo === null ? "" : this.state.checkedValuesineinfo}&search=${this.state.searchtext === undefined || this.state.searchtext === null ? "" : this.state.searchtext}`
let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?course_group=${this.state.checkedValuesineinfo === undefined || this.state.checkedValuesineinfo === null ? "" : this.state.checkedValuesineinfo}&work_status=${this.state.course_groupyslstwo === undefined || this.state.course_groupyslstwo === null ? "" : this.state.course_groupyslstwo}&search=${this.state.searchtext === undefined || this.state.searchtext === null ? "" : this.state.searchtext}`
this.confirmysl(url);
}

@ -414,7 +414,7 @@ class ShixunhomeWorkItem extends Component{
{
discussMessage && discussMessage.upper_category_name &&
<ConditionToolTip title={discussMessage.upper_category_name} condition={ discussMessage.upper_category_name.length > 22 }>
{ <div className=" color-grey9 task-hide fr" style={discussMessage.time_status===1||discussMessage.time_status===2||discussMessage.time_status===3||discussMessage.time_status===4||discussMessage.time_status===5||discussMessage.time_status===6?{"maxWidth":"268px"}:{"maxWidth":"550px"}} title={discussMessage.upper_category_name}>所属目录{discussMessage.upper_category_name}</div>}
{ <div className=" color-grey9 task-hide fr" style={discussMessage.time_status===1||discussMessage.time_status===2||discussMessage.time_status===3||discussMessage.time_status===4||discussMessage.time_status===5||discussMessage.time_status===6?{"maxWidth":"216px"}:{"maxWidth":"550px"}} title={discussMessage.upper_category_name}>所属目录{discussMessage.upper_category_name}</div>}
</ConditionToolTip>
}

@ -87,4 +87,35 @@
.pd30bt{
padding: 10px 30px 0px 30px;
}
}
.bor-reds{
border:1px solid #FF0000!important;
border-radius: 1px!important;
border-top-left-radius: 1px!important;
border-top-right-radius: 1px!important;
border-bottom-right-radius: 1px!important;
border-bottom-left-radius: 1px!important;
}
.bor-reds input {
border:1px solid #FF0000!important;
border-radius: 1px!important;
border-top-left-radius: 1px!important;
border-top-right-radius: 1px!important;
border-bottom-right-radius: 1px!important;
border-bottom-left-radius: 1px!important;
}
.myslHeight{
height: 20px;
min-height: 20px;
}
.maxnamewidth340 {
max-width: 340px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
width: 340px;
max-width: 340px;
}

@ -1,123 +1,128 @@
import React,{ Component } from "react";
import {Menu, Dropdown, Icon,Input,Checkbox} from "antd";
import React, {Component} from "react";
import {Menu, Dropdown, Icon, Input, Checkbox} from "antd";
import {getImageUrl} from 'educoder';
const { Search } = Input;
class Dropdownbox extends Component{
constructor(props){
const {Search} = Input;
class Dropdownbox extends Component {
constructor(props) {
super(props);
this.state={
activeKey:'1',
this.state = {
activeKey: '1',
visible: false,
onSearchvalue:undefined,
checkedValues:[]
onSearchvalue: undefined,
checkedValues: []
}
}
componentDidMount() {
let {group_ids}=this.props;
if(group_ids){
let {group_ids} = this.props;
if (group_ids) {
this.setState({
checkedValues:group_ids
checkedValues: group_ids
})
}
}
componentDidUpdate=(prevProps)=>{
if(prevProps!=this.props){
let {group_ids}=this.props;
if(group_ids){
componentDidUpdate = (prevProps) => {
if (prevProps != this.props) {
let {group_ids} = this.props;
if (group_ids) {
this.setState({
checkedValues:group_ids
checkedValues: group_ids
})
}
}
}
SaveChange=()=>{
this.props.postwork_scoredata(this.state.checkedValues)
SaveChange = () => {
this.props.postwork_scoredata(this.state.checkedValues)
}
handleVisibleChange=flag=>{
this.setState({ visible: flag });
handleVisibleChange = flag => {
this.setState({visible: flag});
};
CheckboxonChange=(checkedValues)=>{
this.setState({
checkedValues:checkedValues
})
CheckboxonChange = (checkedValues) => {
this.setState({
checkedValues: checkedValues
})
}
unCheckboxonChange=()=>{
unCheckboxonChange = () => {
this.setState({
checkedValues:[],
onSearchvalue:undefined
checkedValues: [],
onSearchvalue: undefined
})
}
onSearch=(value)=>{
onSearch = (value) => {
this.setState({
onSearchvalue:value
onSearchvalue: value
})
}
onSearchonChange=(e)=>{
onSearchonChange = (e) => {
this.setState({
onSearchvalue:e.target.value
onSearchvalue: e.target.value
})
}
render(){
let {course_groups}=this.props;
render() {
let {course_groups} = this.props;
const menu = (
<Checkbox.Group style={{ width: 220 }} className={"StatisticsMenubox"} value={this.state.checkedValues} onChange={(checkedValues)=>this.CheckboxonChange(checkedValues)}>
<Menu className="Statisticslibox">
<Checkbox.Group style={{width: 220}} className={"StatisticsMenubox"} value={this.state.checkedValues}
onChange={(checkedValues) => this.CheckboxonChange(checkedValues)}>
<Menu className="Statisticslibox">
<li className={"Statisticsli"}>
{course_groups&&course_groups.length>10?<Search
{course_groups && course_groups.length > 10 ? <Search
placeholder="请输入名称搜索"
onSearch={(value)=>this.onSearch(value)}
onChange={(e)=>this.onSearchonChange(e)}
onSearch={(value) => this.onSearch(value)}
onChange={(e) => this.onSearchonChange(e)}
value={this.state.onSearchvalue}
style={{ width: 200 }}
/>:""}
style={{width: 200}}
/> : ""}
</li>
{course_groups&&course_groups.map((item,key)=>{
if(this.state.onSearchvalue){
if(item.name.indexOf(this.state.onSearchvalue) != -1){
return(
{course_groups && course_groups.map((item, key) => {
if (this.state.onSearchvalue) {
if (item.name.indexOf(this.state.onSearchvalue) != -1) {
return (
<Menu.Item key={key}>
<Checkbox value={item.id} key={item.id}> {item.name}</Checkbox>
<Checkbox value={item.id} key={item.id}> {item.name}</Checkbox>
</Menu.Item>
)
}
}else{
return(
} else {
return (
<Menu.Item key={key}>
<Checkbox value={item.id} key={item.id}> {item.name}</Checkbox>
<Checkbox value={item.id} key={item.id}> {item.name}</Checkbox>
</Menu.Item>
)
}
})}
<Menu.Divider />
<Menu.Divider/>
<li className={"Statisticsli"}>
<span onClick={()=>this.SaveChange()} className={"ant-btn-link"}>确定</span>
<span className={"ml20 ant-btn-link"} onClick={()=>this.unCheckboxonChange()}>重置</span>
<span onClick={() => this.SaveChange()} className={"ant-btn-link"}>确定</span>
<span className={"ml20 ant-btn-link"} onClick={() => this.unCheckboxonChange()}>重置</span>
</li>
</Menu>
</Checkbox.Group>
);
return(
return (
<React.Fragment>
<Dropdown overlay={menu}
onVisibleChange={this.handleVisibleChange}
visible={this.state.visible}
>
<a className="ant-dropdown-link">
分班 <Icon type="down" />
分班 <Icon type="down"/>
</a>
</Dropdown>
</React.Fragment>
)
}
}
export default Dropdownbox;

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

Loading…
Cancel
Save