Merge branch 'dev_TPI' into develop
Conflicts: public/stylesheets/css/edu-common.css public/stylesheets/css/taskstyle.css
This commit is contained in:
commit
1ddac249e2
|
|
@ -39,6 +39,19 @@
|
|||
$("#textCount").text(50-$("#subject").val().length)
|
||||
}
|
||||
});
|
||||
|
||||
$("#message_to_admin").on("click", function(){
|
||||
if($("#subject").val().trim() == ""){
|
||||
$("#error_tip").show();
|
||||
return;
|
||||
}else{
|
||||
$('#new_memo').submit();
|
||||
}
|
||||
})
|
||||
|
||||
$("#subject").on("focus", function(){
|
||||
$("#error_tip").hide();
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
@ -58,8 +71,9 @@
|
|||
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
|
||||
<%= f.text_area :subject, :id=>"subject", :class => "feedbackText mb5", :placeholder => "请在此输入平台的问题和建议,您也可以通过QQ留言,谢谢!" %>
|
||||
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
|
||||
<span class="fl c_red undis" id="error_tip">留言不能为空 </span>
|
||||
<span class="c_grey fl">还能输入<span id="textCount" class="c_orange">50</span>个字符</span>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue_mini f12 fr mr10" onclick="$('#new_memo').submit();">留 言</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue_mini f12 fr mr10" id="message_to_admin">留 言</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey_mini f12 fr mr10" onclick="$('#feedback_div').hide();">取 消</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -29,19 +29,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function choice_answer(st, nThis){
|
||||
if(st == "1"){
|
||||
//$(nThis).hasClass("card-check") ? $(nThis).removeClass("card-check") : $(nThis).addClass("card-check");
|
||||
$(nThis).toggleClass("card-check");
|
||||
$(nThis).toggleClass("color_white");
|
||||
} else if (st == "2"){
|
||||
var choice = $(".color_white");
|
||||
choice.removeClass("card-check");
|
||||
choice.removeClass("color_white");
|
||||
$(nThis).addClass("card-check");
|
||||
$(nThis).toggleClass("color_white");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -76,13 +76,6 @@
|
|||
$("#time-consuming").html("耗时:" + days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 ");
|
||||
}
|
||||
|
||||
/* -----------------下一关增加loading效果--------------------- */
|
||||
$("#next_step").live("click", function(){
|
||||
nNext = $("#code_estimate");
|
||||
html = "<a href='javascript:void(0);' class='task-btn mr15 mt8'>下一关<img src='/images/bigdata/loading2.svg' style='width:25px;float:left;margin-top: 3px' /></a>";
|
||||
nNext.html(html);
|
||||
});
|
||||
|
||||
|
||||
// 选择题提交评测
|
||||
// answer 选择的答案
|
||||
|
|
@ -149,24 +142,18 @@
|
|||
/* ----------------- 评测 -------------------- */
|
||||
function training_task_submmit(){
|
||||
// 加载页面
|
||||
nEvalContent = $("#evaluating_contents");
|
||||
nEvalInfo = $("#evaluating_info");
|
||||
//nHtmlContent = $("#html_contents");
|
||||
nAjaxLoading = $("#evaluating_ajax_loading");
|
||||
//nHtmlAjaxLoading = $("#html_ajax_loading");
|
||||
nInfoAjaxLoading = $("#info_ajax_loading");
|
||||
nAjaxLoading.css("display","flex");
|
||||
nInfoAjaxLoading.css("display","flex");
|
||||
//nHtmlAjaxLoading.css("display","flex");
|
||||
nEvalContent.hide();
|
||||
nEvalInfo.hide();
|
||||
//nHtmlContent.hide();
|
||||
nAjaxLoading.show();
|
||||
nInfoAjaxLoading.show();
|
||||
// nHtmlAjaxLoading.show();
|
||||
nAjaxLoading.html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
nInfoAjaxLoading.html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
//nHtmlAjaxLoading.html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
nEvalContent = $("#evaluating_contents").hide();
|
||||
nEvalInfo = $("#evaluating_info").hide();
|
||||
nAjaxLoading = $("#evaluating_ajax_loading").css("display","flex").show().html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
nInfoAjaxLoading = $("#info_ajax_loading").css("display","flex").show().html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
// nAjaxLoading.css("display","flex");
|
||||
// nInfoAjaxLoading.css("display","flex");
|
||||
// nEvalContent.hide();
|
||||
// nEvalInfo.hide();
|
||||
// nAjaxLoading.show();
|
||||
// nInfoAjaxLoading.show();
|
||||
// nAjaxLoading.html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
// nInfoAjaxLoading.html("<embed src='/images/bigdata/loading2.svg' />");
|
||||
$("#code_test").html("<a class='task-btn mt8 mr15'>评测中..</a>");
|
||||
$("#next_step").attr("href", "javascript:void(0);").removeClass("shixun-task-btn").removeClass("task-btn-blue").addClass("task-btn");
|
||||
$("#exit_shixun").attr("href", "javascript:void(0);").removeClass("shixun-task-btn").removeClass("task-btn-blue").addClass("task-btn");
|
||||
|
|
@ -201,28 +188,25 @@
|
|||
clearInterval(intId);
|
||||
nEvalContent.show();
|
||||
nEvalInfo.show();
|
||||
//nHtmlContent.show();
|
||||
nAjaxLoading.val("");
|
||||
nInfoAjaxLoading.val("");
|
||||
nAjaxLoading.hide();
|
||||
nInfoAjaxLoading.hide();
|
||||
//nHtmlAjaxLoading.hide();
|
||||
// test_sets 公开测,hide_test_sets 隐藏测试集
|
||||
var html = bt('t:exec_results_1',{
|
||||
"test_sets": eval('[' + data.test_sets + ']'),
|
||||
had_test_count: data.had_test_count,
|
||||
test_sets_count: data.test_sets_count,
|
||||
had_passed_testsests_error_count: data.had_passed_testsests_error_count,
|
||||
test_sets_hidden_count: data.test_sets_hidden_count,
|
||||
test_sets_public_count: data.test_sets_public_count,
|
||||
had_passed_testsests_hidden_count: data.had_passed_testsests_hidden_count,
|
||||
had_passed_testsests_public_count: data.had_passed_testsests_public_count,
|
||||
final_score: data.final_score,
|
||||
latest_output: data.latest_output,
|
||||
language: data.language
|
||||
});
|
||||
$("#game_test_set_results").html(html);
|
||||
$(".blacktab_con").eq(1).trigger("click"); // 回到测试结果页面
|
||||
code_evaluation(
|
||||
eval('[' + data.test_sets + ']'),
|
||||
data.had_test_count,
|
||||
data.test_sets_count,
|
||||
data.had_passed_testsests_error_count,
|
||||
data.test_sets_hidden_count,
|
||||
data.test_sets_public_count,
|
||||
data.had_passed_testsests_hidden_count,
|
||||
data.had_passed_testsests_public_count,
|
||||
data.final_score,
|
||||
data.latest_output,
|
||||
data.language
|
||||
);
|
||||
$("#blacktab_nav_1").trigger("click");
|
||||
if(data.status == 2){
|
||||
clearInterval(cm);
|
||||
clearInterval(intId);
|
||||
|
|
@ -261,12 +245,10 @@
|
|||
clearInterval(intId);
|
||||
nEvalContent.show();
|
||||
nEvalInfo.show();
|
||||
//nHtmlContent.show();
|
||||
nAjaxLoading.val("");
|
||||
nInfoAjaxLoading.val("");
|
||||
nAjaxLoading.hide();
|
||||
nInfoAjaxLoading.hide();
|
||||
//nHtmlAjaxLoading.hide();
|
||||
var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' onclick='training_task_submmit();'>评测</a>";
|
||||
var html_1 = "实训云平台繁忙(繁忙等级:88)";
|
||||
$("#code_test").html(html);
|
||||
|
|
@ -276,13 +258,11 @@
|
|||
complete: function(XMLHttpRequest,status){if(status=='timeout'){
|
||||
clearInterval(intId);
|
||||
nEvalContent.show();
|
||||
//nHtmlContent.show();
|
||||
nEvalInfo.show();
|
||||
nAjaxLoading.val("");
|
||||
nInfoAjaxLoading.val("");
|
||||
nAjaxLoading.hide();
|
||||
nInfoAjaxLoading.hide();
|
||||
//nHtmlAjaxLoading.hide();
|
||||
ajaxTimeoutTest.abort();
|
||||
clearInterval(intId);
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -4,52 +4,38 @@
|
|||
</style>
|
||||
|
||||
<form action="<%= file_update_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>" method="post" id="file_update_id" data-remote="true">
|
||||
<li class="clearfix" xmlns="http://www.w3.org/1999/html" id="edit_code_contents">
|
||||
<textarea class="" id="challenge-answer-edit-small" name="content"><%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %></textarea>
|
||||
</li>
|
||||
<li class="clearfix" xmlns="http://www.w3.org/1999/html" id="edit_code_contents">
|
||||
<textarea class="" id="challenge-answer-edit-small" name="content"><%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %></textarea>
|
||||
</li>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
// 自动完成
|
||||
// 自动完成
|
||||
var codeContents = $("#challenge-answer-edit-small").val(); // 获取版本库代码内容
|
||||
var changeCode = codeContents;// 修改代码的内容(初始化时,与版本库代码一致,便于判断)
|
||||
$(function(){
|
||||
loading = $("#ajax-indicator").children('span')[0]; // 加载中的html
|
||||
});
|
||||
var editor_CodeMirror = CodeMirror.fromTextArea(document.getElementById("challenge-answer-edit-small"), {
|
||||
/* mode: {name: "text/x-c++src",
|
||||
// version: 2,
|
||||
singleLineStringErrors: false},*/ // 目前补全js是引入的javascript-hint,因此目前不能指定语言
|
||||
lineNumbers: true,
|
||||
theme: "railscasts",
|
||||
// extraKeys: {"Ctrl-Q": "autocomplete"}, // 快捷键
|
||||
indentUnit: 4, //代码缩进为一个tab的距离
|
||||
matchBrackets: true,
|
||||
autoRefresh: true,
|
||||
smartIndent: true,//智能换行
|
||||
extraKeys: {"Ctrl-Q": "autocomplete"},
|
||||
autofocus: true,
|
||||
styleActiveLine: true,
|
||||
lint: true,
|
||||
gutters: ["CodeMirror-linenumbers", "breakpoints"]
|
||||
});
|
||||
|
||||
var editor_CodeMirror = CodeMirror_fromTextArea("challenge-answer-edit-small");
|
||||
|
||||
editor_CodeMirror.on('change', function(cMirror){
|
||||
// get value right from instance
|
||||
$('#challenge-answer-edit-small').val(cMirror.getValue());
|
||||
changeCode = cMirror.getValue(); // 获取修改后的代码
|
||||
<% if @myshixun.shixun.language == "Html" %>
|
||||
tpi_html_show();
|
||||
tpi_html_show();
|
||||
<% end %>
|
||||
});
|
||||
|
||||
/* // 使用cursorActivity事件也能判断活动行,但是执行添加代码后,会执行活动行样式,会吧添加的代码重新生成。
|
||||
$(".CodeMirror-code").click(function(){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
});*/
|
||||
/* // 使用cursorActivity事件也能判断活动行,但是执行添加代码后,会执行活动行样式,会吧添加的代码重新生成。
|
||||
$(".CodeMirror-code").click(function(){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
});*/
|
||||
|
||||
editor_CodeMirror.setCursor(12, 0);
|
||||
editor_CodeMirror.setCursor(12, 0);
|
||||
|
||||
// 每10秒钟保存一次
|
||||
editor_CodeMirror.on('focus',function(cMirror){
|
||||
|
|
@ -75,107 +61,107 @@
|
|||
clearInterval(sh);
|
||||
});
|
||||
|
||||
// 以下情景用于剔除自动补全功能(下面键盘事件,讲不触发自动补全功能)
|
||||
var ExcludedIntelliSenseTriggerKeys =
|
||||
{
|
||||
"8": "backspace",
|
||||
"9": "tab",
|
||||
"13": "enter",
|
||||
"16": "shift",
|
||||
"17": "ctrl",
|
||||
"18": "alt",
|
||||
"19": "pause",
|
||||
"20": "capslock",
|
||||
"27": "escape",
|
||||
"32": "space",
|
||||
"33": "pageup",
|
||||
"34": "pagedown",
|
||||
"35": "end",
|
||||
"36": "home",
|
||||
"37": "left",
|
||||
"38": "up",
|
||||
"39": "right",
|
||||
"40": "down",
|
||||
"45": "insert",
|
||||
"46": "delete",
|
||||
"59": ";",
|
||||
"91": "left window key",
|
||||
"92": "right window key",
|
||||
"93": "select",
|
||||
"107": "add",
|
||||
"109": "subtract",
|
||||
"110": "decimal point",
|
||||
"111": "divide",
|
||||
"112": "f1",
|
||||
"113": "f2",
|
||||
"114": "f3",
|
||||
"115": "f4",
|
||||
"116": "f5",
|
||||
"117": "f6",
|
||||
"118": "f7",
|
||||
"119": "f8",
|
||||
"120": "f9",
|
||||
"121": "f10",
|
||||
"122": "f11",
|
||||
"123": "f12",
|
||||
"144": "numlock",
|
||||
"145": "scrolllock",
|
||||
"186": "semicolon",
|
||||
"187": "equalsign",
|
||||
"188": "comma",
|
||||
"189": "dash",
|
||||
"190": "period",
|
||||
"191": "slash",
|
||||
"192": "graveaccent",
|
||||
"220": "backslash",
|
||||
"222": "quote"
|
||||
};
|
||||
// 以下情景用于剔除自动补全功能(下面键盘事件,讲不触发自动补全功能)
|
||||
var ExcludedIntelliSenseTriggerKeys =
|
||||
{
|
||||
"8": "backspace",
|
||||
"9": "tab",
|
||||
"13": "enter",
|
||||
"16": "shift",
|
||||
"17": "ctrl",
|
||||
"18": "alt",
|
||||
"19": "pause",
|
||||
"20": "capslock",
|
||||
"27": "escape",
|
||||
"32": "space",
|
||||
"33": "pageup",
|
||||
"34": "pagedown",
|
||||
"35": "end",
|
||||
"36": "home",
|
||||
"37": "left",
|
||||
"38": "up",
|
||||
"39": "right",
|
||||
"40": "down",
|
||||
"45": "insert",
|
||||
"46": "delete",
|
||||
"59": ";",
|
||||
"91": "left window key",
|
||||
"92": "right window key",
|
||||
"93": "select",
|
||||
"107": "add",
|
||||
"109": "subtract",
|
||||
"110": "decimal point",
|
||||
"111": "divide",
|
||||
"112": "f1",
|
||||
"113": "f2",
|
||||
"114": "f3",
|
||||
"115": "f4",
|
||||
"116": "f5",
|
||||
"117": "f6",
|
||||
"118": "f7",
|
||||
"119": "f8",
|
||||
"120": "f9",
|
||||
"121": "f10",
|
||||
"122": "f11",
|
||||
"123": "f12",
|
||||
"144": "numlock",
|
||||
"145": "scrolllock",
|
||||
"186": "semicolon",
|
||||
"187": "equalsign",
|
||||
"188": "comma",
|
||||
"189": "dash",
|
||||
"190": "period",
|
||||
"191": "slash",
|
||||
"192": "graveaccent",
|
||||
"220": "backslash",
|
||||
"222": "quote"
|
||||
};
|
||||
|
||||
// codemmirror键盘按下事件,用来触发自动补全代码功能
|
||||
editor_CodeMirror.on("keyup", function(editor, event)
|
||||
{
|
||||
var __Cursor = editor.getDoc().getCursor();
|
||||
var __Token = editor.getTokenAt(__Cursor);
|
||||
/* // 当前行变化时,codemirror的js会改变gutter的结构,因此要在此需要再增加标示
|
||||
if(event.keyCode == 38 || event.keyCode == 40){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
}*/
|
||||
console.log("####################################");
|
||||
console.log(__Token);
|
||||
if (!editor.state.completionActive &&
|
||||
!ExcludedIntelliSenseTriggerKeys[(event.keyCode || event.which).toString()])
|
||||
{
|
||||
// 中文编码的( 与 { 对于键盘事件是相同的,所以需要再判断
|
||||
if(event.shiftKey && event.keyCode == 57){
|
||||
if(__Token.string == '('){
|
||||
editor.replaceSelection(")"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch); // 设置光标位置在输入(之后
|
||||
return; // 输入的是"(" 不启动补全功能
|
||||
}
|
||||
}else if(event.shiftKey && event.keyCode == 219){
|
||||
if(__Token.string == '{'){
|
||||
editor.replaceSelection("}"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch);// 设置光标位置在输入{之后
|
||||
return; // 输入的是"{" 不启动补全功能
|
||||
}
|
||||
}else if(__Token.string.match(/^[\u4e00-\u9fa5]+$/)){
|
||||
return; // 输入的是中文,也不启动自动补全功能
|
||||
}else if(event.shiftKey && event.keyCode == 51){
|
||||
return;
|
||||
}else if(__Token.string.indexOf("#") > -1 || __Token.type == null){
|
||||
return;
|
||||
}else if(event.ctrlKey){
|
||||
return;
|
||||
}
|
||||
if((event.keyCode >= 65) && (event.keyCode <= 90)){
|
||||
CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); // 开启自动补全
|
||||
}
|
||||
}
|
||||
});
|
||||
// codemmirror键盘按下事件,用来触发自动补全代码功能
|
||||
editor_CodeMirror.on("keyup", function(editor, event)
|
||||
{
|
||||
var __Cursor = editor.getDoc().getCursor();
|
||||
var __Token = editor.getTokenAt(__Cursor);
|
||||
/* // 当前行变化时,codemirror的js会改变gutter的结构,因此要在此需要再增加标示
|
||||
if(event.keyCode == 38 || event.keyCode == 40){
|
||||
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
|
||||
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
|
||||
}
|
||||
}*/
|
||||
console.log("####################################");
|
||||
console.log(__Token);
|
||||
if (!editor.state.completionActive &&
|
||||
!ExcludedIntelliSenseTriggerKeys[(event.keyCode || event.which).toString()])
|
||||
{
|
||||
// 中文编码的( 与 { 对于键盘事件是相同的,所以需要再判断
|
||||
if(event.shiftKey && event.keyCode == 57){
|
||||
if(__Token.string == '('){
|
||||
editor.replaceSelection(")"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch); // 设置光标位置在输入(之后
|
||||
return; // 输入的是"(" 不启动补全功能
|
||||
}
|
||||
}else if(event.shiftKey && event.keyCode == 219){
|
||||
if(__Token.string == '{'){
|
||||
editor.replaceSelection("}"); // 自动添加}
|
||||
editor.setCursor(__Cursor.line, __Cursor.ch);// 设置光标位置在输入{之后
|
||||
return; // 输入的是"{" 不启动补全功能
|
||||
}
|
||||
}else if(__Token.string.match(/^[\u4e00-\u9fa5]+$/)){
|
||||
return; // 输入的是中文,也不启动自动补全功能
|
||||
}else if(event.shiftKey && event.keyCode == 51){
|
||||
return;
|
||||
}else if(__Token.string.indexOf("#") > -1 || __Token.type == null){
|
||||
return;
|
||||
}else if(event.ctrlKey){
|
||||
return;
|
||||
}
|
||||
if((event.keyCode >= 65) && (event.keyCode <= 90)){
|
||||
CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); // 开启自动补全
|
||||
}
|
||||
}
|
||||
});
|
||||
// 设置版本库字体间距
|
||||
// $("#challenge-answer-edit-small" ).nextAll(".CodeMirror").css("line-height", 1.2);
|
||||
// $("#challenge-answer-edit-small" ).nextAll(".CodeMirror").css("line-height", 1.2);
|
||||
$(document).ready(function(){
|
||||
// 设置codemirror的高度/宽度自适应
|
||||
editor_CodeMirror.setSize("auto","auto");
|
||||
|
|
@ -184,17 +170,17 @@
|
|||
$("#file_entry_content").find(".CodeMirror-scroll").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("max-height", h);
|
||||
});
|
||||
// 由于codemirror加载过慢,放在ready中的refresh失效,所以该在页面加载完成之后触发refresh函数
|
||||
$(window).load(function() {
|
||||
editor_CodeMirror.refresh();
|
||||
/* editor_CodeMirror.setCursor(12, 0);
|
||||
var info = editor_CodeMirror.lineInfo(12);
|
||||
editor_CodeMirror.setGutterMarker(12, "breakpoints", info.gutterMarkers ? null : makeMarker());
|
||||
function makeMarker() {
|
||||
var marker = document.createElement("div");
|
||||
marker.style.color = "#fff";
|
||||
marker.innerHTML = "<i class='fa fa-arrow-right' style='left: -30px;position: absolute;' aria-hidden='true'></i>";
|
||||
return marker;
|
||||
}*/
|
||||
});
|
||||
// 由于codemirror加载过慢,放在ready中的refresh失效,所以该在页面加载完成之后触发refresh函数
|
||||
$(window).load(function() {
|
||||
editor_CodeMirror.refresh();
|
||||
/* editor_CodeMirror.setCursor(12, 0);
|
||||
var info = editor_CodeMirror.lineInfo(12);
|
||||
editor_CodeMirror.setGutterMarker(12, "breakpoints", info.gutterMarkers ? null : makeMarker());
|
||||
function makeMarker() {
|
||||
var marker = document.createElement("div");
|
||||
marker.style.color = "#fff";
|
||||
marker.innerHTML = "<i class='fa fa-arrow-right' style='left: -30px;position: absolute;' aria-hidden='true'></i>";
|
||||
return marker;
|
||||
}*/
|
||||
});
|
||||
</script>
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
<div id="game_test_set_results" class="-flex -relative blacktab-inner"></div>
|
||||
<script id="t:exec_results_1" type="text/html">
|
||||
<div id="blacktab_con_1" class="" >
|
||||
|
||||
<! if(language == "Html") { !>
|
||||
<div class="fit -scroll">
|
||||
<div class="-layout-v -fit">
|
||||
|
|
@ -33,7 +34,9 @@
|
|||
<div id="blacktab_con_2" class="<!= language == 'Html' ? 'undis' : '' !>" >
|
||||
<div class="fit -scroll">
|
||||
<div class="-layout-v -fit">
|
||||
<div class="-flex -scroll task-padding16 loading-center undis" id="evaluating_ajax_loading"></div>
|
||||
<div class="-flex -scroll task-padding16 loading-center undis" id="evaluating_ajax_loading">
|
||||
<embed src='/images/bigdata/loading2.svg' />
|
||||
</div>
|
||||
<div class="-flex -scroll task-padding16" id="evaluating_contents">
|
||||
<! if(had_test_count != "0") { !>
|
||||
<! if(had_passed_testsests_error_count != "0") { !>
|
||||
|
|
@ -86,7 +89,9 @@
|
|||
<div id="blacktab_con_3" class="undis" >
|
||||
<div class="fit -scroll">
|
||||
<div class="-layout-v -fit">
|
||||
<div class="-flex -scroll task-padding16 loading-center undis" id="info_ajax_loading"></div>
|
||||
<div class="-flex -scroll task-padding16 loading-center undis" id="info_ajax_loading">
|
||||
<embed src='/images/bigdata/loading2.svg' />
|
||||
</div>
|
||||
<div class="-flex -scroll task-padding16" id="evaluating_info">
|
||||
<! if(had_test_count != "0") { !>
|
||||
<! if(had_passed_testsests_error_count != "0") { !>
|
||||
|
|
@ -117,46 +122,54 @@
|
|||
</script>
|
||||
|
||||
<script>
|
||||
var bt = baidu.template;
|
||||
// test_sets:测试集;had_test_count:输出集的个数;test_sets_count:测试集的个数;had_passed_testsests_error_count:测试集报错数;test_sets_hidden_count:隐藏测试集的个数
|
||||
// test_sets_public_count:公开测试集的个人;had_passed_testsests_hidden_count:通过的隐藏集个数;had_passed_testsests_public_count:通过的公开测试集个数
|
||||
// final_score:最终得分;had_done:通过的是否是最后一关;latest_output:最新的输出;language:实训的语言
|
||||
$(function(){
|
||||
code_evaluation(
|
||||
[<%= @test_sets.html_safe unless @test_sets.blank? %>],
|
||||
'<%= @had_test_count %>',
|
||||
'<%= @test_sets_count %>',
|
||||
'<%= @had_passed_testsests_error_count %>',
|
||||
'<%= @test_sets_hidden_count %>',
|
||||
'<%= @test_sets_public_count %>',
|
||||
'<%= @had_passed_testsests_hidden_count %>',
|
||||
'<%= @had_passed_testsests_public_count %>',
|
||||
'<%= @final_score %>',
|
||||
[<%= @latest_output.html_safe unless @latest_output.blank? %>],
|
||||
'<%= @language %>'
|
||||
);
|
||||
$("#blacktab_nav_1").trigger("click");
|
||||
});
|
||||
|
||||
|
||||
/* var bt = baidu.template;
|
||||
bt.LEFT_DELIMITER = '<!';
|
||||
bt.RIGHT_DELIMITER = '!>';
|
||||
bt.ESCAPE = false;
|
||||
$(function(){
|
||||
// console.log("<%#= @public_test_sets.join(',').html_safe %>");
|
||||
var html = bt('t:exec_results_1',{
|
||||
test_sets: [<%= @test_sets.html_safe unless @test_sets.blank? %>],
|
||||
test_sets: [<%#= @test_sets.html_safe unless @test_sets.blank? %>],
|
||||
// hide_test_sets: [<%#= @private_test_sets.html_safe unless @private_test_sets.blank? %>]
|
||||
had_test_count: '<%= @had_test_count %>',
|
||||
test_sets_count: '<%= @test_sets_count %>',
|
||||
had_passed_testsests_error_count: '<%= @had_passed_testsests_error_count %>',
|
||||
test_sets_hidden_count : '<%= @test_sets_hidden_count %>',
|
||||
test_sets_public_count: '<%= @test_sets_public_count %>',
|
||||
had_passed_testsests_hidden_count: '<%= @had_passed_testsests_hidden_count %>',
|
||||
had_passed_testsests_public_count: '<%= @had_passed_testsests_public_count %>',
|
||||
final_score: '<%= @final_score %>',
|
||||
had_done: '<%= @had_done %>',
|
||||
latest_output: [<%= @latest_output.html_safe unless @latest_output.blank? %>],
|
||||
language: '<%= @language %>'
|
||||
had_test_count: '<%#= @had_test_count %>',
|
||||
test_sets_count: '<%#= @test_sets_count %>',
|
||||
had_passed_testsests_error_count: '<%#= @had_passed_testsests_error_count %>',
|
||||
test_sets_hidden_count : '<%#= @test_sets_hidden_count %>',
|
||||
test_sets_public_count: '<%#= @test_sets_public_count %>',
|
||||
had_passed_testsests_hidden_count: '<%#= @had_passed_testsests_hidden_count %>',
|
||||
had_passed_testsests_public_count: '<%#= @had_passed_testsests_public_count %>',
|
||||
final_score: '<%#= @final_score %>',
|
||||
had_done: '<%#= @had_done %>',
|
||||
latest_output: [<%#= @latest_output.html_safe unless @latest_output.blank? %>],
|
||||
language: '<%#= @language %>'
|
||||
}
|
||||
);
|
||||
$("#game_test_set_results").html(html);
|
||||
$("#blacktab_nav_1").trigger("click");
|
||||
});
|
||||
});*/
|
||||
|
||||
|
||||
// 公开的测试集允许展开与隐藏
|
||||
function toggle_test_case(t_case, id){
|
||||
if(true){
|
||||
var nTest = $("#test_case_"+id).prev(".-task-ces-top").children("i:first-child"); //图标节点
|
||||
if (nTest.hasClass("fa-caret-down")){
|
||||
nTest.addClass("fa-caret-right");
|
||||
nTest.removeClass("fa-caret-down");
|
||||
}else if( nTest.hasClass("fa-caret-right") ){
|
||||
nTest.addClass("fa-caret-down");
|
||||
nTest.removeClass("fa-caret-right");
|
||||
}
|
||||
$("#test_case_"+id).toggle();
|
||||
}
|
||||
}
|
||||
function g_new(o){return document.getElementById(o);}
|
||||
function HoverLi(n){
|
||||
for(var i=1;i<=3;i++){
|
||||
|
|
@ -171,14 +184,5 @@
|
|||
* addClassName---------------点击tab需要添加的样式类
|
||||
* item-----------------------点击的当前tab元素
|
||||
* */
|
||||
function check_tab(allClassName,addClassName,item){
|
||||
//点击tab添加样式
|
||||
$("."+allClassName).removeClass(addClassName);
|
||||
$(item).addClass(addClassName);
|
||||
//获取当前点击的tab的索引位置
|
||||
var index=$(item).index()+1;
|
||||
//显示或隐藏对应的内容块
|
||||
$("#"+allClassName+"_"+index).siblings().addClass("undis");
|
||||
$("#"+allClassName+"_"+index).removeClass("undis");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
<a href="javascript:void(0);" class="tab_type" style="font-size: 16px">背景知识</a>
|
||||
</li>
|
||||
<% unless @game_challenge.answer.blank? %>
|
||||
<li id="tab_nav_3">
|
||||
<li id="tab_nav_3" onclick="open_answer('<%= @game.identifier %>', '<%= @myshixun.identifier %>')">
|
||||
<a href="javascript:void(0);" class="tab_type" style="font-size: 16px">参考答案</a>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
@ -68,10 +68,10 @@
|
|||
<%= render :partial => "games/shixun_comment_block" %>
|
||||
<li class="fl mt10 ml20"><a href="javascript:void(0);" onclick="send_dis_to_shixun()" class="course-bth-blue color_white">发送</a></li>
|
||||
<li class="fl ml20 mt15">
|
||||
<span title="<%= @praise.nil? ? "点赞" : "取消点赞" %>" onclick="game_praise()" id="game_praise_tread" class="pt5 color-grey mr20">
|
||||
<span title="<%= @praise.nil? ? "点赞" : "取消点赞" %>" onclick="game_praise('<%= @game_challenge.id %>', '<%= @game_challenge.class %>')" id="game_praise_tread" class="pt5 color-grey mr20">
|
||||
<i class="fa fa-thumbs-up font-20 mr3 <%= @praise.nil? ? "" : "color-light-green" %>" alt="赞" ></i><span class="font-12 font-bd" id="game_praise_count"><%= @praise_count %></span>
|
||||
</span>
|
||||
<span title="<%= @tread.nil? ? "踩" : "取消踩" %>" onclick="game_tread()" id="game_tread" class="color-grey" style="padding-top:7px;">
|
||||
<span title="<%= @tread.nil? ? "踩" : "取消踩" %>" onclick="game_tread('<%= @game_challenge.id %>')" id="game_tread" class="color-grey" style="padding-top:7px;">
|
||||
<i class="fa fa-thumbs-down font-20 mr3 <%= @tread.nil? ? "" : "color-orange" %>" ></i><span class="font-12 font-bd" id="game_tread_count"><%= @tread_count %></span>
|
||||
</span>
|
||||
</li>
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
<% if @st != 0 %>
|
||||
<!-- 单选多选题 -->
|
||||
<%= render :partial => "games/choice_question" %>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<!-- 编程题 -->
|
||||
<div class="-layout -stretch -fit -vertical centerH">
|
||||
<div class="-layout -vertical -flex -relative -bg-black -flex-basic70" id="games_repository_contents" style="overflow:hidden;">
|
||||
|
|
@ -120,90 +120,12 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
//拖拽增加js
|
||||
$(function(){
|
||||
var doc = $(document);
|
||||
var lab = $(".b-label");
|
||||
var cen = $(".h-center");
|
||||
var nextW2,nextW1;
|
||||
var dragging = false;
|
||||
var flag = false;
|
||||
var wrapWidth;
|
||||
var wrapHeight;
|
||||
lab.bind('mousedown',function(){
|
||||
dragging = true;
|
||||
leftOffset = $(".labelN").offset().left;
|
||||
wrapWidth = $(".labelN").width();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
cen.bind('mousedown',function(){
|
||||
flag = true;
|
||||
topOffset = $(".centerH").offset().top;
|
||||
wrapHeight = $(".centerH").height();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
doc.bind('mousemove',function(e){
|
||||
function error_correction_pop(){
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'games/send_error_pop') %>";
|
||||
pop_box_new(htmlvalue,460,316);
|
||||
$("#popupWrap").addClass("user_bg_shadow");
|
||||
};
|
||||
|
||||
$(".-brother").show();// 代码行的遮罩显示
|
||||
if(dragging) {
|
||||
clickX = e.pageX;
|
||||
|
||||
if(clickX > leftOffset+300&&clickX<leftOffset+1600) {
|
||||
//console.log(1);
|
||||
lab.css('left', clickX - 7 - leftOffset + 'px');
|
||||
lab.prev().width( clickX-leftOffset + 'px');
|
||||
nextW2 = clickX-leftOffset;
|
||||
lab.next().width( wrapWidth - nextW2 + 'px');
|
||||
//console.log(lab.next().width());
|
||||
} else {
|
||||
lab.css('left', '0px');
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
clickY = e.pageY;
|
||||
if(clickY > topOffset+100) {
|
||||
cen.css('top', clickY - 7 - topOffset + 'px');
|
||||
cen.prev().height( clickY-topOffset + 'px');
|
||||
nextW1 = clickY-topOffset;
|
||||
cen.next().height( wrapHeight - nextW1 + 'px');
|
||||
var h = $("#games_repository_contents").height() - $("#top_repository").height() - 50;
|
||||
$("#game_webssh").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("max-height", h);
|
||||
// return h;
|
||||
|
||||
|
||||
console.log( $("#game_webssh").find($contentDocument));
|
||||
// console.log($("#term").height());
|
||||
// $("#term").find(".xterm-viewport").css("min-height", h);
|
||||
// $("#term").find(".xterm-viewport").css("max-height", h);
|
||||
// console.log(1);
|
||||
// console.log($("#game_webssh").find(".xterm-viewport"));
|
||||
} else {
|
||||
cen.css('top', '0px');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
doc.mouseup(function(e) {
|
||||
flag = false;
|
||||
dragging = false;
|
||||
e.cancelBubble = true;
|
||||
$(".-brother").hide(); // 代码行的遮罩隐藏
|
||||
});
|
||||
})
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* var myMirror = $("#game_answer_show")[0];
|
||||
var myCodeMirror = CodeMirror(myMirror, {
|
||||
value: $("#hidden_game_answer").text(),
|
||||
mode: "<%#= @language %>",
|
||||
readOnly: "nocursor", //只读
|
||||
//cursorBlinkRate: -1, //隐藏光标
|
||||
autofocus: true,
|
||||
border: 0
|
||||
});*/
|
||||
$(document).ready(function() {
|
||||
editormd.loadKaTeX(function() {
|
||||
var wordsView;
|
||||
|
|
@ -223,84 +145,8 @@ $(function(){
|
|||
sequenceDiagram: true // 默认不解析
|
||||
});
|
||||
});
|
||||
/* myCodeMirror.setSize("auto", "auto");//设置版本库codemirror的高度
|
||||
$("#game_answer_show").find(".CodeMirror-scroll").css("margin-bottom", 0);
|
||||
$("#game_answer_show" ).children(".CodeMirror").css("line-height", 1.2);
|
||||
$("#game_answer_show").children().css("border", 0);*/
|
||||
/* // 设置图片最大宽度不能超出边框
|
||||
$('#task_pass_contents').find('img').css("max-width", "100%");*/
|
||||
|
||||
});
|
||||
$("#tab_nav_3").click(function(){
|
||||
$.ajax({
|
||||
url: "<%= answer_myshixun_game_path(@game, :myshixun_id => @myshixun) %>",
|
||||
dataType: "script"
|
||||
});
|
||||
});
|
||||
function error_correction_pop(){
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'games/send_error_pop') %>";
|
||||
pop_box_new(htmlvalue,460,316);
|
||||
$("#popupWrap").addClass("user_bg_shadow");
|
||||
};
|
||||
|
||||
// 点赞/取消点赞功能
|
||||
var praiseStatus = <%= @praise.nil? ? false : true %>; // 是否点赞
|
||||
var treadStatus = <%= @tread.nil? ? false : true %>; // 是否踩
|
||||
var h = true;
|
||||
function game_praise(){
|
||||
if(treadStatus){
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: '<%= praise_tread_praise_plus_path({:obj_id => @game_challenge.id, :obj_type => @game_challenge.class}) %>',
|
||||
data: {horizontal: h, game_praise: true},
|
||||
success:function(data){
|
||||
h = !h;
|
||||
var praise_count = $("#game_praise_count");
|
||||
if(data.praise){
|
||||
praiseStatus = true; //已赞
|
||||
praise_count.html(data.praise_tread_count);
|
||||
$("#game_praise_tread").children("i").addClass("color-light-green");
|
||||
$("#game_praise_tread").attr("title", "取消点赞")
|
||||
}else{
|
||||
praiseStatus = false; //取消赞
|
||||
praise_count.html(data.praise_tread_count);
|
||||
$("#game_praise_tread").children("i").removeClass("color-light-green");
|
||||
$("#game_praise_tread").attr("title", "点赞")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// 踩/取消踩功能
|
||||
var d = true;
|
||||
function game_tread(){
|
||||
if(praiseStatus){
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: '<%= praise_tread_praise_plus_path({:obj_id => @game_challenge.id, :obj_type => "ChallengeTread"}) %>',
|
||||
data: {horizontal: d, game_praise: true},
|
||||
success:function(data){
|
||||
d = !d;
|
||||
var tread_count = $("#game_tread_count");
|
||||
if(data.praise){
|
||||
treadStatus = true; // 取消踩
|
||||
tread_count.html(data.praise_tread_count);
|
||||
$("#game_tread").children("i").addClass("color-orange");
|
||||
$("#game_tread").attr("title", "取消踩")
|
||||
}else{
|
||||
treadStatus = false; // 已踩
|
||||
tread_count.html(data.praise_tread_count);
|
||||
$("#game_tread").children("i").removeClass("color-orange");
|
||||
$("#game_tread").attr("title", "踩")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function reply_to_dis(id, name){
|
||||
$("#comment_news").attr("placeholder", "回复"+name+":");
|
||||
$("#dis_reply_id").val(id);
|
||||
$("#comment_news").focus();
|
||||
}
|
||||
</script>
|
||||
|
|
@ -61,26 +61,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
function g_l(o){return document.getElementById(o);}
|
||||
function HoverLi_new(n){
|
||||
for(var i=1;i<=2;i++){
|
||||
g_l('codetab_nav_'+i).className='blacktab_nomal';
|
||||
g_l('codetab_con_'+i).className='undis';
|
||||
|
||||
}
|
||||
if(n==2){
|
||||
$("#games_repository_contents").removeClass("-bg-black").addClass("-bg-weightblack");
|
||||
$("#-bg-change-color").removeClass("-bg-black").addClass("-bg-weightblack");
|
||||
}else{
|
||||
$("#games_repository_contents").removeClass("-bg-weightblack").addClass("-bg-black");
|
||||
$("#-bg-change-color").removeClass("-bg-weightblack").addClass("-bg-black");
|
||||
}
|
||||
g_l('codetab_con_'+n).className='dis -relative';
|
||||
g_l('codetab_nav_'+n).className='blacktab_hover';
|
||||
};
|
||||
<% if @myshixun.shixun.try(:webssh) %>
|
||||
$('#codetab_nav_2').on("click", function(){
|
||||
$.ajax({
|
||||
|
|
@ -89,19 +71,17 @@
|
|||
if(data.error){
|
||||
return;
|
||||
}else{
|
||||
var lHeight = $.browser.mozilla ? 19 : 18; //火狐浏览器行高为19,其他浏览器的位18
|
||||
var h = $("#games_repository_contents").height() - $("#top_repository").height() - 10;
|
||||
var rows = parseInt(h / 18);
|
||||
$("#game_webssh").css("min-height", h);
|
||||
var rows = parseInt(h / lHeight);
|
||||
// 测试版
|
||||
var html = "<iframe src='<%= Redmine::Configuration['webssh'] %>/?Host=" + data.host + "&Port=" + data.port + "&Username=" + data.username + "&Password=" + data.password + "&Gameid=" + data.game_id + "&rows=" + rows + "'" + " style='width:100%;border:0;' scrolling='no' id='game_webssh'></iframe><div class='-brother undis'></div>";
|
||||
// 本地版
|
||||
var html_local ="<iframe src='http://127.0.0.1:9527?Host=106.75.96.108&Port=40054&Username=root&Password=123123&Gameid=" +data.game_id + "&rows=" + rows + "'" + " style='width:100%;border:0;' scrolling='no' id='game_webssh'></iframe><div class='-brother undis'></div>";
|
||||
$("#codetab_con_2").html(html);
|
||||
|
||||
$("#game_webssh").css("min-height", h);
|
||||
HoverLi_new(2);
|
||||
// console.log( $("#game_webssh").contentDocument.body.height());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -19,71 +19,4 @@
|
|||
notice_sure_box("实训更新啦,系统已自动为您重置");
|
||||
<% end %>
|
||||
});
|
||||
var control = 0; // 版本库控制 0表示点击放大 1表示点击缩小
|
||||
var control_1 = 0; // 测评控制 0表示点击放大 1表示点击缩小
|
||||
var nGameRes = $("#games_repository_contents"); // 版本库区域
|
||||
var nGameEva = $("#games_valuation_contents"); // 评测区域
|
||||
var nRIcon = $("#extend_and_zoom").children("i"); // 版本库放大缩小按钮
|
||||
var nCode = $("#file_entry_content").find(".CodeMirror-scroll"); // 版本库代码区域
|
||||
var nVIcon = $("#valuation_extend_and_zoom").children("i"); // 评测放大缩小
|
||||
var nMove = $(".h-center");
|
||||
|
||||
/* --------------------------------版本库的放大与缩小---------------------------------------------*/
|
||||
function repository_extend_and_zoom(){
|
||||
if(control == 0){
|
||||
nGameRes.addClass("-flex-basic100");
|
||||
nGameEva.addClass("-flex-basic0");
|
||||
nRIcon.addClass("fa-compress");
|
||||
nRIcon.removeClass("fa-arrows-alt");
|
||||
nMove.hide();
|
||||
control = 1;
|
||||
}else if(control == 1){
|
||||
nGameRes.removeClass("-flex-basic100");
|
||||
nGameEva.removeClass("-flex-basic0");
|
||||
nRIcon.removeClass("fa-compress");
|
||||
nRIcon.addClass("fa-arrows-alt");
|
||||
nMove.show();
|
||||
control = 0;
|
||||
}
|
||||
editor_CodeMirror.setSize("auto", "auto");
|
||||
var h = nGameRes.height() - $("#top_repository").height() - 50;
|
||||
nCode.css("min-height", h);
|
||||
}
|
||||
|
||||
/* --------------------------------测评的扩大与缩小---------------------------------------------*/
|
||||
function valuation_extend_and_zoom(){
|
||||
if(control_1 == 0){
|
||||
nGameRes.addClass("-flex-basic0");
|
||||
nGameEva.addClass("-flex-basic100");
|
||||
nVIcon.removeClass("fa-expand");
|
||||
nVIcon.addClass("fa-compress");
|
||||
nMove.hide();
|
||||
control_1 = 1;
|
||||
}else if(control_1 == 1){
|
||||
nGameRes.removeClass("-flex-basic0");
|
||||
nGameEva.removeClass("-flex-basic100");
|
||||
nVIcon.addClass("fa-expand");
|
||||
nVIcon.removeClass("fa-compress");
|
||||
nMove.show();
|
||||
control_1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------点击全部任务向右侧展开-----------------------------------------*/
|
||||
$("#all_task_show").on("click", function(e){
|
||||
c = 0;
|
||||
$("#all_task_tab").removeClass('leftnav-active');
|
||||
$("#all_task_show").css("background","rgba(0,0,0,0)");
|
||||
$("#all_task_index").css("left", 0).stop().animate({
|
||||
left: "-505px"
|
||||
}, 400, function(){
|
||||
$("#all_task_show").hide();
|
||||
fadein = 0;
|
||||
});
|
||||
});
|
||||
// 列表区域阻止事件冒泡
|
||||
$("#all_task_index").on("click", function(e){
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -10,13 +10,13 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/font-awesome','css/taskstyle', 'css/project','css/popup','repository','css/gantt','css/cssPlus-v.0.2-build', 'css/edu-common','css/edu-public', 'css/edu-popup', 'css/edu-tooltipster' %>
|
||||
<%= javascript_include_tag 'edu/application' %>
|
||||
<%= javascript_include_tag 'edu/application', 'edu/edu_tpi' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<!--add by huang-->
|
||||
<body onload="prettyPrint();">
|
||||
<body onload="setupAjaxIndicator();">
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="page -layout-v -fit ">
|
||||
|
|
@ -52,11 +52,12 @@
|
|||
</div>
|
||||
<%= yield %>
|
||||
</div>
|
||||
<!--<div id="ajax-indicator" style="display:none;">
|
||||
<span><%#= l(:label_loading) %></span>
|
||||
|
||||
<div id="ajax-indicator-base" style="display:none;">
|
||||
<!--<span><embed src='/images/bigdata/loading2.svg' /></span>-->
|
||||
</div>
|
||||
|
||||
<div id="ajax-modal" style="display:none;"></div>-->
|
||||
<!--<div id="ajax-modal" style="display:none;"></div>-->
|
||||
</body>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
|
|
|
|||
|
|
@ -2,4 +2,12 @@ $("#shixun_comment_block").replaceWith("<%= j(render :partial => "games/shixun_c
|
|||
$(".-tab-nav li").removeClass("tab_hover");
|
||||
$('#tab_nav_4').addClass("tab_hover");
|
||||
$(".tab-info").hide();
|
||||
$('#tab_con_4').show().html("<%= j(render :partial => "games/shixun_comment_list") %>");
|
||||
$('#tab_con_4').show().html("<%= j(render :partial => "games/shixun_comment_list") %>");
|
||||
|
||||
// 评论区域的回复按钮
|
||||
function reply_to_dis(id, name){
|
||||
$("#comment_news").attr("placeholder", "回复"+name+":");
|
||||
$("#dis_reply_id").val(id);
|
||||
$("#comment_news").focus();
|
||||
}
|
||||
// end
|
||||
|
|
@ -672,29 +672,29 @@ function setupHeartBeat(){
|
|||
}
|
||||
|
||||
function setupAjaxIndicator() {
|
||||
$('#ajax-indicator').bind('ajaxSend', function(event, xhr, settings) {
|
||||
if(settings && settings.url && settings.url.match(/account\/heartbeat$/)){
|
||||
return;
|
||||
}
|
||||
//模拟实训时,加载效果不显示
|
||||
if (settings && settings.url && settings.url.match(/operation/)){
|
||||
return;
|
||||
}
|
||||
if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') {
|
||||
$('#ajax-indicator').show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#ajax-indicator').bind('ajaxStop', function() {
|
||||
$('#ajax-indicator').hide();
|
||||
if(MathJax && MathJax.Hub)
|
||||
MathJax.Hub.Queue(['Typeset', MathJax.Hub]); //如果是ajax刷新页面的话,手动执行MathJax的公式显示
|
||||
try{
|
||||
prettyPrint(); //如果刷新出来的页面如果存在代码行的话,也需要美化
|
||||
}catch (e){
|
||||
$('#ajax-indicator').bind('ajaxSend', function(event, xhr, settings) {
|
||||
if(settings && settings.url && settings.url.match(/account\/heartbeat$/)){
|
||||
return;
|
||||
}
|
||||
//模拟实训时,加载效果不显示
|
||||
if (settings && settings.url && settings.url.match(/operation/)){
|
||||
return;
|
||||
}
|
||||
if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') {
|
||||
$('#ajax-indicator').show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
$('#ajax-indicator').bind('ajaxStop', function() {
|
||||
$('#ajax-indicator').hide();
|
||||
if(MathJax && MathJax.Hub)
|
||||
MathJax.Hub.Queue(['Typeset', MathJax.Hub]); //如果是ajax刷新页面的话,手动执行MathJax的公式显示
|
||||
try{
|
||||
prettyPrint(); //如果刷新出来的页面如果存在代码行的话,也需要美化
|
||||
}catch (e){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function hideOnLoad() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,534 @@
|
|||
// 实训游戏需要的js功能
|
||||
var EXPAND = 0; // 放大
|
||||
var SHRINK = 1; // 缩小
|
||||
$(function(){
|
||||
// TPI拖拽功能 begin
|
||||
var doc = $(document);
|
||||
var lab = $(".b-label");
|
||||
var cen = $(".h-center");
|
||||
var nextW2,nextW1;
|
||||
var dragging = false;
|
||||
var flag = false;
|
||||
var wrapWidth;
|
||||
var wrapHeight;
|
||||
lab.bind('mousedown',function(){
|
||||
dragging = true;
|
||||
leftOffset = $(".labelN").offset().left;
|
||||
wrapWidth = $(".labelN").width();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
cen.bind('mousedown',function(){
|
||||
flag = true;
|
||||
topOffset = $(".centerH").offset().top;
|
||||
wrapHeight = $(".centerH").height();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
doc.bind('mousemove',function(e){
|
||||
|
||||
$(".-brother").show();// 代码行的遮罩显示
|
||||
if(dragging) {
|
||||
clickX = e.pageX;
|
||||
if(clickX > leftOffset+300&&clickX<leftOffset+1600) {
|
||||
//console.log(1);
|
||||
lab.css('left', clickX - 7 - leftOffset + 'px');
|
||||
lab.prev().width( clickX-leftOffset + 'px');
|
||||
nextW2 = clickX-leftOffset;
|
||||
lab.next().width( wrapWidth - nextW2 + 'px');
|
||||
//console.log(lab.next().width());
|
||||
} else {
|
||||
lab.css('left', '0px');
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
clickY = e.pageY;
|
||||
if(clickY > topOffset+100) {
|
||||
cen.css('top', clickY - 7 - topOffset + 'px');
|
||||
cen.prev().height( clickY-topOffset + 'px');
|
||||
nextW1 = clickY-topOffset;
|
||||
cen.next().height( wrapHeight - nextW1 + 'px');
|
||||
var h = $("#games_repository_contents").height() - $("#top_repository").height() - 50;
|
||||
$("#game_webssh").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("max-height", h);
|
||||
} else {
|
||||
cen.css('top', '0px');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
doc.mouseup(function(e) {
|
||||
flag = false;
|
||||
dragging = false;
|
||||
e.cancelBubble = true;
|
||||
$(".-brother").hide(); // 代码行的遮罩隐藏
|
||||
});
|
||||
// end;
|
||||
|
||||
// 评论区域的回复按钮
|
||||
function reply_to_dis(id, name){
|
||||
$("#comment_news").attr("placeholder", "回复"+name+":");
|
||||
$("#dis_reply_id").val(id);
|
||||
$("#comment_news").focus();
|
||||
}
|
||||
// end
|
||||
|
||||
// 点击全部任务向右侧展开
|
||||
$("#all_task_show").on("click", function(e){
|
||||
c = 0;
|
||||
$("#all_task_tab").removeClass('leftnav-active');
|
||||
$("#all_task_show").css("background","rgba(0,0,0,0)");
|
||||
$("#all_task_index").css("left", 0).stop().animate({
|
||||
left: "-505px"
|
||||
}, 400, function(){
|
||||
$("#all_task_show").hide();
|
||||
fadein = 0;
|
||||
});
|
||||
});
|
||||
// end
|
||||
|
||||
// 列表区域阻止事件冒泡
|
||||
$("#all_task_index").on("click", function(e){
|
||||
e.stopPropagation();
|
||||
});
|
||||
// end
|
||||
|
||||
// 下一关增加loading效果
|
||||
$("#next_step").live("click", function(){
|
||||
nNext = $("#code_estimate");
|
||||
html = "<a href='javascript:void(0);' class='task-btn mr15 mt8'>下一关<img src='/images/bigdata/loading2.svg' style='width:25px;float:left;margin-top: 3px' /></a>";
|
||||
nNext.html(html);
|
||||
});
|
||||
// end
|
||||
|
||||
});
|
||||
|
||||
// 查看参考答案
|
||||
function open_answer(game, myshixun){
|
||||
$.ajax({
|
||||
url: "/myshixuns/" + myshixun + "/stages/" + game + "/answer",
|
||||
dataType: "script"
|
||||
})
|
||||
}
|
||||
|
||||
// 代码/webssh的tab点击事件
|
||||
function g_l(o){return document.getElementById(o);}
|
||||
function HoverLi_new(n){
|
||||
for(var i=1;i<=2;i++){
|
||||
g_l('codetab_nav_'+i).className='blacktab_nomal';
|
||||
g_l('codetab_con_'+i).className='undis';
|
||||
|
||||
}
|
||||
if(n==2){
|
||||
$("#games_repository_contents").removeClass("-bg-black").addClass("-bg-weightblack");
|
||||
$("#-bg-change-color").removeClass("-bg-black").addClass("-bg-weightblack");
|
||||
}else{
|
||||
$("#games_repository_contents").removeClass("-bg-weightblack").addClass("-bg-black");
|
||||
$("#-bg-change-color").removeClass("-bg-weightblack").addClass("-bg-black");
|
||||
}
|
||||
g_l('codetab_con_'+n).className='dis -relative';
|
||||
g_l('codetab_nav_'+n).className='blacktab_hover';
|
||||
};
|
||||
|
||||
|
||||
// 选择题选择答案
|
||||
function choice_answer(st, nThis){
|
||||
if(st == "1"){
|
||||
//$(nThis).hasClass("card-check") ? $(nThis).removeClass("card-check") : $(nThis).addClass("card-check");
|
||||
$(nThis).toggleClass("card-check");
|
||||
$(nThis).toggleClass("color_white");
|
||||
} else if (st == "2"){
|
||||
var choice = $(".color_white");
|
||||
choice.removeClass("card-check");
|
||||
choice.removeClass("color_white");
|
||||
$(nThis).addClass("card-check");
|
||||
$(nThis).toggleClass("color_white");
|
||||
}
|
||||
}
|
||||
// end
|
||||
|
||||
// 评测区域点击TAB切换样式
|
||||
function check_tab(allClassName,addClassName,item){
|
||||
//点击tab添加样式
|
||||
$("."+allClassName).removeClass(addClassName);
|
||||
$(item).addClass(addClassName);
|
||||
//获取当前点击的tab的索引位置
|
||||
var index=$(item).index()+1;
|
||||
//显示或隐藏对应的内容块
|
||||
$("#"+allClassName+"_"+index).siblings().addClass("undis");
|
||||
$("#"+allClassName+"_"+index).removeClass("undis");
|
||||
}
|
||||
// end
|
||||
|
||||
// 公开的测试集允许展开与隐藏
|
||||
function toggle_test_case(t_case, id){
|
||||
if(true){
|
||||
var nTest = $("#test_case_"+id).parent().prev(".-task-ces-top").children("i:first-child"); //图标节点
|
||||
console.log(nTest);
|
||||
if (nTest.hasClass("fa-caret-down")){
|
||||
nTest.addClass("fa-caret-right");
|
||||
nTest.removeClass("fa-caret-down");
|
||||
}else if( nTest.hasClass("fa-caret-right") ){
|
||||
nTest.addClass("fa-caret-down");
|
||||
nTest.removeClass("fa-caret-right");
|
||||
}
|
||||
$("#test_case_"+id).toggle();
|
||||
}
|
||||
}
|
||||
// end
|
||||
|
||||
// codemirror渲染textarea
|
||||
function CodeMirror_fromTextArea(id){
|
||||
var Code = CodeMirror.fromTextArea(document.getElementById(id), {
|
||||
/* mode: {name: "text/x-c++src",
|
||||
// version: 2,
|
||||
singleLineStringErrors: false},*/ // 目前补全js是引入的javascript-hint,因此目前不能指定语言
|
||||
lineNumbers: true,
|
||||
theme: "railscasts",
|
||||
// extraKeys: {"Ctrl-Q": "autocomplete"}, // 快捷键
|
||||
indentUnit: 4, //代码缩进为一个tab的距离
|
||||
matchBrackets: true,
|
||||
autoRefresh: true,
|
||||
smartIndent: true,//智能换行
|
||||
extraKeys: {"Ctrl-Q": "autocomplete"},
|
||||
autofocus: true,
|
||||
styleActiveLine: true,
|
||||
lint: true,
|
||||
gutters: ["CodeMirror-linenumbers", "breakpoints"]
|
||||
});
|
||||
return Code;
|
||||
}
|
||||
// end
|
||||
|
||||
var control = 0; // 版本库控制 0表示点击放大 1表示点击缩小
|
||||
var control_1 = 0; // 测评控制 0表示点击放大 1表示点击缩小
|
||||
// 版本库的放大与缩小
|
||||
function repository_extend_and_zoom(){
|
||||
var nGameRes = $("#games_repository_contents"); // 版本库区域
|
||||
var nGameEva = $("#games_valuation_contents"); // 评测区域
|
||||
var nRIcon = $("#extend_and_zoom").children("i"); // 版本库放大缩小按钮
|
||||
var nCode = $("#file_entry_content").find(".CodeMirror-scroll"); // 版本库代码区域
|
||||
var nMove = $(".h-center");
|
||||
if(control == 0){
|
||||
nGameRes.addClass("-flex-basic100");
|
||||
nGameEva.addClass("-flex-basic0");
|
||||
nRIcon.addClass("fa-compress");
|
||||
nRIcon.removeClass("fa-arrows-alt");
|
||||
nMove.hide();
|
||||
control = 1;
|
||||
}else if(control == 1){
|
||||
nGameRes.removeClass("-flex-basic100");
|
||||
nGameEva.removeClass("-flex-basic0");
|
||||
nRIcon.removeClass("fa-compress");
|
||||
nRIcon.addClass("fa-arrows-alt");
|
||||
nMove.show();
|
||||
control = 0;
|
||||
}
|
||||
editor_CodeMirror.setSize("auto", "auto");
|
||||
var h = nGameRes.height() - $("#top_repository").height() - 50;
|
||||
nCode.css("min-height", h);
|
||||
}
|
||||
// end
|
||||
|
||||
// 测评的扩大与缩小
|
||||
function valuation_extend_and_zoom(){
|
||||
var nGameRes = $("#games_repository_contents"); // 版本库区域
|
||||
var nGameEva = $("#games_valuation_contents"); // 评测区域
|
||||
var nVIcon = $("#valuation_extend_and_zoom").children("i"); // 评测放大缩小
|
||||
var nMove = $(".h-center");
|
||||
if(control_1 == 0){
|
||||
nGameRes.addClass("-flex-basic0");
|
||||
nGameEva.addClass("-flex-basic100");
|
||||
nVIcon.removeClass("fa-expand");
|
||||
nVIcon.addClass("fa-compress");
|
||||
nMove.hide();
|
||||
control_1 = 1;
|
||||
}else if(control_1 == 1){
|
||||
nGameRes.removeClass("-flex-basic0");
|
||||
nGameEva.removeClass("-flex-basic100");
|
||||
nVIcon.addClass("fa-expand");
|
||||
nVIcon.removeClass("fa-compress");
|
||||
nMove.show();
|
||||
control_1 = 0;
|
||||
}
|
||||
}
|
||||
// end
|
||||
|
||||
// 点赞与取消点赞
|
||||
var h = true;
|
||||
function game_praise(obj_id, obj_type){
|
||||
if(treadStatus){
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: "/praise_tread/praise_plus?obj_id=" + obj_id + "&obj_type=" + obj_type,
|
||||
data: {horizontal: h, game_praise: true},
|
||||
success:function(data){
|
||||
h = !h;
|
||||
var praise_count = $("#game_praise_count");
|
||||
if(data.praise){
|
||||
praiseStatus = true; //已赞
|
||||
praise_count.html(data.praise_tread_count);
|
||||
$("#game_praise_tread").children("i").addClass("color-light-green");
|
||||
$("#game_praise_tread").attr("title", "取消点赞")
|
||||
}else{
|
||||
praiseStatus = false; //取消赞
|
||||
praise_count.html(data.praise_tread_count);
|
||||
$("#game_praise_tread").children("i").removeClass("color-light-green");
|
||||
$("#game_praise_tread").attr("title", "点赞")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// 踩/取消踩功能
|
||||
var d = true;
|
||||
function game_tread(obj_id){
|
||||
if(praiseStatus){
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: "/praise_tread/praise_plus?obj_id=" + obj_id + "&obj_type=ChallengeTread",
|
||||
data: {horizontal: d, game_praise: true},
|
||||
success:function(data){
|
||||
d = !d;
|
||||
var tread_count = $("#game_tread_count");
|
||||
if(data.praise){
|
||||
treadStatus = true; // 取消踩
|
||||
tread_count.html(data.praise_tread_count);
|
||||
$("#game_tread").children("i").addClass("color-orange");
|
||||
$("#game_tread").attr("title", "取消踩")
|
||||
}else{
|
||||
treadStatus = false; // 已踩
|
||||
tread_count.html(data.praise_tread_count);
|
||||
$("#game_tread").children("i").removeClass("color-orange");
|
||||
$("#game_tread").attr("title", "踩");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// end
|
||||
|
||||
|
||||
|
||||
function setupAjaxIndicatorBase() {
|
||||
console.log(1);
|
||||
console.log($('#ajax-indicator-base').length);
|
||||
$('#ajax-indicator-base').bind('ajaxSend', function(event, xhr, settings) {
|
||||
console.log($('.ajax-loading'));
|
||||
if(settings && settings.url
|
||||
&& (settings.url.match(/account\/heartbeat$/)
|
||||
|| settings.url.match(/file_update/)
|
||||
|| settings.url.match(/game_build/)
|
||||
|| settings.url.match(/game_status/)
|
||||
|| settings.url.match(/refresh_game_list/)
|
||||
|| settings.url.match(/next_step/)
|
||||
|| settings.url.match(/open_webssh/)
|
||||
)){
|
||||
return;
|
||||
}
|
||||
if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') {
|
||||
$('#ajax-indicator-base').show().html("<span><embed src='/images/bigdata/loading2.svg' /></span>");
|
||||
}
|
||||
});
|
||||
|
||||
$('#ajax-indicator-base').bind('ajaxStop', function() {
|
||||
$('#ajax-indicator-base').html("").hide();
|
||||
if(MathJax && MathJax.Hub)
|
||||
MathJax.Hub.Queue(['Typeset', MathJax.Hub]); //如果是ajax刷新页面的话,手动执行MathJax的公式显示
|
||||
try{
|
||||
prettyPrint(); //如果刷新出来的页面如果存在代码行的话,也需要美化
|
||||
}catch (e){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(setupAjaxIndicatorBase);
|
||||
// test_sets:测试集;had_test_count:输出集的个数;test_sets_count:测试集的个数;had_passed_testsests_error_count:测试集报错数;test_sets_hidden_count:隐藏测试集的个数
|
||||
// test_sets_public_count:公开测试集的个人;had_passed_testsests_hidden_count:通过的隐藏集个数;had_passed_testsests_public_count:通过的公开测试集个数
|
||||
// final_score:最终得分;latest_output:最新的输出;language:实训的语言
|
||||
function code_evaluation(test_sets,
|
||||
had_test_count,
|
||||
test_sets_count,
|
||||
had_passed_testsests_error_count,
|
||||
test_sets_hidden_count,
|
||||
test_sets_public_count,
|
||||
had_passed_testsests_hidden_count,
|
||||
had_passed_testsests_public_count,
|
||||
final_score,
|
||||
latest_output,
|
||||
language
|
||||
) {
|
||||
//动态加载评测区域
|
||||
/**
|
||||
* Created by wang on 2017/8/9.
|
||||
*/
|
||||
|
||||
var $EffectDisplay , $b, $TestResult, $d, $e, $f, $g, $h, $EvaluationInformation , $n;
|
||||
// 第一块 效果显示
|
||||
$EffectDisplay = "<div id=\"blacktab_con_1\" class=\"\" ></div>";
|
||||
$b = "<div class=\"fit -scroll\">" +
|
||||
"<div class=\"-layout-v -fit\">" +
|
||||
"<div class=\"-flex -scroll task-padding16 loading-center undis\" id=\"html_ajax_loading\"></div>" +
|
||||
"<div class=\"-flex -scroll task-padding16\" id=\"html_contents\" style=\"background: #fff\">" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>";
|
||||
|
||||
if (language == "Html") {
|
||||
$EffectDisplay = "<div id=\"blacktab_con_1\" class=\"\" >"+$b+"</div>";
|
||||
}
|
||||
|
||||
//第二块 测试结果
|
||||
if (had_test_count != "0") {
|
||||
if (had_passed_testsests_error_count != "0") {
|
||||
$d = "<p class=\"-text-danger mb10\">" +
|
||||
"<i class=\"fa fa-exclamation-circle font-16\" ></i>" +
|
||||
" <span class=\"ml5 mr5 -text-danger\">" + had_passed_testsests_error_count + '/' + test_sets_count + "</span>" + latest_output + "</p>";
|
||||
|
||||
} else {
|
||||
$d = "<p class=\"color-light-green mb10\">" +
|
||||
"<i class=\"fa fa-check-circle font-16\" ></i>" +
|
||||
"<span class=\"ml5 mr5\">" + test_sets_count + "/" + test_sets_count + "</span> 全部通过</p>";
|
||||
}
|
||||
|
||||
}
|
||||
var $forHtml = "";
|
||||
var $Bear = "";
|
||||
for (var i = 0; i < test_sets.length; i++) {
|
||||
/* console.log("test_sets[" +i+"]" + test_sets[i].result);
|
||||
console.log("test_sets[" +i+"]" + test_sets[i].is_public);
|
||||
console.log("test_sets[" +i+"]" + test_sets[i].actual_output);
|
||||
console.log("test_sets[" +i+"]" + test_sets[i].output);
|
||||
console.log("test_sets[" +i+"]" + test_sets[i].input);*/
|
||||
if (test_sets[i].result == 0) {
|
||||
$g = "<i class=\"fa fa-exclamation-circle -text-danger fr mt8 ml5\" ></i>"
|
||||
}
|
||||
if (test_sets[i].result == 1) {
|
||||
$g = "<i class=\"fa fa-check-circle color-light-green fr mt8 ml5 font-16\" ></i>"
|
||||
}
|
||||
if (test_sets[i].is_public == 0) {
|
||||
$g = "<i class=\"fa fa-lock fr mt8\" ></i>"
|
||||
}
|
||||
if (test_sets[i].is_public == 1) {
|
||||
$h = "<div class=\"-task-ces-info undis\" id=\"test_case_" + i + "\">" +
|
||||
"<ul class=\"font-14\">" +
|
||||
"<li class=\"clearfix\">" +
|
||||
"<div class=\"clearfix\">" +
|
||||
"<span class=\"-task-ces-info-left color-blue fl fb\">测试输入:</span>" +
|
||||
"<p class=\"fl\">" + ( test_sets[i].input == null ? "空" : test_sets[i].input.replace(/\r\n/g, "<br>") ) + " </p>" +
|
||||
"</div>" +
|
||||
"</li>" +
|
||||
"<li class=\"clearfix\">" +
|
||||
"<div class=\"clearfix\">" +
|
||||
" <span class=\"-task-ces-info-left color-blue fl fb\">预期输出:</span>" +
|
||||
"<p class=\"fl\">" + ( test_sets[i].output == null ? "空" : test_sets[i].output.replace(/\r\n/g, "<br>") ) + "</p>" +
|
||||
"</div>" +
|
||||
"</li>" +
|
||||
"<li class=\"clearfix\">" +
|
||||
"<div class=\"clearfix\">" +
|
||||
"<span class=\"-task-ces-info-left color-blue fl fb\">实际输出:</span>" +
|
||||
"<p class=\"fl color-orange\">" + (test_sets[i].actual_output == null ? "空" : test_sets[i].actual_output.replace(/\r\n/g, "<br>")) + "</p>" +
|
||||
"</div>" +
|
||||
"</li>" +
|
||||
"</ul>" +
|
||||
"</div>";
|
||||
}
|
||||
if (test_sets[i].is_public == 0) {
|
||||
$h = "<div class=\"-task-ces-info undis\" id=\"test_case_" + i + "\">" +
|
||||
" <ul class=\"font-14\">" +
|
||||
" <li class=\"clearfix\">" +
|
||||
"<div class=\"clearfix\">" +
|
||||
"<p class=\"fl color-orange\" style=\"margin-left: 34px;\">此为隐藏测试项,暂不支持查看</p>" +
|
||||
" </div>" +
|
||||
"</li>" +
|
||||
" </ul>" +
|
||||
"</div>";
|
||||
|
||||
}
|
||||
$e = "<div class=\"-task-ces-box mb15 clearfix\">"+$h+"</div>";
|
||||
$f = "<div class=\"-task-ces-top\" onclick=\"toggle_test_case(" + test_sets[i].is_public + ', ' + i + ")\" style=\"cursor:pointer\">" +
|
||||
"<i class=\"fa fa-caret-right mr5 font-16\" ></i>" +
|
||||
"<span class=\"font-14\">测试集 " + (i + 1) + "</span>" + ($g == undefined ? "" : $g)+"</div>";
|
||||
|
||||
$forHtml = $f + $e;
|
||||
$Bear += $forHtml;
|
||||
}
|
||||
$TestResult = "<div id=\"blacktab_con_2\" class=\" " + (language == 'Html' ? 'undis' : '') + "\">" +
|
||||
"<div class=\"fit -scroll\">" +
|
||||
"<div class=\"-layout-v -fit\">" +
|
||||
"<div class=\"-flex -scroll task-padding16 loading-center undis\" id=\"evaluating_ajax_loading\"></div>" +
|
||||
"<div class=\"-flex -scroll task-padding16\" id=\"evaluating_contents\">" + ($d == undefined ? "" : $d) + $Bear + "</div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>";
|
||||
|
||||
// console.log(test_sets.length);
|
||||
|
||||
|
||||
//第三块 评测信息
|
||||
if (had_test_count != "0") {
|
||||
if (had_passed_testsests_error_count != "0") {
|
||||
$n = "<p class=\"-text-danger mb10\">" +
|
||||
"<i class=\"fa fa-exclamation-circle font-16\" ></i>" +
|
||||
"<span class=\"ml5 mr5 -text-danger\">" + had_passed_testsests_error_count + "/" + test_sets_count + "</span> " + latest_output + "</p>";
|
||||
|
||||
} else {
|
||||
$n = "<p class=\"color-light-green mb10\">" +
|
||||
"<i class=\"fa fa-check-circle font-16 \" ></i>" +
|
||||
"<span class=\"ml5 mr5\">" + test_sets_count + "/" + test_sets_count + "</span> 全部通过</p>";
|
||||
}
|
||||
// $("#evaluating_info").html($n);
|
||||
}
|
||||
$EvaluationInformation = "<div id=\"blacktab_con_3\" class=\"undis\" >" +
|
||||
"<div class=\"fit -scroll\">" +
|
||||
"<div class=\"-layout-v -fit\">" +
|
||||
"<div class=\"-flex -scroll task-padding16 loading-center undis\" id=\"info_ajax_loading\"></div>" +
|
||||
"<div class=\"-flex -scroll task-padding16\" id=\"evaluating_info\">" + ($n == undefined ? "" : $n)+"<div class=\"-task-ces-box mb10 clearfix\">" +
|
||||
"<div class=\"-task-ces-info\">" +
|
||||
"<ul>" +
|
||||
"<li>" +
|
||||
"<span class=\"-task-ces-info-left \">公开测试:</span>" +
|
||||
"<span class=\"color-light-green\">" + had_passed_testsests_public_count + "/" + test_sets_public_count + "</span>" +
|
||||
"</li>" +
|
||||
"<li>" +
|
||||
"<span class=\"-task-ces-info-left\"> 隐藏测试:</span>" +
|
||||
"<span class=\"color-light-green\">" + had_passed_testsests_hidden_count + "/" + test_sets_hidden_count + "</span>" +
|
||||
"</li>" +
|
||||
"<li>" +
|
||||
"<span class=\"-task-ces-info-left\"> 经验值:</span>" +
|
||||
"<span class=\"color-light-green\" id=\"experience_value\">+ " + final_score + " </span>" +
|
||||
"</li>" +
|
||||
"<li>" +
|
||||
"<span class=\"-task-ces-info-left\">金币:</span>" +
|
||||
"<span class=\"color-light-green\" id=\"grade_value\">+ " + final_score + "</span>" +
|
||||
"</li>" +
|
||||
"</ul>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>";
|
||||
|
||||
var $html = $EffectDisplay + $TestResult + $EvaluationInformation;
|
||||
/* console.log("第一块区域:" + $EffectDisplay);
|
||||
console.log("第二块区域:" + $TestResult);
|
||||
console.log("第三块区域:" + $EvaluationInformation);
|
||||
console.log($("#evaluating_info"));
|
||||
console.log($(".-task-ces-box"));
|
||||
console.log("had_test_count: " + had_test_count);
|
||||
console.log("test_sets_count: " + test_sets_count);
|
||||
console.log("had_passed_testsests_error_count: " + had_passed_testsests_error_count);
|
||||
console.log("test_sets_hidden_count: " + test_sets_hidden_count);
|
||||
console.log("test_sets_public_count: " + test_sets_public_count);
|
||||
console.log("had_passed_testsests_hidden_count: " + had_passed_testsests_hidden_count);
|
||||
console.log("had_passed_testsests_public_count: " + had_passed_testsests_public_count);
|
||||
console.log("final_score: " + final_score);
|
||||
console.log("language: " + language);
|
||||
console.log("latest_output: " + latest_output);*/
|
||||
$("#game_test_set_results").html($html);
|
||||
|
||||
}
|
||||
// end
|
||||
|
||||
|
|
@ -267,12 +267,13 @@ table.table-pa5 th,table.table-pa5 td{ padding:0 5px;}
|
|||
/***** loading ******/
|
||||
/***** Ajax indicator ******/
|
||||
#ajax-indicator {
|
||||
position: absolute; /* fixed not supported by IE */
|
||||
position: absolute; /* fixed not supported by IE*/
|
||||
background-color:#eee;
|
||||
border: 1px solid #bbb;
|
||||
top:35%;
|
||||
left:40%;
|
||||
width:20%;
|
||||
/*height:5%;*/
|
||||
font-weight:bold;
|
||||
text-align:center;
|
||||
padding:0.6em;
|
||||
|
|
@ -282,13 +283,15 @@ table.table-pa5 th,table.table-pa5 td{ padding:0 5px;}
|
|||
|
||||
html>body #ajax-indicator { position: fixed; }
|
||||
|
||||
#ajax-indicator span {
|
||||
#ajax-indicator span{
|
||||
color:#fff;
|
||||
color: #333333;
|
||||
background-position: 0% 40%;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(/images/loading.gif);
|
||||
padding-left: 26px;
|
||||
vertical-align: bottom;
|
||||
z-index:999;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -96,10 +96,10 @@ a.opnionButton:hover{background: #297fb8; }
|
|||
.hiddent{ overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
|
||||
.font_bold{font-weight: bold;}
|
||||
/***** Ajax indicator ******/
|
||||
#ajax-indicator { position: absolute; /* fixed not supported by IE */ background-color:#eee;border: 1px solid #bbb; top:35%; left:40%; width:20%; font-weight:bold; text-align:center;
|
||||
#ajax-indicator { position: absolute; /* fixed not supported by IE */ background-color:#eee;border: 1px solid #bbb; top:35%; left:40%; width:50%; font-weight:bold; text-align:center;
|
||||
padding:0.6em; z-index:100000; opacity: 0.5;}
|
||||
html>body #ajax-indicator { position: fixed; }
|
||||
#ajax-indicator span { background-position: 0% 40%; background-repeat: no-repeat; background-image: url(/images/loading.gif); padding-left: 26px; vertical-align: bottom;}
|
||||
/*#ajax-indicator span { background-position: 0% 40%; vertical-align: bottom;}*/
|
||||
div.modal { border-radius: 5px; background: #fff; z-index: 50; padding: 4px;}
|
||||
.ui-widget-content { border: 1px solid #ddd; color: #333;}
|
||||
.ui-widget { font-family: Verdana, sans-serif; font-size: 1.1em;}
|
||||
|
|
|
|||
|
|
@ -368,10 +368,31 @@ a.shixun-task-ban-btn{background-color: #c2c4c6;display: inline-block;font-weigh
|
|||
.loading_main img{border-radius: 4px;}
|
||||
.loading_main span{font-size: 44px;font-weight: bold;color: #ff7500;letter-spacing: 5px;margin-left: 5px;}
|
||||
.load{width: auto;top:50%;margin-top:-100px;position: relative;}
|
||||
.loading_seconde{color: #ff7500;letter-spacing: 3px;font-size: 16px;}
|
||||
|
||||
|
||||
|
||||
.loading_seconde{color: #ff7500;letter-spacing: 3px;font-size: 16px;}#ajax-indicator-base {
|
||||
position: absolute; /* fixed not supported by IE*/
|
||||
background-color:#eee;
|
||||
border: 1px solid #bbb;
|
||||
top:35%;
|
||||
left:40%;
|
||||
width:20%;
|
||||
height:5%;
|
||||
font-weight:bold;
|
||||
text-align:center;
|
||||
padding:0.6em;
|
||||
z-index:100;
|
||||
opacity: 0.5;
|
||||
}
|
||||
html>body #ajax-indicator-base { position: fixed; }
|
||||
|
||||
#ajax-indicator-base span{
|
||||
color:#fff;
|
||||
background-position: 0% 40%;
|
||||
background-repeat: no-repeat;
|
||||
/*background-image: url(/images/loading.gif);*/
|
||||
padding-left: 26px;
|
||||
vertical-align: bottom;
|
||||
z-index:999;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -812,13 +812,13 @@ a.opnionButton:hover{background: #297fb8; }
|
|||
|
||||
html>body #ajax-indicator { position: fixed; }
|
||||
|
||||
#ajax-indicator span {
|
||||
background-position: 0% 40%;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(../images/loading.gif);
|
||||
padding-left: 26px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
/*#ajax-indicator span {*/
|
||||
/*background-position: 0% 40%;*/
|
||||
/*background-repeat: no-repeat;*/
|
||||
/*background-image: url(../images/loading.gif);*/
|
||||
/*padding-left: 26px;*/
|
||||
/*vertical-align: bottom;*/
|
||||
/*}*/
|
||||
|
||||
div.modal {
|
||||
border-radius: 5px;
|
||||
|
|
|
|||
Loading…
Reference in New Issue