From 5a5f5ff1d0cf30f710121a34e4beb35896ebbcb2 Mon Sep 17 00:00:00 2001 From: zhoulexin Date: Tue, 16 Jun 2026 11:39:43 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=AD=97=E6=AE=B5=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DataCard.vue | 26 +- src/components/SideMenu.vue | 9 +- src/components/WebRtcPlayer.vue | 4 +- src/router/index.js | 8 +- src/views/behavior/index.vue | 132 ++- src/views/bigscreen/index.vue | 264 +++--- src/views/bigscreen/roomDetail.vue | 45 + .../components/AttendanceTrendChart.vue | 22 +- src/views/dashboard/index.vue | 10 +- src/views/info/building.vue | 776 +++++++++++++----- 10 files changed, 900 insertions(+), 396 deletions(-) create mode 100644 src/views/bigscreen/roomDetail.vue diff --git a/src/components/DataCard.vue b/src/components/DataCard.vue index 525a748..e1a0a7e 100644 --- a/src/components/DataCard.vue +++ b/src/components/DataCard.vue @@ -1,10 +1,13 @@ - 教学楼信息 + 教室信息 @@ -108,12 +108,7 @@ import { useAppStore } from '@/stores/app' const route = useRoute() const appStore = useAppStore() -const activeMenu = computed(() => { - const { path } = route - if (path.startsWith('/settings')) return '/settings' - if (path.startsWith('/info')) return '/info' - return path -}) +const activeMenu = computed(() => route.path) diff --git a/src/views/bigscreen/index.vue b/src/views/bigscreen/index.vue index ae9db4a..ccb2940 100644 --- a/src/views/bigscreen/index.vue +++ b/src/views/bigscreen/index.vue @@ -29,7 +29,7 @@
{{ stats.attendanceRate }}%
-
全校今日出勤率
+
课程平均出勤率
{{ Math.abs(stats.trend) }}% 较昨日 @@ -71,87 +71,84 @@
- +
-

教室实时监控

+

教室数据概览

- - -
-
-
请选择教学楼和教室查看监控
- - + +
- - -
- -
该设备暂无视频流
-
-
+ + diff --git a/src/views/dashboard/components/AttendanceTrendChart.vue b/src/views/dashboard/components/AttendanceTrendChart.vue index 970f169..38f301a 100644 --- a/src/views/dashboard/components/AttendanceTrendChart.vue +++ b/src/views/dashboard/components/AttendanceTrendChart.vue @@ -26,7 +26,7 @@ const initTrendChart = (dates = [], values = []) => { tooltip: { trigger: 'axis' }, grid: { top: 20, right: 20, bottom: 20, left: 40 }, xAxis: { type: 'category', data: dates, axisTick: { show: false } }, - yAxis: { type: 'value', min: 80, max: 100, axisLabel: { formatter: '{value}%' } }, + yAxis: { type: 'value', min: 0, max: 100, axisLabel: { formatter: '{value}%' } }, series: [{ data: values, type: 'line', smooth: true, symbol: 'circle', symbolSize: 6, @@ -44,21 +44,13 @@ const initTrendChart = (dates = [], values = []) => { const fetchTrendData = async () => { try { const res = await getTrend() - const data = res.data - if (data && Array.isArray(data.dates) && Array.isArray(data.values)) { - initTrendChart(data.dates, data.values) - } else { - // 数据格式不符时使用默认数据 - const defaultDates = ['5/26', '5/27', '5/28', '5/29', '5/30', '5/31', '6/01'] - const defaultValues = [93, 95, 94.5, 96, 95.8, 97, 96.8] - initTrendChart(defaultDates, defaultValues) - } + const list = res.data + if (Array.isArray(list) && list.length > 0) { + const dates = list.map(item => item.date) + const values = list.map(item => item.attendanceRate) + initTrendChart(dates, values) + } } catch { - // 请求失败时使用默认数据兜底 - initTrendChart( - ['5/26', '5/27', '5/28', '5/29', '5/30', '5/31', '6/01'], - [93, 95, 94.5, 96, 95.8, 97, 96.8] - ) } } diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 0215baa..6fa27bb 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -3,13 +3,14 @@