dev_sync_trustie
cxt 5 years ago
parent 434d7023c5
commit e83ffc8071

@ -69,7 +69,7 @@ class Competitions::CompetitionsController < Competitions::BaseController
end end
def update_md_content def update_md_content
tip_exception("标题和内容不能为空") if params[:name].blank? || params[:content].blank? tip_exception("内容不能为空") if params[:content].blank?
tip_exception("缺少competition_module_id") if params[:competition_module_id].blank? tip_exception("缺少competition_module_id") if params[:competition_module_id].blank?
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
com_module = current_competition.competition_modules.find_by!(id: params[:competition_module_id]) com_module = current_competition.competition_modules.find_by!(id: params[:competition_module_id])

@ -324,7 +324,7 @@
<div class="card-body"> <div class="card-body">
<div id="large_panel" class="large_panel"> <div id="large_panel" class="large_panel">
<% if @competition.competition_stages.count > 0 %> <% if @competition.competition_stages.count > 0 %>
<% @competition.competition_stages.each do |stage| %> <% @competition.competition_stages.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">
@ -345,22 +345,23 @@
<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>
<div id="small_panel_1" class="small_panel"> <div id="small_panel_<%= index + 1 %>" class="small_panel">
<div class="row d-flex small_panel_item" attr_line="sub_1_1" count="1"> <% stage.competition_stage_sections.each_with_index do |section, j| %>
<span class="col-1 mt-2 subName">第1阶段</span> <div class="row d-flex small_panel_item" attr_line="sub_1_1" count="<%= j + 1 %>">
<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">
<input class="use_time_begin_1_1 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">
<input class="use_time_end_1_1 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="task_require_small_1_1"/> <input type="number" class="form-control" name="stage[][end_time]"/>
</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">
@ -381,6 +382,7 @@
<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>
</span> </span>
</div> </div>
<% end %>
</div> </div>
</div> </div>
<% end %> <% end %>

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

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