TPI单选多选题
This commit is contained in:
parent
7bb99cee44
commit
2c7e5d1f38
|
@ -296,55 +296,41 @@ class GamesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
# 选择题评测(选择题不需要重新评测)
|
# 选择题评测(选择题不需要重新评测)
|
||||||
|
# score 获得金币数 tag_count 技能数 right用户是否全对 answer_right全部选择题的正确性
|
||||||
def evaluating_choice
|
def evaluating_choice
|
||||||
|
@game_challenge = @game.challenge
|
||||||
if false
|
@challenges = Challenge.where(:shixun_id => @myshixun.shixun_id)
|
||||||
@game_challenge = @game.challenge
|
@shixun = @myshixun.shixun
|
||||||
user_answer = params[:answer]
|
score = 0
|
||||||
correct = true
|
tag_count = 0
|
||||||
score = 0
|
@right = true
|
||||||
tag_count = 0
|
answer_right = []
|
||||||
if !user_answer.blank?
|
@game_challenge.challenge_chooses.each_with_index do |choose, index|
|
||||||
if user_answer.split("").count != @game_challenge.challenge_questions.where(:right_key => true).count
|
correct = (params[:answer][index] == choose.standard_answer) ? true : false
|
||||||
correct = false
|
if choose.choose_outputs.blank?
|
||||||
else
|
ChooseOutputs.create(:challenge_choose_id => choose.id, :user_id => User.current.id, :answer => params[:answer][index], :correct => correct)
|
||||||
user_answer.split("").each do |answer|
|
|
||||||
question = @game_challenge.challenge_questions.where(:position => answer.to_i).first
|
|
||||||
unless question.right_key
|
|
||||||
correct = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
correct = false
|
|
||||||
end
|
end
|
||||||
@game.update_attributes(:status => 2, :end_time => Time.now)
|
if @shixun.status > 1 && !@game.answer_open
|
||||||
had_done = @game.had_done
|
|
||||||
shixun = @myshixun.shixun
|
|
||||||
if shixun.status > 1 && !@game.answer_open
|
|
||||||
if correct
|
if correct
|
||||||
#User.current.update_attributes(:grade => (User.current.grade + @game.challenge.score), :experience => (User.current.experience + @game.challenge.score))
|
score += choose.score
|
||||||
reward_grade(@game.user, @game.id, 'Game', @game_challenge.score)
|
tag_count += choose.challenge_tags.count
|
||||||
reward_experience(@game.user, @game.id, 'Game', @game_challenge.score)
|
|
||||||
@game.update_attribute(:final_score, @game_challenge.score)
|
|
||||||
score = @game_challenge.score
|
|
||||||
tag_count = @game_challenge.challenge_tags.count
|
|
||||||
else
|
|
||||||
score = "+0"
|
|
||||||
tag_count = 0
|
|
||||||
end
|
end
|
||||||
elsif shixun.status > 1 && @game.answer_open
|
elsif @shixun.status > 1 && @game.answer_open
|
||||||
score = -@game_challenge.score.to_i
|
score -= choose.score
|
||||||
tag_count = 0
|
|
||||||
else
|
|
||||||
score = "+0"
|
|
||||||
tag_count = 0
|
|
||||||
end
|
end
|
||||||
if @game.outputs.blank?
|
unless correct
|
||||||
Output.create(:game_id => @game.id, :actual_output => user_answer, :result => correct)
|
@right = false
|
||||||
end
|
end
|
||||||
render :json => {correct: correct, had_done: had_done, :grade => User.where(:id => User.current.id).first.grade, score: score, tag_count: tag_count}
|
answer_right << correct
|
||||||
|
end
|
||||||
|
@game.update_attributes(:status => 2, :end_time => Time.now)
|
||||||
|
@had_done = @game.had_done
|
||||||
|
reward_grade(@game.user, @game.id, 'Game', score)
|
||||||
|
reward_experience(@game.user, @game.id, 'Game', score)
|
||||||
|
@game.update_attribute(:final_score, score)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.js{redirect_to myshixun_game_path(@game, :myshixun_id => @myshixun, :choose => 1)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,27 @@ class Challenge < ActiveRecord::Base
|
||||||
str
|
str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def choose_correct_num
|
||||||
|
num = 0
|
||||||
|
self.challenge_chooses.each do |choose|
|
||||||
|
outputs = ChooseOutputs.where(:challenge_choose_id => choose.id).first
|
||||||
|
if outputs.nil?
|
||||||
|
num = nil
|
||||||
|
else
|
||||||
|
num += (outputs.correct ? 1 : 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return num
|
||||||
|
end
|
||||||
|
|
||||||
|
def choose_score
|
||||||
|
score = 0
|
||||||
|
self.challenge_chooses.each do |choose|
|
||||||
|
score += choose.score
|
||||||
|
end
|
||||||
|
return score
|
||||||
|
end
|
||||||
|
|
||||||
def next_challenge
|
def next_challenge
|
||||||
challenge_count = Challenge.where(:shixun_id => self.shixun_id).count
|
challenge_count = Challenge.where(:shixun_id => self.shixun_id).count
|
||||||
render_404 if self.position ==challenge_count
|
render_404 if self.position ==challenge_count
|
||||||
|
|
|
@ -11,30 +11,30 @@
|
||||||
</ul>
|
</ul>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div id="codotab_con_1" class="white_bg" style="overflow-y: auto;height: 100%">
|
<div id="codotab_con_1" class="white_bg" style="overflow-y: auto;height: 100%">
|
||||||
<div class="panel-header clearfix" id="top_repository" style="border-bottom:0;padding:15px;">
|
<div class="panel-header clearfix" id="top_repository" style="border-bottom:0;padding:15px;">
|
||||||
<% @game_challenge.challenge_chooses.each_with_index do |choose, index| %>
|
<% @game_challenge.challenge_chooses.each_with_index do |choose, index| %>
|
||||||
<p class="font-bd font-18 color-grey3"><%= (index + 1).to_s + "." + (choose.category == 1 ? "单选题" : "多选题") %></p>
|
<p class="font-bd font-18 color-grey3"><%= (index + 1).to_s + "." + (choose.category == 1 ? "单选题" : "多选题") %></p>
|
||||||
<div class="font-15 color-grey3 mb10 new_li read_only" unselectable="on" id="choose_subject_<%= index + 1 %>" style="padding: 10px 0px 10px 10px">
|
<div class="font-15 color-grey3 mb10 new_li read_only" unselectable="on" id="choose_subject_<%= index + 1 %>" style="padding: 10px 0px 10px 10px">
|
||||||
<textarea style="display:none;"><%= choose.subject %></textarea>
|
<textarea style="display:none;"><%= choose.subject %></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="problem_single">
|
<div class="problem_single">
|
||||||
<% choose.challenge_questions.each_with_index do |question, i| %>
|
<% choose.challenge_questions.each_with_index do |question, i| %>
|
||||||
<p class="ml10 mb10 ">
|
<p class="ml10 mb10 ">
|
||||||
<span>
|
<span>
|
||||||
<% if choose.category == 1 %>
|
<% if choose.category == 1 %>
|
||||||
<input type="radio" name="answer[]" category="<%= choose.category %>" value="<%= (question.position + 65).chr %>" id="result_<%= index %>_<%= i %>" class="ml-3 mr5 magic-radio ml5">
|
<input type="radio" <%= (choose.choose_outputs.try(:answer) == (i + 65).chr) ? "checked" : "" %> name="answer[<%= index + 1 %>]" category="<%= choose.category %>" value="<%= (question.position + 65).chr %>" id="result_<%= index %>_<%= i %>" class="ml-3 mr5 magic-radio ml5">
|
||||||
<% else %>
|
<% else %>
|
||||||
<!--多选-->
|
<!--多选-->
|
||||||
<input type="checkbox" name="answer[]" category="<%= choose.category %>" value="<%= (question.position + 65).chr %>" id="result_<%= index %>_<%= i %>" class="ml-3 mr5 magic-checkbox ml5">
|
<input type="checkbox" <%= (!choose.choose_outputs.try(:answer).nil? && (choose.choose_outputs.try(:answer).include? ((i + 65).chr))) ? "checked" : "" %> name="answer[]" category="<%= choose.category %>" value="<%= (question.position + 65).chr %>" id="result_<%= index %>_<%= i %>" class="ml-3 mr5 magic-checkbox ml5">
|
||||||
<% end %>
|
<% end %>
|
||||||
<label for="result_<%= index %>_<%= i %>" style="top: 0px"><span><%= (question.position + 65).chr %></span>.<%= question.option_name %></label>
|
<label for="result_<%= index %>_<%= i %>" style="top: 0px"><span><%= (question.position + 65).chr %></span>.<%= question.option_name %></label>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<input type="hidden" name="user_answer">
|
<input type="hidden" name="user_answer">
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<!--<div class="pl5 pr5 pt10 pb10 bor-grey-e">
|
<!--<div class="pl5 pr5 pt10 pb10 bor-grey-e">
|
||||||
<div for="result_<%#= question.position %>" class="card -elevation-1 mt10 mb5 <%#= (@user_answer.nil? || @user_answer.index(i.to_s).nil?) ? "" : "card-check color_white" %>" onclick="">
|
<div for="result_<%#= question.position %>" class="card -elevation-1 mt10 mb5 <%#= (@user_answer.nil? || @user_answer.index(i.to_s).nil?) ? "" : "card-check color_white" %>" onclick="">
|
||||||
<!–单选–>
|
<!–单选–>
|
||||||
<%# if choose.category == 1 %>
|
<%# if choose.category == 1 %>
|
||||||
|
@ -51,8 +51,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>-->
|
</div>-->
|
||||||
<h3 id="save_status" class="ml15 fl" style="font-weight: normal"></h3>
|
<h3 id="save_status" class="ml15 fl" style="font-weight: normal"></h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--拖拽增加结构---------------------------------------->
|
<!--拖拽增加结构---------------------------------------->
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!------------------------------------------------------>
|
<!------------------------------------------------------>
|
||||||
<div class="split-panel--second -layout -vertical -flex -relative -bg-black -flex-basic60" id="games_valuation_contents">
|
<div class="split-panel--second -layout -vertical -flex -relative -bg-black -flex-basic60" id="games_valuation_contents">
|
||||||
<%= render :partial => 'games/game_choose_results' %>
|
<%= render :partial => 'games/game_choose_results', :locals => { :game_challenge => @game_challenge} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -129,7 +129,6 @@
|
||||||
<input type="radio" name="answer[]" value="<%= question.position %>" id="result_<%= question.position %>" class="ml-3 mr5 magic-radio ml5">
|
<input type="radio" name="answer[]" value="<%= question.position %>" id="result_<%= question.position %>" class="ml-3 mr5 magic-radio ml5">
|
||||||
<!--多选-->
|
<!--多选-->
|
||||||
<input type="checkbox" name="answer[]" value="<%= question.position %>" id="result_<%= question.position %>" class="ml-3 mr5 magic-checkbox ml5">
|
<input type="checkbox" name="answer[]" value="<%= question.position %>" id="result_<%= question.position %>" class="ml-3 mr5 magic-checkbox ml5">
|
||||||
<input type="hidden" name="answer" value="<%= question.position %>">
|
|
||||||
<div class="-layout-h -center break_word">
|
<div class="-layout-h -center break_word">
|
||||||
<span class="mr10"><%= (question.position + 65).chr %>.</span>
|
<span class="mr10"><%= (question.position + 65).chr %>.</span>
|
||||||
<div class="markdown">
|
<div class="markdown">
|
||||||
|
|
|
@ -84,57 +84,25 @@
|
||||||
// 选择题提交评测
|
// 选择题提交评测
|
||||||
// answer 选择的答案
|
// answer 选择的答案
|
||||||
function choice_submmit(){
|
function choice_submmit(){
|
||||||
var answer = "";
|
var user_answer = [];
|
||||||
var nBtn = $(".card-check");
|
var input_answer = $("input[name='user_answer']");
|
||||||
var choice = nBtn.find("input[name='answer']");
|
var lens = input_answer.length;
|
||||||
for(var i = 0; i < choice.length; i++){
|
for(i = 0; i < lens; i++ ){
|
||||||
answer += $(choice[i]).val();
|
var answer = $(input_answer[i]).val();
|
||||||
}
|
if(answer == ""){
|
||||||
if(answer == ""){
|
notice_sure_box("第"+ (i+1) + "题未答,请确认!");
|
||||||
notice_sure_box("答案不能为空!");
|
return;
|
||||||
return;
|
}
|
||||||
|
user_answer.push(answer)
|
||||||
}
|
}
|
||||||
|
console.log(user_answer);
|
||||||
$("#code_test").html("<a class='task-btn mt8 mr15'>评测中..</a>");
|
$("#code_test").html("<a class='task-btn mt8 mr15'>评测中..</a>");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "POST",
|
||||||
url: '<%= evaluating_choice_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
|
url: '<%= evaluating_choice_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
|
||||||
data: {answer: answer},
|
data: {answer:user_answer},
|
||||||
dataType: "json",
|
dataType: "script",
|
||||||
success: function(data){
|
success: function(data){
|
||||||
console.log(data);
|
|
||||||
clearInterval(cm);
|
|
||||||
var icon = $("#game_status_<%= @game_challenge.id %>"); // 实训列表的icon
|
|
||||||
icon.find("i").attr("class", "fa fa-unlock fr font-18 mt5 color-light-green w20_center");
|
|
||||||
icon.find("a:last").attr("title", "已完成");
|
|
||||||
$("#code_test").remove();
|
|
||||||
if(data.correct){
|
|
||||||
$("#correct_tip").show();
|
|
||||||
$("#user_grade").html(data.grade);
|
|
||||||
$("#shixun_exp_<%=@game_challenge.id %>").html("经验值<span class='color-light-green mr5'>+"+ data.score + "</span>");
|
|
||||||
$("#shixun_grade_<%=@game_challenge.id %>").html("金币<span class='color-light-green mr5'>+"+ data.score + "</span>");
|
|
||||||
$("#shixun_tag_<%=@game_challenge.id %>").html("技能标签<span class='color-light-green mr5'>+"+ data.tag_count + "</span>");
|
|
||||||
if( data.had_done == 0 ) {
|
|
||||||
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
|
|
||||||
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 0}) %>";
|
|
||||||
}else{
|
|
||||||
$("#code_estimate").html("<a href='<%= shixun_path(@myshixun.shixun) %>' class='task-btn task-btn-blue mt8 mr15' >退出实训</a>");
|
|
||||||
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);
|
|
||||||
}else{
|
|
||||||
$("#error_tip").show();
|
|
||||||
var span_class = parseInt(data.score) < 0 ? "u-color-light-red" : "color-light-green";
|
|
||||||
$("#shixun_exp_<%=@game_challenge.id %>").html("经验值<span class='color-light-green mr5'>+0</span>");
|
|
||||||
$("#shixun_grade_<%=@game_challenge.id %>").html("金币<span class='"+ span_class +" mr5'>"+ data.score + "</span>");
|
|
||||||
$("#shixun_tag_<%=@game_challenge.id %>").html("技能标签<span class='color-light-green mr5'>+0</span>");
|
|
||||||
if(0 == data.had_done){
|
|
||||||
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
|
|
||||||
}else if(1 == data.had_done ){
|
|
||||||
$("#code_estimate").html("<a href='<%= shixun_path(@myshixun.shixun) %>' class='task-btn task-btn-blue mt8 mr15' >退出实训</a>");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
error: function(){
|
error: function(){
|
||||||
console.log("错了");
|
console.log("错了");
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
<%= content_for(:header_tags) do %>
|
|
||||||
<%= javascript_include_tag 'baiduTemplate', 'jquery.datetimepicker.js' %>
|
|
||||||
<% end %>
|
|
||||||
<ul id="blacktab_nav">
|
<ul id="blacktab_nav">
|
||||||
<li class="blacktab_con blacktab_hover">
|
<li class="blacktab_con blacktab_hover">
|
||||||
<a href="javascript:void(0);" class="tab_type tab_color">测试结果</a>
|
<a href="javascript:void(0);" class="tab_type tab_color">测试结果</a>
|
||||||
|
@ -14,25 +11,41 @@
|
||||||
<div class="fit -scroll">
|
<div class="fit -scroll">
|
||||||
<div class="-layout-v -fit">
|
<div class="-layout-v -fit">
|
||||||
<div class="-flex -scroll task-padding16">
|
<div class="-flex -scroll task-padding16">
|
||||||
<p class="-text-danger mb10">
|
<% unless game_challenge.choose_correct_num == nil %>
|
||||||
<i class="fa fa-exclamation-circle font-16" ></i><span class="ml5 mr5 -text-danger">3/5</span>
|
<% if game_challenge.choose_correct_num != game_challenge.challenge_chooses.count %>
|
||||||
</p>
|
<p class="-text-danger mb10">
|
||||||
<p class="color-light-green mb10">
|
<i class="fa fa-exclamation-circle font-16" ></i><span class="ml5 mr5 -text-danger"><%= game_challenge.choose_correct_num %>/<%= game_challenge.challenge_chooses.count %></span>错误
|
||||||
<i class="fa fa-check-circle font-16" ></i><span class="ml5 mr5">5/5</span> 全部通过
|
</p>
|
||||||
</p>
|
<% else %>
|
||||||
<% @game_challenge.challenge_chooses.each_with_index do |choose, index| %>
|
<p class="color-light-green mb10">
|
||||||
|
<i class="fa fa-check-circle font-16" ></i><span class="ml5 mr5"><%= game_challenge.challenge_chooses.count %>/<%= game_challenge.challenge_chooses.count %></span> 全部通过
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% game_challenge.challenge_chooses.each_with_index do |choose, index| %>
|
||||||
<div class="-task-ces-box mb15 clearfix">
|
<div class="-task-ces-box mb15 clearfix">
|
||||||
<div class="-task-ces-top" onclick="toggle_test_case('0', '<%= index %>')" style="cursor:pointer">
|
<div class="-task-ces-top" onclick="toggle_test_case('0', '<%= index %>')" style="cursor:pointer">
|
||||||
<i class="fa fa-caret-right mr5 font-16" ></i>
|
<i class="fa fa-caret-right mr5 font-16" ></i>
|
||||||
<span class="font-14">题目<%= index + 1 %></span>
|
<span class="font-14">题目<%= index + 1 %></span>
|
||||||
<i class="fa fa-exclamation-circle -text-danger fr mt8 ml5" ></i>
|
<%# outputs = ChooseOutputs.where(:challenge_choose_id => choose.id).first %>
|
||||||
<i class="fa fa-check-circle color-light-green fr mt8 ml5 f14" ></i>
|
<% unless choose.choose_outputs.blank? %>
|
||||||
<i class="fa fa-lock fr mt8" ></i>
|
<% if choose.choose_outputs.try(:answer) != choose.standard_answer %>
|
||||||
|
<i class="fa fa-exclamation-circle -text-danger fr mt8 ml5" ></i>
|
||||||
|
<% else %>
|
||||||
|
<i class="fa fa-check-circle color-light-green fr mt8 ml5 f14" ></i>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<i class="fa fa-lock fr mt8" ></i>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="-task-ces-info undis" id="test_case_<%= index %>">
|
<div class="-task-ces-info undis" id="test_case_<%= index %>">
|
||||||
<ul class=" font-14">
|
<ul class=" font-14">
|
||||||
<li><span class="-task-ces-info-left color-blue">正确选项:</span><span><%= choose.standard_answer %></span></li>
|
<% if choose.choose_outputs.blank? %>
|
||||||
<li><span class="-task-ces-info-left color-blue">你的选项:</span><span class="color-orange">789</span></li>
|
<li><span class="ml30">尚未提交,暂不支持查看</span></li>
|
||||||
|
<% else %>
|
||||||
|
<li><span class="-task-ces-info-left color-blue">正确选项:</span><span><%= choose.standard_answer %></span></li>
|
||||||
|
<li><span class="-task-ces-info-left color-blue">你的选项:</span><span class="color-orange"><%= choose.choose_outputs.try(:answer).nil? ? "无" : choose.choose_outputs.try(:answer) %></span></li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -27,7 +27,12 @@
|
||||||
<li id="tab_nav_4">
|
<li id="tab_nav_4">
|
||||||
<%= link_to '评论', shixun_discuss_shixun_path(@shixun), :class => "tab_type", :style => "font-size: 16px", :remote => true %>
|
<%= link_to '评论', shixun_discuss_shixun_path(@shixun), :class => "tab_type", :style => "font-size: 16px", :remote => true %>
|
||||||
</li>
|
</li>
|
||||||
<span class="btn-cir-big fr mt8 mr15" >经验值:<%= @game_challenge.score %></span>
|
<% if @st == 0 %>
|
||||||
|
<span class="btn-cir-big fr mt8 mr15" >经验值:<%= @game_challenge.score %></span>
|
||||||
|
<% else %>
|
||||||
|
<span class="btn-cir-big fr mt8 mr15" >经验值:<%= @game_challenge.choose_score %></span>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="-flex -relative greytab-inner" >
|
<div class="-flex -relative greytab-inner" >
|
||||||
|
|
|
@ -10,6 +10,18 @@
|
||||||
$("#all_task_show").html("<%= j (render :partial => "games_list") %>");
|
$("#all_task_show").html("<%= j (render :partial => "games_list") %>");
|
||||||
$("#all_task_show").hide();
|
$("#all_task_show").hide();
|
||||||
fadein = 0;
|
fadein = 0;
|
||||||
|
// 选择题
|
||||||
|
<% if params[:choose] == "1" %>
|
||||||
|
<% if @had_done == 0 %>
|
||||||
|
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
|
||||||
|
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game=> @game, :myshixun => @myshixun, :had_done => 0}) %>";
|
||||||
|
<% else %>
|
||||||
|
$("#code_estimate").html("<a href='<%= shixun_path(@myshixun.shixun) %>' class='task-btn task-btn-blue mt8 mr15' >退出实训</a>");
|
||||||
|
var htmlvalue = "<%= j (render :partial => 'games/pass_game_show', :locals => { :game => @game, :myshixun => @myshixun, :had_done => 1}) %>";
|
||||||
|
<% end %>
|
||||||
|
// 传递具体屏幕的宽高,实现不同浏览器与不同分辨率都能撑满屏幕
|
||||||
|
pop_box_new2(htmlvalue, window.innerWidth, window.innerHeight);
|
||||||
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#all_task_show").html("<%= j (render :partial => "games_list") %>");
|
$("#all_task_show").html("<%= j (render :partial => "games_list") %>");
|
||||||
$("#all_task_tab").trigger("click"); // 模拟全部任务点击事件
|
$("#all_task_tab").trigger("click"); // 模拟全部任务点击事件
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
class ModifyCorrectTypeForChooseOutputs < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
change_column :choose_outputs, :correct, :boolean
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue