Compare commits

..

No commits in common. "8a3bbd565bf0593e3b4394fc16b116cbcc433d83" and "19df4739ad07e0f62c31b7a3d63eccb9974cd5c5" have entirely different histories.

7 changed files with 148 additions and 181 deletions

View File

@ -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" &&

View File

@ -32,13 +32,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%;

View File

@ -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;

View File

@ -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,74 +265,61 @@ const IndexPage = () => {
</Dropdown.Item> </Dropdown.Item>
</Dropdown> </Dropdown>
</div> </div>
<div <div className={styles["list-box"]}>
className="float-left" {loading &&
style={{ position: "relative", paddingTop: 96 }} Array.from({ length: 2 }).map((_, i) => (
> <div
<PullToRefresh style={{
onRefresh={async () => { width: "100%",
setLoading(true); height: 75,
await sleep(700); display: "flex",
getData(); alignItems: "center",
}} marginBottom: 30,
> marginTop: 30,
<div className={styles["list-box"]}> }}
{loading && key={i}
Array.from({ length: 2 }).map((_, i) => ( >
<div <Skeleton
style={{ animated
width: "100%", style={{
height: 75, width: 100,
display: "flex", height: 75,
alignItems: "center", borderRadius: 8,
marginBottom: 30, marginRight: 15,
marginTop: 30, }}
}} />
key={i} <div
> style={{
<Skeleton flex: 1,
animated height: 75,
style={{ display: "flex",
width: 100, flexDirection: "column",
height: 75, justifyContent: "space-between",
borderRadius: 8, }}
marginRight: 15, >
}} <Skeleton animated style={{ width: "100%", height: 21 }} />
/> <Skeleton animated style={{ width: "100%", height: 24 }} />
<div </div>
style={{ </div>
flex: 1, ))}
height: 75, {!loading && coursesList.length === 0 && <Empty></Empty>}
display: "flex", {!loading && coursesList.length > 0 && (
flexDirection: "column", <>
justifyContent: "space-between", {coursesList.map((item: any) => (
}} <div className={styles["item"]} key={item.id}>
> <CoursesModel
<Skeleton animated style={{ width: "100%", height: 21 }} /> id={item.id}
<Skeleton animated style={{ width: "100%", height: 24 }} /> title={item.title}
</div> thumb={item.thumb}
</div> isRequired={item.is_required}
))} record={learnCourseRecords[item.id]}
{!loading && coursesList.length === 0 && <Empty></Empty>} hourCount={learnCourseHourCount[item.id]}
{!loading && coursesList.length > 0 && ( ></CoursesModel>
<> </div>
{coursesList.map((item: any) => ( ))}
<div className={styles["item"]} key={item.id}> <Footer></Footer>
<CoursesModel </>
id={item.id} )}
title={item.title}
thumb={item.thumb}
isRequired={item.is_required}
record={learnCourseRecords[item.id]}
hourCount={learnCourseHourCount[item.id]}
></CoursesModel>
</div>
))}
<Footer></Footer>
</>
)}
</div>{" "}
</PullToRefresh>
</div> </div>
</div> </div>
); );

View File

@ -1,7 +0,0 @@
.playedu-app {
width: 100vw;
height: 100vh;
overflow-y: auto;
overflow-x: hidden;
position: relative;
}

View File

@ -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> </>
); );
}; };

View File

@ -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,97 +61,87 @@ 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" }}> <div className={styles["list-box"]}>
<PullToRefresh {loading &&
onRefresh={async () => { Array.from({ length: 2 }).map((_, i) => (
setLoading(true); <div className={styles["item"]} key={i}>
await sleep(700); <Skeleton
getCourses(); animated
}} style={{
> width: 100,
<div className={styles["list-box"]}> height: 75,
{loading && borderRadius: 8,
Array.from({ length: 2 }).map((_, i) => ( marginRight: 15,
<div className={styles["item"]} key={i}> }}
<Skeleton />
animated <div className={styles["item-info"]}>
style={{ <Skeleton animated style={{ width: "100%", height: 21 }} />
width: 100, <Skeleton animated style={{ width: "100%", height: 24 }} />
height: 75, </div>
borderRadius: 8, </div>
marginRight: 15, ))}
}} {!loading &&
/> courses.length === 0 &&
<div className={styles["item-info"]}> todayCourses.length === 0 &&
<Skeleton animated style={{ width: "100%", height: 21 }} /> yesterdayCourses.length === 0 && <Empty></Empty>}
<Skeleton animated style={{ width: "100%", height: 24 }} /> {!loading && (
</div> <>
</div> {todayCourses.length > 0 && (
))}
{!loading &&
courses.length === 0 &&
todayCourses.length === 0 &&
yesterdayCourses.length === 0 && <Empty></Empty>}
{!loading && (
<> <>
{todayCourses.length > 0 && ( <div className={styles["label"]}></div>
<> {todayCourses.map((item: any, index: number) => (
<div className={styles["label"]}></div> <div key={index} style={{ width: "100%" }}>
{todayCourses.map((item: any, index: number) => ( {item.course && (
<div key={index} style={{ width: "100%" }}> <CoursesModel
{item.course && ( id={item.course.id}
<CoursesModel title={item.course.title}
id={item.course.id} thumb={item.course.thumb}
title={item.course.title} isRequired={item.course.is_required}
thumb={item.course.thumb} record={item.record}
isRequired={item.course.is_required} ></CoursesModel>
record={item.record} )}
></CoursesModel> </div>
)} ))}
</div>
))}
</>
)}
{yesterdayCourses.length > 0 && (
<>
<div className={styles["label"]}></div>
{yesterdayCourses.map((item: any, index: number) => (
<div key={index} style={{ width: "100%" }}>
{item.course && (
<CoursesModel
id={item.course.id}
title={item.course.title}
thumb={item.course.thumb}
isRequired={item.course.is_required}
record={item.record}
></CoursesModel>
)}
</div>
))}
</>
)}
{courses.length > 0 && (
<>
<div className={styles["label"]}></div>
{courses.map((item: any, index: number) => (
<div key={index} style={{ width: "100%" }}>
{item.course && (
<CoursesModel
id={item.course.id}
title={item.course.title}
thumb={item.course.thumb}
isRequired={item.course.is_required}
record={item.record}
></CoursesModel>
)}
</div>
))}
</>
)}
</> </>
)} )}
</div> {yesterdayCourses.length > 0 && (
</PullToRefresh> <>
<div className={styles["label"]}></div>
{yesterdayCourses.map((item: any, index: number) => (
<div key={index} style={{ width: "100%" }}>
{item.course && (
<CoursesModel
id={item.course.id}
title={item.course.title}
thumb={item.course.thumb}
isRequired={item.course.is_required}
record={item.record}
></CoursesModel>
)}
</div>
))}
</>
)}
{courses.length > 0 && (
<>
<div className={styles["label"]}></div>
{courses.map((item: any, index: number) => (
<div key={index} style={{ width: "100%" }}>
{item.course && (
<CoursesModel
id={item.course.id}
title={item.course.title}
thumb={item.course.thumb}
isRequired={item.course.is_required}
record={item.record}
></CoursesModel>
)}
</div>
))}
</>
)}
</>
)}
</div> </div>
</div> </div>
); );