core&ui: fix contestTimer on duration contest (#576)

This commit is contained in:
panda authored and GitHub committed 2023-05-16 08:02:02 +08:00
1 parent 58cab9919d
commit 5b78afeba5
8 files changed
+15 -6

No files matched your search

+3 -3
View File
@@ -6,9 +6,9 @@ import { tpl } from 'vj/utils';
const contestTimer = $(tpl`<pre class="contest-timer" style="display:none"></pre>`);
contestTimer.appendTo(document.body);
export default new NamedPage(['contest_detail', 'contest_detail_problem', 'contest_scoreboard'], () => {
const beginAt = new Date(UiContext.tdoc.beginAt).getTime();
const endAt = new Date(UiContext.tdoc.endAt).getTime();
export default new NamedPage(['contest_detail', 'contest_problemlist', 'contest_detail_problem', 'contest_scoreboard'], () => {
const beginAt = new Date((UiContext.tdoc.duration && UiContext.tsdoc?.startAt) || UiContext.tdoc.beginAt).getTime();
const endAt = new Date((UiContext.tdoc.duration && UiContext.tsdoc?.endAt) || UiContext.tdoc.endAt).getTime();
NProgress.configure({ trickle: false, showSpinner: false, minimum: 0 });
function updateProgress() {
const now = Date.now();
@@ -4,6 +4,7 @@
{% import "components/problem.html" as problem with context %}
{% block content %}
{{ set(UiContext, 'tdoc', tdoc) }}
{{ set(UiContext, 'tsdoc', tsdoc) }}
<div class="row">
<div class="medium-9 columns">
<div class="section">
@@ -4,6 +4,7 @@
{% import "components/problem.html" as problem with context %}
{% block content %}
{{ set(UiContext, 'tdoc', tdoc) }}
{{ set(UiContext, 'tsdoc', tsdoc) }}
<div class="row">
<div class="medium-9 columns">
<div class="section">
@@ -1,6 +1,7 @@
{% import "components/paginator.html" as paginator with context %}
{% extends "layout/basic.html" %}
{{ set(UiContext, 'tdoc', tdoc) }}
{{ set(UiContext, 'tsdoc', tsdoc) }}
{% set type = 'homework' if tdoc.rule == 'homework' else 'contest' %}
{% block content %}
@@ -15,6 +15,7 @@
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}', query={tid:tdoc.docId})) }}
{{ set(UiContext, 'pretestConnUrl', "record-conn?pretest=1&uidOrName=" + handler.user._id + "&pid=" + pdoc.docId + "&domainId=" + handler.args.domainId + "&tid=" + tdoc.docId) }}
{{ set(UiContext, 'tdoc', tdoc) }}
{{ set(UiContext, 'tsdoc', tsdoc) }}
{% else %}
{{ set(UiContext, 'canViewRecord', true) }}
{{ set(UiContext, 'postSubmitUrl', url('problem_submit', pid=pdoc.docId)) }}