Przeglądaj źródła

没有封面加载默认图

visuddhinanda 3 lat temu
rodzic
commit
fc225feb9a
1 zmienionych plików z 18 dodań i 2 usunięć
  1. 18 2
      dashboard/src/pages/studio/course/list.tsx

+ 18 - 2
dashboard/src/pages/studio/course/list.tsx

@@ -10,12 +10,13 @@ import {
   MenuProps,
   Menu,
   Table,
+  Image,
 } from "antd";
 import { ProTable, ActionType } from "@ant-design/pro-components";
 import { PlusOutlined, SearchOutlined } from "@ant-design/icons";
 
 import CourseCreate from "../../../components/course/CourseCreate";
-import { get } from "../../../request";
+import { API_HOST, get } from "../../../request";
 import {
   ICourseListResponse,
   ICourseNumberResponse,
@@ -129,7 +130,21 @@ const Widget = () => {
             tip: "过长会自动收缩",
             ellipsis: true,
             render: (text, row, index, action) => {
-              return <Link to={`/course/${row.id}`}>{row.title}</Link>;
+              return (
+                <Space>
+                  <Image
+                    src={`${API_HOST}/${row.cover_img_name}`}
+                    width="64"
+                    fallback={`${API_HOST}/app/course/img/default.jpg`}
+                  />
+                  <div>
+                    <div>
+                      <Link to={`/course/${row.id}`}>{row.title}</Link>
+                    </div>
+                    <div>{row.subtitle}</div>
+                  </div>
+                </Space>
+              );
             },
           },
           {
@@ -258,6 +273,7 @@ const Widget = () => {
               title: item.title,
               subtitle: item.subtitle,
               teacher: item.teacher.nickName,
+              cover_img_name: item.cover,
               type: item.type,
               createdAt: date.getTime(),
             };