2015-09-01 16:18:03 +08:00
|
|
|
|
<% content_for :header_tags do %>
|
2015-09-19 18:17:12 +08:00
|
|
|
|
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<%= javascript_include_tag 'homework','baiduTemplate' %>
|
2015-09-19 18:17:12 +08:00
|
|
|
|
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<% end %>
|
2016-02-25 10:23:38 +08:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(function(){
|
|
|
|
|
$("#RSide").removeAttr("id");
|
|
|
|
|
$("#Container").css("width","1000px");
|
2016-07-18 14:09:41 +08:00
|
|
|
|
<%if !@is_test && @homework.anonymous_comment == 0 && @homework.homework_detail_manual.comment_status != 1%>
|
2016-06-16 15:58:34 +08:00
|
|
|
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_student_work_alert') %>');
|
|
|
|
|
showModal('ajax-modal', '360px');
|
|
|
|
|
$('#ajax-modal').siblings().remove();
|
|
|
|
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
|
|
|
|
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
|
|
|
|
$('#ajax-modal').parent().css("top","65%").css("left","60%").css("border","3px solid #269ac9");
|
|
|
|
|
$('#ajax-modal').parent().addClass("anonymos_work");
|
|
|
|
|
<% end%>
|
2016-02-25 10:23:38 +08:00
|
|
|
|
});
|
|
|
|
|
</script>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
2016-03-25 14:43:51 +08:00
|
|
|
|
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<script id="t:result-list" type="text/html">
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<! if((tseq == tcount) ||(status == 2)||(status == -2)){ !>
|
|
|
|
|
<div class="ProResultTop">
|
|
|
|
|
<p class="c_blue fl">第<!=index!>次测试</p><span class="fr c_grey"><!= time !></span>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<!}!>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
|
|
|
|
|
<! if(status == -2){!>
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<div class="ProResultCon "><pre style="white-space: pre-wrap;"><!= error_msg !></pre></div>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<!}else{!>
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<div class="ProResultTable ">
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<ul class="ProResultUl " >
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<li ><span class="w60 T_C">测试<!=tseq!></span>
|
|
|
|
|
<! if(results["status"]!=0){ !>
|
|
|
|
|
<! if(results["status"]==2){!>
|
|
|
|
|
<span class="w60 c_red">超时!</span>
|
|
|
|
|
<!}else{!>
|
2016-03-25 21:06:25 +08:00
|
|
|
|
<span class="w60 c_red">测试错误!</span>
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<!}!>
|
|
|
|
|
<span class="w60">您的输出:</span>
|
|
|
|
|
<span class="w180"><pre style="white-space: pre-wrap; margin-right: 15px;"><!=results["result"]!> </pre></span>
|
|
|
|
|
<span class="w60">正确输出:</span>
|
|
|
|
|
<span class="w180"><pre style="white-space: pre-wrap; margin-right: 15px;"><!=results["output"]!></pre></span>
|
2016-04-14 11:29:22 +08:00
|
|
|
|
<!--<! if(results["status"]==2){!>-->
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<span class="w50"> 耗时:</span>
|
2016-04-14 11:29:22 +08:00
|
|
|
|
<span class="w80"><pre><!=results["time_used"]==0?1:results["time_used"]!>毫秒</pre></span>
|
|
|
|
|
<!--<!}!>-->
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<div class="cl"></div>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
</li>
|
|
|
|
|
<!}else{!>
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<span class="w60 c_green">测试正确!</span>
|
2016-04-14 11:29:22 +08:00
|
|
|
|
<span style="width:480px;"> </span>
|
|
|
|
|
<span class="w50"> 耗时:</span>
|
|
|
|
|
<span class="w80"><pre ><!=results["time_used"]==0?1:results["time_used"]!>毫秒</pre></span>
|
2016-03-21 14:40:47 +08:00
|
|
|
|
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<div class="cl"></div>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
</li>
|
|
|
|
|
<!}!>
|
2016-03-25 14:43:51 +08:00
|
|
|
|
</ul>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
<! } !>
|
|
|
|
|
</script>
|
|
|
|
|
<!-- 模板1结束 -->
|
|
|
|
|
|
2016-02-25 10:23:38 +08:00
|
|
|
|
<div class="ProgramHomework ml10">
|
2015-09-07 18:29:25 +08:00
|
|
|
|
|
2015-09-07 23:09:19 +08:00
|
|
|
|
<div class="homepageRightBanner mb10">
|
|
|
|
|
<div class="NewsBannerName"><%= @is_test ? '模拟答题' : '提交作品' %></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
|
|
|
|
|
<div class="HomeWork">
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<div class="HomeWorkBox">
|
|
|
|
|
<div class="">
|
2015-09-18 13:51:37 +08:00
|
|
|
|
<div class="homepagePostTitle fl">
|
|
|
|
|
<%= @homework.name %>
|
|
|
|
|
</div>
|
|
|
|
|
<span class="fr c_grey">
|
|
|
|
|
截止时间:<%= @homework.end_time %>
|
|
|
|
|
</span>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<a href="javascript:void(0);" class="c_blue"><%= @homework.user.show_name %></a>
|
|
|
|
|
<p class="HomeWorkP">
|
|
|
|
|
<%= @homework.description.html_safe %>
|
|
|
|
|
</p>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
</div>
|
2015-09-02 21:47:07 +08:00
|
|
|
|
<!--p class="c_grey mt15">注:迟交扣<span class="c_red">2</span>分,缺评一个作品扣<span class="c_red">2</span>分</p-->
|
2015-09-01 16:18:03 +08:00
|
|
|
|
</div><!---HomeWorkBox end -->
|
|
|
|
|
<div class="HomeWorkCon">
|
|
|
|
|
<%= form_for(@student_work,
|
|
|
|
|
:html => { :multipart => true },
|
|
|
|
|
:url => {:controller => 'users',
|
|
|
|
|
:action => 'user_commit_homework',
|
|
|
|
|
:student_work_id => @student_work.id,
|
|
|
|
|
:homework => @homework.id
|
|
|
|
|
},
|
|
|
|
|
:method => :post) do |f|%>
|
2015-09-02 21:38:13 +08:00
|
|
|
|
<input type="hidden" name="is_test" value="<%=@is_test%>">
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<div class="mt15">
|
|
|
|
|
<span>请使用 <%= @homework.language_name %> 语言编写</span>
|
2016-05-18 16:23:28 +08:00
|
|
|
|
<% if @homework.language.to_i == 1 %>
|
2016-05-20 17:25:56 +08:00
|
|
|
|
<span class = "fr">编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC)</span>
|
2016-05-18 16:23:28 +08:00
|
|
|
|
<% elsif @homework.language.to_i == 2 %>
|
2016-05-20 17:25:56 +08:00
|
|
|
|
<span class = "fr">编译器信息:gcc version "4.4.7" 20120313 (Red Hat 4.4.7-11) (GCC)</span>
|
2016-05-18 16:23:28 +08:00
|
|
|
|
<% elsif @homework.language.to_i == 3 %>
|
2016-05-20 17:25:56 +08:00
|
|
|
|
<span class = "fr">编译器信息:Python version "2.6.6"</span>
|
2016-05-18 16:23:28 +08:00
|
|
|
|
<% elsif @homework.language.to_i == 4 %>
|
2016-05-20 17:25:56 +08:00
|
|
|
|
<span class = "fr">编译器信息:java version "1.7.0_85" OpenJDK Runtime Environment</span>
|
2016-05-18 16:23:28 +08:00
|
|
|
|
<% end %>
|
2015-09-19 18:17:12 +08:00
|
|
|
|
<span data-language=<%=@homework.language%> style="display-hidden" id="data-language"></span>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
</div>
|
2015-09-11 18:03:37 +08:00
|
|
|
|
<div class="mt10">
|
2016-03-14 15:02:37 +08:00
|
|
|
|
<%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能", value:"#{@homework.name}的作品提交" %>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="mt10">
|
2015-09-07 18:29:25 +08:00
|
|
|
|
<%= f.text_area :description, id: 'program-src', class:"InputBox W700 H150", placeholder:"请贴入你的代码", rows: 10 %>
|
2015-09-11 18:03:37 +08:00
|
|
|
|
<script>
|
|
|
|
|
var text = document.getElementById("program-src");
|
|
|
|
|
autoTextarea(text);// 调用
|
|
|
|
|
</script>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="mt10">
|
|
|
|
|
<a href="javascript:void(0);" class="BlueCirBtn fl" data-homework-id="<%=@homework.id%>" data-student-work-id="<%=@student_work.id%>" id="test-program-btn">测试代码</a>
|
2016-02-25 10:23:38 +08:00
|
|
|
|
<% if @is_test %>
|
2016-04-22 14:13:24 +08:00
|
|
|
|
<%=link_to '返 回',homework_common_index_path(:course => @course.id),:class=>'fr mt6',:style =>'line-height:30px;' %>
|
2016-02-25 10:23:38 +08:00
|
|
|
|
<% else @is_test %>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<a href="javascript:void(0);" class="BlueCirBtn fr" id="commit-program-work-btn">提交代码</a>
|
2015-09-02 21:38:13 +08:00
|
|
|
|
<% end %>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div><!----HomeWorkCon end-->
|
|
|
|
|
</div><!----HomeWork end-->
|
2015-09-02 22:09:23 +08:00
|
|
|
|
|
|
|
|
|
<div class="cl"></div>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<div class="ProResult mt10">
|
2015-09-02 22:09:23 +08:00
|
|
|
|
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<% @student_work.student_work_tests.each_with_index do |test, index| %>
|
|
|
|
|
<div class="ProResultTop">
|
2015-09-30 09:50:14 +08:00
|
|
|
|
<p class="c_blue fl">
|
|
|
|
|
第<%= @student_work.student_work_tests.count - index%>次测试
|
|
|
|
|
</p>
|
|
|
|
|
<span class="fr c_grey"><%= format_time(test.created_at).to_s%></span>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<% if test.status.to_i == -2 %>
|
2015-11-07 19:58:19 +08:00
|
|
|
|
<div class="ProResultCon"><pre><%= test.results.first %></pre></div>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<% else %>
|
|
|
|
|
<div class="ProResultTable " >
|
|
|
|
|
<ul class="ProResultUl " >
|
2016-03-25 21:06:25 +08:00
|
|
|
|
<% test.results.reverse.each_with_index do |x, i| %>
|
2016-03-25 21:11:13 +08:00
|
|
|
|
<% unless x.nil? %>
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<li ><span class="w60 T_C">测试<%=test.results.size-i%></span>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<% if x["status"].to_i != 0 %>
|
2016-03-21 14:40:47 +08:00
|
|
|
|
<% if x["status"].to_i == 2 %>
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<span class="w60 c_red">超时!</span>
|
2016-03-21 14:40:47 +08:00
|
|
|
|
<% else %>
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<span class="w60 c_red">测试错误!</span>
|
2016-03-21 14:40:47 +08:00
|
|
|
|
<% end %>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<span class="w60">您的输出:</span>
|
2016-04-19 13:03:12 +08:00
|
|
|
|
<span class="w180"><pre style="white-space: pre-wrap; margin-right: 15px;"><%=x["result"].force_encoding("UTF-8")%> </pre></span>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<span class="w60">正确输出:</span>
|
2016-04-19 13:03:12 +08:00
|
|
|
|
<span class="w180"><pre style="white-space: pre-wrap; margin-right: 15px;"><%= x["output"].force_encoding("UTF-8") %></pre></span>
|
2016-04-14 11:29:22 +08:00
|
|
|
|
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<span class="w50"> 耗时:</span>
|
2016-04-14 11:29:22 +08:00
|
|
|
|
<span class="w80"><pre><%=x["time_used"]==0?1:x["time_used"]%>毫秒</pre></span>
|
|
|
|
|
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</li>
|
|
|
|
|
<% else %>
|
2016-03-25 14:43:51 +08:00
|
|
|
|
<span class="w60 c_green">测试正确!</span>
|
2016-04-14 11:29:22 +08:00
|
|
|
|
<span style="width:480px;"> </span>
|
|
|
|
|
<span class="w50"> 耗时:</span>
|
|
|
|
|
<span class="w80"><pre><%=x["time_used"]==0?1:x["time_used"]%>毫秒</pre></span>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</li>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
2016-03-25 21:11:13 +08:00
|
|
|
|
<% end %>
|
2015-09-01 16:18:03 +08:00
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div><!----ProResult end-->
|
|
|
|
|
</div><!--homepageRight end-->
|