From 02fcf9ae8f975ea4ed9aa2281e50f2d77dd56ee3 Mon Sep 17 00:00:00 2001 From: biss Date: Tue, 11 Aug 2026 20:27:11 +0800 Subject: [PATCH] v2.4.0 patch2 --- .../TimetableManagementController.cs | 2 +- web/src/views/VenueDisplayView.vue | 26 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/Jiaowu.Api/Controllers/TimetableManagementController.cs b/src/Jiaowu.Api/Controllers/TimetableManagementController.cs index a747607..f423c1d 100644 --- a/src/Jiaowu.Api/Controllers/TimetableManagementController.cs +++ b/src/Jiaowu.Api/Controllers/TimetableManagementController.cs @@ -304,7 +304,7 @@ public sealed class TimetableManagementController( public sealed record TimetableBatchExportRequest( TimetableResourceType ResourceType, - [property: Required, MinLength(1), MaxLength(100)] IReadOnlyCollection ResourceIds, + [param: Required, MinLength(1), MaxLength(100)] IReadOnlyCollection ResourceIds, Guid AcademicTermId, Guid? SchedulePlanId); diff --git a/web/src/views/VenueDisplayView.vue b/web/src/views/VenueDisplayView.vue index c2a82f4..08db9cf 100644 --- a/web/src/views/VenueDisplayView.vue +++ b/web/src/views/VenueDisplayView.vue @@ -8,25 +8,43 @@ const type = computed(() => route.params.type as 'classroom' | 'building') const id = computed(() => route.params.id as string) const data = ref() const now = ref(new Date()) +const page = ref(0) +const pageSize = ref(1) let timer = 0 +let pageTimer = 0 const title = computed(() => type.value === 'classroom' ? data.value?.classroom : data.value?.building) const timeText = computed(() => now.value.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit', second: '2-digit' })) +const displayItems = computed(() => type.value === 'classroom' ? data.value?.entries ?? [] : data.value?.rooms ?? []) +const pageCount = computed(() => Math.max(1, Math.ceil(displayItems.value.length / pageSize.value))) +const visibleItems = computed(() => displayItems.value.slice(page.value * pageSize.value, (page.value + 1) * pageSize.value)) async function load() { data.value = (await http.get(`/venue-displays/${type.value}s/${id.value}`)).data } -onMounted(async () => { await load(); timer = window.setInterval(() => { now.value = new Date(); if (now.value.getMinutes() % 5 === 0 && now.value.getSeconds() === 0) void load() }, 1000) }) -onBeforeUnmount(() => window.clearInterval(timer)) +function fitPage() { + const header = window.innerWidth < 620 ? 220 : 170 + const available = Math.max(1, window.innerHeight - header) + if (type.value === 'classroom') { + const columns = window.innerWidth >= 1280 ? 3 : window.innerWidth >= 760 ? 2 : 1 + pageSize.value = Math.max(1, Math.floor(available / 190) * columns) + } else pageSize.value = Math.max(1, Math.floor(available / 58)) + page.value = Math.min(page.value, pageCount.value - 1) +} +function nextPage() { page.value = (page.value + 1) % pageCount.value } +onMounted(async () => { await load(); fitPage(); window.addEventListener('resize', fitPage); timer = window.setInterval(() => { now.value = new Date(); if (now.value.getMinutes() % 5 === 0 && now.value.getSeconds() === 0) void load() }, 1000); pageTimer = window.setInterval(nextPage, 25000) }) +onBeforeUnmount(() => { window.clearInterval(timer); window.clearInterval(pageTimer); window.removeEventListener('resize', fitPage) })