首页优化

This commit is contained in:
禺狨 2023-03-27 18:00:38 +08:00
parent b681c24fe3
commit 2ab98305b3
4 changed files with 75 additions and 31 deletions

View File

@ -76,7 +76,8 @@
}
.desc {
width: 100%;
height: 112px;
height: auto;
max-height: 112px;
font-size: 16px;
font-weight: 400;
color: rgba(0, 0, 0, 0.6);

View File

@ -112,6 +112,7 @@
gap: 24px;
grid-template-columns: repeat(3, minmax(0, 1fr));
position: relative;
min-height: 301px;
}
.extra {

View File

@ -114,14 +114,14 @@ const IndexPage = () => {
<div className={styles["info"]}>
<div className={styles["info-item"]}>
<span></span>
<strong> {stats.required_finished_hour_count} </strong>
<span>/ {stats.required_hour_count}</span>
<strong> {stats.required_finished_hour_count || 0} </strong>
<span>/ {stats.required_hour_count || 0}</span>
</div>
{stats.nun_required_hour_count > 0 && (
<div className={styles["info-item"]}>
<span></span>
<strong> {stats.nun_required_finished_hour_count} </strong>
<span>/ {stats.nun_required_hour_count}</span>
<strong> {stats.nun_required_finished_hour_count || 0} </strong>
<span>/ {stats.nun_required_hour_count || 0}</span>
</div>
)}
</div>
@ -138,37 +138,61 @@ const IndexPage = () => {
<>
<strong>
{" "}
{studyTimeFormat(stats.today_learn_duration)[0]}{" "}
{studyTimeFormat(stats.today_learn_duration)[0] || 0}{" "}
</strong>
</>
)}
<strong>
{" "}
{studyTimeFormat(stats.today_learn_duration)[1]}{" "}
</strong>
<strong>
{" "}
{studyTimeFormat(stats.today_learn_duration)[2]}{" "}
</strong>
</div>
<div className={styles["info-item"]}>
{studyTimeFormat(stats.learn_duration)[0] !== 0 && (
{studyTimeFormat(stats.today_learn_duration)[1] !== 0 && (
<>
<strong>
{" "}
{studyTimeFormat(stats.learn_duration || 0)[0]}{" "}
{studyTimeFormat(stats.today_learn_duration)[1] || 0}{" "}
</strong>
</>
)}
<strong>
{" "}
{studyTimeFormat(stats.today_learn_duration)[2] || 0}{" "}
</strong>
<strong>
{" "}
{studyTimeFormat(stats.today_learn_duration)[3] || 0}{" "}
</strong>
</div>
<div className={styles["info-item"]}>
{studyTimeFormat(stats.learn_duration || 0)[0] !== 0 && (
<>
<strong>
{" "}
{studyTimeFormat(stats.learn_duration || 0)[0] || 0}{" "}
</strong>
</>
)}
<strong> {studyTimeFormat(stats.learn_duration || 0)[1]} </strong>
<strong> {studyTimeFormat(stats.learn_duration || 0)[2]} </strong>
{studyTimeFormat(stats.learn_duration || 0)[1] !== 0 && (
<>
<strong>
{" "}
{studyTimeFormat(stats.learn_duration || 0)[1] || 0}{" "}
</strong>
</>
)}
<strong>
{" "}
{studyTimeFormat(stats.learn_duration || 0)[2] || 0}{" "}
</strong>
<strong>
{" "}
{studyTimeFormat(stats.learn_duration || 0)[3] || 0}{" "}
</strong>
</div>
</div>
</div>
@ -200,19 +224,36 @@ const IndexPage = () => {
))}
{/* <Tabs defaultActiveKey="0" items={items} onChange={onChange} /> */}
</div>
<Row style={{ width: 1200, margin: "0 auto", paddingTop: 14 }}>
{loading && (
{loading && (
<Row
style={{
width: 1200,
margin: "0 auto",
paddingTop: 14,
minHeight: 301,
}}
>
<div className="float-left d-j-flex mt-50">
<Spin size="large" />
</div>
)}
{coursesList.length === 0 && (
</Row>
)}
{!loading && coursesList.length === 0 && (
<Row
style={{
width: 1200,
margin: "0 auto",
paddingTop: 14,
minHeight: 301,
}}
>
<Col span={24}>
<Empty description="暂无课程" />
</Col>
)}
</Row>
{coursesList.length > 0 && (
</Row>
)}
{!loading && coursesList.length > 0 && (
<div className={styles["courses-list"]}>
{coursesList.map((item: any) => (
<div key={item.id}>

View File

@ -31,6 +31,7 @@ export function studyTimeFormat(dateStr: number) {
value.push(Math.floor(d.asDays()));
value.push(d.hours());
value.push(d.minutes());
value.push(d.seconds());
return value;
}