fix: 修复个人信息页面数据显示和日历颜色问题
- 在App.jsx中初始化Redux学生信息 - 修复日历当日事件的颜色显示 - 添加CSS变量定义确保样式正确显示
This commit is contained in:
13
src/App.jsx
13
src/App.jsx
@@ -1,6 +1,10 @@
|
|||||||
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
import Layout from "./components/Layout";
|
import Layout from "./components/Layout";
|
||||||
import routes from "./routes";
|
import routes from "./routes";
|
||||||
|
import { mockData } from "./data/mockData";
|
||||||
|
import { setStudentInfo } from "./store/slices/studentSlice";
|
||||||
|
|
||||||
// 样式文件导入
|
// 样式文件导入
|
||||||
import "./global.css";
|
import "./global.css";
|
||||||
@@ -26,7 +30,16 @@ const getAllRoutes = (routes) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
const dispatch = useDispatch();
|
||||||
const allRoutes = getAllRoutes(routes);
|
const allRoutes = getAllRoutes(routes);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// 初始化学生信息
|
||||||
|
if (mockData.profileOverview?.studentInfo) {
|
||||||
|
dispatch(setStudentInfo(mockData.profileOverview.studentInfo));
|
||||||
|
}
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Layout>
|
<Layout>
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
/* CSS变量定义 */
|
||||||
|
:root {
|
||||||
|
--primary-color: #3b82f6;
|
||||||
|
--border-color: #e5e6eb;
|
||||||
|
--text-color: #1d2129;
|
||||||
|
--text-muted: #86909c;
|
||||||
|
--bg-hover: #f2f3f5;
|
||||||
|
}
|
||||||
|
|
||||||
/* 日历页面样式 */
|
/* 日历页面样式 */
|
||||||
.calendar-page {
|
.calendar-page {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -174,7 +183,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.day-cell.today .day-number {
|
.day-cell.today .day-number {
|
||||||
background: var(--primary-color);
|
background: #3b82f6;
|
||||||
color: white;
|
color: white;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
|
|||||||
Reference in New Issue
Block a user