Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop
commit
63f9a3cac1
@ -1,47 +1,71 @@
|
||||
<div class="openSource_1" style="background: url('/images/educoder/competition/qg/qg_open_1.png') no-repeat top center;"></div>
|
||||
<div class="openSource_2" style="background: url('/images/educoder/competition/qg/qg_open_2.png') no-repeat top center;"></div>
|
||||
<div class="openSource_3" style="background: url('/images/educoder/competition/qg/qg_open_3.png') no-repeat top center;">
|
||||
<% index = 0 %>
|
||||
<div class="openSource_1" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
|
||||
<% index += 1 %>
|
||||
<div class="openSource_2" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
|
||||
<% index += 1 %>
|
||||
|
||||
<% @competition.competition_stages.each_with_index do |stage, i| %>
|
||||
<div class="openSource_<%= index + 1 %>" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;">
|
||||
<%
|
||||
first_section = stage.competition_stage_sections[0]
|
||||
second_section = stage.competition_stage_sections[1]
|
||||
%>
|
||||
<div class="enter_panel" style="height: 285px">
|
||||
<ul>
|
||||
<p class="font-22 enter_title padding30 clearfix">
|
||||
<span class="fl ml30">
|
||||
<span class="mr20 font-bd">开源任务征集</span>
|
||||
<span>2019年7月1日~2019年7月20日</span>
|
||||
<span class="mr20 font-bd"><%= first_section.try(:name) %></span>
|
||||
<span><%= first_section.start_time.try(:strftime, '%Y年%m月%d日') %> ~ <%= first_section.end_time.try(:strftime, '%Y年%m月%d日') %></span>
|
||||
</span>
|
||||
<span class="fr mr30">
|
||||
<span class="mr20 font-bd">开源任务发布</span>
|
||||
<span>2019年7月21日</span>
|
||||
<span class="mr20 font-bd"><%= second_section.try(:name) %></span>
|
||||
<span><%= second_section.try(:start_time).try(:strftime, '%Y年%m月%d日') %> ~ <%= second_section.try(:end_time).try(:strftime, '%Y年%m月%d日') %></span>
|
||||
</span>
|
||||
</p>
|
||||
<li class="inline enter_btn mt20">
|
||||
<a href="javascript:void(0);" class="li-1">项目名称1</a>
|
||||
<a href="javascript:void(0);" class="li-1">项目名称2</a>
|
||||
<a href="javascript:void(0);" class="li-1">项目名称3</a>
|
||||
<% is_start = Time.now > first_section.start_time %>
|
||||
<% first_section.competition_entries.each_with_index do |entry, j| %>
|
||||
<%
|
||||
competition_url = User.current.logged? ? "#{entry.url}?eid=#{User.current.id}" : "#{entry.url}"
|
||||
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
|
||||
%>
|
||||
<a class="li-1 <%= is_start ? 'active' : '' %>"
|
||||
href="javascript:void(0);"
|
||||
data-url="<%= btn_url %>"><%= entry.name %></a>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="openSource_4" style="background: url('/images/educoder/competition/qg/qg_open_4.png') no-repeat top center;">
|
||||
<div class="enter_panel" style="height: 285px">
|
||||
<ul>
|
||||
<p class="font-22 enter_title padding30 clearfix">
|
||||
<span class="fl ml30">
|
||||
<span class="mr20 font-bd">开源开发阶段</span>
|
||||
<span>2019年7月1日~2019年7月20日</span>
|
||||
</span>
|
||||
<span class="fr mr30">
|
||||
<span class="mr20 font-bd">成绩发布阶段</span>
|
||||
<span>2019年7月21日</span>
|
||||
</span>
|
||||
</p>
|
||||
<li class="inline enter_btn mt20">
|
||||
<a href="javascript:void(0);" class="li-1">项目名称1</a>
|
||||
<a href="javascript:void(0);" class="li-1">项目名称2</a>
|
||||
<a href="javascript:void(0);" class="li-1">项目名称3</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="openSource_5" style="background: url('/images/educoder/competition/qg/qg_open_5.png') no-repeat top center;"></div>
|
||||
<div class="openSource_6" style="background: url('/images/educoder/competition/qg/qg_open_6.png') no-repeat top center;"></div>
|
||||
<div class="openSource_7" style="background: url('/images/educoder/competition/qg/qg_open_7.png') no-repeat top center;"></div>
|
||||
<% index += 1 %>
|
||||
<% end %>
|
||||
|
||||
<div class="openSource_5" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
|
||||
<% index += 1 %>
|
||||
<div class="openSource_6" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
|
||||
<% index += 1 %>
|
||||
<div class="openSource_7" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></div>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
var userLogged = <%= @user.present? && @user.logged? %>;
|
||||
var userEnrolled = <%= @enrolled %>;
|
||||
|
||||
$(".enter_btn .li-1.active").on("click", function(){
|
||||
var url = $(this).data("url");
|
||||
|
||||
if (!userLogged) {
|
||||
location.href = "<%= signin_url(back_url: competition_path(id: params[:id])) %>";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!userEnrolled) {
|
||||
sure_box_redirect_without_newtab_btn("<%= enroll_competition_path(id: params[:id]) %>", "完成报名后即可参赛", "我要报名");
|
||||
return;
|
||||
}
|
||||
|
||||
var newTab = window.open("_blank");
|
||||
newTab.location = url;
|
||||
})
|
||||
})
|
||||
</script>
|
Loading…
Reference in new issue