This commit is contained in:
禺狨 2023-04-11 16:42:42 +08:00
commit ec32b7a6d1
4 changed files with 50 additions and 11 deletions

View File

@ -1 +1,2 @@
VITE_APP_URL=
VITE_APP_URL=
VITE_G_ID=

22
README.md Normal file
View File

@ -0,0 +1,22 @@
<p align="center">
<img src="https://playedu.xyz/images/index/logo-big.png?v=2023032901" width="150"/>
</p>
<h1 align="center">PC界面程序 - PlayEdu开源培训系统</h1>
<p align="center">一款开源的培训系统,您可以使用它快速搭建私有化内部培训平台</p>
### 常用链接
+ [官网](https://playedu.xyz)
+ [快速上手](https://playedu.xyz/docs/docs/category/pc%E7%95%8C%E9%9D%A2%E7%A8%8B%E5%BA%8F%E5%AE%89%E8%A3%85)
### 开发团队
杭州白书科技有限公司
### 使用协议
欢迎使用杭州白书科技有限公司提供的开源培训解决方案!请您仔细阅读以下条款。通过使用 PlayEdu ,您表示同意接受以下所有条款。
+ 本开源项目中所有代码基于 Apache-2.0 许可协议,您默认遵守许可协议中约定的义务。
+ 您默认授权我们将您使用 PlayEdu 所在业务的 Logo 放置在本官网展示。

View File

@ -10,18 +10,22 @@
},
"dependencies": {
"@reduxjs/toolkit": "^1.9.3",
"add": "^2.0.6",
"antd": "^5.3.2",
"axios": "^1.3.4",
"localforage": "^1.10.0",
"match-sorter": "^6.3.1",
"moment": "^2.29.4",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-ga": "^3.3.1",
"react-redux": "^8.0.5",
"react-router-dom": "^6.9.0",
"redux": "^4.2.1",
"sort-by": "^1.2.0",
"web-vitals": "^3.3.0"
"web-vitals": "^3.3.0",
"yarn": "^1.22.19"
},
"devDependencies": {
"@types/react": "^18.0.28",

View File

@ -1,31 +1,43 @@
import { useRoutes } from "react-router-dom";
import { Suspense, useEffect } from "react";
import ReactGA from "react-ga";
import { useLocation, useRoutes } from "react-router-dom";
import routes from "./routes";
import "./App.scss";
import { Suspense } from "react";
import LoadingPage from "./pages/loading";
import { user } from "./api/index";
import { getToken } from "./utils/index";
import { useDispatch } from "react-redux";
import { loginAction } from "./store/user/loginUserSlice";
function App() {
const Views = () => useRoutes(routes);
const G_ID = import.meta.env.VITE_G_ID || "";
if (G_ID) {
ReactGA.initialize(G_ID);
}
const App = () => {
const dispatch = useDispatch();
const getUser = () => {
const Views = () => useRoutes(routes);
if (getToken()) {
user.detail().then((res: any) => {
const data = res.data;
dispatch(loginAction(data));
});
};
if (getToken()) {
getUser();
}
const location = useLocation();
useEffect(() => {
if (!G_ID) {
return;
}
ReactGA.pageview(location.pathname + location.search);
}, [location]);
return (
<Suspense fallback={<LoadingPage />}>
<Views />
</Suspense>
);
}
};
export default App;