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

dev_sync_trustie
杨树明 5 years ago
commit 105a564deb

@ -29,6 +29,9 @@ $(document).on('turbolinks:load', function(){
$(".nav-setting-form .enroll_end_time").datetimepicker(timeOptions); $(".nav-setting-form .enroll_end_time").datetimepicker(timeOptions);
$(".stage-update-form .section-start-time").datetimepicker(timeOptions);
$(".stage-update-form .section-end-time").datetimepicker(timeOptions);
defineDateRangeSelect('.teaching-mode-date'); defineDateRangeSelect('.teaching-mode-date');
// defineTimeRangeSelect('.competition-start-end-date'); // defineTimeRangeSelect('.competition-start-end-date');
@ -182,10 +185,8 @@ $(function () {
' <span class="mt-2">人</span>\n' + ' <span class="mt-2">人</span>\n' +
' <div class="col-2 mt-1">\n' + ' <div class="col-2 mt-1">\n' +
' <select class="form-control" name="competition_staffs[][category]">\n' + ' <select class="form-control" name="competition_staffs[][category]">\n' +
' <option value="all">不限</option>\n' +
' <option value="teacher">教师</option>\n' +
' <option value="student">学生</option>\n' + ' <option value="student">学生</option>\n' +
' <option value="profession">专业人士</option>\n' + ' <option value="teacher">教师</option>\n' +
' </select>\n' + ' </select>\n' +
' </div>\n' + ' </div>\n' +
' <div class="col-2 mt-1">\n' + ' <div class="col-2 mt-1">\n' +
@ -209,7 +210,7 @@ $(function () {
$("#requireForm").on("click",".delRequrieBtn",function () { $("#requireForm").on("click",".delRequrieBtn",function () {
$(this).parents(".requireForm_item").remove(); $(this).parents(".requireForm_item").remove();
}) });
$('.competition-staff-settings').on('click', '.mutiple-limited-radio', function(){ $('.competition-staff-settings').on('click', '.mutiple-limited-radio', function(){
var radio = $(this); var radio = $(this);
@ -248,8 +249,6 @@ $(function () {
}); });
}); });
// 排行榜设置 // 排行榜设置
//删除小阶段 //删除小阶段
$("#large_panel").on("click",".small_panel_item_del",function () { $("#large_panel").on("click",".small_panel_item_del",function () {
@ -260,7 +259,89 @@ $(function () {
console.log(i); console.log(i);
$(list).find(".subName").eq(i).html("第"+parseInt(i+1)+"阶段"); $(list).find(".subName").eq(i).html("第"+parseInt(i+1)+"阶段");
} }
}) });
$('form.stage-update-form').validate({
errorElement: 'span',
errorClass: 'danger text-danger',
rules: {
stage_name: "required",
"stage[][start_time]": "required",
"stage[][end_time]": "required",
"stage[][mission_count]": {
required: true,
min: 1
},
"stage[][entry]": {
required: true,
min: 1
},
score_rate: {
required: true,
range: [0, 100]
}
},
messages: {
"stage[][mission_count]": {
min: ">=1"
},
"stage[][entry]": {
min: ">=1"
},
}
});
$('form.stage-update-form').on('click', ".update-stage", function () {
var updateForm = $(this).parents("form");
$(this).attr('disabled', 'disabled');
updateForm.find('.error').html('');
var valid = updateForm.valid();
updateForm.find('input[name="stage[][identifiers][]"]').each(function(_, e){
var $ele = $(e);
if($ele.val() === undefined || $ele.val().length === 0){
$ele.addClass('danger text-danger');
valid = false;
} else {
$ele.removeClass('danger text-danger');
}
});
if (!valid) return;
updateForm.find('input[name="stage[][mission_count]"]').each(function(_, e){
var $missionCount = $(e);
var $entryCount = $(e).parents("div.row").find('input[name="stage[][mission_count]"]');
if(parseInt($missionCount.val()) > parseInt($entryCount.val()) ){
$missionCount.addClass('danger text-danger');
$missionCount.after('<span class="danger text-danger">不能大于总任务数</span>');
valid = false;
} else {
$missionCount.removeClass('danger text-danger');
$missionCount.siblings().remove();
}
});
$.ajax({
method: 'POST',
dataType: 'json',
url: updateForm.attr('action'),
data: new FormData(updateForm[0]),
processData: false,
contentType: false,
success: function (data) {
$.notify({message: '保存成功'});
// window.location.reload();
},
error: function (res) {
var data = res.responseJSON;
$navForm.find('.error').html(data.message);
},
complete: function () {
$navForm.find('.submit-btn').attr('disabled', false);
}
});
});
}); });
@ -374,16 +455,14 @@ function addNewTab() {
var html = '<div class="large_panel_part" attr_line="'+count+'"><div class="row d-flex mt-3">\n' + var html = '<div class="large_panel_part" attr_line="'+count+'"><div class="row d-flex mt-3">\n' +
' <span class="col-1 mt-2">tab标题</span>\n' + ' <span class="col-1 mt-2">tab标题</span>\n' +
' <div class="col-2 no_padding">\n' + ' <div class="col-2 no_padding">\n' +
' <input type="text" class="form-control" name="tab_title_1"/>\n' + ' <input type="text" class="form-control" name="stage_name"/>\n' +
' </div>\n' + ' </div>\n' +
' <span class="col-1 text-right mt-2 no_padding">总排行榜占比:</span>\n' + ' <span class="col-1 text-right mt-2 no_padding">总排行榜占比:</span>\n' +
' <div class="col-1 no_padding">\n' + ' <div class="col-1 no_padding">\n' +
' <input type="number" class="form-control" name="tab_percent_'+count+'"/>\n' + ' <input type="number" class="form-control" name="score_rate" value="100"/>\n' +
' </div><span class=" mt-2">%</span>\n' + ' </div><span class=" mt-2">%</span>\n' +
' <div class="flex-1">\n' + ' <div class="flex-1">\n' +
' <a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add_task_sub" onclick="add_task_sub(this)">新增子阶段</a>\n' + ' <a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add_task_sub" onclick="add_task_sub(this)">新增子阶段</a>\n' +
' <a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">发送短信提醒</a>\n' +
' <a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">计算成绩</a>\n' +
' </div>\n' + ' </div>\n' +
' <a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>\n' + ' <a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>\n' +
' <a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">保存</a>\n' + ' <a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">保存</a>\n' +
@ -391,4 +470,4 @@ function addNewTab() {
' <div id="small_panel_'+count+'" class="small_panel"></div></div>'; ' <div id="small_panel_'+count+'" class="small_panel"></div></div>';
$("#large_panel").append(html); $("#large_panel").append(html);
} }

@ -1,16 +1,18 @@
class Admins::CompetitionStagesController < Admins::BaseController class Admins::CompetitionStagesController < Admins::BaseController
def create def create
if @competition.competition_stages.exists?(name: params[:stage_name]) Admins::CompetitionStageUpdateService.call(current_competition, update_form_params)
render_ok
if current_competition.competition_stages.exists?(name: params[:stage_name])
render_error "已存在同名的阶段" render_error "已存在同名的阶段"
else else
@competition.competition_stages << CompetitionStage.new(name: params[:stage_name]) current_competition.competition_stages << CompetitionStage.new(name: params[:stage_name])
render_ok render_ok
end end
end end
def update def update
current_stage.update_attributes!(name: params[:stage_name], score_rate: params[:score_rate]) Admins::CompetitionStageUpdateService.call(current_competition, update_form_params, current_stage)
render_ok render_ok
end end
@ -78,6 +80,11 @@ class Admins::CompetitionStagesController < Admins::BaseController
end end
def current_stage def current_stage
@_current_stage ||= CompetitionStage.find_by!(competition_id: params[:competition_id], id: params[:stage_id]) @_current_stage ||= CompetitionStage.find_by!(competition_id: params[:competition_id], id: params[:id])
end
def update_form_params
params.permit(:stage_name, :score_rate, stage: [:start_time, :end_time, :mission_count, :entry, :score_source, identifiers: []])
end end
end end

@ -116,7 +116,8 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController
keyword = params[:keyword].to_s.strip keyword = params[:keyword].to_s.strip
if keyword.present? if keyword.present?
teams = teams.joins(users: { user_extension: :school }).where('schools.name LIKE ?', "%#{keyword}%") teams = teams.joins(users: { user_extension: :school })
.where('competition_teams.name LIKE :keyword OR schools.name LIKE :keyword', keyword: "%#{keyword}%")
end end
@all_count = teams.count @all_count = teams.count

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

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

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

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

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

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

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

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

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

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

@ -13,7 +13,7 @@ class Competitions::JoinTeamService < ApplicationService
invite_code = params[:invite_code].to_s.strip invite_code = params[:invite_code].to_s.strip
raise Error, '战队邀请码不能为空' if invite_code.blank? raise Error, '战队邀请码不能为空' if invite_code.blank?
raise Error, '本竞赛只对指定单位/学校开放' unless competition.open?(user) raise Error, '本竞赛只面向部分学校/单位开放,你暂时没有参赛资格' unless competition.open?(user)
is_teacher = user.is_teacher? is_teacher = user.is_teacher?
raise Error, '本竞赛的参赛者限定为:学生' if is_teacher && competition.teacher_enroll_forbidden? raise Error, '本竞赛的参赛者限定为:学生' if is_teacher && competition.teacher_enroll_forbidden?

@ -238,10 +238,8 @@
<span class="mt-2">人</span> <span class="mt-2">人</span>
<div class="col-2 mt-1"> <div class="col-2 mt-1">
<select class="form-control" name="competition_staffs[][category]"> <select class="form-control" name="competition_staffs[][category]">
<option value="all" <%= staff.category == "all" ? "selected='selected'" : "" %>>不限</option>
<option value="teacher" <%= staff.category == "teacher" ? "selected='selected'" : "" %>>教师</option>
<option value="student" <%= staff.category == "student" ? "selected='selected'" : "" %>>学生</option> <option value="student" <%= staff.category == "student" ? "selected='selected'" : "" %>>学生</option>
<option value="profession" <%= staff.category == "profession" ? "selected='selected'" : "" %>>专业人士</option> <option value="teacher" <%= staff.category == "teacher" ? "selected='selected'" : "" %>>教师</option>
</select> </select>
</div> </div>
<div class="col-2 mt-1"> <div class="col-2 mt-1">
@ -341,10 +339,10 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<div id="large_panel" class="large_panel"> <div id="large_panel" class="large_panel competition-chart-setting">
<% if @competition.competition_stages.count > 0 %> <% if @competition.competition_stages.count > 0 %>
<% @competition.competition_stages.each_with_index do |stage, index| %> <% @competition.competition_stages.includes(competition_stage_sections: :competition_entries).each_with_index do |stage, index| %>
<%= form_tag(admins_competition_competition_stage_path(competition_id: @competition.id, id: stage.id), method: :put, class: 'stage_update_form flex-1', remote: true) do %> <%= form_tag(admins_competition_competition_stage_path(competition_id: @competition.id, id: stage.id), method: :put, class: 'stage-update-form flex-1', remote: true) do %>
<div class="large_panel_part" attr_line="1"> <div class="large_panel_part" attr_line="1">
<div class="row d-flex"> <div class="row d-flex">
<span class="col-1 mt-2">tab标题</span> <span class="col-1 mt-2">tab标题</span>
@ -361,41 +359,50 @@
<a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">计算成绩</a> <a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">计算成绩</a>
</div> </div>
<a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a> <a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>
<a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">保存</a> <a href="javascript:void(0)" class="btn btn-outline-primary export-action update-stage ml20">保存</a>
</div> </div>
<div id="small_panel_<%= index + 1 %>" class="small_panel"> <div id="small_panel_<%= index + 1 %>" class="small_panel">
<% stage.competition_stage_sections.each_with_index do |section, j| %> <% stage.competition_stage_sections.each_with_index do |section, j| %>
<div class="row d-flex small_panel_item" attr_line="sub_1_1" count="<%= j + 1 %>"> <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="col-1 mt-2 subName">第<%= j + 1 %>阶段</span>
<div class="flex-1"> <div class="flex-1">
<div class="row"> <div class="row">
<span class="mt-2 ml20">有效时间:</span> <span class="mt-2 ml20">有效时间:</span>
<div class="col-2 no_padding input_middle"> <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: '有效开始时间' %> <%= 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> </div>
<span class="mt-2">~</span> <span class="mt-2">~</span>
<div class="col-2 no_padding input_middle"> <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: '有效结束时间' %> <%= 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> <span class="col-2 text-right mt-2 no_padding">任务完成要求:</span>
<div class="col-1 no_padding input_small"> <div class="col-1 no_padding input_small">
<input type="number" class="form-control" name="stage[][end_time]"/> <input type="number" class="form-control" value="<%= section.mission_count %>" name="stage[][mission_count]"/>
</div> </div>
<span class="mt-2 ml10 mr10">/</span> <span class="mt-2 ml10 mr10">/</span>
<div class="col-1 no_padding input_small"> <div class="col-1 no_padding input_small">
<input type="number" class="form-control task_all" onchange="change_total(this)" name="task_require_all_1_1"/> <input type="number" class="form-control task_all" value="<%= section.entry %>" onchange="change_total(this)" name="stage[][entry]"/>
</div> </div>
<span class=" mt-2">(总任务)</span> <span class=" mt-2">(总任务)</span>
<span class="col-1 text-right mt-2 no_padding">成绩来源:</span> <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>
<div class="col-2 no_padding input_middle"> <div class="col-2 no_padding input_middle">
<select class="form-control" name="source_1_1"> <select class="form-control" name="stage[][score_source]">
<option>经验值</option> <option value="0" <%= section.score_source == 0 ? "selected='selected'" : "" %>>经验值</option>
<option>预测准确率</option> <option value="1" <%= section.score_source == 1 ? "selected='selected'" : "" %>>预测准确率</option>
</select> </select>
</div> </div>
</div> </div>
<div class="row mt-2" id="task_Input_sub_1_1"></div> <div class="row mt-2" id="task_Input_sub_<%= index %>_<%= j %>">
<% section.competition_entries.each_with_index do |entry, z| %>
<div class="col-4 row task_Input_div">
<span class="col-3 text-center mt-3">任务<%= z+1 %></span>
<div class="col-8">
<input type="text" class="form-control mt-2" value="<%= entry.shixun_identifier %>" name="stage[][identifiers][]" placeholder="请填写实训ID">
</div>
</div>
<% end %>
</div>
</div> </div>
<span> <span>
<a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a> <a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a>
@ -403,72 +410,74 @@
</div> </div>
<% end %> <% end %>
</div> </div>
<div class="error my-2 danger text-danger"></div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
<% else %> <% else %>
<%= form_tag(admins_competition_competition_stages_path(competition_id: @competition.id), method: :post, class: 'stage-update-form new-stage-form flex-1', remote: true) do %>
<div class="large_panel_part" attr_line="1">
<div class="row d-flex">
<span class="col-1 mt-2">tab标题</span>
<div class="col-2 no_padding">
<input type="text" class="form-control" name="stage_name"/>
</div>
<span class="col-1 text-right mt-2 no_padding">总排行榜占比:</span>
<div class="col-1 no_padding">
<input type="number" class="form-control" name="score_rate" value="100"/>
</div><span class=" mt-2">%</span>
<div class="flex-1">
<a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add_task_sub" onclick="add_task_sub(this)">新增子阶段</a>
</div>
<a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>
<a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">保存</a>
</div>
<div id="small_panel_1" class="small_panel">
<div class="row d-flex small_panel_item" attr_line="sub_new_new" count="1">
<span class="col-1 mt-2 subName">第1阶段</span>
<div class="flex-1">
<div class="row">
<span class="mt-2 ml20">有效时间:</span>
<div class="col-2 no_padding input_middle">
<%= text_field_tag 'stage[][start_time]', '', autocomplete: 'off', class: 'section-start-time form-control', placeholder: '有效开始时间' %>
</div>
<span class="mt-2">~</span>
<div class="col-2 no_padding input_middle">
<%= text_field_tag 'stage[][end_time]', '', autocomplete: 'off', class: 'section-end-time form-control', placeholder: '有效结束时间' %>
</div>
<span class="col-2 text-right mt-2 no_padding">任务完成要求:</span>
<div class="col-1 no_padding input_small">
<input type="number" class="form-control" name="stage[][mission_count]" value="1"/>
</div>
<span class="mt-2 ml10 mr10">/</span>
<div class="col-1 no_padding input_small">
<input type="number" class="form-control task_all" onchange="change_total(this)" value="3" name="stage[][entry]"/>
</div>
<span class=" mt-2">(总任务)</span>
<span class="col-1 text-right mt-2 no_padding">成绩来源:</span>
<div class="col-2 no_padding input_middle">
<select class="form-control" name="stage[][score_source]">
<option value="0">经验值</option>
<option value="1">预测准确率</option>
</select>
</div>
</div>
<div class="row mt-2" id="task_Input_sub_new_new"></div>
</div>
<span>
<a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a>
</span>
</div>
</div>
</div>
<% end %>
<% end %> <% end %>
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div id="large_panel" class="large_panel"> <div id="large_panel" class="large_panel">
<div class="large_panel_part" attr_line="1">
<div class="row d-flex">
<span class="col-1 mt-2">tab标题</span>
<div class="col-2 no_padding">
<input type="text" class="form-control" name="tab_title_1"/>
</div>
<span class="col-1 text-right mt-2 no_padding">总排行榜占比:</span>
<div class="col-1 no_padding">
<input type="number" class="form-control" name="tab_percent_1"/>
</div><span class=" mt-2">%</span>
<div class="flex-1">
<a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add_task_sub" onclick="add_task_sub(this)">新增子阶段</a>
<a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">发送短信提醒</a>
<a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">计算成绩</a>
</div>
<a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>
<a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">保存</a>
</div>
<div id="small_panel_1" class="small_panel">
<div class="row d-flex small_panel_item" attr_line="sub_1_1" count="1">
<span class="col-1 mt-2 subName">第1阶段</span>
<div class="flex-1">
<div class="row">
<span class="mt-2 ml20">有效时间:</span>
<div class="col-2 no_padding input_middle">
<input class="use_time_begin_1_1 form-control" placeholder="有效开始时间"/>
</div>
<span class="mt-2">~</span>
<div class="col-2 no_padding input_middle">
<input class="use_time_end_1_1 form-control" placeholder="有效结束时间"/>
</div>
<span class="col-2 text-right mt-2 no_padding">任务完成要求:</span>
<div class="col-1 no_padding input_small">
<input type="number" class="form-control" name="task_require_small_1_1"/>
</div>
<span class="mt-2 ml10 mr10">/</span>
<div class="col-1 no_padding input_small">
<input type="number" class="form-control task_all" onchange="change_total(this)" name="task_require_all_1_1"/>
</div>
<span class=" mt-2">(总任务)</span>
<span class="col-1 text-right mt-2 no_padding">成绩来源:</span>
<div class="col-2 no_padding input_middle">
<select class="form-control" name="source_1_1">
<option>经验值</option>
<option>预测准确率</option>
</select>
</div>
</div>
<div class="row mt-2" id="task_Input_sub_1_1"></div>
</div>
<span>
<a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a>
</span>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

@ -830,7 +830,7 @@ class Registration extends React.Component {
} }
{ {
type === 2 || type === 4 || type === 5 ? type === 4 || type === 5 ?
( (
count < 20 ? <div style={{ count < 20 ? <div style={{
height: "20px", height: "20px",

@ -585,6 +585,13 @@
} }
.reglistviewdivss333p {
width: 31px;
font-size: 12px;
color: #666666;
text-align: center;
}
.reglistviewdivss3p { .reglistviewdivss3p {
width: 31px; width: 31px;
font-size: 12px; font-size: 12px;
@ -620,6 +627,17 @@ reglistviewdivs2 {
/*PersonModal.js*/ /*PersonModal.js*/
.yslanswerList {
}
.yslanswerList li {
}
.yslanswerList li:hover {
background-color: #F6F4F4;
}
.permaindiv { .permaindiv {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

@ -877,11 +877,21 @@ class PersonModal extends Component {
alignItems: "center", alignItems: "center",
height: "40px", height: "40px",
}}> }}>
<p className=" reglistviewdivss4p" <style>
{
`
a:hover
{
color: #05101A;
}
`
}
</style>
<a title={item.name} className=" reglistviewdivss4p maxnamewidth90"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
>{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}</p> >{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}</a>
{ {
index === 0 ? index === 0 ?
<p className=" reglistviewdivss4p" <p className=" reglistviewdivss4p"
@ -890,32 +900,32 @@ class PersonModal extends Component {
}} }}
>创建者</p> >创建者</p>
: :
<p className=" reglistviewdivss4p" <a title={item.type} className=" reglistviewdivss4p maxnamewidth90"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
>{item.type === undefined || item.type === null || item.type === "" ? "--" : item.type}</p> >{item.type === undefined || item.type === null || item.type === "" ? "--" : item.type}</a>
} }
<p className=" reglistviewdivss5p" <a title={item.school_name} className=" reglistviewdivss5p maxnamewidth110"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
>{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</p> >{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</a>
<p className=" reglistviewdivss2p" <a title={item.identity} className=" reglistviewdivss2p maxnamewidth90"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
>{item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}</p> >{item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}</a>
{ {
index === 0 ? index === 0 ?
<p className=" reglistviewdivss33p" <p className=" reglistviewdivss333p"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
></p> ></p>
: :
<p className=" reglistviewdivss33p" <p className=" reglistviewdivss333p"
style={{ style={{
textAlign: "center", textAlign: "center",
}} }}
@ -928,7 +938,8 @@ class PersonModal extends Component {
// console.log(this.props.teamutiple_limited ); // console.log(this.props.teamutiple_limited );
if (teacher_ids) { if (teacher_ids) {
cpersondiv1Items = teacher_ids.map((item, index) => cpersondiv1Items = teacher_ids.map((item, index) =>
<a <div className={"yslanswerList"}>
<li
className={this.props.teamutiple_limited === undefined || this.props.teamutiple_limited === null ? "reglistviewdivss2 " : (this.props.teamutiple_limited === true && item.enrollable === false ? "reglistviewdivss2c" : "reglistviewdivss2 ")} className={this.props.teamutiple_limited === undefined || this.props.teamutiple_limited === null ? "reglistviewdivss2 " : (this.props.teamutiple_limited === true && item.enrollable === false ? "reglistviewdivss2c" : "reglistviewdivss2 ")}
key={index} style={{ key={index} style={{
width: "100%", width: "100%",
@ -1026,16 +1037,16 @@ class PersonModal extends Component {
} }
</li>
</a> </div>
); );
} }
const cpersondiv1 = ( const cpersondiv1 = (
<div className={" backgroundspersondiv cpersondiv1 borders2"}> <div className={" backgroundspersondiv cpersondiv1 borders2"}>
<Spin spinning={false}> <Spin spinning={false}>
<div className={cpersondiv1Items.length === 0 ? "demo-infinite-container33" : "demo-infinite-container2"}> <div
className={cpersondiv1Items.length === 0 ? "demo-infinite-container33 yslanswerList" : "demo-infinite-container2 yslanswerList"}>
{ {
cpersondiv1Items.length === 0 ? cpersondiv1Items.length === 0 ?
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
@ -1062,7 +1073,10 @@ class PersonModal extends Component {
var persondiv2Items = []; var persondiv2Items = [];
if (member_ids) { if (member_ids) {
persondiv2Items = member_ids.map((item, index) => persondiv2Items = member_ids.map((item, index) =>
<a <div className={"yslanswerList"}>
<li
className={this.props.mutiple_limited === undefined || this.props.mutiple_limited === null ? "reglistviewdivss2 " : (this.props.mutiple_limited === true && item.enrollable === false ? "reglistviewdivss2c" : "reglistviewdivss2 ")} className={this.props.mutiple_limited === undefined || this.props.mutiple_limited === null ? "reglistviewdivss2 " : (this.props.mutiple_limited === true && item.enrollable === false ? "reglistviewdivss2c" : "reglistviewdivss2 ")}
key={index} style={{ key={index} style={{
width: "100%", width: "100%",
@ -1159,15 +1173,15 @@ class PersonModal extends Component {
} }
</li>
</a> </div>
); );
} }
const persondiv2 = ( const persondiv2 = (
<div className={" backgroundspersondiv cpersondiv1 borders2"}> <div className={" backgroundspersondiv cpersondiv1 borders2"}>
{/*this.state.loading2*/} {/*this.state.loading2*/}
<Spin spinning={false}> <Spin spinning={false}>
<div className={persondiv2Items.length === 0 ? "demo-infinite-container33" : "demo-infinite-container2"}> <div className={persondiv2Items.length === 0 ? "demo-infinite-container33 " : "demo-infinite-container2 "}>
{ {
persondiv2Items.length === 0 ? persondiv2Items.length === 0 ?
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
@ -1205,16 +1219,16 @@ class PersonModal extends Component {
width="620px" width="620px"
> >
<style> {/*<style>*/}
{ {/* {*/}
` {/* `*/}
a:hover {/* a:hover*/}
{ {/* {*/}
background-color:#F6F4F4; {/* background-color:#F6F4F4;*/}
} {/* }*/}
` {/* `*/}
} {/* }*/}
</style> {/*</style>*/}
<div className="permaindiv"> <div className="permaindiv">
{/*队名*/} {/*队名*/}
<style>{ <style>{

Loading…
Cancel
Save