Compare commits

..

No commits in common. "96da44a884706d7fb55abb0fe2f3c89cfd9767f9" and "f1985d0b8f11c9652f95a7b80edad4e02bfe6905" have entirely different histories.

15 changed files with 75 additions and 58 deletions

View File

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

4
.gitignore vendored
View File

@ -32,6 +32,4 @@ yarn.lock
deploy-test.sh
deploy-prod.sh
deploy-demo.sh
pnpm-lock.yaml
deploy-demo.sh

View File

@ -13,5 +13,10 @@
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script
crossorigin="anonymous"
integrity="sha512-oHrfR/z2wkuRuaHrdZ9NhoT/o/1kteub+QvmQgVzOKK7NTvIKQMvnY9+/RR0+eW311o4lAE/YzzLXXmP2XUvig=="
src="https://lib.baomitu.com/hls.js/1.1.4/hls.min.js"
></script>
</body>
</html>

View File

@ -1,6 +1,6 @@
{
"name": "playedu-pc-interface",
"private": false,
"name": "frontend",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
@ -9,26 +9,25 @@
"preview": "vite preview"
},
"dependencies": {
"@ant-design/icons": "^5.3.0",
"@reduxjs/toolkit": "^1.9.3",
"add": "^2.0.6",
"antd": "^5.3.2",
"axios": "^1.3.4",
"dayjs": "^1.11.10",
"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"
},
"devDependencies": {
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-legacy": "^4.1.1",
"@vitejs/plugin-react-swc": "^3.0.0",
"rollup-plugin-gzip": "^3.1.0",

1
public/js/xg/hls.min.js vendored Normal file

File diff suppressed because one or more lines are too long

21
public/js/xg/index.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,31 @@
import { Suspense } from "react";
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 LoadingPage from "./pages/loading";
const G_ID = import.meta.env.VITE_G_ID || "";
if (G_ID) {
ReactGA.initialize(G_ID);
}
const App = () => {
const views = useRoutes(routes);
return <Suspense fallback={<LoadingPage />}>{views}</Suspense>;
const location = useLocation();
useEffect(() => {
if (!G_ID) {
return;
}
ReactGA.pageview(location.pathname + location.search);
}, [location]);
return (
<Suspense fallback={<LoadingPage />}>
{views}
</Suspense>
);
};
export default App;

View File

@ -1,21 +1,14 @@
import axios, { Axios, AxiosResponse } from "axios";
import { message } from "antd";
import {
getToken,
clearToken,
clearDepKey,
clearDepName,
} from "../../utils/index";
import { getToken, clearToken } from "../../utils/index";
const GoLogin = () => {
clearToken();
clearDepName();
clearDepKey();
window.location.href = "/login";
};
const GoError = (status: number) => {
window.location.href = "/error?status=" + status;
const GoError = () => {
window.location.href = "/error";
};
export class HttpClient {
@ -63,13 +56,13 @@ export class HttpClient {
GoLogin();
} else if (status === 404) {
// 跳转到404页面
GoError(404);
GoError();
} else if (status === 403) {
// 跳转到无权限页面
GoError(403);
GoError();
} else if (status === 500) {
// 跳转到500异常页面
GoError(500);
GoError();
}
return Promise.reject(error.response);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -33,18 +33,6 @@ body {
min-height: 100vh;
}
.layout-box {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.footer-box {
flex: 1;
display: flex;
flex-direction: column-reverse;
}
.main-body {
width: 100%;
height: auto;

View File

@ -101,7 +101,7 @@
align-items: center;
position: relative;
.tab-item {
min-width: 64px;
width: 64px;
height: 48px;
margin-right: 50px;
transition: all 0.2s;
@ -114,7 +114,7 @@
}
}
.tit {
width: 100%;
width: 64px;
height: 40px;
font-size: 16px;
font-weight: 400;
@ -123,7 +123,7 @@
}
}
.tab-active-item {
min-width: 64px;
width: 64px;
height: 48px;
cursor: pointer;
margin-right: 50px;
@ -133,7 +133,7 @@
opacity: 0.8;
}
.tit {
width: 100%;
width: 64px;
height: 40px;
font-size: 16px;
font-weight: 500;

View File

@ -1,17 +1,14 @@
import { useState } from "react";
import { Button, Result } from "antd";
import { useNavigate, useLocation } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import styles from "./index.module.scss";
const ErrorPage = () => {
const navigate = useNavigate();
const result = new URLSearchParams(useLocation().search);
const [status, setStatus] = useState(String(result.get("status") || "404"));
return (
<Result
status="404"
title={status}
title="404"
subTitle="您访问的页面不存在"
className={styles["main"]}
extra={

View File

@ -5,15 +5,13 @@ import LoadingPage from "../../loading";
const WithHeaderWithFooter = () => {
return (
<div className="layout-box">
<>
<Header></Header>
<Suspense fallback={<LoadingPage height="100vh" />}>
<Outlet />
</Suspense>
<div className="footer-box">
<Footer></Footer>
</div>
</div>
<Footer></Footer>
</>
);
};

View File

@ -5,14 +5,12 @@ import LoadingPage from "../../loading";
const WithoutHeaderWithFooter = () => {
return (
<div className="layout-box">
<>
<Suspense fallback={<LoadingPage height="100vh" />}>
<Outlet />
</Suspense>
<div className="footer-box">
<Footer></Footer>
</div>
</div>
<Footer></Footer>
</>
);
};

View File

@ -31,7 +31,7 @@ const loginUserSlice = createSlice({
stage.value.user = e.payload.user;
stage.value.departments = e.payload.departments;
stage.value.isLogin = true;
if (e.payload.departments.length > 0 && !getDepKey()) {
if (e.payload.departments.length > 0 && stage.value.currentDepId === 0) {
stage.value.currentDepId = e.payload.departments[0].id;
setDepName(e.payload.departments[0].name);
}