mirror of
https://github.com/PlayEdu/h5.git
synced 2026-01-02 04:19:47 +08:00
Compare commits
4 Commits
v1.3
...
19df4739ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19df4739ad | ||
|
|
e5315f621f | ||
|
|
0f811618b7 | ||
|
|
21e152cb74 |
@@ -28,9 +28,11 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^18.0.28",
|
"@types/react": "^18.0.28",
|
||||||
"@types/react-dom": "^18.0.11",
|
"@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,5 +1,3 @@
|
|||||||
@import "./assets/iconfont/iconfont.css";
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ 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";
|
||||||
|
|||||||
@@ -22,10 +22,8 @@ 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);
|
||||||
@@ -60,19 +58,17 @@ 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) {
|
||||||
setLearnTodayDay(todayData[0]);
|
setLearnTodayHour(todayData[0]);
|
||||||
setLearnTodayHour(todayData[1]);
|
setLearnTodayMin(todayData[1]);
|
||||||
setLearnTodayMin(todayData[2]);
|
if (todayData[1] === 0 && todayData[2] > 0) {
|
||||||
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) {
|
||||||
setLearnTotalDay(totalData[0]);
|
setLearnTotalHour(totalData[0]);
|
||||||
setLearnTotalHour(totalData[1]);
|
setLearnTotalMin(totalData[1]);
|
||||||
setLearnTotalMin(totalData[2]);
|
if (totalData[1] === 0 && totalData[2] > 0) {
|
||||||
if (totalData[2] === 0 && totalData[3] > 0) {
|
|
||||||
setLearnTodayMin(1);
|
setLearnTodayMin(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,11 +187,6 @@ 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>
|
||||||
@@ -203,11 +194,6 @@ 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>
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ 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,13 +1,22 @@
|
|||||||
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: [react()],
|
plugins: [
|
||||||
|
react(),
|
||||||
|
legacy({
|
||||||
|
targets: ["chrome 52"],
|
||||||
|
additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
|
||||||
|
renderLegacyChunks: true,
|
||||||
|
modernPolyfills: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
plugins: [gzipPlugin()],
|
plugins: [gzipPlugin()],
|
||||||
|
|||||||
Reference in New Issue
Block a user