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(); } -