From cbcd63f4c3df90d4dc28b4b2ffc4cb21327045b1 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Fri, 14 Apr 2017 10:27:19 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=AE=ADtpm=E7=BB=8F=E9=AA=8C?=
=?UTF-8?q?=E5=80=BC=E9=9A=8F=E9=9A=BE=E6=98=93=E5=BA=A6=E7=9A=84=E6=94=B9?=
=?UTF-8?q?=E5=8A=A8=E8=80=8C=E6=94=B9=E5=8F=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/challenges/_form.html.erb | 48 ++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 5 deletions(-)
diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb
index 1e436a5ff..daf25b887 100644
--- a/app/views/challenges/_form.html.erb
+++ b/app/views/challenges/_form.html.erb
@@ -130,7 +130,7 @@
- <%= 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;" %>
请选择自动检测学员是否完成本任务的评测标准
@@ -238,13 +238,13 @@
<%= radio_button_tag("challenge[difficulty]", 1, checked = (@challenge.difficulty ==1 ? true : false)) %>简单
<%= radio_button_tag("challenge[difficulty]", 2, checked = (@challenge.difficulty ==2 ? true : false)) %>中等
<%= radio_button_tag("challenge[difficulty]", 3, checked = (@challenge.difficulty ==3 ? true : false)) %>困难
- 请选择难易度并设定通过本关后,学员得到的经验值
+
- <%= f.text_field :score, :class => "panel-form-height-30 fl", :no_label => true, :style => "padding:5px;", :placeholder => "请输入分值(只能是数字)" %>
- (100~200 经验值)
+ <%#= 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;" %>
分值设定不能为空
@@ -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("");
+ }
+ }else if(list == 2){
+ $("#challenge_score").empty();
+ for(var i= 300; i <= 600; i += 100){
+ $("#challenge_score").append("");
+ }
+ }else if(list == 3){
+ $("#challenge_score").empty();
+ for(var i= 700; i <= 1000; i += 100){
+ $("#challenge_score").append("");
+ }
+ }
+ $("#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("");
+ }
+ });
+ $("#challenge_difficulty_2").click(function(){
+ $("#challenge_score").empty();
+ for(var i= 300; i <= 600; i += 100){
+ $("#challenge_score").append("");
+ }
+ });
+ $("#challenge_difficulty_3").click(function(){
+ $("#challenge_score").empty();
+ for(var i= 700; i <= 1000; i += 100){
+ $("#challenge_score").append("");
+ }
+ })
+
});
// 设置textarea的宽度到140以后出现滚动条
var text1 = document.getElementById("textarea_sample_input_test");
@@ -418,5 +457,4 @@
var obj = thisObj.parentNode.id;
$("#"+obj).remove();
}
-