mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
ui: allow quick rejudge
This commit is contained in:
1 parent
78925f0507
commit
0bf2c8362a
4 files changed
+19
-4
No files matched your search
@@ -196,7 +196,8 @@ class RecordDetailHandler extends ContestDetailBaseHandler {
|
|||||||
if (!pdoc?.config || typeof pdoc.config === 'string') throw new ProblemConfigError();
|
if (!pdoc?.config || typeof pdoc.config === 'string') throw new ProblemConfigError();
|
||||||
const priority = await record.submissionPriority(this.user._id, -20);
|
const priority = await record.submissionPriority(this.user._id, -20);
|
||||||
const isContest = this.rdoc.contest && this.rdoc.contest.toString() !== '000000000000000000000000';
|
const isContest = this.rdoc.contest && this.rdoc.contest.toString() !== '000000000000000000000000';
|
||||||
await record.reset(domainId, rid, true);
|
const rdoc = await record.reset(domainId, rid, true);
|
||||||
|
bus.broadcast('record/change', rdoc);
|
||||||
await record.judge(domainId, rid, priority, isContest ? { detail: false } : {});
|
await record.judge(domainId, rid, priority, isContest ? { detail: false } : {});
|
||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -1,7 +1,8 @@
|
|||||||
import ReconnectingWebSocket from 'reconnecting-websocket';
|
import ReconnectingWebSocket from 'reconnecting-websocket';
|
||||||
|
|
||||||
export default class Sock {
|
export default class Sock {
|
||||||
constructor(url) {
|
private sock: ReconnectingWebSocket;
|
||||||
|
constructor(public url: string) {
|
||||||
const i = new URL(url, window.location.href);
|
const i = new URL(url, window.location.href);
|
||||||
if (i.host !== window.location.host) i.searchParams.append('sid', document.cookie.split('sid=')[1].split(';')[0]);
|
if (i.host !== window.location.host) i.searchParams.append('sid', document.cookie.split('sid=')[1].split(';')[0]);
|
||||||
i.protocol = i.protocol.replace('http', 'ws');
|
i.protocol = i.protocol.replace('http', 'ws');
|
||||||
@@ -24,6 +25,10 @@ export default class Sock {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onmessage: (message: MessageEvent<any>) => void;
|
||||||
|
onclose: (code: number, reason: string) => void;
|
||||||
|
onopen: (sock: ReconnectingWebSocket) => void;
|
||||||
|
|
||||||
send(data) {
|
send(data) {
|
||||||
this.sock.send(data);
|
this.sock.send(data);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import ProblemSelectAutoComplete from 'vj/components/autocomplete/ProblemSelectAutoComplete';
|
import ProblemSelectAutoComplete from 'vj/components/autocomplete/ProblemSelectAutoComplete';
|
||||||
import UserSelectAutoComplete from 'vj/components/autocomplete/UserSelectAutoComplete';
|
import UserSelectAutoComplete from 'vj/components/autocomplete/UserSelectAutoComplete';
|
||||||
|
import Notification from 'vj/components/notification';
|
||||||
import { NamedPage } from 'vj/misc/Page';
|
import { NamedPage } from 'vj/misc/Page';
|
||||||
import { getAvailableLangs, tpl } from 'vj/utils';
|
import { getAvailableLangs, request, tpl } from 'vj/utils';
|
||||||
|
|
||||||
const page = new NamedPage('record_main', async () => {
|
const page = new NamedPage('record_main', async () => {
|
||||||
const [{ default: WebSocket }, { DiffDOM }] = await Promise.all([
|
const [{ default: WebSocket }, { DiffDOM }] = await Promise.all([
|
||||||
@@ -39,6 +40,14 @@ const page = new NamedPage('record_main', async () => {
|
|||||||
(i) => ($('select[name="lang"]').append(tpl`<option value="${i}" key="${i}">${availableLangs[i].display}</option>`)));
|
(i) => ($('select[name="lang"]').append(tpl`<option value="${i}" key="${i}">${availableLangs[i].display}</option>`)));
|
||||||
const lang = new URL(window.location.href).searchParams.get('lang');
|
const lang = new URL(window.location.href).searchParams.get('lang');
|
||||||
if (lang) $('select[name="lang"]').val(lang);
|
if (lang) $('select[name="lang"]').val(lang);
|
||||||
|
|
||||||
|
for (const operation of ['rejudge', 'cancel']) {
|
||||||
|
$(document).on('click', `[name="operation"][value="${operation}"]`, (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
const action = $(ev.target).closest('form').attr('action');
|
||||||
|
request.post(action, { operation }).catch((e) => Notification.error(e));
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default page;
|
export default page;
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
{{ _('Rejudge') }}
|
{{ _('Rejudge') }}
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" name="operation" value="cancel" class="link text-maroon lighter">
|
<button type="submit" name="operation" value="cancel" class="link text-maroon lighter">
|
||||||
<span class="icon icon-cross"></span>
|
<span class="icon icon-close"></span>
|
||||||
{{ _('Cancel Score') }}
|
{{ _('Cancel Score') }}
|
||||||
</button> |
|
</button> |
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Reference in new issue
Block a user