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/db.html.erb

83 lines
4.1 KiB

6 years ago
<div id="competition-db-content">
<p id="dbpage1"></p>
<div class="intoGame">
<div class="top-com">
<% @names.each_with_index do |name, i| %>
<div class="partGame">
<div class="partborder">
<span class="gemeName"><%= name %></span>
<% @stages.each_with_index do |stage, j| %>
<div class="partTime <%= Time.now > @times[i][j] ? "active" : "" %> mb20">
<p class="font-18">
<span class="mr15 pro"><%= stage %></span>
<% if Time.now > @times[i][j] %>
<% if i < 2 %> <!-- 前2个赛事 -->
<% if Time.now <= @times[i][j] + @end_times[j] %>
<span class="time time1">正在进行</span>
<% else %>
<span class="time time1">已结束</span>
<% end %>
<% end %>
<% else %>
<span class="time open_time"><%= @times[i][j].strftime('%Y-%m-%d %H:%M:%S') %></span>
<input type="hidden" class="get_open_time" value="<%= consume_time @times[i][j] %>" />
<% end %>
</p>
<div class="enterTo clearfix edu-txt-center mt20">
<div class="inline">
<% "@urls[i][j][k]表示: 第i个比赛的第j个对象的第k个url入口" %>
<% @shixun_names.each_with_index do |name, k| %>
<a class="li-1" href="<%= Time.now > @times[i][j] ? "#{@urls[i][j][k]}" : "javascript:void(0);" %>" target="_blank"><%= name %></a>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
</div>
<% end %>
</div>
</div>
<img src="/images/educoder/competition/db/db2.jpg" width="100%">
<div class="pr" id="page3">
<img src="/images/educoder/competition/db/db3.jpg" width="100%">
<div class="position-shixun"><p class="inline">
<a href="https://www.educoder.net/paths/38" target="_blank" class="shixun-btn">Java实战教程</a>
<a href="https://www.educoder.net/paths/3" target="_blank" class="shixun-btn">C/C++实战教程</a>
<a href="https://www.educoder.net/paths/11" target="_blank" class="shixun-btn">Python实战教程</a>
</p></div>
</div>
<img src="/images/educoder/competition/db/db4.jpg" width="100%">
<img src="/images/educoder/competition/db/db5.jpg" width="100%">
<img src="/images/educoder/competition/db/db6.jpg" width="100%">
<img src="/images/educoder/competition/db/db7.jpg" id="page7" width="100%">
</div>
<script>
$(function(){
var interval = 0;
var $countdown = $(".get_open_time:first");
var time = $countdown.val();
var endTime = (new Date(time)).getTime();
var nowTime = (new Date("<%= consume_time(Time.now) %>")).getTime();
var intId = setInterval(function(){
if( time != undefined && time != null && time != ""){
interval += 1;
var timeDiff = parseInt(endTime - nowTime) - interval * 1000;
if(timeDiff > 0){
var days = parseInt(timeDiff / (1000 * 60 * 60 * 24));
var hours = parseInt((timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = parseInt((timeDiff % (1000 * 60 * 60 * 24) % (1000 * 60 * 60))/ (1000 * 60));
var seconds = parseInt((timeDiff % (1000 * 60 * 60 * 24) % (1000 * 60 * 60)) % (1000 * 60) / 1000);
$(".open_time:first").addClass("timered");
$(".open_time:first").html("倒计时:"+ days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 ");
}else{
clearInterval(intId);
window.location.reload();
}
}else{
clearInterval(intId);
}
}, 1000);
});
</script>