Merge branch 'dev_shixun_project' of https://git.trustie.net/jacknudt/trustieforge into dev_shixun_project
Conflicts: app/controllers/games_controller.rb
This commit is contained in:
commit
072c9550fc
|
@ -1,7 +1,7 @@
|
|||
class GamesController < ApplicationController
|
||||
layout "base_myshixun"
|
||||
before_filter :find_myshixun, :only => [:index]
|
||||
before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :output_show, :file_edit, :file_update]
|
||||
before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :output_show, :file_edit, :file_update, :game_status]
|
||||
before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update]
|
||||
before_filter :allowd_manager, :only => [:game_build]
|
||||
include ApplicationHelper
|
||||
|
@ -76,10 +76,7 @@ class GamesController < ApplicationController
|
|||
|
||||
@outputs = @game.outputs
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def game_status
|
||||
|
|
|
@ -1,71 +1,91 @@
|
|||
<div class=" col-width fl content-history mt15" >
|
||||
<div class="panel-header clearfix">
|
||||
<h3 class="fl">测评历史</h3>
|
||||
<%= 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 content-history mt15" >
|
||||
<div class="panel-header clearfix">
|
||||
<h3 class="fl">测评历史</h3>
|
||||
<div class="fr mt5">
|
||||
<a href="#"><i class="fa fa-minus font-14 mr10 fl color-grey"></i></a>
|
||||
<a href="#"><i class="fa fa-minus-square font-14 fl color-grey"></i></a>
|
||||
<a href="#"><i class="fa fa-minus font-14 mr10 fl color-grey"></i></a>
|
||||
<a href="#"><i class="fa fa-minus-square font-14 fl color-grey"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-history-inner">
|
||||
<% unless @outputs.blank? %>
|
||||
<% @outputs.each do |output| %>
|
||||
</div>
|
||||
<div class="content-history-inner">
|
||||
<% unless @outputs.blank? %>
|
||||
<% @outputs.each do |output| %>
|
||||
<div class="<%= output.code == 0 ? 'clearfix history-success mb10' : 'clearfix history-fail mb10' %>">
|
||||
<span class="<%= output.code == 0 ? 'icon-success fl mr5' : 'icon-fail fl mr5' %>">2</span>
|
||||
<p class="fl"><%= output.code == 0 ? '恭喜,您已经完成了本任务!' : '错误结果!' %></p>
|
||||
<%= link_to "详情", outputs_show_myshixun_game_path(@game, :myshixun_id => @myshixun, :game_output_id => output.id), :class => "fr mr10" %>
|
||||
<span class="<%= output.code == 0 ? 'icon-success fl mr5' : 'icon-fail fl mr5' %>">2</span>
|
||||
<p class="fl"><%= output.code == 0 ? '恭喜,您已经完成了本任务!' : '错误结果!' %></p>
|
||||
<%= link_to "详情", outputs_show_myshixun_game_path(@game, :myshixun_id => @myshixun, :game_output_id => output.id), :class => "fr mr10" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-width fl content-output ml15 mt15">
|
||||
<div class="panel-header ">
|
||||
<h3 >测试输出</h3>
|
||||
</div>
|
||||
<div class="content-history-inner">
|
||||
999999
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-width fl content-output ml15 mt15">
|
||||
<div class="panel-header ">
|
||||
<h3 >测试输出</h3>
|
||||
</div>
|
||||
<div class="content-history-inner">
|
||||
Thor position=(32,4).Light position={32,4}<br/>
|
||||
Engryg=74
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-width fl content-submit ml15 mt15">
|
||||
<div class="panel-header ">
|
||||
<h3 >操作</h3>
|
||||
</div>
|
||||
<div class="content-submitbox">
|
||||
<a href="#" class="task-btn mb10 ">保存修改</a>
|
||||
<% if @game.status == 0 %>
|
||||
<div id="game_commit">
|
||||
<%= link_to "提交评测", {:controller => 'games', :action => "game_build", :id => @game, :myshixun_id => @myshixun}, :class => "task-btn task-btn-green", :onclick => "training_task_submmit();", :remote => true %>
|
||||
</div>
|
||||
<% elsif @game.status == 1 %>
|
||||
<a class="task-btn mb10">评测中..</a>
|
||||
<% elsif @game.status == 2 %>
|
||||
<%= link_to "下 一 步", {:controller => 'games', :action => "next_step", :id => @game, :myshixun_id => @myshixun}, :class => "task-btn task-btn-green", :onclick => "training_task_submmit();", :remote => true %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-width fl content-submit ml15 mt15">
|
||||
<div class="panel-header ">
|
||||
<h3 >操作</h3>
|
||||
</div>
|
||||
<div class="content-submitbox">
|
||||
<a href="#" class="task-btn mb10 ">保存修改</a>
|
||||
|
||||
<! 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){ !>
|
||||
<%= link_to "下 一 步", {:controller => 'games', :action => "next_step", :id => @game, :myshixun_id => @myshixun}, :class => "task-btn task-btn-green", :onclick => "training_task_submmit();", :remote => true %>
|
||||
<! } !>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script >
|
||||
var bt = baidu.template;
|
||||
bt.LEFT_DELIMITER = '<!';
|
||||
bt.RIGHT_DELIMITER = '!>';
|
||||
$(function(){
|
||||
var html = bt('t:exec_results',{status: <%= @game.status %>});
|
||||
$("#code_results").html(html);
|
||||
});
|
||||
|
||||
<script>
|
||||
function training_task_submmit(){
|
||||
|
||||
$.ajax('game_build', function(){
|
||||
$("#game_commit").html("<span class='task-btn task-btn-green'>当前任务正在后台测评中,稍后将显示您的任务完成情况......</span>");
|
||||
|
||||
//循环等1分钟
|
||||
var intId = setInterval(function(){
|
||||
$.ajax('game_status', function(data){
|
||||
//如果查到了,就退出
|
||||
clearInterval(intId);
|
||||
|
||||
$("#code_results").html(data);
|
||||
|
||||
});
|
||||
}, 2000);
|
||||
|
||||
|
||||
|
||||
});
|
||||
$.ajax({
|
||||
url: '<%= game_build_myshixun_game_path(@game, @myshixun) %>',
|
||||
success: function (){
|
||||
$("#training_tasl_commit").html("<span class='task-display-span alert-blue mt10'>当前任务正在后台测评中,稍后将显示您的任务完成情况......</span>");
|
||||
//循环等1分钟
|
||||
alert("111");
|
||||
var intId = setInterval(function(){
|
||||
$.ajax({
|
||||
url: '<%= game_status_myshixun_game_path(@game) %>',
|
||||
data:'test',
|
||||
success:function(data){
|
||||
//如果查到了,就退出
|
||||
alert(data.status);
|
||||
clearInterval(intId);
|
||||
var html = bt('t:exec_results',{status: 2});
|
||||
console.log(html);
|
||||
$("#code_results").html(html);
|
||||
}
|
||||
});
|
||||
}, 6000);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
|
@ -41,9 +41,7 @@
|
|||
<div id="code_content">
|
||||
<%= render :partial => 'repository' %>
|
||||
</div>
|
||||
<div id="code_results">
|
||||
<%= render :partial => 'exec_results' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
<%# activity = activity.nil? ? local_assigns[:activity] : activity %>
|
||||
<div class="mb10">
|
||||
<% if activity.status == 1 %>
|
||||
|
@ -14,27 +15,6 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
function training_task_submmit(){
|
||||
|
||||
$.ajax('game_build', function(){
|
||||
$("#training_tasl_commit").html("<span class='task-display-span alert-blue mt10'>当前任务正在后台测评中,稍后将显示您的任务完成情况......</span>");
|
||||
|
||||
//循环等1分钟
|
||||
var intId = setInterval(function(){
|
||||
$.ajax('game_status', function(data){
|
||||
//如果查到了,就退出
|
||||
clearInterval(intId);
|
||||
|
||||
$("#code_results").html(data);
|
||||
|
||||
});
|
||||
}, 2000);
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -139,8 +139,8 @@ a.rightbar-pause{ color:#29bd8b; font-size: 18px; margin-right:245px; margin-top
|
|||
.task-header-navs li{ float: left;}
|
||||
.task-header-navs li a{ display: block; height: 50px; padding:0 50px; color:#fff; text-align: center; font-size: 16px; line-height: 50px;}
|
||||
.task-header-navs li a:hover,.task-header-navs li a.active{ background:#29bd8b;}
|
||||
.task-pm-content{ width: 1000px; margin: 0 auto; }
|
||||
.task-pm-box{ width: 100%; background: #fff; border: 1px solid #e8e8e8;}
|
||||
.task-pm-content{ width: 1000px; margin: 0 auto; min-height:566px}
|
||||
.task-pm-box{ width: 100%; background: #fff; border: 1px solid #e8e8e8;}
|
||||
.task-paner-con{ padding:15px; color:#666; line-height:2.0;}
|
||||
.panel-form{ width:800px; margin:0 100px; padding:30px 0; line-height: 40px; }
|
||||
.panel-form li{ margin-bottom:20px; font-size: 14px; color:#666;}
|
||||
|
|
Loading…
Reference in New Issue