diff --git a/views/submission.ejs b/views/submission.ejs index cf9856e..acd314b 100644 --- a/views/submission.ejs +++ b/views/submission.ejs @@ -28,6 +28,9 @@ .accordion > .content > .accordion > .content > :last-child { margin-bottom: -10px !important; } +.disabled{ + display: none; +}
@@ -52,7 +55,8 @@ - +
<%= cid %>
+
<%= pid %>
<% if (formattedCode !== null) { %> @@ -311,11 +315,10 @@ const vueApp = new Vue({ $('.ui.accordion').off().accordion({ selector: { trigger: '.title:not(.unexpandable)' } }); } }); -console.log(token); if (token != null) { const loadSocketIO = function () { - const cid = <%= cid%>; - const pid = <%= pid%>; + const cid = parseInt(document.getElementById('cid').innerHTML); + const pid = parseInt(document.getElementById('pid').innerHTML); let currentVersion = 0; const socket = io(socketUrl); socket.on('connect', function () { @@ -342,7 +345,7 @@ if (token != null) { vueApp.roughData.result = p.roughResult; if (p.roughResult.result === 'Accepted') { $.ajax({ - url: `/api/practice/pass/${cid}/${pid}`, + url: `/api/pass/${cid}/${pid}`, type: 'GET', success: function (data) { }, @@ -352,7 +355,7 @@ if (token != null) { }); } else { $.ajax({ - url: `/api/practice/nopass/${cid}/${pid}`, + url: `/api/nopass/${cid}/${pid}`, type: 'GET', success: function (data) { }, @@ -366,12 +369,42 @@ if (token != null) { }); socket.emit('join', token, function (data) { console.log("join! ", data); + // data.ok=true; + // data.finished=true; + // data.roughResult = { + // memory: 7128, + // result: "Accepted", + // score: 100, + // time: 272, + // } + // data.running=false; if (data && data.ok) { if (data.finished) { vueApp.roughData.result = data.roughResult; // if (!data.result) location.reload(true); vueApp.detailResult = data.result; vueApp.roughData.running = false; + // if (data.roughResult.result === 'Accepted') { + // $.ajax({ + // url: `/api/pass/${cid}/${pid}`, + // type: 'GET', + // success: function (data) { + // }, + // error: function (XMLHttpRequest, textStatus, errorThrown) { + // alert('练习功能发生故障'); + // } + // }); + // } else { + // $.ajax({ + // url: `/api/nopass/${cid}/${pid}`, + // type: 'GET', + // success: function (data) { + // }, + // error: function (XMLHttpRequest, textStatus, errorThrown) { + // alert('练习功能发生故障'); + // } + // }); + // } socket.close(); } else { if (data.running) {