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 @@