208 lines
10 KiB
Plaintext
208 lines
10 KiB
Plaintext
<% content_for :header_tags do %>
|
||
<%= javascript_include_tag 'homework','baiduTemplate' %>
|
||
<% end %>
|
||
|
||
<% if @homework.homework_type == 1 %>
|
||
<script type="text/javascript">
|
||
<%if @homework.homework_type == 1 && @homework.homework_detail_manual.comment_status != 1%>
|
||
$(function(){
|
||
$('#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","").css("left","");
|
||
$('#ajax-modal').parent().addClass("anonymos_work");
|
||
// alert("当前作业已开启匿评,您提交作品后将不会收到任何匿评作品,您的作品也不会被其他用户匿评,如需获得最终成绩,请您联系主讲老师对您的作品单独进行评分");
|
||
});
|
||
<% end%>
|
||
</script>
|
||
<div class="HomeWork" id="RSide">
|
||
<div class="RightBanner">
|
||
<div class="NewsBannerName">提交作品</div>
|
||
</div>
|
||
<div class="Newwork">
|
||
<div class="hwork_ctt">
|
||
<div class="hwork_dis" id="tbc_01">
|
||
<%= form_for(@student_work,
|
||
:html => { :multipart => true },
|
||
:url => {:controller => 'student_work',
|
||
:action => 'create',
|
||
:homework => @homework.id
|
||
}) do |f|%>
|
||
<div class="N_con">
|
||
<% if @homework.homework_type == 1%>
|
||
<div class=" c_red mb10 ml90">
|
||
提示:匿评作业提交的作品,作品名称和描述中不能出现真实的姓名信息
|
||
</div>
|
||
<% end%>
|
||
<p>
|
||
<label class="fl"><span class="c_red">*</span> 作品名称 :</label>
|
||
<%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %>
|
||
<% if @homework.homework_type != 2%>
|
||
<a href="javascript:void(0)" class="fl ml10 mt3" onclick=" $('#about_project').slideToggle();" >
|
||
项目信息
|
||
<img class="ml5 " src="../images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于 网络的协作空间,能够为个人 或小组提供分布式的协同交流 和资料管理等方面的。">
|
||
</a>
|
||
<% end%>
|
||
<div class="cl"></div>
|
||
<p id="student_work_name_span" class="c_red ml90 mb10"></p>
|
||
</p>
|
||
<div class="cl"></div>
|
||
<p id="about_project" class="about_project" >
|
||
<label class="fl"> 选择项目 :</label>
|
||
<%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %>
|
||
</p>
|
||
<div class="cl"></div>
|
||
<p>
|
||
<label class="fl">
|
||
<span class="c_red">*</span>
|
||
<%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>
|
||
:
|
||
</label>
|
||
<% if @homework.homework_type == 2 && @homework.homework_detail_programing%>
|
||
<%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%>
|
||
<% else %>
|
||
<%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>
|
||
<% end%>
|
||
<div class="cl"></div>
|
||
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
|
||
</p>
|
||
<div class="cl"></div>
|
||
<% if @homework.homework_type != 2%>
|
||
<p>
|
||
<label class="fl"> 添加附件 :</label>
|
||
<%= render :partial => 'attachments/new_form' %>
|
||
</p>
|
||
<div class="cl"></div>
|
||
<% end%>
|
||
<p class="ml80 ">
|
||
<a href="javascript:void(0)" class="blue_btn fl c_white mt10" onclick="new_student_work();">提交作品</a>
|
||
<%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white mt10 ml10"%>
|
||
<div class="cl"></div>
|
||
</p>
|
||
</div><!---创建作业内容结束-->
|
||
<% end%>
|
||
</div>
|
||
</div>
|
||
</div><!--新建作业结束-->
|
||
<div class="cl"></div>
|
||
</div>
|
||
|
||
<% else %>
|
||
|
||
|
||
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
||
<script id="t:result-list" type="text/html">
|
||
<div class="ProResultTop">
|
||
<p class="c_blue fl">第<!=index!>次测试</p><span class="fr c_grey"><!= time !></span>
|
||
<div class="cl"></div>
|
||
</div>
|
||
|
||
<! if(status == -2){!>
|
||
<div class="ProResultCon "><!= error_msg !></div>
|
||
<!}else{!>
|
||
<div class="ProResultTable " >
|
||
<ul class="ProResultUl " >
|
||
<! for(var i =0; i <results.length; ++i){ !>
|
||
<li ><span class="w60 T_C">测试<!=i+1!></span>
|
||
<! if(results[i]["status"]!=0){ !>
|
||
<span class="w150 c_red">测试错误!</span>
|
||
<span class="w60">您的输出:</span>
|
||
<span class="W200"><!=results[i]["result"]!></span>
|
||
<span class="w60">正确输出:</span>
|
||
<span class="W200"><!=results[i]["output"]!></span>
|
||
<div class="cl"></div>
|
||
</li>
|
||
<!}else{!>
|
||
<span class="w150 c_green">测试正确!</span>
|
||
<div class="cl"></div>
|
||
</li>
|
||
<!}!>
|
||
<!}!>
|
||
</ul>
|
||
</div>
|
||
<! } !>
|
||
|
||
</script>
|
||
<!-- 模板1结束 -->
|
||
|
||
|
||
<div class="HomeWork" id="RSide">
|
||
<div class="RightBanner">
|
||
<div class="NewsBannerName">提交作品</div>
|
||
</div>
|
||
<div class="HomeWorkBox">
|
||
<div class="">
|
||
<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 %> <br />
|
||
输入 2 1 1 4 4 2 3 6 5 <br />
|
||
输出 15<br />
|
||
</p>
|
||
</div>
|
||
<p class="c_grey mt15">注:迟交扣<span class="c_red">2</span>分,缺评一个作品扣<span class="c_red">2</span>分</p>
|
||
</div><!---HomeWorkBox end -->
|
||
<div class="HomeWorkCon">
|
||
<%= form_for(@student_work,
|
||
:html => { :multipart => true },
|
||
:url => {:controller => 'student_work',
|
||
:action => 'create',
|
||
:student_work_id => @student_work.id,
|
||
:homework => @homework.id
|
||
},
|
||
:method => :post) do |f|%>
|
||
|
||
<div class="mt15">
|
||
<span>请使用 <%= @homework.language_name %> 语言编写</span>
|
||
</div>
|
||
<div class="mt10">
|
||
<%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %>
|
||
</div>
|
||
<div class="mt10">
|
||
<%= f.text_area :description, id: 'program-src', class:" W700 H150", placeholder:"请贴入你的代码", rows: 10 %>
|
||
</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>
|
||
<a href="javascript:void(0);" class="BlueCirBtn fr" id="commit-program-work-btn">提交代码</a>
|
||
<div class="cl"></div>
|
||
</div>
|
||
<% end %>
|
||
</div><!----HomeWorkCon end-->
|
||
</div><!----HomeWork end-->
|
||
<div class="ProResult mt10">
|
||
<% @student_work.student_work_tests.each_with_index do |test, index| %>
|
||
<div class="ProResultTop">
|
||
<p class="c_blue fl">第<%= @student_work.student_work_tests.count - index%>次测试</p><span class="fr c_grey"><%= test.created_at.to_s(:db) %></span>
|
||
<div class="cl"></div>
|
||
</div>
|
||
<% if test.status.to_i == -2 %>
|
||
<div class="ProResultCon "><%= test.results.first %></div>
|
||
<% else %>
|
||
<div class="ProResultTable " >
|
||
<ul class="ProResultUl " >
|
||
<% test.results.each_with_index do |x, i| %>
|
||
<li ><span class="w60 T_C">测试<%=i+1%></span>
|
||
<% if x["status"].to_i != 0 %>
|
||
<span class="w150 c_red">测试错误!</span>
|
||
<span class="w60">您的输出:</span>
|
||
<span class="W200"><%=x["result"]%></span>
|
||
<span class="w60">正确输出:</span>
|
||
<span class="W200"><%=x["output"]%></span>
|
||
<div class="cl"></div>
|
||
</li>
|
||
<% else %>
|
||
<span class="w150 c_green">测试正确!</span>
|
||
<div class="cl"></div>
|
||
</li>
|
||
<% end %>
|
||
<% end %>
|
||
</ul>
|
||
</div>
|
||
<% end %>
|
||
<% end %>
|
||
</div><!----ProResult end-->
|
||
|
||
<% end %>
|