实训任务通关展示
This commit is contained in:
parent
eea8939c49
commit
b070292b45
|
@ -126,7 +126,7 @@ class GamesController < ApplicationController
|
||||||
else
|
else
|
||||||
outputs = outputs.map{|result| [result.code, result.id]}
|
outputs = outputs.map{|result| [result.code, result.id]}
|
||||||
end
|
end
|
||||||
had_done = 1 if (@myshixun.games.count == game_challenge.position && @game.status ==2)
|
(@myshixun.games.count == game_challenge.position && @game.status ==2) ? had_done = 1 : had_done = 0
|
||||||
latest_output = @game.latest_output.try(:out_put)
|
latest_output = @game.latest_output.try(:out_put)
|
||||||
render :json => {status: @game.status, output: latest_output, results: outputs, had_done: had_done}
|
render :json => {status: @game.status, output: latest_output, results: outputs, had_done: had_done}
|
||||||
end
|
end
|
||||||
|
|
|
@ -111,6 +111,7 @@
|
||||||
data:'test',
|
data:'test',
|
||||||
success:function(data){
|
success:function(data){
|
||||||
//如果查到了,就退出
|
//如果查到了,就退出
|
||||||
|
// i变量用来统计setInterval执行了多少次,便于统计访问时间
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
if(data.status == 2 || data.status == 0){
|
if(data.status == 2 || data.status == 0){
|
||||||
clearInterval(intId);
|
clearInterval(intId);
|
||||||
|
@ -119,11 +120,16 @@
|
||||||
var html = bt('t:exec_results',{status: data.status, output: data.output, results: data.results, had_done: data.had_done});
|
var html = bt('t:exec_results',{status: data.status, output: data.output, results: data.results, had_done: data.had_done});
|
||||||
$("#code_results").html(html);
|
$("#code_results").html(html);
|
||||||
if(data.status == 2){
|
if(data.status == 2){
|
||||||
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun}) %>";
|
if( data.had_done == 0 ) {
|
||||||
|
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 1}) %>";
|
||||||
|
}else{
|
||||||
|
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 1}) %>";
|
||||||
|
}
|
||||||
// 传递具体屏幕的宽高,实现不同浏览器与不同分辨率都能撑满屏幕
|
// 传递具体屏幕的宽高,实现不同浏览器与不同分辨率都能撑满屏幕
|
||||||
pop_box_new2(htmlvalue, window.innerWidth, window.innerHeight);
|
pop_box_new2(htmlvalue, window.innerWidth, window.innerHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 访问30次,即60s后后台还未改变状态即执行
|
||||||
if(i == 30){
|
if(i == 30){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<%= change_status_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
|
url: '<%= change_status_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
<%= stylesheet_link_tag 'css/bigdata-common', 'css/bigdata-popup' %>
|
<%= stylesheet_link_tag 'css/bigdata-common', 'css/bigdata-popup' %>
|
||||||
|
|
||||||
<div class="task-popup-warp" style="background-color: rgba(0,0,0,0.7);">
|
<div class="task-popup-warp" style="background-color: rgba(0,0,0,0.7);">
|
||||||
<div class="task-popup-box task-box1">
|
<div class="task-popup-box <%= had_done == 0 ? "task-box1" : "task-box2" %>">
|
||||||
<a href="javascript:void(0)" class="task-popup-close" onclick="hideModal();"></a>
|
<a href="javascript:void(0)" class="task-popup-close" onclick="hideModal();"></a>
|
||||||
<div class="task-su-con">
|
<div class="task-su-con">
|
||||||
<p class="task-su-p">恭喜您通过本关</p>
|
<% if had_done == 0 %>
|
||||||
<%= link_to "下 一 步", {:controller => 'games', :action => "next_step", :id => game, :myshixun_id => myshixun}, :class => "task-su-btn", :remote => true %>
|
<p class="task-su-p">恭喜您通过本关</p>
|
||||||
|
<%= link_to "下 一 步", {:controller => 'games', :action => "next_step", :id => game, :myshixun_id => myshixun}, :class => "task-su-btn", :remote => true %>
|
||||||
|
<% else %>
|
||||||
|
<a href="#" class="task-su-btn-white mt50">查看光辉历史</a>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -20,33 +20,33 @@
|
||||||
|
|
||||||
<div class="task-container EXTENDER">
|
<div class="task-container EXTENDER">
|
||||||
<div class="COLS">
|
<div class="COLS">
|
||||||
<div class="leftbar CELL">
|
<div class="leftbar CELL" style="width: 120px;">
|
||||||
<div class="CELL">
|
<div class="CELL">
|
||||||
<div class="user-info">
|
<div class="user-info" style="width: 120px;height:120px;padding-top: 10px;">
|
||||||
<%= link_to image_tag(url_to_avatar(@myshixun.owner), :width => "100", :height => "100"), user_path(@myshixun.owner), :alt => "用户头像", :class => "user-info-img" %>
|
<%= link_to image_tag(url_to_avatar(@myshixun.owner), :width => "100", :height => "100"), user_path(@myshixun.owner), :alt => "用户头像", :class => "user-info-img", :style => "border-radius: 100px;margin-left: 5px;" %>
|
||||||
<!--<a href="#" class="user-info-img"><img src="images/user/male.jpg" width="100" height="" alt="100"></a>-->
|
<!--<a href="#" class="user-info-img"><img src="images/user/male.jpg" width="100" height="" alt="100"></a>-->
|
||||||
<%= link_to @myshixun.owner.try(:show_name), user_path(@myshixun.owner), :class => "user-info-name" %>
|
<%#= link_to @myshixun.owner.try(:show_name), user_path(@myshixun.owner), :class => "user-info-name" %>
|
||||||
</div>
|
</div>
|
||||||
<div class="leftnav">
|
<div class="leftnav">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="leftnav-box">
|
<li class="leftnav-box" style="width: 120px">
|
||||||
<a href="<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>" class="leftnav-box-inner leftnav-active" id="current_task_tab" data-remote="true">
|
<a href="<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>" class="leftnav-box-inner leftnav-active" style="width: 120px" id="current_task_tab" data-remote="true">
|
||||||
<i class="fa fa-gamepad font-28"></i><br/><span class="font-16">当前任务</span>
|
<i class="fa fa-gamepad font-28"></i><br/><span class="font-16">当前任务</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="leftnav-box">
|
<li class="leftnav-box" style="width: 120px">
|
||||||
<a href="<%= myshixun_games_path(@myshixun) %>" class="leftnav-box-inner" id="all_task_tab" data-remote="true">
|
<a href="<%= myshixun_games_path(@myshixun) %>" class="leftnav-box-inner" style="width: 120px" id="all_task_tab" data-remote="true">
|
||||||
<i class="fa fa-qrcode font-28"></i><br/><span class="font-16">全部任务</span><span class="btn-cir ml5"><%= @myshixun.games.count %></span>
|
<i class="fa fa-qrcode font-28"></i><br/><span class="font-16">全部任务</span><span class="btn-cir ml5"><%= @myshixun.games.count %></span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="rightbar CELL _FLEX ROWS">
|
<div class="rightbar CELL _FLEX ROWS">
|
||||||
<%= render :partial => "myshixuns/myshixun_top" %>
|
<%= render :partial => "myshixuns/myshixun_top" %>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue