实训tpm经验值随难易度的改动而改变
This commit is contained in:
parent
5f67392bfa
commit
cbcd63f4c3
|
|
@ -130,7 +130,7 @@
|
|||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl"><span class="c_red mr5">*</span>评测方式:</label>
|
||||
<%= select_tag :evaluation_way, options_for_select([["输出输出", 1], ["文件存在", 2]]), :name => 'challenge[evaluation_way]', :class => " fl", :style => "height: 40px; width:200px;" %>
|
||||
<%= select_tag :evaluation_way, options_for_select([["输出输出", 1]]), :name => 'challenge[evaluation_way]', :class => " fl", :style => "height: 40px; width:200px;" %>
|
||||
<span class="fl ml15 mt8">请选择自动检测学员是否完成本任务的评测标准</span>
|
||||
</li>
|
||||
|
||||
|
|
@ -238,13 +238,13 @@
|
|||
<span class="mt10 fl"><%= radio_button_tag("challenge[difficulty]", 1, checked = (@challenge.difficulty ==1 ? true : false)) %></span><span class="ml5 fl mt8 mr15">简单</span>
|
||||
<span class="mt10 fl"><%= radio_button_tag("challenge[difficulty]", 2, checked = (@challenge.difficulty ==2 ? true : false)) %></span><span class="ml5 fl mt8 mr15">中等</span>
|
||||
<span class="mt10 fl"><%= radio_button_tag("challenge[difficulty]", 3, checked = (@challenge.difficulty ==3 ? true : false)) %></span><span class="ml5 fl mt8 mr15">困难 </span>
|
||||
<span class="fl color-orange ml30 mt8"><i class="fa fa-exclamation-circle mr5"></i>请选择难易度并设定通过本关后,学员得到的经验值</span>
|
||||
<!-- <span class="fl color-orange ml30 mt8"><i class="fa fa-exclamation-circle mr5"></i>请选择难易度并设定通过本关后,学员得到的经验值</span>-->
|
||||
</li>
|
||||
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl"><span class="c_red mr5">*</span>奖励经验值:</label>
|
||||
<%= f.text_field :score, :class => "panel-form-height-30 fl", :no_label => true, :style => "padding:5px;", :placeholder => "请输入分值(只能是数字)" %>
|
||||
<span class="fl ml5" style="line-height: 40px;">(100~200 经验值)</span>
|
||||
<%#= f.text_field :score, :class => "panel-form-height-30 fl", :no_label => true, :style => "padding:5px;", :placeholder => "请输入分值(只能是数字)" %>
|
||||
<%= select_tag :challenge_score, options_for_select([100, 200]), :name => 'challenge[score]', :class => " fl", :style => "height: 40px; width:170px;" %>
|
||||
<div class="clear"></div>
|
||||
<span style="display: none" class="c_red ml90" id="new_shixun_score">分值设定不能为空</span>
|
||||
</li>
|
||||
|
|
@ -315,6 +315,45 @@
|
|||
$(inputs_labels[j]).html("组" + (j + 1));
|
||||
}
|
||||
});
|
||||
|
||||
// 根据难易程度设置不同的奖励经验值(适用新建与编辑模式)
|
||||
var list= $('input:radio[name="challenge[difficulty]"]:checked').val(); // 获取select的索引值
|
||||
if(list == 1){
|
||||
$("#challenge_score").empty();
|
||||
for(var i= 100; i <= 200; i += 100){
|
||||
$("#challenge_score").append("<option value="+ i + ">"+ i +"</option>");
|
||||
}
|
||||
}else if(list == 2){
|
||||
$("#challenge_score").empty();
|
||||
for(var i= 300; i <= 600; i += 100){
|
||||
$("#challenge_score").append("<option value="+ i + ">"+ i +"</option>");
|
||||
}
|
||||
}else if(list == 3){
|
||||
$("#challenge_score").empty();
|
||||
for(var i= 700; i <= 1000; i += 100){
|
||||
$("#challenge_score").append("<option value="+ i + ">"+ i +"</option>");
|
||||
}
|
||||
}
|
||||
$("#challenge_score").find("option[value='<%= @challenge.score %>']").attr("selected",true); // 设置option默认值
|
||||
$("#challenge_difficulty_1").click(function(){
|
||||
$("#challenge_score").empty();
|
||||
for(var i= 100; i <= 200; i += 100){
|
||||
$("#challenge_score").append("<option value="+ i + ">"+ i +"</option>");
|
||||
}
|
||||
});
|
||||
$("#challenge_difficulty_2").click(function(){
|
||||
$("#challenge_score").empty();
|
||||
for(var i= 300; i <= 600; i += 100){
|
||||
$("#challenge_score").append("<option value="+ i + ">"+ i +"</option>");
|
||||
}
|
||||
});
|
||||
$("#challenge_difficulty_3").click(function(){
|
||||
$("#challenge_score").empty();
|
||||
for(var i= 700; i <= 1000; i += 100){
|
||||
$("#challenge_score").append("<option value="+ i + ">"+ i +"</option>");
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
// 设置textarea的宽度到140以后出现滚动条
|
||||
var text1 = document.getElementById("textarea_sample_input_test");
|
||||
|
|
@ -418,5 +457,4 @@
|
|||
var obj = thisObj.parentNode.id;
|
||||
$("#"+obj).remove();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue