编程作业答题时,测试集很长的显示默认收起,点击才展开

This commit is contained in:
cxt 2017-02-07 10:35:21 +08:00
parent 0b44fbebd9
commit f0a94302a0
3 changed files with 63 additions and 38 deletions

View File

@ -24,15 +24,18 @@
<% end%>
<div class="cl"></div>
<li >
<span class="tit_fb ">编程代码:</span>
<div class="showHworkP break_word"><pre id="work-src_<%= work.id%>" style="display: none;"><%= work.description if work.description%></pre><div class="fontGrey2 font_cus" id="work-code_<%= work.id%>">
<li>
<span class="tit_fb">编程代码:</span>
<div class="showHworkP break_word">
<pre id="work-src_<%= work.id%>" style="display: none;"><%= work.description if work.description%></pre>
<div class="fontGrey2 font_cus" id="work-code_<%= work.id%>">
</div>
</div>
<div class="cl"></div>
</li>
<li class="mt10 fl">
<div class="cl"></div>
<li class="mt10">
<span class="tit_fb ">
测试结果:
</span>
@ -52,50 +55,65 @@
<%= test.results.first %>
</div>
<% else %>
<div class="ProResultTable " >
<ul class="ProResultUl " >
<div class="ProResultTable">
<div class="ProResultUl">
<% test.results.reverse.each_with_index do |x, i| %>
<% unless x.nil? %>
<li >
<span class="w60 T_C">测试<%=test.results.size-i%></span>
<% if x["status"].to_i != 0 %>
<% if x["status"].to_i == 2 %>
<span class="w60 c_red">超时!</span>
<% else %>
<span class="w60 c_red">测试错误!</span>
<% end %>
<span class="w60">您的输出:</span>
<span class="width120"><pre style="white-space: pre-wrap; margin-right: 15px;"><%=x["result"].force_encoding("UTF-8")%> </pre></span>
<span class="w60">正确输出:</span>
<% unless x.nil? %>
<%= %>
<div>
<span class="w60 T_C">测试<%=test.results.size-i%></span>
<% if x["status"].to_i != 0 %>
<% if x["status"].to_i == 2 %>
<span class="w60 c_red">超时!</span>
<% else %>
<span class="w60 c_red">测试错误!</span>
<% end %>
<span style="width: 340px; padding-left: 20px;">
<a href="javascript:void(0)" class="linkBlue test_result_link_expand">查看</a>
</span>
<span class="width120"><pre style="white-space: pre-wrap; margin-right: 15px;"><%=x["output"].force_encoding("UTF-8")%></pre></span>
<span class="w50">耗时:</span>
<span class="w80"><pre><%=x["time_used"]==0?1:x["time_used"]%>毫秒</pre></span>
<div class="cl"></div>
<% else %>
<span class="w60 c_green">测试正确!</span>
<span style="width:360px;">&nbsp;</span>
<span class="w50">耗时:</span>
<span class="w80"><pre><%=x["time_used"]==0?1:x["time_used"]%>毫秒</pre></span>
<div class="cl"></div>
<% end %>
</li>
<% end %>
<span class="w50">耗时:</span>
<span class="w80"><pre><%=x["time_used"]==0?1:x["time_used"]%>毫秒</pre></span>
<div class="cl"></div>
<% else %>
<span class="w60 c_green">测试正确!</span>
<span style="width:360px;">&nbsp;</span>
<span class="w50">耗时:</span>
<span class="w80"><pre><%=x["time_used"]==0?1:x["time_used"]%>毫秒</pre></span>
<div class="cl"></div>
<% end %>
</div>
<% if x["status"].to_i != 0 %>
<div class="none test_result_block">
<div style="max-height: 350px; overflow: auto;">
<span style="width: 120px;">&nbsp;</span>
<span class="w60">您的输出:</span>
<span class="width120"><pre style="white-space: pre-wrap; margin-right: 15px;"><%=x["result"].force_encoding("UTF-8")%> </pre></span>
<span class="w60">正确输出:</span>
<span class="width120"><pre style="white-space: pre-wrap; margin-right: 15px;"><%=x["output"].force_encoding("UTF-8")%></pre></span>
</div>
<div class="cl"></div>
<p class="text_c c_blue">
<a href="javascript:void(0);" class="test_result_link_hidden linkBlue">收起</a>
</p>
</div>
<% end %>
<% end %>
<% end %>
</ul>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="cl"></div>
</li>
<li >
<li>
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%>
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<ul id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => false}%>
</div>
</ul>
<% end%>
<div class="cl"></div>
</li>
@ -119,6 +137,12 @@
<% if defined?(is_focus) && is_focus.to_i == 1 %>
$("#upload_revise_attachment").click();
<% end %>
$(".test_result_link_expand").on('click', function(){
$(this).parent().parent().next().toggle();
});
$(".test_result_link_hidden").on('click', function(){
$(this).parent().parent().toggle();
});
});
function show_upload(){
var htmlvalue = "<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>";

View File

@ -112,7 +112,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.w108 {width:108px;}.w125{width:125px;}.w128{ width:128px;}.w130{ width:130px;}.w140{ width:140px;}.w145{ width:145px;}.w150{ width:150px;}
.w160{width:160px !important;}.w170{width:170px;}.w180{width:180px;}.w186{ width:186px;}.w190{width: 190px;}.w196{ width:196px;}.w200{width: 200px;}.w210{ width:210px;}
.w230{width:230px !important;}.w235{ width:235px !important;}.w265{ width: 265px;}.w270{ width: 270px;}.w280{ width:280px;}.w289{ width:289px !important;}.w290{ width:290px !important;}
.w300{ width:300px !important;}.w305{ width:305px;}.w350 {width:350px;}.w362 {width:362px;}.h400{height:400px !important;}.w430{ width:430px;}
.w300{ width:300px !important;}.w305{ width:305px;}.w350 {width:350px;}.w360 {width:360px;}.w362 {width:362px;}.h400{height:400px !important;}.w430{ width:430px;}
.W440{ width:440px;}.w450 {width:450px;}.w455{width:455px !important;}.w459{ width:459px;}.w460{ width:460px;}.w465{width:465px !important;}
.w490{width:490px;}.w536{ width:536px;}.w543{ width:543px;}.w557{ width:557px;}.w570 {width:570px !important;}.w576{ width:576px;}.w590{ width:590px !important;}
.w607 {width:607px;}.w664{ width:664px;}.w683{ width:683px;}.w610{ width:610px;}.w600{ width:600px !important;}.w603{ width:603px !important;}

View File

@ -31,7 +31,7 @@ a.remove-upload {background: url(/images/delete.png) no-repeat 1px 50%;width: 1p
a.FilesName{ max-width:540px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:block;}
a.FilesName02{ max-width:665px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:block;}
.ProResultUl span { display:block; float:left;}
.ProResultUl li{ line-height:35px; border-bottom:1px solid #dddddd; }
.ProResultUl>div{ line-height:35px; border-bottom:1px solid #dddddd; }
.DateBorder{border:1px solid #d9d9d9; border-left:none; padding:7px 6px 6px 6px;}
a.UsersEditBtn{ display:block; width:55px; height:20px; border:1px solid #6d6d6d; color:#fff; background:#888888 url(/images/homepage_icon.png) -11px -35px no-repeat; padding-left:25px; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
a:hover.UsersEditBtn{ color:#484848; background:#888888 url(/images/homepage_icon2.png) -11px -74px no-repeat;}
@ -327,6 +327,7 @@ a.work_list_tit{width:580px; display:block; overflow:hidden; font-size:14px; f
.evaluation{position: relative;}
.evaluation_submit{position: absolute;right: 0px;bottom: 0px;}
.student_work_search{background-color: #3b94d6;color: white !important;padding: 2px 7px;margin-left: 10px;cursor: pointer; }
.test_result_block{border-bottom: 1px solid #dddddd; line-height: 35px;}
/* 与我相关 */
a.about_me{text-align:center;font-size:16px; color:#3b94d6; margin:10px 0 0 10px;}
a:hover.about_me{ color:#0781b4;}