From 75446cb998d38ff0a61f32103909b12d6141a3c3 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 25 Oct 2019 09:16:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/competition_settings/index.js | 5 +- app/models/competition.rb | 4 +- .../competition_settings/index.html.erb | 185 ++++++++++++------ 3 files changed, 132 insertions(+), 62 deletions(-) diff --git a/app/assets/javascripts/admins/competition_settings/index.js b/app/assets/javascripts/admins/competition_settings/index.js index cc56c8641..207fd0ee3 100644 --- a/app/assets/javascripts/admins/competition_settings/index.js +++ b/app/assets/javascripts/admins/competition_settings/index.js @@ -249,7 +249,8 @@ $(function () { } }) -}) +}); + //新增子阶段 function add_task_sub(item){ var index = $(item).parents(".large_panel_part").attr("attr_line"); @@ -355,7 +356,7 @@ function Del_tab(item) { $(item).parents(".large_panel_part").remove(); } //新增tab -function addNewTab() { +function addNewTab() { var count = parseInt($("#large_panel").find(".large_panel_part").length)+1; var html = '
\n' + ' tab标题\n' + diff --git a/app/models/competition.rb b/app/models/competition.rb index 845c5c00f..461af5471 100644 --- a/app/models/competition.rb +++ b/app/models/competition.rb @@ -23,8 +23,8 @@ class Competition < ApplicationRecord has_many :competition_awards, dependent: :destroy has_many :competition_schools, dependent: :destroy - has_one :sponsor_schools, -> { where(source: :sponsor) }, class_name: 'CompetitionSchool' # 主办方 - has_one :region_schools, -> { where(source: :region) }, class_name: 'CompetitionSchool' # 开放范围 + has_many :sponsor_schools, -> { where(source: :sponsor) }, class_name: 'CompetitionSchool' # 主办方 + has_many :region_schools, -> { where(source: :region) }, class_name: 'CompetitionSchool' # 开放范围 after_create :create_competition_modules diff --git a/app/views/admins/competition_settings/index.html.erb b/app/views/admins/competition_settings/index.html.erb index 34a326dee..c06dc0000 100644 --- a/app/views/admins/competition_settings/index.html.erb +++ b/app/views/admins/competition_settings/index.html.erb @@ -210,7 +210,7 @@
  
- +
~
@@ -312,74 +312,143 @@
+<% if @competition.mode == 1 %> +
+
+ 排行榜设置 + + 新增tab + 实训ID填写示例:实训地址为https://www.educoder.net/shixuns/u5plmgka/challenges,则填写“u5plmgka” +
+
+
+ <% if @competition.competition_stages.count > 0 %> + <% @competition.competition_stages.each do |stage| %> + <%= 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 %> +
+
+ tab标题 +
+ +
+ 总排行榜占比: +
+ +
% + + 删除 + 保存 +
-
-
- 排行榜设置 - + 新增tab +
+
+ 第1阶段 +
+
+ 有效时间: +
+ +
+ ~ +
+ +
+ 任务完成要求: +
+ +
+ / +
+ +
+ (总任务) + 成绩来源: +
+ +
+
+
+
+ + 删除 + +
+
+
+ <% end %> + <% end %> + <% else %> + <% end %> +
+
- 实训ID填写示例:实训地址为https://www.educoder.net/shixuns/u5plmgka/challenges,则填写“u5plmgka” -
-
-
-
-
- tab标题 -
- -
- 总排行榜占比: -
- -
% - - 删除 - 保存 -
-
-
- 第1阶段 +
+
+
+
+ tab标题 +
+ +
+ 总排行榜占比: +
+ +
%
-
- 有效时间: -
- -
- ~ -
- -
- 任务完成要求: -
- -
- / -
- -
- (总任务) - 成绩来源: -
- + 新增子阶段 + 发送短信提醒 + 计算成绩 +
+ 删除 + 保存 +
+
+
+ 第1阶段 +
+
+ 有效时间: +
+ +
+ ~ +
+ +
+ 任务完成要求: +
+ +
+ / +
+ +
+ (总任务) + 成绩来源: +
+ +
+
-
-
- + 删除 +
-
+<% end %>