mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: add contest progress
This commit is contained in:
1 parent
88d6ecb816
commit
e64a443bbb
8 files changed
+45
-25
No files matched your search
@@ -136,8 +136,7 @@ $supplementary-link-color = lighten($text-1-color, 40%)
|
|||||||
|
|
||||||
$pager-border-color = $table-border-color
|
$pager-border-color = $table-border-color
|
||||||
|
|
||||||
$nprogress-color = #FFF
|
$nprogress-color = $primary-color
|
||||||
$nprogress-color-floating = $primary-color
|
|
||||||
|
|
||||||
$syntax-hl-bg-color = #F8F8F8
|
$syntax-hl-bg-color = #F8F8F8
|
||||||
|
|
||||||
|
|||||||
@@ -7,32 +7,19 @@ $spinner-margin = ($nav-item-height - $spinner-size) / 2
|
|||||||
#nprogress .bar
|
#nprogress .bar
|
||||||
background: $nprogress-color
|
background: $nprogress-color
|
||||||
position: fixed
|
position: fixed
|
||||||
z-index: 1031
|
top: $nav-item-height
|
||||||
top: 0
|
z-index: 99
|
||||||
left: 0
|
left: 0
|
||||||
width: 100%
|
width: 100%
|
||||||
height: 2px
|
height: 2px
|
||||||
|
|
||||||
&+above(rupture.mobile-cutoff)
|
|
||||||
background: $nprogress-color-floating
|
|
||||||
|
|
||||||
#nprogress .peg
|
#nprogress .peg
|
||||||
display: block
|
display: none
|
||||||
position: absolute
|
|
||||||
right: 0px
|
|
||||||
width: 100px
|
|
||||||
height: 100%
|
|
||||||
box-shadow: 0 0 10px $nprogress-color, 0 0 5px $nprogress-color
|
|
||||||
opacity: 1.0
|
|
||||||
transform: rotate(3deg) translate(0px, -4px)
|
|
||||||
|
|
||||||
&+above(rupture.mobile-cutoff)
|
|
||||||
box-shadow: 0 0 10px $nprogress-color-floating, 0 0 5px $nprogress-color-floating
|
|
||||||
|
|
||||||
#nprogress .spinner
|
#nprogress .spinner
|
||||||
display: block
|
display: block
|
||||||
position: fixed
|
position: fixed
|
||||||
z-index: 1031
|
z-index: 99999
|
||||||
top: rem($spinner-margin)
|
top: rem($spinner-margin)
|
||||||
right: rem($spinner-margin)
|
right: rem($spinner-margin)
|
||||||
|
|
||||||
@@ -46,10 +33,6 @@ $spinner-margin = ($nav-item-height - $spinner-size) / 2
|
|||||||
border-radius: 50%
|
border-radius: 50%
|
||||||
animation: nprogress-spinner 400ms linear infinite
|
animation: nprogress-spinner 400ms linear infinite
|
||||||
|
|
||||||
&+above(rupture.mobile-cutoff)
|
|
||||||
border-top-color: $nprogress-color-floating
|
|
||||||
border-left-color: $nprogress-color-floating
|
|
||||||
|
|
||||||
.nprogress-custom-parent
|
.nprogress-custom-parent
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
position: relative
|
position: relative
|
||||||
@@ -63,4 +46,3 @@ $spinner-margin = ($nav-item-height - $spinner-size) / 2
|
|||||||
transform: rotate(0deg)
|
transform: rotate(0deg)
|
||||||
100%
|
100%
|
||||||
transform: rotate(360deg)
|
transform: rotate(360deg)
|
||||||
|
|
||||||
@@ -5,6 +5,16 @@ import Notification from 'vj/components/notification';
|
|||||||
import PageLoader from 'vj/misc/PageLoader';
|
import PageLoader from 'vj/misc/PageLoader';
|
||||||
import delay from 'vj/utils/delay';
|
import delay from 'vj/utils/delay';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
UserContext: any;
|
||||||
|
UiContext: any;
|
||||||
|
Hydro: any;
|
||||||
|
// eslint-disable-next-line camelcase
|
||||||
|
node_modules: any;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const start = new Date();
|
const start = new Date();
|
||||||
window.UserContext = JSON.parse(window.UserContext);
|
window.UserContext = JSON.parse(window.UserContext);
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.24.4",
|
"version": "4.24.5",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import NProgress from 'nprogress';
|
||||||
|
import { NamedPage } from 'vj/misc/Page';
|
||||||
|
|
||||||
|
export default new NamedPage(['contest_detail', 'contest_detail_problem'], () => {
|
||||||
|
const beginAt = new Date(UiContext.tdoc.beginAt).getTime();
|
||||||
|
const endAt = new Date(UiContext.tdoc.endAt).getTime();
|
||||||
|
NProgress.configure({ trickle: false, showSpinner: false, minimum: 0 });
|
||||||
|
function updateProgress() {
|
||||||
|
const now = Date.now();
|
||||||
|
console.log(now, beginAt, endAt);
|
||||||
|
if (beginAt <= now && now <= endAt) NProgress.set((now - beginAt) / (endAt - beginAt));
|
||||||
|
else if (now > endAt) NProgress.set(1);
|
||||||
|
else {
|
||||||
|
console.log('set');
|
||||||
|
NProgress.set(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NProgress.start();
|
||||||
|
updateProgress();
|
||||||
|
setInterval(updateProgress, 5000);
|
||||||
|
});
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
{% import "components/record.html" as record with context %}
|
{% import "components/record.html" as record with context %}
|
||||||
{% import "components/problem.html" as problem with context %}
|
{% import "components/problem.html" as problem with context %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{{ set(UiContext, 'tdoc', tdoc) }}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="medium-9 columns">
|
<div class="medium-9 columns">
|
||||||
<div class="section">
|
<div class="section">
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
{{ set(UiContext, 'getSubmissionsUrl', url('record_main', query={fullStatus:'true', pid:pdoc.pid, tid:tdoc.docId})) }}
|
{{ set(UiContext, 'getSubmissionsUrl', url('record_main', query={fullStatus:'true', pid:pdoc.pid, tid:tdoc.docId})) }}
|
||||||
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}', query={tid:tdoc.docId})) }}
|
{{ 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.domainId + "&tid=" + tdoc.docId) }}
|
{{ set(UiContext, 'pretestConnUrl', "/record-conn?pretest=1&uidOrName=" + handler.user._id + "&pid=" + pdoc.docId + "&domainId=" + handler.domainId + "&tid=" + tdoc.docId) }}
|
||||||
|
{{ set(UiContext, 'tdoc', tdoc) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ set(UiContext, 'canViewRecord', true) }}
|
{{ set(UiContext, 'canViewRecord', true) }}
|
||||||
{{ set(UiContext, 'postSubmitUrl', url('problem_submit', pid=pdoc.docId)) }}
|
{{ set(UiContext, 'postSubmitUrl', url('problem_submit', pid=pdoc.docId)) }}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
|
declare let UserContext: any;
|
||||||
|
declare let UiContext: any;
|
||||||
|
declare let Hydro: any;
|
||||||
|
// eslint-disable-next-line camelcase
|
||||||
|
declare let node_modules: any;
|
||||||
Reference in new issue
Block a user