diff --git a/src/pages/index/compenents/courses-model.tsx b/src/pages/index/compenents/courses-model.tsx index 6a1017b..0496e6e 100644 --- a/src/pages/index/compenents/courses-model.tsx +++ b/src/pages/index/compenents/courses-model.tsx @@ -3,7 +3,6 @@ import { Image, Progress } from "antd"; import { useNavigate } from "react-router-dom"; import styles from "./courses-model.module.scss"; import mediaIcon from "../../../assets/images/commen/icon-medal.png"; -import { Navigate } from "react-router-dom"; interface PropInterface { id: number; diff --git a/src/pages/latest-learn/index.module.scss b/src/pages/latest-learn/index.module.scss index be44757..15d9e12 100644 --- a/src/pages/latest-learn/index.module.scss +++ b/src/pages/latest-learn/index.module.scss @@ -5,6 +5,101 @@ margin: 0 auto; box-sizing: border-box; padding: 50px 0; + .item { + width: 100%; + height: 138px; + background: #ffffff; + border: 2px solid #f6f6f6; + border-radius: 12px; + margin-bottom: 24px; + display: flex; + align-items: center; + box-sizing: border-box; + padding: 24px; + cursor: pointer; + &:hover { + border: none; + box-shadow: 0px 4px 16px 8px rgba(0, 0, 0, 0.04); + } + .item-info { + flex: 1; + height: 90px; + margin-left: 16px; + .top { + width: 100%; + display: flex; + align-items: center; + height: 24px; + .type { + width: 52px; + height: 24px; + background: rgba(255, 77, 79, 0.1); + border-radius: 6px; + font-size: 14px; + font-weight: 400; + color: #ff4d4f; + line-height: 24px; + display: flex; + align-items: center; + justify-content: center; + } + .active-type { + width: 52px; + height: 24px; + background: rgba(#ff9900, 0.1); + border-radius: 6px; + font-size: 14px; + font-weight: 400; + color: #ff9900; + line-height: 24px; + display: flex; + align-items: center; + justify-content: center; + } + .title { + width: 966px; + height: 24px; + font-size: 16px; + font-weight: 500; + color: rgba(0, 0, 0, 0.88); + line-height: 24px; + margin-left: 8px; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + text-align: left; + } + } + .record { + width: 100%; + height: 24px; + font-size: 14px; + font-weight: 400; + color: rgba(0, 0, 0, 0.45); + line-height: 24px; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + text-align: left; + margin-top: 9px; + } + .progress { + width: 336px; + margin-top: 9px; + height: 24px; + display: flex; + align-items: center; + .tip { + margin-left: 8px; + height: 24px; + font-size: 14px; + font-weight: 400; + color: #ff4d4f; + line-height: 24px; + } + } + } + } } .extra { width: 1200px; diff --git a/src/pages/latest-learn/index.tsx b/src/pages/latest-learn/index.tsx index a57e751..7544b38 100644 --- a/src/pages/latest-learn/index.tsx +++ b/src/pages/latest-learn/index.tsx @@ -1,12 +1,14 @@ import React, { useState, useEffect } from "react"; import styles from "./index.module.scss"; import { course } from "../../api/index"; -import { Row, Col, Empty, Spin, Image } from "antd"; +import { Row, Col, Empty, Spin, Image, Progress } from "antd"; +import mediaIcon from "../../assets/images/commen/icon-medal.png"; +import { useNavigate } from "react-router-dom"; const LatestLearnPage = () => { + const navigate = useNavigate(); const [loading, setLoading] = useState(false); const [courses, setCourses] = useState([]); - useEffect(() => { getCourses(); @@ -15,10 +17,7 @@ const LatestLearnPage = () => { const getCourses = () => { setLoading(true); course.latestLearn().then((res: any) => { - - setCourses(res.data); - - + setCourses(res.data); setLoading(false); }); }; @@ -26,7 +25,7 @@ const LatestLearnPage = () => { return (
- + {loading && (
@@ -38,6 +37,77 @@ const LatestLearnPage = () => { )} + {courses.length > 0 && + courses.map((item: any) => ( +
{ + navigate(`/course/${item.course.id}`); + }} + > + +
+
+ {item.course.is_required === 1 && ( +
必修课
+ )} + {item.course.is_required === 0 && ( +
选修课
+ )} +
{item.course.title}
+
+ {item.record && ( + <> +
+ 上次学到:{item.record.finished_count}/ + {item.record.hour_count}课时 +
+
+ {item.record.progress < 10000 && ( + + )} + {item.record.progress >= 10000 && ( + <> + + + 恭喜你学完此套课程! + + + )} +
+ + )} + {!item.record && ( + <> +
+
+ +
+ + )} +
+
+ ))}
~莫道桑榆晚,为霞尚满天~