feat: 🎸 更新了一部分接口请求信息
This commit is contained in:
@@ -1,12 +1,28 @@
|
||||
import { useState } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import { Spin } from "@arco-design/web-react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { getLoginStudentInfo } from "@/services";
|
||||
import { setStudentInfo } from "@/store/slices/studentSlice";
|
||||
import Sidebar from "../Sidebar";
|
||||
import "./index.css";
|
||||
|
||||
const Layout = ({ children }) => {
|
||||
const loading = useSelector((state) => state.loading.value);
|
||||
const dispatch = useDispatch();
|
||||
const [isCollapsed, setIsCollapsed] = useState(true);
|
||||
const loading = useSelector((state) => state.loading.value);
|
||||
const studentInfo = useSelector((state) => state.student.studentInfo);
|
||||
|
||||
const queryLoginStudentInfo = async () => {
|
||||
const res = await getLoginStudentInfo();
|
||||
dispatch(setStudentInfo(res));
|
||||
};
|
||||
|
||||
// 初始化项目统一获取登录用户信息
|
||||
useEffect(() => {
|
||||
if (!studentInfo) {
|
||||
queryLoginStudentInfo();
|
||||
}
|
||||
}, [studentInfo]);
|
||||
|
||||
return (
|
||||
<div className="app-layout">
|
||||
|
||||
Reference in New Issue
Block a user