898 lines
25 KiB
Vue
898 lines
25 KiB
Vue
<script setup lang="ts">
|
||
import { computed, onMounted, reactive, ref, watch } from "vue";
|
||
import { useI18n } from "vue-i18n";
|
||
import { ElMessage, ElMessageBox } from "element-plus";
|
||
import { ArrowLeft, ArrowRight, Plus } from "@element-plus/icons-vue";
|
||
import http from "../api/http";
|
||
import { useAuthStore } from "../stores/auth";
|
||
import {
|
||
academicTermLabel,
|
||
defaultAcademicTermId,
|
||
} from "../utils/academicTerms";
|
||
interface CalendarEvent {
|
||
id: string;
|
||
academicTermId: string;
|
||
title: string;
|
||
kind: number | string;
|
||
startsOn: string;
|
||
endsOn?: string;
|
||
reminderDays: number;
|
||
audienceRoles: string[];
|
||
description?: string;
|
||
isEnabled: boolean;
|
||
}
|
||
interface HolidayPreview {
|
||
name: string;
|
||
date: string;
|
||
isOffDay: boolean;
|
||
}
|
||
const auth = useAuthStore(),
|
||
terms = ref<any[]>([]),
|
||
events = ref<CalendarEvent[]>([]),
|
||
selectedTermId = ref(""),
|
||
loading = ref(false),
|
||
dialogVisible = ref(false),
|
||
holidayDialogVisible = ref(false),
|
||
holidayLoading = ref(false),
|
||
holidayDays = ref<HolidayPreview[]>([]),
|
||
holidayYear = ref(new Date().getFullYear()),
|
||
editingId = ref<string>(),
|
||
cursor = ref(new Date(new Date().getFullYear(), new Date().getMonth(), 1));
|
||
const { locale, t } = useI18n();
|
||
const canManage = computed(
|
||
() =>
|
||
auth.user?.roles.some((role) =>
|
||
["SuperAdmin", "AcademicAdmin"].includes(role),
|
||
) ?? false,
|
||
);
|
||
const isStudent = computed(() => auth.user?.roles.includes("Student") ?? false);
|
||
const roleKeys = ["SuperAdmin", "AcademicAdmin", "CollegeAdmin", "Leader", "Counselor", "Teacher", "Student", "MaintenanceAdmin", "MaintenanceStaff", "PhysicalEducationAdmin", "DormitoryAdmin", "StudentAffairsAdmin"];
|
||
const roles = computed(() => roleKeys.map((role) => [role, t(`calendar.roles.${role}`)]));
|
||
const kindValues = [1, 2, 3, 4, 5, 6, 99];
|
||
const kinds = computed(() => kindValues.map((kind) => [kind, label(kind)]));
|
||
const weekdays = computed(() => Array.from({ length: 7 }, (_, index) => new Intl.DateTimeFormat(locale.value, { weekday: "short" }).format(new Date(2026, 10, 2 + index))));
|
||
const form = reactive<any>({
|
||
academicTermId: "",
|
||
title: "",
|
||
kind: 99,
|
||
startsOn: "",
|
||
endsOn: "",
|
||
reminderDays: 7,
|
||
audienceRoles: [],
|
||
description: "",
|
||
isEnabled: true,
|
||
});
|
||
function key(date: Date) {
|
||
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
||
}
|
||
function parse(value: string) {
|
||
const [y, m, d] = value.slice(0, 10).split("-").map(Number);
|
||
return new Date(y, m - 1, d);
|
||
}
|
||
function kindKey(kind: number | string) {
|
||
return (
|
||
(
|
||
{
|
||
"1": "course",
|
||
courseselection: "course",
|
||
"2": "grade",
|
||
grade: "grade",
|
||
"3": "evaluation",
|
||
evaluation: "evaluation",
|
||
"4": "exam",
|
||
exam: "exam",
|
||
"5": "graduation",
|
||
graduationaudit: "graduation",
|
||
"6": "holiday",
|
||
publicholiday: "holiday",
|
||
"99": "other",
|
||
other: "other",
|
||
} as Record<string, string>
|
||
)[String(kind).toLowerCase()] ?? "other"
|
||
);
|
||
}
|
||
function label(kind: number | string) {
|
||
return t(`calendar.kinds.${kindKey(kind)}`);
|
||
}
|
||
function spans(item: CalendarEvent, day: string) {
|
||
return item.startsOn <= day && (item.endsOn ?? item.startsOn) >= day;
|
||
}
|
||
interface WeekEventSegment {
|
||
item: CalendarEvent;
|
||
id: string;
|
||
startColumn: number;
|
||
length: number;
|
||
lane: number;
|
||
}
|
||
const today = key(new Date()),
|
||
monthTitle = computed(() => new Intl.DateTimeFormat(locale.value, { year: "numeric", month: "long" }).format(cursor.value));
|
||
const days = computed(() => {
|
||
const first = new Date(
|
||
cursor.value.getFullYear(),
|
||
cursor.value.getMonth(),
|
||
1,
|
||
),
|
||
start = new Date(first);
|
||
start.setDate(first.getDate() - ((first.getDay() + 6) % 7));
|
||
return Array.from({ length: 42 }, (_, i) => {
|
||
const date = new Date(start);
|
||
date.setDate(start.getDate() + i);
|
||
const day = key(date);
|
||
return {
|
||
date,
|
||
day,
|
||
inMonth: date.getMonth() === cursor.value.getMonth(),
|
||
events: events.value.filter((item) => spans(item, day)),
|
||
};
|
||
});
|
||
});
|
||
const weeks = computed(() =>
|
||
Array.from({ length: 6 }, (_, weekIndex) => {
|
||
const weekDays = days.value.slice(weekIndex * 7, weekIndex * 7 + 7);
|
||
const firstDay = weekDays[0].day;
|
||
const lastDay = weekDays[6].day;
|
||
const laneEnds: string[] = [];
|
||
const eventSegments: WeekEventSegment[] = events.value
|
||
.filter((item) => spans(item, firstDay) || spans(item, lastDay) || (item.startsOn < firstDay && (item.endsOn ?? item.startsOn) > lastDay))
|
||
.map((item) => {
|
||
const startsOn = item.startsOn > firstDay ? item.startsOn : firstDay;
|
||
const endsOn = (item.endsOn ?? item.startsOn) < lastDay ? (item.endsOn ?? item.startsOn) : lastDay;
|
||
return {
|
||
item,
|
||
startsOn,
|
||
endsOn,
|
||
startColumn: weekDays.findIndex((day) => day.day === startsOn) + 1,
|
||
length: Math.round((parse(endsOn).getTime() - parse(startsOn).getTime()) / 86400000) + 1,
|
||
};
|
||
})
|
||
.sort((left, right) => left.startsOn.localeCompare(right.startsOn) || right.length - left.length || left.item.title.localeCompare(right.item.title))
|
||
.map((segment) => {
|
||
const lane = laneEnds.findIndex((endsOn) => endsOn < segment.startsOn);
|
||
const assignedLane = lane === -1 ? laneEnds.length : lane;
|
||
laneEnds[assignedLane] = segment.endsOn;
|
||
return { ...segment, id: `${segment.item.id}-${weekIndex}`, lane: assignedLane };
|
||
});
|
||
return { days: weekDays, eventSegments };
|
||
}),
|
||
);
|
||
const monthEvents = computed(() =>
|
||
events.value.filter((item) => {
|
||
const monthStart = key(new Date(cursor.value.getFullYear(), cursor.value.getMonth(), 1));
|
||
const monthEnd = key(new Date(cursor.value.getFullYear(), cursor.value.getMonth() + 1, 0));
|
||
return item.startsOn <= monthEnd && (item.endsOn ?? item.startsOn) >= monthStart;
|
||
}),
|
||
);
|
||
function shift(amount: number) {
|
||
cursor.value = new Date(
|
||
cursor.value.getFullYear(),
|
||
cursor.value.getMonth() + amount,
|
||
1,
|
||
);
|
||
}
|
||
function goToday() {
|
||
cursor.value = new Date(new Date().getFullYear(), new Date().getMonth(), 1);
|
||
}
|
||
function due(item: CalendarEvent) {
|
||
const gap = Math.ceil(
|
||
(parse(item.startsOn).getTime() - parse(today).getTime()) / 86400000,
|
||
);
|
||
return gap >= 0 && gap <= item.reminderDays;
|
||
}
|
||
function audience(item: CalendarEvent) {
|
||
return item.audienceRoles.length
|
||
? item.audienceRoles
|
||
.map((role) => roles.value.find((x) => x[0] === role)?.[1] ?? role)
|
||
.join(t("common.listSeparator"))
|
||
: t("calendar.allRoles");
|
||
}
|
||
async function load() {
|
||
loading.value = true;
|
||
try {
|
||
const calendarRequest = http.get(
|
||
canManage.value ? "/academic-calendar/manage" : "/academic-calendar",
|
||
{
|
||
params: selectedTermId.value
|
||
? { academicTermId: selectedTermId.value }
|
||
: undefined,
|
||
},
|
||
);
|
||
const examRequest = isStudent.value
|
||
? http.get("/exams/my-schedule")
|
||
: Promise.resolve({ data: [] });
|
||
const [calendar, exams] = await Promise.all([calendarRequest, examRequest]);
|
||
const examEvents = (exams.data as any[]).map((exam) => ({
|
||
id: `exam-${exam.id}`,
|
||
academicTermId: selectedTermId.value,
|
||
title: t("calendar.examTitle", { course: exam.courseName }),
|
||
kind: "Exam",
|
||
startsOn: exam.examDate,
|
||
reminderDays: 7,
|
||
audienceRoles: ["Student"],
|
||
description: `${exam.startsAt?.slice(11, 16) ?? ""}—${exam.endsAt?.slice(11, 16) ?? ""} · ${[exam.buildingName, exam.classroomName].filter(Boolean).join(" ")}`,
|
||
isEnabled: true,
|
||
source: "ExamSchedule",
|
||
}));
|
||
events.value = [...calendar.data, ...examEvents];
|
||
} finally {
|
||
loading.value = false;
|
||
}
|
||
}
|
||
async function previewHolidays() {
|
||
holidayLoading.value = true;
|
||
try {
|
||
const { data } = await http.get(
|
||
`/academic-calendar/holidays/${holidayYear.value}`,
|
||
);
|
||
holidayDays.value = data.days;
|
||
} finally {
|
||
holidayLoading.value = false;
|
||
}
|
||
}
|
||
async function openHolidaySync() {
|
||
holidayDialogVisible.value = true;
|
||
await previewHolidays();
|
||
}
|
||
async function syncHolidays() {
|
||
if (!selectedTermId.value)
|
||
return ElMessage.warning(t("calendar.messages.selectTerm"));
|
||
await ElMessageBox.confirm(
|
||
t("calendar.messages.syncConfirm", { year: holidayYear.value }),
|
||
t("calendar.sync.title"),
|
||
{ type: "warning", confirmButtonText: t("calendar.sync.confirm") },
|
||
);
|
||
holidayLoading.value = true;
|
||
try {
|
||
const { data } = await http.put("/academic-calendar/holidays/sync", {
|
||
academicTermId: selectedTermId.value,
|
||
year: holidayYear.value,
|
||
});
|
||
ElMessage.success(t("calendar.messages.synced", { count: data.syncedCount, days: data.sourceDayCount }));
|
||
holidayDialogVisible.value = false;
|
||
await load();
|
||
} finally {
|
||
holidayLoading.value = false;
|
||
}
|
||
}
|
||
function open(item?: CalendarEvent) {
|
||
editingId.value = item?.id;
|
||
Object.assign(
|
||
form,
|
||
item
|
||
? { ...item, endsOn: item.endsOn ?? "" }
|
||
: {
|
||
academicTermId:
|
||
selectedTermId.value || defaultAcademicTermId(terms.value) || "",
|
||
title: "",
|
||
kind: 99,
|
||
startsOn: today,
|
||
endsOn: "",
|
||
reminderDays: 7,
|
||
audienceRoles: [],
|
||
description: "",
|
||
isEnabled: true,
|
||
},
|
||
);
|
||
dialogVisible.value = true;
|
||
}
|
||
async function save() {
|
||
if (!form.academicTermId || !form.title.trim() || !form.startsOn)
|
||
return ElMessage.warning(t("calendar.messages.required"));
|
||
const body = {
|
||
...form,
|
||
title: form.title.trim(),
|
||
endsOn: form.endsOn || null,
|
||
description: form.description?.trim() || null,
|
||
};
|
||
if (editingId.value)
|
||
await http.put(`/academic-calendar/${editingId.value}`, body);
|
||
else await http.post("/academic-calendar", body);
|
||
ElMessage.success(t("calendar.messages.saved"));
|
||
dialogVisible.value = false;
|
||
await load();
|
||
}
|
||
async function remove(item: CalendarEvent) {
|
||
await ElMessageBox.confirm(t("calendar.messages.deleteConfirm", { title: item.title }), t("calendar.messages.deleteTitle"), {
|
||
type: "warning",
|
||
});
|
||
await http.delete(`/academic-calendar/${item.id}`);
|
||
ElMessage.success(t("calendar.messages.deleted"));
|
||
await load();
|
||
}
|
||
onMounted(async () => {
|
||
terms.value = (await http.get("/base-data/terms")).data;
|
||
selectedTermId.value = defaultAcademicTermId(terms.value) ?? "";
|
||
await load();
|
||
});
|
||
watch(locale, load);
|
||
</script>
|
||
<template>
|
||
<section class="calendar-page">
|
||
<header class="calendar-masthead">
|
||
<div>
|
||
<p>ACADEMIC ALMANAC</p>
|
||
<h1>{{ t('calendar.title') }}</h1>
|
||
<span
|
||
>{{ t('calendar.description') }}</span
|
||
>
|
||
</div>
|
||
<div v-if="canManage" class="calendar-masthead-actions">
|
||
<el-button @click="openHolidaySync">{{ t('calendar.sync.action') }}</el-button>
|
||
<el-button type="primary" :icon="Plus" @click="open()"
|
||
>{{ t('calendar.add') }}</el-button
|
||
>
|
||
</div>
|
||
</header>
|
||
<div class="calendar-controls">
|
||
<el-select
|
||
v-model="selectedTermId"
|
||
clearable
|
||
:placeholder="t('calendar.currentTerm')"
|
||
@change="load"
|
||
><el-option
|
||
v-for="term in terms"
|
||
:key="term.id"
|
||
:label="academicTermLabel(term)"
|
||
:value="term.id"
|
||
/></el-select>
|
||
<div class="month-switcher">
|
||
<el-button :icon="ArrowLeft" circle text @click="shift(-1)" /><strong>{{
|
||
monthTitle
|
||
}}</strong
|
||
><el-button text @click="goToday">{{ t('calendar.today') }}</el-button
|
||
><el-button :icon="ArrowRight" circle text @click="shift(1)" />
|
||
</div>
|
||
<div class="calendar-legend">
|
||
<span class="holiday">{{ t('calendar.kinds.holiday') }}</span><span>{{ t('calendar.teachingSchedule') }}</span
|
||
><span class="due">{{ t('calendar.due') }}</span>
|
||
</div>
|
||
</div>
|
||
<el-alert
|
||
v-if="!canManage"
|
||
:title="t('calendar.info')"
|
||
type="info"
|
||
:closable="false"
|
||
show-icon
|
||
/>
|
||
<div v-loading="loading" class="calendar-layout">
|
||
<div class="calendar-board">
|
||
<div class="weekdays">
|
||
<span v-for="weekday in weekdays" :key="weekday"
|
||
>{{ weekday }}</span
|
||
>
|
||
</div>
|
||
<div class="calendar-grid">
|
||
<section v-for="(week, weekIndex) in weeks" :key="weekIndex" class="calendar-week">
|
||
<div class="week-days">
|
||
<article
|
||
v-for="day in week.days"
|
||
:key="day.day"
|
||
:class="[
|
||
'calendar-day',
|
||
{
|
||
muted: !day.inMonth,
|
||
today: day.day === today,
|
||
weekend: day.date.getDay() === 0 || day.date.getDay() === 6,
|
||
},
|
||
]"
|
||
>
|
||
<div class="day-number">{{ day.date.getDate() }}</div>
|
||
</article>
|
||
</div>
|
||
<div v-if="week.eventSegments.length" class="week-events">
|
||
<button
|
||
v-for="segment in week.eventSegments"
|
||
:key="segment.id"
|
||
type="button"
|
||
:style="{ gridColumn: `${segment.startColumn} / span ${segment.length}`, gridRow: segment.lane + 1 }"
|
||
:class="['calendar-event', kindKey(segment.item.kind), { due: due(segment.item) }]"
|
||
:title="segment.item.title"
|
||
@click="canManage && open(segment.item)"
|
||
><span>{{ segment.item.title.replace(/\s*[((].*[))]$/, "") }}</span></button>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</div>
|
||
<aside class="month-agenda">
|
||
<header>
|
||
<span>{{ t('calendar.monthAgenda') }}</span><strong>{{ t('calendar.items', { count: monthEvents.length }) }}</strong>
|
||
</header>
|
||
<div v-if="monthEvents.length" class="agenda-items">
|
||
<article
|
||
v-for="item in monthEvents"
|
||
:key="item.id"
|
||
:class="['agenda-item', kindKey(item.kind)]"
|
||
>
|
||
<time
|
||
>{{ item.startsOn.slice(5).replace("-", " / ")
|
||
}}<template v-if="item.endsOn && item.endsOn !== item.startsOn"
|
||
>—{{ item.endsOn.slice(5).replace("-", " / ") }}</template
|
||
></time
|
||
>
|
||
<div>
|
||
<b>{{ item.title }}</b>
|
||
<p>{{ item.description || label(item.kind) }}</p>
|
||
<small v-if="canManage"
|
||
>{{ t('calendar.audience', { audience: audience(item) })
|
||
}}<template v-if="due(item)"> · {{ t('calendar.dueReminder') }}</template></small
|
||
>
|
||
</div>
|
||
<div v-if="canManage" class="agenda-actions">
|
||
<el-button text @click="open(item)">{{ t('calendar.edit') }}</el-button
|
||
><el-button text type="danger" @click="remove(item)"
|
||
>{{ t('calendar.delete') }}</el-button
|
||
>
|
||
</div>
|
||
</article>
|
||
</div>
|
||
<el-empty v-else :image-size="60" :description="t('calendar.empty')" />
|
||
</aside>
|
||
</div>
|
||
<el-dialog
|
||
v-model="dialogVisible"
|
||
:title="editingId ? t('calendar.dialog.edit') : t('calendar.dialog.add')"
|
||
width="620px"
|
||
destroy-on-close
|
||
><el-form label-width="98px"
|
||
><el-form-item :label="t('calendar.form.term')" required
|
||
><el-select v-model="form.academicTermId"
|
||
><el-option
|
||
v-for="term in terms"
|
||
:key="term.id"
|
||
:label="academicTermLabel(term)"
|
||
:value="term.id" /></el-select></el-form-item
|
||
><el-form-item :label="t('calendar.form.name')" required
|
||
><el-input v-model="form.title" maxlength="120" /></el-form-item
|
||
><el-form-item :label="t('calendar.form.type')"
|
||
><el-select v-model="form.kind"
|
||
><el-option
|
||
v-for="kind in kinds"
|
||
:key="kind[0]"
|
||
:label="kind[1]"
|
||
:value="kind[0]" /></el-select></el-form-item
|
||
><el-form-item :label="t('calendar.form.range')" required
|
||
><el-date-picker
|
||
v-model="form.startsOn"
|
||
type="date"
|
||
value-format="YYYY-MM-DD" /><span class="range-separator">{{ t('calendar.form.to') }}</span
|
||
><el-date-picker
|
||
v-model="form.endsOn"
|
||
type="date"
|
||
value-format="YYYY-MM-DD"
|
||
clearable /></el-form-item
|
||
><el-form-item :label="t('calendar.form.reminder')"
|
||
><el-input-number v-model="form.reminderDays" :min="0" :max="90" />
|
||
<span class="form-hint">{{ t('calendar.form.reminderHint') }}</span></el-form-item
|
||
><el-form-item :label="t('calendar.form.roles')"
|
||
><el-checkbox-group v-model="form.audienceRoles"
|
||
><el-checkbox
|
||
v-for="role in roles"
|
||
:key="role[0]"
|
||
:label="role[0]"
|
||
>{{ role[1] }}</el-checkbox
|
||
></el-checkbox-group
|
||
>
|
||
<div class="form-hint">{{ t('calendar.form.rolesHint') }}</div></el-form-item
|
||
><el-form-item :label="t('calendar.form.description')"
|
||
><el-input
|
||
v-model="form.description"
|
||
type="textarea"
|
||
:rows="3"
|
||
maxlength="1000"
|
||
show-word-limit /></el-form-item
|
||
><el-form-item :label="t('calendar.form.enabled')"
|
||
><el-switch v-model="form.isEnabled" /></el-form-item></el-form
|
||
><template #footer
|
||
><el-button @click="dialogVisible = false">{{ t('calendar.cancel') }}</el-button
|
||
><el-button type="primary" @click="save">{{ t('calendar.save') }}</el-button></template
|
||
></el-dialog
|
||
><el-dialog
|
||
v-model="holidayDialogVisible"
|
||
:title="t('calendar.sync.title')"
|
||
width="620px"
|
||
destroy-on-close
|
||
>
|
||
<p class="holiday-sync-intro">
|
||
{{ t('calendar.sync.intro') }}
|
||
</p>
|
||
<div class="holiday-sync-controls">
|
||
<el-input-number
|
||
v-model="holidayYear"
|
||
:min="2000"
|
||
:max="2100"
|
||
controls-position="right"
|
||
/>
|
||
<el-button :loading="holidayLoading" @click="previewHolidays"
|
||
>{{ t('calendar.sync.preview') }}</el-button
|
||
>
|
||
</div>
|
||
<div v-loading="holidayLoading" class="holiday-preview">
|
||
<el-empty
|
||
v-if="!holidayDays.length"
|
||
:image-size="50"
|
||
:description="t('calendar.sync.previewHint')"
|
||
/>
|
||
<div v-else class="holiday-preview-list">
|
||
<span
|
||
v-for="item in holidayDays"
|
||
:key="`${item.date}-${item.name}`"
|
||
:class="{ workday: !item.isOffDay }"
|
||
>
|
||
<b>{{ item.date }}</b
|
||
>{{ item.name }} · {{ item.isOffDay ? t('calendar.sync.dayOff') : t('calendar.sync.workday') }}
|
||
</span>
|
||
</div>
|
||
</div>
|
||
<template #footer>
|
||
<el-button @click="holidayDialogVisible = false">{{ t('calendar.cancel') }}</el-button>
|
||
<el-button
|
||
type="primary"
|
||
:loading="holidayLoading"
|
||
:disabled="!holidayDays.length"
|
||
@click="syncHolidays"
|
||
>{{ t('calendar.sync.submit') }}</el-button
|
||
>
|
||
</template>
|
||
</el-dialog>
|
||
</section>
|
||
</template>
|
||
<style scoped>
|
||
.calendar-page {
|
||
max-width: 1280px;
|
||
margin: auto;
|
||
padding: 10px 0 38px;
|
||
}
|
||
.calendar-masthead {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: end;
|
||
gap: 24px;
|
||
margin: 10px 0 22px;
|
||
}
|
||
.calendar-masthead-actions {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: flex-end;
|
||
gap: 10px;
|
||
}
|
||
.calendar-masthead p {
|
||
margin: 0 0 5px;
|
||
color: #2a7890;
|
||
font:
|
||
700 11px/1 ui-monospace,
|
||
monospace;
|
||
letter-spacing: 0.14em;
|
||
}
|
||
.calendar-masthead h1 {
|
||
margin: 0 0 9px;
|
||
color: #183e57;
|
||
font:
|
||
700 32px/1.1 "STZhongsong",
|
||
"Songti SC",
|
||
serif;
|
||
}
|
||
.calendar-masthead span {
|
||
color: #657b8d;
|
||
font-size: 14px;
|
||
}
|
||
.calendar-controls {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 18px;
|
||
margin: 14px 0 16px;
|
||
padding: 11px 14px;
|
||
border-top: 2px solid #2b6f83;
|
||
border-bottom: 1px solid #d9e4e8;
|
||
background: #f8fbfb;
|
||
}
|
||
.calendar-controls > .el-select {
|
||
width: 238px;
|
||
}
|
||
.month-switcher {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
}
|
||
.month-switcher strong {
|
||
min-width: 112px;
|
||
color: #214d63;
|
||
text-align: center;
|
||
font:
|
||
700 18px "STZhongsong",
|
||
"Songti SC",
|
||
serif;
|
||
}
|
||
.calendar-legend {
|
||
display: flex;
|
||
gap: 12px;
|
||
margin-left: auto;
|
||
color: #60798a;
|
||
font-size: 12px;
|
||
}
|
||
.calendar-legend span {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 5px;
|
||
}
|
||
.calendar-legend span:before {
|
||
width: 8px;
|
||
height: 8px;
|
||
border-radius: 50%;
|
||
background: #4f91a0;
|
||
content: "";
|
||
}
|
||
.calendar-legend .holiday:before {
|
||
background: #be4b4f;
|
||
}
|
||
.calendar-legend .due:before {
|
||
background: #df9c35;
|
||
}
|
||
.calendar-layout {
|
||
display: grid;
|
||
grid-template-columns: minmax(0, 1fr) 300px;
|
||
border: 1px solid #dce6e8;
|
||
background: #fff;
|
||
}
|
||
.weekdays,
|
||
.week-days,
|
||
.week-events {
|
||
display: grid;
|
||
grid-template-columns: repeat(7, minmax(0, 1fr));
|
||
}
|
||
.weekdays {
|
||
border-bottom: 1px solid #dce6e8;
|
||
background: #edf4f5;
|
||
}
|
||
.weekdays span {
|
||
padding: 9px;
|
||
text-align: center;
|
||
color: #456a78;
|
||
font-size: 12px;
|
||
font-weight: 700;
|
||
}
|
||
.weekdays span:nth-last-child(-n + 2) {
|
||
color: #a45a55;
|
||
}
|
||
.calendar-week {
|
||
border-bottom: 1px solid #e4ecee;
|
||
}
|
||
.calendar-week:last-child {
|
||
border-bottom: 0;
|
||
}
|
||
.week-events {
|
||
gap: 3px 0;
|
||
padding: 0 8px 8px;
|
||
}
|
||
.calendar-day {
|
||
min-height: 120px;
|
||
padding: 8px;
|
||
border-right: 1px solid #e4ecee;
|
||
background: #fff;
|
||
}
|
||
.calendar-day:nth-child(7n) {
|
||
border-right: 0;
|
||
}
|
||
.calendar-day.muted {
|
||
background: #fafcfc;
|
||
}
|
||
.calendar-day.weekend:not(.muted) {
|
||
background: #fffafa;
|
||
}
|
||
.calendar-day.today .day-number {
|
||
display: grid;
|
||
place-items: center;
|
||
width: 23px;
|
||
height: 23px;
|
||
border-radius: 50%;
|
||
background: #22687e;
|
||
color: #fff;
|
||
}
|
||
.day-number {
|
||
margin: 0 0 5px;
|
||
color: #4a6270;
|
||
font:
|
||
700 13px/1 ui-monospace,
|
||
monospace;
|
||
}
|
||
.muted .day-number {
|
||
color: #b1bdc3;
|
||
}
|
||
.calendar-event {
|
||
display: block;
|
||
overflow: hidden;
|
||
width: 100%;
|
||
min-width: 0;
|
||
margin: 0;
|
||
padding: 3px 5px;
|
||
color: #315966;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
border: 0;
|
||
border-left: 2px solid #5d9aac;
|
||
background: #edf7f8;
|
||
cursor: pointer;
|
||
text-align: left;
|
||
font-size: 11px;
|
||
}
|
||
.calendar-event.holiday {
|
||
color: #9c3439;
|
||
border-left-color: #c24348;
|
||
background: #fff0f0;
|
||
font-weight: 700;
|
||
}
|
||
.calendar-event.grade {
|
||
border-left-color: #9170b0;
|
||
background: #f5f0fb;
|
||
}
|
||
.calendar-event.exam {
|
||
border-left-color: #bc783a;
|
||
background: #fff5e8;
|
||
}
|
||
.calendar-event.due {
|
||
box-shadow: inset -3px 0 #df9c35;
|
||
}
|
||
.more-events {
|
||
color: #708996;
|
||
font-size: 11px;
|
||
}
|
||
.month-agenda {
|
||
border-left: 1px solid #dce6e8;
|
||
background: #f9fbfb;
|
||
}
|
||
.month-agenda header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding: 16px;
|
||
border-bottom: 1px solid #dde8ea;
|
||
color: #284e61;
|
||
}
|
||
.month-agenda header span {
|
||
font-size: 13px;
|
||
}
|
||
.month-agenda header strong {
|
||
font:
|
||
700 15px ui-monospace,
|
||
monospace;
|
||
}
|
||
.agenda-items {
|
||
padding: 5px 12px;
|
||
}
|
||
.agenda-item {
|
||
display: grid;
|
||
grid-template-columns: 68px 1fr;
|
||
gap: 9px;
|
||
padding: 12px 0;
|
||
border-bottom: 1px solid #e2eaec;
|
||
}
|
||
.agenda-item time {
|
||
color: #4f8796;
|
||
font:
|
||
700 11px/1.45 ui-monospace,
|
||
monospace;
|
||
}
|
||
.agenda-item b {
|
||
display: block;
|
||
color: #304f5f;
|
||
font-size: 13px;
|
||
}
|
||
.agenda-item p {
|
||
margin: 4px 0;
|
||
color: #718691;
|
||
font-size: 12px;
|
||
line-height: 1.5;
|
||
}
|
||
.agenda-item small {
|
||
color: #9a7740;
|
||
font-size: 11px;
|
||
}
|
||
.agenda-item.holiday time {
|
||
color: #b04a4d;
|
||
}
|
||
.agenda-actions {
|
||
grid-column: 2;
|
||
display: flex;
|
||
gap: 3px;
|
||
}
|
||
.range-separator {
|
||
padding: 0 8px;
|
||
color: #627184;
|
||
}
|
||
.form-hint {
|
||
color: #5f6f83;
|
||
font-size: 13px;
|
||
}
|
||
.holiday-sync-intro {
|
||
margin: 0 0 16px;
|
||
color: #60798a;
|
||
line-height: 1.65;
|
||
}
|
||
.holiday-sync-controls {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
}
|
||
.holiday-preview {
|
||
min-height: 130px;
|
||
margin-top: 14px;
|
||
padding: 10px;
|
||
border: 1px solid #e1eaed;
|
||
background: #fafcfc;
|
||
}
|
||
.holiday-preview-list {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
}
|
||
.holiday-preview-list span {
|
||
padding: 5px 7px;
|
||
color: #9c3439;
|
||
border-left: 2px solid #c24348;
|
||
background: #fff1f1;
|
||
font-size: 12px;
|
||
}
|
||
.holiday-preview-list span.workday {
|
||
color: #835d20;
|
||
border-left-color: #c08831;
|
||
background: #fff7e9;
|
||
}
|
||
.holiday-preview-list b {
|
||
margin-right: 5px;
|
||
font:
|
||
700 11px ui-monospace,
|
||
monospace;
|
||
}
|
||
@media (max-width: 980px) {
|
||
.calendar-layout {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
.month-agenda {
|
||
border-top: 1px solid #dce6e8;
|
||
border-left: 0;
|
||
}
|
||
.agenda-items {
|
||
display: grid;
|
||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||
gap: 0 15px;
|
||
}
|
||
}
|
||
@media (max-width: 700px) {
|
||
.calendar-masthead,
|
||
.calendar-controls {
|
||
align-items: flex-start;
|
||
flex-direction: column;
|
||
}
|
||
.calendar-legend {
|
||
margin-left: 0;
|
||
}
|
||
.calendar-day {
|
||
min-height: 70px;
|
||
padding: 5px;
|
||
}
|
||
.week-events {
|
||
padding: 0 5px 5px;
|
||
}
|
||
.calendar-event {
|
||
padding: 2px 3px;
|
||
font-size: 10px;
|
||
}
|
||
.calendar-event span {
|
||
display: none;
|
||
}
|
||
.calendar-event:after {
|
||
content: "●";
|
||
}
|
||
.calendar-event.holiday:after {
|
||
content: "○";
|
||
}
|
||
.weekdays span {
|
||
padding: 7px 2px;
|
||
font-size: 11px;
|
||
}
|
||
.agenda-items {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
.calendar-controls > .el-select {
|
||
width: 100%;
|
||
}
|
||
}
|
||
</style>
|