Merge branch 'dev_shixun_project' of https://git.trustie.net/jacknudt/trustieforge into dev_shixun_project
This commit is contained in:
commit
a2b20f485e
|
@ -84,7 +84,7 @@ class ChallengesController < ApplicationController
|
|||
next_challenge = @challenge.next_challenge
|
||||
position = @challenge.position
|
||||
@challenge.update_attribute(:position, (position + 1))
|
||||
next_challenge.update_attribute(:position, position - 1)
|
||||
next_challenge.update_attribute(:position, next_challenge.position - 1)
|
||||
end
|
||||
|
||||
def index_up
|
||||
|
|
|
@ -8,6 +8,7 @@ class GamesController < ApplicationController
|
|||
|
||||
def index
|
||||
@games = @myshixun.games
|
||||
@games_count = @games.count
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
|
@ -45,29 +46,42 @@ class GamesController < ApplicationController
|
|||
gitUrl = git_repository_url(@myshixun, "Myshixun")
|
||||
gitUrl = Base64.encode64(gitUrl)
|
||||
taskId = params[:id]
|
||||
jobName = @myshixun.forked_from
|
||||
jobName = "myshixun_#{@myshixun.id}"
|
||||
input = {}
|
||||
output = {}
|
||||
test_sets = @game.test_sets
|
||||
unless test_sets.blank?
|
||||
test_sets.each_with_index do |test_set, index|
|
||||
input.store("input_#{index}",test_set.try(:input))
|
||||
output.store("output_#{index}",test_set.try(:output))
|
||||
end
|
||||
end
|
||||
|
||||
step = @game.stage
|
||||
if @game.status == 0
|
||||
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}"}
|
||||
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}", :input => input, :output => output }
|
||||
uri = URI.parse("http://123.59.135.74:9999/jenkins-exec/api/buildJob")
|
||||
res = uri_exec uri, params
|
||||
@game.update_attribute(:status, 1)
|
||||
@outputs = @game.game_outputses
|
||||
|
||||
@outputs = @game.outputs
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def game_status
|
||||
render :json => {status: @game.status}
|
||||
end
|
||||
|
||||
# 自动推送下一个任务
|
||||
def next_step
|
||||
shixun = @myshixun.parent
|
||||
position = @game.stage + 1
|
||||
challenge = Challenge.where(:shixun_id => shixun, :position => position).first
|
||||
render_404 if challenge.blank?
|
||||
next_game = publish_games challenge, @myshixun.id, position
|
||||
next_game = @game.next_game
|
||||
next_game.update_attribute(:status, 0)
|
||||
respond_to do |format|
|
||||
format.html{redirect_to myshixun_game_path(next_game, :myshixun_id => @myshixun.id)}
|
||||
format.js{redirect_to myshixun_game_path(next_game, :myshixun_id => @myshixun.id)}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -14,12 +14,10 @@ class MyshixunsController < ApplicationController
|
|||
outPut = params[:outPut]
|
||||
message = Base64.decode64(params[:msg]) unless params[:msg].blank?
|
||||
game = Game.find(task_id)
|
||||
return if game.status == 1
|
||||
if game.status == 0
|
||||
game.update_attribute(:status, 2)
|
||||
message = nil
|
||||
else
|
||||
# 失败的时候可以继续提交
|
||||
game.update_attribute(:status, 0)
|
||||
end
|
||||
game_outputs = GameOutputs.create(:code => status, :msg => message, :game_id => task_id, :out_put => outPut)
|
||||
|
|
|
@ -37,10 +37,11 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
gshixun = g.fork(@shixun.gpid, User.current.gid)
|
||||
myshixun = copy_myshixun(@shixun, gshixun)
|
||||
first_challenge = Challenge.where(:shixun_id => @shixun.id, :position => 1).first
|
||||
render_404 if first_challenge.blank?
|
||||
game = publish_games(first_challenge, myshixun.id)
|
||||
|
||||
challenges = @shixun.challenges
|
||||
render_404 if challenges.blank?
|
||||
challenges.each_with_index do |challenge, index|
|
||||
publish_games(challenge, myshixun.id, index)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html{redirect_to myshixun_path(myshixun)}
|
||||
end
|
||||
|
@ -129,24 +130,25 @@ class ShixunsController < ApplicationController
|
|||
@notice = "实训开启失败:请先创建版本库"
|
||||
return
|
||||
end
|
||||
jobName = "#{@shixun.id}"
|
||||
pipeLine = "#{Base64.encode64(@shixun.script)}"
|
||||
uri = URI("http://123.59.135.74:9999/jenkins-exec/api/createJob")
|
||||
params = {jobName: jobName, pipeLine: pipeLine}
|
||||
res = uri_exec uri, params
|
||||
training_shixun_notice res
|
||||
if res['code'] == 0
|
||||
@shixun.update_attribute(:status, 1)
|
||||
end
|
||||
@shixun.update_attribute(:status, 1)
|
||||
# jobName = "#{@shixun.id}"
|
||||
# pipeLine = "#{Base64.encode64(@shixun.script)}"
|
||||
# uri = URI("http://123.59.135.74:9999/jenkins-exec/api/createJob")
|
||||
# params = {jobName: jobName, pipeLine: pipeLine}
|
||||
# res = uri_exec uri, params
|
||||
# training_shixun_notice res
|
||||
# if res['code'] == 0
|
||||
# @shixun.update_attribute(:status, 1)
|
||||
# end
|
||||
end
|
||||
|
||||
# 更新实训job
|
||||
def shixun_job_update
|
||||
jobName = "#{@shixun.id}"
|
||||
pipeLine = "#{Base64.encode64(@shixun.script)}"
|
||||
uri = URI("http://123.59.135.74:9999/jenkins-exec/api/updateJob")
|
||||
params = {jobName: jobName, pipeLine: pipeLine}
|
||||
res = uri_exec uri, params
|
||||
# jobName = "#{@shixun.id}"
|
||||
# pipeLine = "#{Base64.encode64(@shixun.script)}"
|
||||
# uri = URI("http://123.59.135.74:9999/jenkins-exec/api/updateJob")
|
||||
# params = {jobName: jobName, pipeLine: pipeLine}
|
||||
# res = uri_exec uri, params
|
||||
training_shixun_notice res
|
||||
if res['code'] == 0
|
||||
@shixun.update_attribute(:status, 1)
|
||||
|
@ -191,6 +193,10 @@ class ShixunsController < ApplicationController
|
|||
if myshixun.save
|
||||
m = MyshixunMember.new(:user_id => User.current.id, :role => 1)
|
||||
myshixun.myshixun_members << m
|
||||
uri = URI("http://123.59.135.74:9999/jenkins-exec/api/createJob")
|
||||
pipeLine = "#{Base64.encode64(tpm_shixun.script)}"
|
||||
params = {jobName: "myshixun_#{myshixun.id}", pipeLine: pipeLine}
|
||||
res = uri_exec uri, params
|
||||
copy_myshixun_repository(myshixun, gshixun)
|
||||
return myshixun
|
||||
end
|
||||
|
|
|
@ -37,11 +37,13 @@ module ApplicationHelper
|
|||
# super
|
||||
# end
|
||||
# 复制一个任务
|
||||
def publish_games challenge, myshixun_id
|
||||
def publish_games challenge, myshixun_id, index
|
||||
game = Game.new
|
||||
game.attributes = challenge.attributes.dup.except("id","shixun_id","user_id","visits")
|
||||
game.myshixun_id = myshixun_id
|
||||
game.user_id = User.current.id
|
||||
game.stage = challenge.position
|
||||
index == 0 ? game.status = 0 : game.status = 3
|
||||
challenge_samples = challenge.challenge_samples
|
||||
test_sets = challenge.test_sets
|
||||
if game.save
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Game < ActiveRecord::Base
|
||||
# stauts 0: can exe 1:failed 2:successed
|
||||
# stauts 0: can exe 1:doing 2:successed 3:locked
|
||||
attr_accessible :description, :myshixun_id, :stage, :subject, :user_id, :status, :ready_knowledge, :task_pass, :answer, :score
|
||||
belongs_to :myshixun,:touch=> true
|
||||
belongs_to :user
|
||||
|
@ -7,4 +7,10 @@ class Game < ActiveRecord::Base
|
|||
has_many :outputs, :dependent => :destroy
|
||||
has_many :test_sets, :dependent => :destroy
|
||||
has_many :challenge_samples, :dependent => :destroy
|
||||
|
||||
def next_game
|
||||
game = Game.where(:myshixun_id => self.myshixun_id, :stage => self.stage + 1).first
|
||||
render_404 if game.nil?
|
||||
return game
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ class Myshixun < ActiveRecord::Base
|
|||
# 优先取未完成的任务,如果任务都完成则取stage最大的任务(有下一步)
|
||||
def current_task
|
||||
games = self.games
|
||||
current_game = games.select{|game| game.status != 2}
|
||||
current_game = games.select{|game| game.status != 2 && game.status != 3}
|
||||
if current_game.blank?
|
||||
current_game = Game.where(:status => 2, :myshixun_id => self.id).order("stage desc").first
|
||||
end
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<%= javascript_include_tag 'homework', 'baiduTemplate', 'jquery.datetimepicker.js' %>
|
||||
<%= javascript_include_tag 'baiduTemplate', 'jquery.datetimepicker.js' %>
|
||||
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
|
||||
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
|
||||
|
||||
|
||||
<script id="t:sample-answer-list" type="text/html">
|
||||
<li class="clearfix">
|
||||
<p class="clearfix">
|
||||
|
@ -120,7 +124,10 @@
|
|||
</li>
|
||||
<li class="clearfix">
|
||||
<label class=" panel-form-label fl"> 参考答案:</label>
|
||||
<%= f.text_area :answer, :class => "panel-form-width-690 panel-form-height-150 fl task-textarea-pd", :no_label => true %>
|
||||
<%= f.text_area :answer, :id => 'challenge-answer', :class => "panel-form-width-690 panel-form-height-150 fl task-textarea-pd", :no_label => true %>
|
||||
<script>
|
||||
var text = document.getElementById("challenge-answer");
|
||||
</script>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class=" panel-form-label fl"><span class="c_red mr5">*</span>分值设定:</label>
|
||||
|
@ -136,6 +143,21 @@
|
|||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("challenge-answer"), {
|
||||
mode: {name: 'text/x-java',
|
||||
version: 2,
|
||||
singleLineStringErrors: false},
|
||||
lineNumbers: true,
|
||||
indentUnit: 2,
|
||||
matchBrackets: true
|
||||
});
|
||||
|
||||
editor.on('change',function(cMirror){
|
||||
// get value right from instance
|
||||
$('#challenge-answer').val(cMirror.getValue());
|
||||
});
|
||||
|
||||
|
||||
function add_tag(){
|
||||
var num = $(".task-bd-grey").children('div').length;
|
||||
var val = $(".task-tag-input").val().trim();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
|
||||
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
|
||||
<% end %>
|
||||
|
||||
<div class="task-pm-content mb20">
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
|
||||
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
|
||||
<% end %>
|
||||
|
||||
<div class="task-pm-content mb20">
|
||||
|
|
|
@ -7,12 +7,65 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="content-history-inner">
|
||||
<% @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" %>
|
||||
</div>
|
||||
<% 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" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
|
||||
<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);
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
|
@ -6,13 +6,13 @@
|
|||
<div class="content-row mr15">
|
||||
<div class="content-info col-width fl ">
|
||||
<div class="panel-header clearfix">
|
||||
<h3 class="fl">第1关:Python的初始化</h3>
|
||||
<h3 class="fl">第<%= @game.stage %>关:<%= @game.subject %></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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab_content clearfix" >
|
||||
<div class="tab_content clearfix">
|
||||
<ul id="tab_nav">
|
||||
<li id="tab_nav_1" class="tab_hover " onclick="HoverLi(1);">
|
||||
<a href="javascript:void(0);" class="tab_type">过关任务</a>
|
||||
|
@ -44,12 +44,6 @@
|
|||
<div id="code_results">
|
||||
<%= render :partial => 'exec_results' %>
|
||||
</div>
|
||||
<div id="code_outpus">
|
||||
<%= render :partial => 'code_outputs' %>
|
||||
</div>
|
||||
<div id="code_actions">
|
||||
<%= render :partial => 'code_actions' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,74 +1,56 @@
|
|||
<div class="content clearfix" >
|
||||
<div class="col-width-10 ml15 mt15 mr15">
|
||||
<div class="panel-header clearfix">
|
||||
<h3 class="fl">全部任务</h3><span class="btn-cir btn-cir-grey ml5 mt3 fl"><%= @myshixun.games.count %></span>
|
||||
<h3 class="fl">全部任务</h3><span class="btn-cir btn-cir-grey ml5 mt3 fl"><%= @games_count %></span>
|
||||
</div>
|
||||
<div class="panel-list">
|
||||
<div class=" clearfix panel-inner">
|
||||
<h4 class="fl panel-inner-title "><i class="fa fa-check-circle font-18 color-green mr5"></i><span class="color-red">第1关</span> Python基础入门</h4>
|
||||
<p class="fr "><i class="fa fa-trophy color-yellow font-16 mr5 "></i><span class=" color-grey">NO.120</span></p>
|
||||
<div class="cl"></div>
|
||||
<p class="ml15 mt15 color-grey">
|
||||
<span class=" mr10">开始时间:2017-02-28 15:08</span>
|
||||
<span class=" mr10">完成时间:2017-02-28 15:28</span>
|
||||
<span class=" mr10">耗时:00小时20分</span>
|
||||
<span class=" mr10">测评次数:3次</span>
|
||||
<span class=" mr10">得分:108分</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-list">
|
||||
<div class=" clearfix panel-inner">
|
||||
<div class="fl">
|
||||
<h4 class=" panel-inner-title "><i class="fa fa-dot-circle-o font-18 color-green mr5"></i><span class="color-red">第2关</span> 用Python语言写程序</h4>
|
||||
<p class="ml15 mt15 color-grey">
|
||||
<span class=" mr10">已闯关:2489人</span>
|
||||
<span class=" mr10">平均耗时:0小时28分</span>
|
||||
</p>
|
||||
<% @games.each do |game| %>
|
||||
<div class="panel-list">
|
||||
<div class=" clearfix panel-inner">
|
||||
<% if game.status == 0 %>
|
||||
<div class="fl">
|
||||
<h4 class=" panel-inner-title "><i class="fa fa-dot-circle-o font-18 color-green mr5"></i><span class="color-red">第<%= game.stage %>关</span> <%= game.subject %></h4>
|
||||
<p class="ml15 mt15 color-grey">
|
||||
<span class=" mr10">已闯关:2489人</span>
|
||||
<span class=" mr10">平均耗时:0小时28分</span>
|
||||
</p>
|
||||
</div>
|
||||
<a href="#" class=" task-btn task-btn-green fr">马上开启</a>
|
||||
<div class="cl"></div>
|
||||
<% elsif game.status == 1 %>
|
||||
<div class="fl">
|
||||
<h4 class=" panel-inner-title "><i class="fa fa-dot-circle-o font-18 color-green mr5"></i><span class="color-red">第<%= game.stage %>关</span> <%= game.subject %></h4>
|
||||
<p class="ml15 mt15 color-grey">
|
||||
<span class=" mr10">已闯关:2489人</span>
|
||||
<span class=" mr10">平均耗时:0小时28分</span>
|
||||
</p>
|
||||
</div>
|
||||
<a href="#" class=" fr link-color-green">正在解决中</a>
|
||||
<div class="cl"></div>
|
||||
<% elsif game.status == 2 %>
|
||||
<h4 class="fl panel-inner-title "><i class="fa fa-check-circle font-18 color-green mr5"></i><span class="color-red">第<%= game.stage %>关</span> <%= game.subject %></h4>
|
||||
<p class="fr "><i class="fa fa-trophy color-yellow font-16 mr5 "></i><span class=" color-grey">NO.120</span></p>
|
||||
<div class="cl"></div>
|
||||
<p class="ml15 mt15 color-grey">
|
||||
<span class=" mr10">开始时间:2017-02-28 15:08</span>
|
||||
<span class=" mr10">完成时间:2017-02-28 15:28</span>
|
||||
<span class=" mr10">耗时:00小时20分</span>
|
||||
<span class=" mr10">测评次数:3次</span>
|
||||
<span class=" mr10">得分:108分</span>
|
||||
</p>
|
||||
<% elsif game.status == 3 %>
|
||||
<div class="fl">
|
||||
<h4 class=" panel-inner-title "><i class="fa fa-lock font-18 color-grey mr5"></i><span class="color-red">第<%= game.stage %>关</span> <%= game.subject %></h4>
|
||||
<p class="ml15 mt15 color-grey">
|
||||
<span class=" mr10">已闯关:2489人</span>
|
||||
<span class=" mr10">平均耗时:0小时28分</span>
|
||||
</p>
|
||||
</div>
|
||||
<a href="#" class=" task-btn fr"> 已锁定 </a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<a href="#" class=" task-btn task-btn-green fr">马上开启</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-list">
|
||||
<div class=" clearfix panel-inner">
|
||||
<div class="fl">
|
||||
<h4 class=" panel-inner-title "><i class="fa fa-dot-circle-o font-18 color-green mr5"></i><span class="color-red">第2关</span> 用Python语言写程序</h4>
|
||||
<p class="ml15 mt15 color-grey">
|
||||
<span class=" mr10">已闯关:2489人</span>
|
||||
<span class=" mr10">平均耗时:0小时28分</span>
|
||||
</p>
|
||||
</div>
|
||||
<a href="#" class=" fr link-color-green">正在解决中</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-list">
|
||||
<div class=" clearfix panel-inner">
|
||||
<div class="fl">
|
||||
<h4 class=" panel-inner-title "><i class="fa fa-lock font-18 color-grey mr5"></i><span class="color-red">第3关</span> Python的字符串使用</h4>
|
||||
<p class="ml15 mt15 color-grey">
|
||||
<span class=" mr10">已闯关:2489人</span>
|
||||
<span class=" mr10">平均耗时:0小时28分</span>
|
||||
</p>
|
||||
</div>
|
||||
<a href="#" class=" task-btn fr"> 已锁定 </a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-list">
|
||||
<div class=" clearfix panel-inner">
|
||||
<div class="fl">
|
||||
<h4 class=" panel-inner-title "><i class="fa fa-lock font-18 color-grey mr5"></i><span class="color-red">第4关</span>关 Python的简单结构</h4>
|
||||
<p class="ml15 mt15 color-grey">
|
||||
<span class=" mr10">已闯关:2489人</span>
|
||||
<span class=" mr10">平均耗时:0小时28分</span>
|
||||
</p>
|
||||
</div>
|
||||
<a href="#" class=" task-btn fr"> 已锁定 </a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#code_results").html('<%= escape_javascript(render :partial => 'games/exec_results') %>');
|
|
@ -43,6 +43,6 @@
|
|||
</body>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
<%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %>
|
||||
<%= javascript_include_tag 'application', 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<% unless @shixun.script.blank? %>
|
||||
<% if @shixun.status == 1 %>
|
||||
<%= link_to "重启实训", shixun_job_update_shixun_path(@shixun), :class => "task-btn task-btn-green fr mr10", :remote => true %>
|
||||
<a class="fr sy_btn_green mb10">已开启</a>
|
||||
<% else %>
|
||||
<%= link_to "开启实训", shixun_job_create_shixun_path(@shixun), :class => "task-btn task-btn-green fr mr10", :remote => true %>
|
||||
<% end %>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<% else %>
|
||||
<% if User.current.member_of?(@project) && @project.is_child_training_project? %>
|
||||
<div id="training_tasl_commit">
|
||||
<%= link_to "提交评测", task_execute_project_path(@project, :training_task_id => activity.id), :class => "task-display-span bBlue mt10", :onclick => "training_task_submmit();", :remote => true %>
|
||||
<%= link_to "提交评测", task_execute_project_path(@project, :training_task_id => activity.id), :class => "task-display-span bBlue mt10", :onclick => "training_task_submmit();" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -15,7 +15,25 @@
|
|||
|
||||
<script>
|
||||
function training_task_submmit(){
|
||||
$("#training_tasl_commit").html("<span class='task-display-span alert-blue mt10'>当前任务正在后台测评中,稍后将显示您的任务完成情况......</span>")
|
||||
|
||||
$.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>
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'next_step', :via => [:get, :post]
|
||||
get 'entry'
|
||||
get 'outputs_show'
|
||||
get 'game_status'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue