Browse Source

coverUrl: item.cover_url,

visuddhinanda 2 năm trước cách đây
mục cha
commit
6570999119
1 tập tin đã thay đổi với 15 bổ sung4 xóa
  1. 15 4
      dashboard/src/components/course/LecturerList.tsx

+ 15 - 4
dashboard/src/components/course/LecturerList.tsx

@@ -1,7 +1,7 @@
 //主讲人列表
 import { useNavigate } from "react-router-dom";
 import { useEffect, useState } from "react";
-import { Card, List, message, Typography } from "antd";
+import { Card, List, message, Typography, Image } from "antd";
 
 import { ICourse } from "../../pages/library/course/course";
 import { ICourseListResponse } from "../api/Course";
@@ -25,7 +25,7 @@ const LecturerListWidget = () => {
             subtitle: item.subtitle,
             teacher: item.teacher,
             intro: item.content,
-            coverUrl: item.cover,
+            coverUrl: item.cover_url,
           };
         });
         setData(course);
@@ -44,11 +44,22 @@ const LecturerListWidget = () => {
             hoverable
             style={{ width: "100%", height: 300 }}
             cover={
-              <img
+              <Image
                 alt="example"
-                src={API_HOST + "/" + item.coverUrl}
+                src={
+                  item.coverUrl && item.coverUrl.length > 1
+                    ? item.coverUrl[1]
+                    : undefined
+                }
+                preview={{
+                  src:
+                    item.coverUrl && item.coverUrl.length > 0
+                      ? item.coverUrl[0]
+                      : undefined,
+                }}
                 width="240"
                 height="200"
+                fallback={`${API_HOST}/app/course/img/default.jpg`}
               />
             }
             onClick={(e) => {