You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/app/views/competitions/index.html.erb

111 lines
5.5 KiB

6 years ago
<div class="educontent mt20 mb80">
<% if @competitions.count > 0 %>
<div class="clearfix competitionsList">
<% @competitions.each do |competition| %>
<% if competition.status? %>
6 years ago
<div class="competitionsList-item mb20">
<div class="edu-back-white">
<a href="<%= competition_path(competition) %>" class="competition-Img" target="_blank">
<%= image_tag(url_to_avatar(competition), :width => "100%", :height => "100%") %>
</a>
<div class="pt20 pl20 mb10 clearfix">
<a href="<%= competition_path(competition) %>" style="max-width: 400px;" class="font-16 task-hide fl" target="_blank"><%= [competition.name, competition.sub_title.presence].compact.join('——') %></a>
6 years ago
<% if competition.start_time > Time.now %>
<% unless competition.enroll_end_time.present? && competition.enroll_end_time < Time.now %>
<div class="fr status-orange">
<img src="/images/educoder/competition/home/orange.png" class="fl">
<span class="status-tag fl">报名中</span>
</div>
<% else %>
<div class="fr status-blue">
<img src="/images/educoder/competition/home/blue.png" class="fl">
<span class="status-tag fl">即将开始</span>
</div>
<% end %>
<% elsif competition.end_time < Time.now %>
<div class="fr status-grey">
<img src="/images/educoder/competition/home/grey.png" class="fl">
<span class="status-tag fl">已结束</span>
</div>
<% else %>
<% max_min_stage = max_min_stage_time competition %>
<% if max_min_stage.count == 1 %>
<div class="fr status-blue">
<img src="/images/educoder/competition/home/blue.png" class="fl">
<span class="status-tag fl">距离结束还剩<%= how_much_day competition.end_time %></span>
</div>
<% else %>
<% max_min_stage.each do |stage| %>
<% if stage.min_start_time > Time.now %>
<div class="fr status-blue">
<img src="/images/educoder/competition/home/blue.png" class="fl">
<span class="status-tag fl"><%= stage.competition_stage.name %>即将开始</span>
</div>
<% break %>
<% elsif stage.max_end_time > Time.now %>
<div class="fr status-blue">
<img src="/images/educoder/competition/home/blue.png" class="fl">
<span class="status-tag fl"><%= stage.competition_stage.name %>正在进行</span>
</div>
<% break %>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
<p class="color-grey-B3 clearfix pl20 pr20 pb20">
<span class="fl"><span><%= format_date competition.start_time %></span>&nbsp;~&nbsp;<span><%= com_end_date competition.end_time %></span></span>
<span class="fr">
<span class="fl cdefault" data-tip-down="浏览数"><i class="iconfont icon-liulanyan font-16 fl mr3"></i><span class="font-12 mt3 fl"><%= competition.visits %></span></span>
<% if competition.member_count > 0 %>
<span class="ml30 fl cdefault" data-tip-down="报名数"><i class="iconfont icon-chengyuan font-16 fl mr3"></i>
<span class="font-12 mt4 fl">
<%= competition.identifier == "hn" ? 1125 : competition.member_count %>
</span>
</span>
<% end %>
</span>
</p>
</div>
</div>
<% elsif competition.published_at.present? %>
<% url = admin_or_business? ? competition_path(competition) : 'javascript:void(0)' %>
<div class="competitionsList-item mb20">
<div class="edu-back-white">
<a href="<%= url %>" class="competition-Img">
<%= image_tag(url_to_avatar(competition), :width => "100%", :height => "100%") %>
</a>
5 years ago
<div class="pt30 pb30 pl20 mb10 clearfix">
<a href="<%= url %>" style="max-width: 400px;" class="font-16 task-hide fl"><%= [competition.name, competition.sub_title.presence].compact.join('——') %></a>
<div class="fr status-orange">
<img src="/images/educoder/competition/home/orange.png" class="fl">
<span class="status-tag fl">即将发布</span>
</div>
</div>
<p class="color-grey-B3 clearfix pl20 pr20 pb20"></p>
</div>
5 years ago
<div class="competitionsList-item-tip strongNone">
<div class="color-white font-26">
<p>即将发布</p><p>敬请期待</p>
</div>
</div>
</div>
<% end %>
6 years ago
<% end %>
</div>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>
</div>
5 years ago
<script>
$(function(){
<% unless admin_or_business? %>
$(".competitionsList-item").hover(function(){
5 years ago
$(this).find(".competitionsList-item-tip").removeClass("strongNone");
},function(){
$(this).find(".competitionsList-item-tip").addClass("strongNone");
});
<% end %>
5 years ago
})
</script>