作业功能

This commit is contained in:
masnn committed 2020-06-02 11:33:40 +08:00
1 parent 216a4a91e4
commit bc50913e6e
60 files changed
+1161 -197

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
.page--homework_detail
.col--status
width: rem(150px)
.col--submit-at
width: rem(150px)
.col--problem
border-left: 1px solid $table-border-color
+mobile()
.col--submit-at
display: none
+37
View File
@@ -0,0 +1,37 @@
import { NamedPage } from 'vj/misc/PageLoader';
import Calendar from 'vj/components/calendar';
import i18n from 'vj/utils/i18n';
import { parse as parseMongoId } from 'vj/utils/mongoId';
const page = new NamedPage('homework_main', () => {
// Homework Calendar
if (Context.docs) {
const events = Context.docs.map((doc) => ({
beginAt: doc.beginAt * 1000,
endAt: doc.endAt * 1000,
title: doc.title,
maskFrom: doc.penaltySince ? doc.penaltySince * 1000 : null,
maskTitle: i18n('Time Extension'),
colorIndex: parseMongoId(doc.id).timestamp % 12,
link: doc.url,
}));
const calendar = new Calendar(events);
calendar.getDom().appendTo('[name="calendar_entry"]');
$('[name="homework_display"]').change((ev) => {
switch (ev.currentTarget.value) {
case 'calendar':
$('.homework__list').hide();
$('[name="calendar_entry"]').show();
break;
case 'list':
$('.homework__list').show();
$('[name="calendar_entry"]').hide();
break;
default:
throw new Error('Unexpected display parameter');
}
});
}
});
export default page;
+14
View File
@@ -0,0 +1,14 @@
$highlight-button-color = #F6DF45
.page--homework_main
.homework__title
line-height: 1.2em
margin-bottom: rem(10px)
font-size: rem($font-size-title)
.homework__info-attended
color: $success-color
.homework__date
margin-right: rem(10px)
white-space: nowrap
+22
View File
@@ -0,0 +1,22 @@
.page--homework_scoreboard
.col--rank
width: rem(70px)
border-right: 1px solid $table-border-color
.col--user
width: rem(140px)
.col--total_score, .col--total_time_str, .col--solved_problems
width: rem(100px)
text-align: center
.col--problem_detail
border-left: 1px solid $table-border-color
text-align: center
+mobile()
.col--user
width: auto
.col--problem_detail
display: none