fix: 修复个人信息页面数据显示和日历颜色问题

- 在App.jsx中初始化Redux学生信息
- 修复日历当日事件的颜色显示
- 添加CSS变量定义确保样式正确显示
This commit is contained in:
KQL
2025-09-03 10:20:59 +08:00
parent 204b02404d
commit 72a45484af
2 changed files with 23 additions and 1 deletions

View File

@@ -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 (
<BrowserRouter>
<Layout>

View File

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