socialforge/app/views/student_work/work_canrepeat.js.erb

100 lines
6.8 KiB
Plaintext
Raw Normal View History

2016-04-15 17:07:38 +08:00
//代码查重
<% if @work_count <= 1 %>
//弹框
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_2',:locals => {:des=>"对不起该作业的作品过少不能查重!",:status=>0, :homework=> @homework,:courseid=> @course_id})%>');
showModal('ajax-modal', '580px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 565px; margin-top:-10px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top", "30%").css("left", "50%").css("padding-top", "10px").css("position", "fixed");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left", "16px").css("padding-bottom", "16px");
function closeModal() {
hideModal($(".blue-border-box"));
}
<% else %>
2016-04-15 18:48:39 +08:00
<% if !@homework.simi_time %>
//请求查重
var test_repeat = function () {
$.post(
'/student_work/code_repeattest',
{homework: <%=@homework.id%>},
function (data, status) {
if (data.status == 0) {
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_2',:locals => {:des=>"查重完成是否立即查看结果?",:status=>1, :homework=> @homework,:courseid=> @course_id})%>');
showModal('ajax-modal', '580px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 565px; margin-top:-10px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top", "30%").css("left", "50%").css("padding-top", "10px").css("position", "fixed");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left", "16px").css("padding-bottom", "16px");
2016-04-15 17:07:38 +08:00
2016-04-15 18:48:39 +08:00
function closeModal() {
hideModal($(".blue-border-box"));
}
}
else if (data.status == -1) {
// confirm("对不起只支持java/c/c++的代码查重!");
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_2',:locals => {:des=>"对不起目前只支持java/c/c++的代码查重!",:status=>0, :homework=> @homework,:courseid=> @course_id})%>');
showModal('ajax-modal', '580px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 565px; margin-top:-10px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top", "30%").css("left", "50%").css("padding-top", "10px").css("position", "fixed");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left", "16px").css("padding-bottom", "16px");
2016-04-15 17:07:38 +08:00
2016-04-15 18:48:39 +08:00
function closeModal() {
hideModal($(".blue-border-box"));
}
2016-04-15 17:07:38 +08:00
}
2016-04-15 18:48:39 +08:00
else if (data.status == -2) {
// confirm("对不起该作业的作品过少不能查重!");
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_2',:locals => {:des=>"对不起该作业的作品过少不能查重!",:status=>0, :homework=> @homework,:courseid=> @course_id})%>');
showModal('ajax-modal', '580px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 565px; margin-top:-10px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top", "30%").css("left", "50%").css("padding-top", "10px").css("position", "fixed");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left", "16px").css("padding-bottom", "16px");
2016-04-15 17:07:38 +08:00
2016-04-15 18:48:39 +08:00
function closeModal() {
hideModal($(".blue-border-box"));
}
2016-04-15 17:07:38 +08:00
}
}
2016-04-15 18:48:39 +08:00
).fail(function (xhr, status) {
// confirm("对不起,服务器繁忙请稍后再试!");
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_2',:locals => {:des=>"对不起,服务器繁忙请稍后再试!",:status=>0, :homework=> @homework,:courseid=> @course_id})%>');
2016-04-15 17:07:38 +08:00
showModal('ajax-modal', '580px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 565px; margin-top:-10px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top", "30%").css("left", "50%").css("padding-top", "10px").css("position", "fixed");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left", "16px").css("padding-bottom", "16px");
function closeModal() {
hideModal($(".blue-border-box"));
}
2016-04-15 18:48:39 +08:00
});
};
test_repeat();
<% else%>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/compare_code_tips_1',:locals => {:homework=> @homework,:courseid=>@course_id })%>');
$('#compare-tips-1').html('您上次查重的时间为<%= Time.parse(@homework.simi_time.to_s).strftime("%Y-%m-%d %H:%M:%S")%>');
2016-04-15 18:48:39 +08:00
showModal('ajax-modal', '580px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 565px; margin-top:-10px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top", "30%").css("left", "50%").css("padding-top", "10px").css("position", "fixed");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left", "16px").css("padding-bottom", "16px");
2016-04-15 17:07:38 +08:00
2016-04-15 18:48:39 +08:00
function closeModal() {
hideModal($(".blue-border-box"));
}
<% end %>
2016-04-15 17:07:38 +08:00
<% end %>