mirror of
https://github.com/PlayEdu/h5.git
synced 2025-06-23 05:43:07 +08:00
Compare commits
No commits in common. "main" and "v1.2" have entirely different histories.
@ -1 +1,2 @@
|
|||||||
VITE_APP_URL=
|
VITE_APP_URL=
|
||||||
|
VITE_G_ID=
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -32,5 +32,3 @@ yarn.lock
|
|||||||
|
|
||||||
deploy-test.sh
|
deploy-test.sh
|
||||||
deploy-demo.sh
|
deploy-demo.sh
|
||||||
|
|
||||||
pnpm-lock.yaml
|
|
@ -13,6 +13,11 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<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>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
if (
|
if (
|
||||||
typeof WeixinJSBridge == "object" &&
|
typeof WeixinJSBridge == "object" &&
|
||||||
|
15
package.json
15
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "playedu-h5-interface",
|
"name": "frontend",
|
||||||
"private": false,
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -10,7 +10,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@reduxjs/toolkit": "^1.9.3",
|
"@reduxjs/toolkit": "^1.9.3",
|
||||||
"ahooks": "^3.7.10",
|
|
||||||
"antd-mobile": "^5.31.1",
|
"antd-mobile": "^5.31.1",
|
||||||
"axios": "^1.3.4",
|
"axios": "^1.3.4",
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
@ -19,19 +18,19 @@
|
|||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-ga": "^3.3.1",
|
||||||
"react-redux": "^8.0.5",
|
"react-redux": "^8.0.5",
|
||||||
"react-router-dom": "^6.9.0",
|
"react-router-dom": "^6.9.0",
|
||||||
"redux": "^4.2.1",
|
"redux": "^4.2.1",
|
||||||
"sort-by": "^1.2.0"
|
"sort-by": "^1.2.0",
|
||||||
|
"web-vitals": "^3.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^18.2.0",
|
"@types/react": "^18.0.28",
|
||||||
"@types/react-dom": "^18.2.0",
|
"@types/react-dom": "^18.0.11",
|
||||||
"@vitejs/plugin-legacy": "^4.1.1",
|
|
||||||
"@vitejs/plugin-react-swc": "^3.0.0",
|
"@vitejs/plugin-react-swc": "^3.0.0",
|
||||||
"rollup-plugin-gzip": "^3.1.0",
|
"rollup-plugin-gzip": "^3.1.0",
|
||||||
"sass": "^1.59.3",
|
"sass": "^1.59.3",
|
||||||
"terser": "^5.19.4",
|
|
||||||
"typescript": "^4.9.3",
|
"typescript": "^4.9.3",
|
||||||
"vite": "^4.2.0"
|
"vite": "^4.2.0"
|
||||||
}
|
}
|
||||||
|
1
public/js/xg/hls.min.js
vendored
Normal file
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
21
public/js/xg/index.js
Normal file
File diff suppressed because one or more lines are too long
18
src/App.tsx
18
src/App.tsx
@ -1,12 +1,26 @@
|
|||||||
import { Suspense } from "react";
|
import { Suspense, useEffect } from "react";
|
||||||
import { useRoutes } from "react-router-dom";
|
import ReactGA from "react-ga";
|
||||||
|
import { useLocation, useRoutes } from "react-router-dom";
|
||||||
import routes from "./routes";
|
import routes from "./routes";
|
||||||
import "./App.scss";
|
import "./App.scss";
|
||||||
import LoadingPage from "./pages/loading";
|
import LoadingPage from "./pages/loading";
|
||||||
|
|
||||||
|
const G_ID = import.meta.env.VITE_G_ID || "";
|
||||||
|
if (G_ID) {
|
||||||
|
ReactGA.initialize(G_ID);
|
||||||
|
}
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const Views = () => useRoutes(routes);
|
const Views = () => useRoutes(routes);
|
||||||
|
|
||||||
|
const location = useLocation();
|
||||||
|
useEffect(() => {
|
||||||
|
if (!G_ID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ReactGA.pageview(location.pathname + location.search);
|
||||||
|
}, [location]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={<LoadingPage />}>
|
<Suspense fallback={<LoadingPage />}>
|
||||||
<Views />
|
<Views />
|
||||||
|
@ -10,10 +10,3 @@ export function login(email: string, password: string) {
|
|||||||
export function logout() {
|
export function logout() {
|
||||||
return client.post("/api/v1/auth/logout", {});
|
return client.post("/api/v1/auth/logout", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loginLdap(email: string, password: string) {
|
|
||||||
return client.post("/api/v1/auth/login/ldap", {
|
|
||||||
username: email,
|
|
||||||
password: password,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
@import "./assets/iconfont/iconfont.css";
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
@ -32,13 +34,6 @@ code {
|
|||||||
float: left;
|
float: left;
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.float-left {
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-header {
|
.main-header {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -2,7 +2,6 @@ import ReactDOM from "react-dom/client";
|
|||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
import store from "./store";
|
import store from "./store";
|
||||||
import { BrowserRouter } from "react-router-dom";
|
import { BrowserRouter } from "react-router-dom";
|
||||||
import "./assets/iconfont/iconfont.css";
|
|
||||||
import "./main.scss";
|
import "./main.scss";
|
||||||
import App from "./App";
|
import App from "./App";
|
||||||
import AutoScorllTop from "./AutoTop";
|
import AutoScorllTop from "./AutoTop";
|
||||||
|
@ -107,7 +107,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0px 20px 55px 20px;
|
padding: 96px 20px 55px 20px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { Dropdown, PullToRefresh, Skeleton, Tabs } from "antd-mobile";
|
import { Dropdown, Skeleton, Tabs } from "antd-mobile";
|
||||||
import { sleep } from "antd-mobile/es/utils/sleep";
|
|
||||||
import { DropdownRef } from "antd-mobile/es/components/dropdown";
|
import { DropdownRef } from "antd-mobile/es/components/dropdown";
|
||||||
import { user } from "../../api/index";
|
import { user } from "../../api/index";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
@ -72,15 +71,14 @@ const IndexPage = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLoading(true);
|
|
||||||
if (currentDepId === 0) {
|
if (currentDepId === 0) {
|
||||||
setLoading(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getData();
|
getData();
|
||||||
}, [currentDepId, categoryId]);
|
}, [currentDepId, categoryId]);
|
||||||
|
|
||||||
const getData = () => {
|
const getData = () => {
|
||||||
|
setLoading(true);
|
||||||
user.courses(currentDepId, categoryId).then((res: any) => {
|
user.courses(currentDepId, categoryId).then((res: any) => {
|
||||||
const records = res.data.learn_course_records;
|
const records = res.data.learn_course_records;
|
||||||
setLearnCourseRecords(records);
|
setLearnCourseRecords(records);
|
||||||
@ -267,17 +265,6 @@ const IndexPage = () => {
|
|||||||
</Dropdown.Item>
|
</Dropdown.Item>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
className="float-left"
|
|
||||||
style={{ position: "relative", paddingTop: 96 }}
|
|
||||||
>
|
|
||||||
<PullToRefresh
|
|
||||||
onRefresh={async () => {
|
|
||||||
setLoading(true);
|
|
||||||
await sleep(700);
|
|
||||||
getData();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className={styles["list-box"]}>
|
<div className={styles["list-box"]}>
|
||||||
{loading &&
|
{loading &&
|
||||||
Array.from({ length: 2 }).map((_, i) => (
|
Array.from({ length: 2 }).map((_, i) => (
|
||||||
@ -333,8 +320,6 @@ const IndexPage = () => {
|
|||||||
<Footer></Footer>
|
<Footer></Footer>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>{" "}
|
|
||||||
</PullToRefresh>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -24,7 +24,6 @@ export const InitPage = (props: Props) => {
|
|||||||
if (props.configData) {
|
if (props.configData) {
|
||||||
let config: SystemConfigStoreInterface = {
|
let config: SystemConfigStoreInterface = {
|
||||||
//系统配置
|
//系统配置
|
||||||
"ldap-enabled": props.configData["ldap-enabled"],
|
|
||||||
systemApiUrl: props.configData["system-api-url"],
|
systemApiUrl: props.configData["system-api-url"],
|
||||||
systemH5Url: props.configData["system-h5-url"],
|
systemH5Url: props.configData["system-h5-url"],
|
||||||
systemLogo: props.configData["system-logo"],
|
systemLogo: props.configData["system-logo"],
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
.playedu-app {
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
overflow-x: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
@ -2,16 +2,15 @@ import { Suspense } from "react";
|
|||||||
import { Outlet } from "react-router-dom";
|
import { Outlet } from "react-router-dom";
|
||||||
import LoadingPage from "../../loading";
|
import LoadingPage from "../../loading";
|
||||||
import { TabBarFooter } from "../../../components";
|
import { TabBarFooter } from "../../../components";
|
||||||
import styles from "./index.module.scss";
|
|
||||||
|
|
||||||
const WithoutHeaderWithoutFooter = () => {
|
const WithoutHeaderWithoutFooter = () => {
|
||||||
return (
|
return (
|
||||||
<div className={styles["playedu-app"]}>
|
<>
|
||||||
<Suspense fallback={<LoadingPage />}>
|
<Suspense fallback={<LoadingPage />}>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
<TabBarFooter></TabBarFooter>
|
<TabBarFooter></TabBarFooter>
|
||||||
</div>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Button, Toast, Input, Image } from "antd-mobile";
|
import { Button, Toast, Input, Image } from "antd-mobile";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { login, system, user } from "../../api/index";
|
import { login, system, user } from "../../api/index";
|
||||||
import { setToken } from "../../utils/index";
|
import { setToken } from "../../utils/index";
|
||||||
@ -19,7 +19,6 @@ const LoginPage = () => {
|
|||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
const [bodyHeight, setBodyHeight] = useState(0);
|
const [bodyHeight, setBodyHeight] = useState(0);
|
||||||
const systemConfig = useSelector((state: any) => state.systemConfig.value);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.title = "登录";
|
document.title = "登录";
|
||||||
@ -30,7 +29,7 @@ const LoginPage = () => {
|
|||||||
const loginSubmit = async (e: any) => {
|
const loginSubmit = async (e: any) => {
|
||||||
if (!email) {
|
if (!email) {
|
||||||
Toast.show({
|
Toast.show({
|
||||||
content: "请输入邮箱或UID",
|
content: "请输入学员邮箱账号",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -48,19 +47,6 @@ const LoginPage = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
if (systemConfig["ldap-enabled"] === "1") {
|
|
||||||
try {
|
|
||||||
let res: any = await login.loginLdap(email, password);
|
|
||||||
setToken(res.data.token); //将token写入本地
|
|
||||||
await getSystemConfig(); //获取系统配置并写入store
|
|
||||||
await getUser(); //获取登录用户的信息并写入store
|
|
||||||
setLoading(false);
|
|
||||||
navigate("/member", { replace: true });
|
|
||||||
} catch (e) {
|
|
||||||
console.error("错误信息", e);
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
try {
|
try {
|
||||||
let res: any = await login.login(email, password);
|
let res: any = await login.login(email, password);
|
||||||
setToken(res.data.token); //将token写入本地
|
setToken(res.data.token); //将token写入本地
|
||||||
@ -72,8 +58,6 @@ const LoginPage = () => {
|
|||||||
console.error("错误信息", e);
|
console.error("错误信息", e);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getUser = async () => {
|
const getUser = async () => {
|
||||||
@ -86,7 +70,6 @@ const LoginPage = () => {
|
|||||||
if (configRes.data) {
|
if (configRes.data) {
|
||||||
let config: SystemConfigStoreInterface = {
|
let config: SystemConfigStoreInterface = {
|
||||||
//系统配置
|
//系统配置
|
||||||
"ldap-enabled": configRes.data["ldap-enabled"],
|
|
||||||
systemApiUrl: configRes.data["system-api-url"],
|
systemApiUrl: configRes.data["system-api-url"],
|
||||||
systemH5Url: configRes.data["system-h5-url"],
|
systemH5Url: configRes.data["system-h5-url"],
|
||||||
systemLogo: configRes.data["system-logo"],
|
systemLogo: configRes.data["system-logo"],
|
||||||
@ -127,7 +110,7 @@ const LoginPage = () => {
|
|||||||
<div className={styles["input-box"]}>
|
<div className={styles["input-box"]}>
|
||||||
<Input
|
<Input
|
||||||
className={styles["input-item"]}
|
className={styles["input-item"]}
|
||||||
placeholder="请输入邮箱或UID"
|
placeholder="请输入学员邮箱账号"
|
||||||
value={email}
|
value={email}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
setEmail(val);
|
setEmail(val);
|
||||||
|
@ -22,8 +22,10 @@ const MemberPage = () => {
|
|||||||
url: "",
|
url: "",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
const [learnTodayDay, setLearnTodayDay] = useState(0);
|
||||||
const [learnTodayHour, setLearnTodayHour] = useState(0);
|
const [learnTodayHour, setLearnTodayHour] = useState(0);
|
||||||
const [learnTodayMin, setLearnTodayMin] = useState(0);
|
const [learnTodayMin, setLearnTodayMin] = useState(0);
|
||||||
|
const [learnTotalDay, setLearnTotalDay] = useState(0);
|
||||||
const [learnTotalHour, setLearnTotalHour] = useState(0);
|
const [learnTotalHour, setLearnTotalHour] = useState(0);
|
||||||
const [learnTotalMin, setLearnTotalMin] = useState(0);
|
const [learnTotalMin, setLearnTotalMin] = useState(0);
|
||||||
const user = useSelector((state: any) => state.loginUser.value.user);
|
const user = useSelector((state: any) => state.loginUser.value.user);
|
||||||
@ -58,17 +60,19 @@ const MemberPage = () => {
|
|||||||
setStats(res.data.stats);
|
setStats(res.data.stats);
|
||||||
let todayData = studyTimeFormat(res.data.stats.today_learn_duration);
|
let todayData = studyTimeFormat(res.data.stats.today_learn_duration);
|
||||||
if (todayData) {
|
if (todayData) {
|
||||||
setLearnTodayHour(todayData[0]);
|
setLearnTodayDay(todayData[0]);
|
||||||
setLearnTodayMin(todayData[1]);
|
setLearnTodayHour(todayData[1]);
|
||||||
if (todayData[1] === 0 && todayData[2] > 0) {
|
setLearnTodayMin(todayData[2]);
|
||||||
|
if (todayData[2] === 0 && todayData[3] > 0) {
|
||||||
setLearnTodayMin(1);
|
setLearnTodayMin(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let totalData = studyTimeFormat(res.data.stats.learn_duration);
|
let totalData = studyTimeFormat(res.data.stats.learn_duration);
|
||||||
if (totalData) {
|
if (totalData) {
|
||||||
setLearnTotalHour(totalData[0]);
|
setLearnTotalDay(totalData[0]);
|
||||||
setLearnTotalMin(totalData[1]);
|
setLearnTotalHour(totalData[1]);
|
||||||
if (totalData[1] === 0 && totalData[2] > 0) {
|
setLearnTotalMin(totalData[2]);
|
||||||
|
if (totalData[2] === 0 && totalData[3] > 0) {
|
||||||
setLearnTodayMin(1);
|
setLearnTodayMin(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,6 +191,11 @@ const MemberPage = () => {
|
|||||||
<div className={styles["stats-content"]}>
|
<div className={styles["stats-content"]}>
|
||||||
<div className={styles["stat-item"]}>
|
<div className={styles["stat-item"]}>
|
||||||
<span className={styles["time"]}>
|
<span className={styles["time"]}>
|
||||||
|
{learnTodayDay > 0 && (
|
||||||
|
<>
|
||||||
|
<strong>{learnTodayDay} </strong>天
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<strong> {learnTodayHour} </strong>时
|
<strong> {learnTodayHour} </strong>时
|
||||||
<strong> {learnTodayMin} </strong>分
|
<strong> {learnTodayMin} </strong>分
|
||||||
</span>
|
</span>
|
||||||
@ -194,6 +203,11 @@ const MemberPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles["stat-item"]}>
|
<div className={styles["stat-item"]}>
|
||||||
<span className={styles["time"]}>
|
<span className={styles["time"]}>
|
||||||
|
{learnTotalDay > 0 && (
|
||||||
|
<>
|
||||||
|
<strong>{learnTotalDay} </strong>天
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<strong> {learnTotalHour} </strong>时
|
<strong> {learnTotalHour} </strong>时
|
||||||
<strong> {learnTotalMin} </strong>分
|
<strong> {learnTotalMin} </strong>分
|
||||||
</span>
|
</span>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { PullToRefresh, Skeleton } from "antd-mobile";
|
import { Skeleton } from "antd-mobile";
|
||||||
import { sleep } from "antd-mobile/es/utils/sleep";
|
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
import { course } from "../../api/index";
|
import { course } from "../../api/index";
|
||||||
import { Empty } from "../../components";
|
import { Empty } from "../../components";
|
||||||
@ -18,11 +17,14 @@ const StudyPage = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLoading(true);
|
|
||||||
getCourses();
|
getCourses();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const getCourses = () => {
|
const getCourses = () => {
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setLoading(true);
|
||||||
course
|
course
|
||||||
.latestLearn()
|
.latestLearn()
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
@ -59,14 +61,6 @@ const StudyPage = () => {
|
|||||||
return (
|
return (
|
||||||
<div className="main-body">
|
<div className="main-body">
|
||||||
<div className={styles["title"]}>最近学习</div>
|
<div className={styles["title"]}>最近学习</div>
|
||||||
<div className="float-left" style={{ position: "relative" }}>
|
|
||||||
<PullToRefresh
|
|
||||||
onRefresh={async () => {
|
|
||||||
setLoading(true);
|
|
||||||
await sleep(700);
|
|
||||||
getCourses();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className={styles["list-box"]}>
|
<div className={styles["list-box"]}>
|
||||||
{loading &&
|
{loading &&
|
||||||
Array.from({ length: 2 }).map((_, i) => (
|
Array.from({ length: 2 }).map((_, i) => (
|
||||||
@ -149,8 +143,6 @@ const StudyPage = () => {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</PullToRefresh>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
15
src/reportWebVitals.ts
Normal file
15
src/reportWebVitals.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { ReportHandler } from 'web-vitals';
|
||||||
|
|
||||||
|
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
||||||
|
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||||
|
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||||
|
getCLS(onPerfEntry);
|
||||||
|
getFID(onPerfEntry);
|
||||||
|
getFCP(onPerfEntry);
|
||||||
|
getLCP(onPerfEntry);
|
||||||
|
getTTFB(onPerfEntry);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default reportWebVitals;
|
@ -1,7 +1,6 @@
|
|||||||
import { createSlice } from "@reduxjs/toolkit";
|
import { createSlice } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
type SystemConfigStoreInterface = {
|
type SystemConfigStoreInterface = {
|
||||||
"ldap-enabled": string;
|
|
||||||
systemApiUrl: string;
|
systemApiUrl: string;
|
||||||
systemPcUrl: string;
|
systemPcUrl: string;
|
||||||
systemH5Url: string;
|
systemH5Url: string;
|
||||||
@ -17,7 +16,6 @@ type SystemConfigStoreInterface = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let defaultValue: SystemConfigStoreInterface = {
|
let defaultValue: SystemConfigStoreInterface = {
|
||||||
"ldap-enabled": "",
|
|
||||||
systemApiUrl: "",
|
systemApiUrl: "",
|
||||||
systemPcUrl: "",
|
systemPcUrl: "",
|
||||||
systemH5Url: "",
|
systemH5Url: "",
|
||||||
|
@ -54,6 +54,7 @@ export function changeAppUrl(str: string) {
|
|||||||
export function studyTimeFormat(dateStr: number) {
|
export function studyTimeFormat(dateStr: number) {
|
||||||
var d = moment.duration(dateStr / 1000, "seconds");
|
var d = moment.duration(dateStr / 1000, "seconds");
|
||||||
let value = [];
|
let value = [];
|
||||||
|
value.push(Math.floor(d.asDays()));
|
||||||
value.push(d.hours());
|
value.push(d.hours());
|
||||||
value.push(d.minutes());
|
value.push(d.minutes());
|
||||||
value.push(d.seconds());
|
value.push(d.seconds());
|
||||||
|
@ -1,22 +1,13 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import react from "@vitejs/plugin-react-swc";
|
import react from "@vitejs/plugin-react-swc";
|
||||||
import gzipPlugin from "rollup-plugin-gzip";
|
import gzipPlugin from "rollup-plugin-gzip";
|
||||||
import legacy from "@vitejs/plugin-legacy";
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
server: {
|
server: {
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [react()],
|
||||||
react(),
|
|
||||||
legacy({
|
|
||||||
targets: ["chrome 52"],
|
|
||||||
additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
|
|
||||||
renderLegacyChunks: true,
|
|
||||||
modernPolyfills: true,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
plugins: [gzipPlugin()],
|
plugins: [gzipPlugin()],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user