点击测评局部刷新测试集
This commit is contained in:
parent
d174152e7f
commit
d670cf8a36
|
|
@ -1,8 +1,9 @@
|
|||
<span class="mt10 -flex c_grey ml15">耗时:<%= game_spend_time(@game.open_time, @game.updated_at) %></span>
|
||||
<div id="code_estimate">
|
||||
<% if @game.status == 0 %>
|
||||
<a href="javascript:void(0)" class="task-btn task-btn-blue mr15 mt8" onclick="training_task_submmit();">评测</a>
|
||||
<a href="javascript:void(0)" class="task-btn task-btn-blue mr15 mt8" id="code_test" onclick="training_task_submmit();">评测</a>
|
||||
<% elsif @game.status == 1 %>
|
||||
<a class="task-btn mb10 mt6">评测中..</a>
|
||||
<a class="task-btn mb10 mt6" id="code_testing">评测中..</a>
|
||||
<% elsif @game.status == 2 %>
|
||||
<%= link_to "下 一 步 ", {:controller => 'games',:action => "next_step", :id => @game,
|
||||
:myshixun_id => @myshixun},
|
||||
|
|
@ -10,12 +11,12 @@
|
|||
:onclick => "training_task_submmit();",
|
||||
:remote => true %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
function training_task_submmit(){
|
||||
var i = 0;
|
||||
$("#ajax-indicator").show();
|
||||
$("#game_commit").html("<a class='task-btn mb10 mt6'>评测中..</a>");
|
||||
$("#code_estimate").replaceWith("<a class='task-btn mb10 mt6 mr15' id='code_testing'>评测中..</a>");
|
||||
$.ajax({
|
||||
url: '<%= game_build_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
|
||||
success: function (){
|
||||
|
|
@ -24,7 +25,6 @@
|
|||
$("#ajax-indicator").children('span')[0].remove();
|
||||
$("#ajax-indicator").css('border', 0);
|
||||
$("#ajax-indicator").css('padding', 0);
|
||||
|
||||
var intId = setInterval(function(){
|
||||
var ajaxTimeoutTest = $.ajax({
|
||||
url: '<%= game_status_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
|
||||
|
|
@ -40,12 +40,56 @@
|
|||
$("#ajax-indicator").html(temp);
|
||||
$("#ajax-indicator").css('border', "1px solid #bbb");
|
||||
$("#ajax-indicator").css('padding', "0.6em");
|
||||
var html = bt('t:exec_results',{status: data.status, results: data.results, had_done: data.had_done});
|
||||
$("#code_results").html(html);
|
||||
console.log(data.output)
|
||||
$("#game_test_output").html(data.output)
|
||||
var html = bt('t:extend_exec_results',{status: data.status, output: data.output, results: data.results, had_done: data.had_done});
|
||||
$("#extend_code_results").html(html);
|
||||
// test_sets 公开测,hide_test_sets 隐藏测试集
|
||||
var html = bt('t:exec_results_1',{
|
||||
test_sets: [
|
||||
{
|
||||
is_public: 1,
|
||||
result: 1,
|
||||
input: "input7",
|
||||
actual_output: "actual_output7",
|
||||
output: "output7"
|
||||
},
|
||||
{
|
||||
is_public: 1,
|
||||
result: 1,
|
||||
input: "input8",
|
||||
actual_output: "actual_output8",
|
||||
output: "output8"
|
||||
},
|
||||
{
|
||||
is_public: 1,
|
||||
result: 1,
|
||||
input: "input9",
|
||||
actual_output: "actual_output9",
|
||||
output: "output9"
|
||||
}
|
||||
],
|
||||
hide_test_sets: [
|
||||
{
|
||||
is_public: 0,
|
||||
result: 0,
|
||||
input: "input10",
|
||||
actual_output: "actual_output10",
|
||||
output: "output10"
|
||||
},
|
||||
{
|
||||
is_public: 0,
|
||||
result: 0,
|
||||
input: "input11",
|
||||
actual_output: "actual_output11",
|
||||
output: "output11"
|
||||
},
|
||||
{
|
||||
is_public: 0,
|
||||
result: 0,
|
||||
input: "input12",
|
||||
actual_output: "actual_output12",
|
||||
output: "output12"
|
||||
}
|
||||
]
|
||||
});
|
||||
$("#game_test_set_results").html(html);
|
||||
if(data.status == 2){
|
||||
if( data.had_done == 0 ) {
|
||||
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 0}) %>";
|
||||
|
|
@ -62,8 +106,8 @@
|
|||
url: '<%= change_status_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
|
||||
success:function(data){
|
||||
clearInterval(intId);
|
||||
var html = bt('t:exec_results',{status: data.status, output: data.output, results: data.results, had_done: data.had_done});
|
||||
$("#code_results").html(html);
|
||||
var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' id='code_test' onclick='training_task_submmit();'>评测</a>";
|
||||
$("#code_testing").replaceWith(html);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,4 +5,17 @@
|
|||
.task-popup-content{ padding:15px;}
|
||||
.task-popup-submit{ margin:15px auto; width: 200px;}
|
||||
|
||||
.task-popup-bggrey{ background:#ccc; color:#333;}
|
||||
.task-popup-bggrey{ background:#ccc; color:#333;}
|
||||
/************实训弹窗****************/
|
||||
.task-popup-warp{ width: 100%; height:100%; background:black; position:fixed;}
|
||||
.task-popup-box{ position: relative; margin:150px auto; }
|
||||
.task-box1{ width:428px; height:420px;background:url(/images/task/task-success.png) 0px 0px no-repeat;}
|
||||
.task-box2{ width:496px; height:373px;background:url(/images/task/task-success02.png) 0px 50px no-repeat;}
|
||||
a.task-popup-close{ display: block; background:url(/images/task/task-close.png) 0px 0px no-repeat; width: 31px; height: 31px; position:absolute; right:5px; top:100px;}
|
||||
a:hover.task-popup-close{background:url(/images/task/task-close.png) -40px 0px no-repeat; }
|
||||
.task-su-con{ text-align: center; padding-top:285px;}
|
||||
.task-su-p{ font-size: 20px; color:#ee4a1f; font-weight: bold;}
|
||||
a.task-su-btn{display: block;background:url(/images/task/task-su-btn.png) 0px -64px no-repeat; width: 138px; height: 57px;color:#ee4a1f; line-height: 50px; text-align: center; font-size: 16px; margin:20px auto;}
|
||||
a:hover.task-su-btn{background:url(/images/task/task-su-btn.png) 0px 0px no-repeat; }
|
||||
a.task-su-btn-white{ display: inline-block; padding:8px 25px; border:1px solid #fff; color:#fff; text-align: center; border-radius:5px; font-size:14px;}
|
||||
a:hover.task-su-btn-white{ color: #ee4a1f; border:1px solid #ee4a1f; }
|
||||
Loading…
Reference in New Issue