From 72a45484af0e4e627fa60b469765fbc4d4cfe0e2 Mon Sep 17 00:00:00 2001 From: KQL Date: Wed, 3 Sep 2025 10:20:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=92=8C=E6=97=A5=E5=8E=86=E9=A2=9C=E8=89=B2=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在App.jsx中初始化Redux学生信息 - 修复日历当日事件的颜色显示 - 添加CSS变量定义确保样式正确显示 --- src/App.jsx | 13 +++++++++++++ src/pages/CalendarPage/index.css | 11 ++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/App.jsx b/src/App.jsx index f045f93..ada2253 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,6 +1,10 @@ import { BrowserRouter, Route, Routes } from "react-router-dom"; +import { useEffect } from "react"; +import { useDispatch } from "react-redux"; import Layout from "./components/Layout"; import routes from "./routes"; +import { mockData } from "./data/mockData"; +import { setStudentInfo } from "./store/slices/studentSlice"; // 样式文件导入 import "./global.css"; @@ -26,7 +30,16 @@ const getAllRoutes = (routes) => { }; function App() { + const dispatch = useDispatch(); const allRoutes = getAllRoutes(routes); + + useEffect(() => { + // 初始化学生信息 + if (mockData.profileOverview?.studentInfo) { + dispatch(setStudentInfo(mockData.profileOverview.studentInfo)); + } + }, [dispatch]); + return ( diff --git a/src/pages/CalendarPage/index.css b/src/pages/CalendarPage/index.css index a3282af..253594a 100644 --- a/src/pages/CalendarPage/index.css +++ b/src/pages/CalendarPage/index.css @@ -1,3 +1,12 @@ +/* CSS变量定义 */ +:root { + --primary-color: #3b82f6; + --border-color: #e5e6eb; + --text-color: #1d2129; + --text-muted: #86909c; + --bg-hover: #f2f3f5; +} + /* 日历页面样式 */ .calendar-page { width: 100%; @@ -174,7 +183,7 @@ } .day-cell.today .day-number { - background: var(--primary-color); + background: #3b82f6; color: white; width: 24px; height: 24px;