164 lines
6.5 KiB
Plaintext
164 lines
6.5 KiB
Plaintext
<%= content_for(:header_tags) do %>
|
|
<%= javascript_include_tag 'baiduTemplate', 'jquery.datetimepicker.js' %>
|
|
<% end %>
|
|
<div id="code_results">
|
|
</div>
|
|
<script id="t:exec_results" type="text/html">
|
|
<div class="col-width fl mt15 content-half-fix undis" style="margin-top:125px;">
|
|
<div class="panel-header clearfix">
|
|
<h3 class="fl">测评历史</h3>
|
|
<div class="fr mt5">
|
|
<a href="javascript:void(0)" onclick="hide_windows();"><i class="fa fa-compress font-14 fl color-grey"></i></a>
|
|
</div>
|
|
</div>
|
|
<div class="content-history-inner" style="height: 100px;">
|
|
<! for(var i=0;i< results.length; i++) { !>
|
|
<! if(results[i][0] == 0){ !>
|
|
<div class="clearfix history-success mb10">
|
|
<span class="icon-success fl mr5"><!= i+1 !></span>
|
|
<p class="fl">恭喜,您已经完成了本任务!</p>
|
|
<a href="/myshixuns/<%= @myshixun.id %>/games/<%= @game.id %>/outputs_show?game_output_id=<!= results[i][1] !>" class="fr mr10" data-remote="true">详情</a>
|
|
</div>
|
|
<! }else{ !>
|
|
<div class="clearfix history-fail mb10">
|
|
<span class="icon-fail fl mr5"><!= i+1 !></span>
|
|
<p class="fl">错误结果!</p>
|
|
<a href="/myshixuns/<%= @myshixun.id %>/games/<%= @game.id %>/outputs_show?game_output_id=<!= results[i][1] !>" class="fr mr10" data-remote="true" >详情</a>
|
|
</div>
|
|
<! } !>
|
|
<! } !>
|
|
</div>
|
|
</div>
|
|
<div class="col-width fl content-history mt15" >
|
|
<div class="panel-header clearfix">
|
|
<h3 class="fl">测评历史</h3>
|
|
<div class="fr mt5">
|
|
<a href="javascript:void(0)" onclick="extend_window()"><i class="fa fa-expand font-14 fl color-grey"></i></a>
|
|
</div>
|
|
</div>
|
|
<div class="content-history-inner">
|
|
<!--<! if (results.length != 0) { !>-->
|
|
<! for(var i=0;i< results.length; i++) { !>
|
|
<! if(results[i][0] == 0){ !>
|
|
<div class="clearfix history-success mb10">
|
|
<span class="icon-success fl mr5"><!= i+1 !></span>
|
|
<p class="fl">恭喜,您已经完成了本任务!</p>
|
|
<a href="/myshixuns/<%= @myshixun.id %>/games/<%= @game.id %>/outputs_show?game_output_id=<!= results[i][1] !>" class="fr mr10" data-remote="true">详情</a>
|
|
</div>
|
|
<! }else{ !>
|
|
<div class="clearfix history-fail mb10">
|
|
<span class="icon-fail fl mr5"><!= i+1 !></span>
|
|
<p class="fl">错误结果!</p>
|
|
<a href="/myshixuns/<%= @myshixun.id %>/games/<%= @game.id %>/outputs_show?game_output_id=<!= results[i][1] !>" class="fr mr10" data-remote="true" >详情</a>
|
|
|
|
</div>
|
|
<! } !>
|
|
<! } !>
|
|
<!--<! } !>-->
|
|
</div>
|
|
</div>
|
|
<div class="col-width fl content-output ml15 mt15">
|
|
<div class="panel-header">
|
|
<h3 >测试输出</h3>
|
|
</div>
|
|
<div class="content-history-inner" id="game_test_output">
|
|
<!=output !>
|
|
</div>
|
|
</div>
|
|
<div class="col-width fl content-submit ml19 mt15">
|
|
<div class="panel-header ">
|
|
<h3 >操作</h3>
|
|
</div>
|
|
<div class="content-submitbox">
|
|
<! if(status == 0){ !>
|
|
<div id="game_commit">
|
|
<a href="javascript:void(0)" class="task-btn task-btn-green" onclick="training_task_submmit();">提交评测</a>
|
|
</div>
|
|
<! }else if(status == 1){ !>
|
|
<a class="task-btn mb10">评测中..</a>
|
|
<! }else if(status == 2 && had_done != 1){ !>
|
|
<%= link_to "下 一 步", {:controller => 'games', :action => "next_step", :id => @game, :myshixun_id => @myshixun}, :class => "task-btn task-btn-green", :remote => true %>
|
|
<! } !>
|
|
<! if(had_done == 1) { !>
|
|
<a href="javascript:void(0)" class="task-btn mb10" >已通关</a>
|
|
<! } !>
|
|
</div>
|
|
</div>
|
|
</script>
|
|
|
|
<script >
|
|
var bt = baidu.template;
|
|
bt.LEFT_DELIMITER = '<!';
|
|
bt.RIGHT_DELIMITER = '!>';
|
|
$(function(){
|
|
var html = bt('t:exec_results',{status: <%= @game.status %>, output:"<%= @latest_output %>", results: <%= @results %>, had_done: "<%= @had_done %>"});
|
|
$("#code_results").html(html);
|
|
});
|
|
|
|
function training_task_submmit(){
|
|
$("#game_commit").html("<a class='task-btn mb10'>评测中..</a>");
|
|
$.ajax({
|
|
url: '<%= game_build_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
|
|
success: function (){
|
|
|
|
//循环等1分钟
|
|
var intId = setInterval(function(){
|
|
$.ajax({
|
|
url: '<%= game_status_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
|
|
data:'test',
|
|
success:function(data){
|
|
//如果查到了,就退出
|
|
console.log(html);
|
|
if(data.status == 2 || data.status == 0){
|
|
alert("进来了");
|
|
clearInterval(intId);
|
|
var html = bt('t:exec_results',{status: data.status, output: data.output, results: data.results, had_done: data.had_done});
|
|
console.log(html);
|
|
$("#code_results").html(html);
|
|
}
|
|
}
|
|
});
|
|
}, 2000);
|
|
}
|
|
})
|
|
|
|
}
|
|
function extend_window(){
|
|
var web_h = window.innerHeight;
|
|
if($.browser.msie) {
|
|
$(".content-half-fix").css("width", "42%");
|
|
$(".content-half-fix").css("height", web_h - 168 + "px");
|
|
}
|
|
else if($.browser.safari)
|
|
{
|
|
$(".content-half-fix").css("width", "42%");
|
|
$(".content-half-fix").css("height", web_h - 168 + "px");
|
|
}
|
|
else if($.browser.mozilla)
|
|
{
|
|
$(".content-half-fix").css("width", "42.5%");
|
|
$(".content-half-fix").css("height", web_h - 158 + "px");
|
|
}
|
|
else if($.browser.opera) {
|
|
$(".content-half-fix").css("width", "42%");
|
|
}else if($.browser.chrome){
|
|
if(window.navigator.userAgent.indexOf("MetaSr") == -1){
|
|
$(".content-half-fix").css("width", "42.5%");
|
|
$(".content-half-fix").css("height", web_h - 160 + "px");
|
|
}else{
|
|
$(".content-half-fix").css("width", "42.5%");
|
|
$(".content-half-fix").css("height", web_h - 155 + "px");
|
|
}
|
|
}
|
|
$(".content-half-fix").show();
|
|
}
|
|
function hide_windows(){
|
|
$(".content-half-fix").hide();
|
|
}
|
|
|
|
|
|
function file_edit_submit(){
|
|
$('#file_update_id').submit();
|
|
}
|
|
|
|
</script> |