Преглед на файлове

点击标题触发 onSelect 事件

visuddhinanda преди 2 години
родител
ревизия
87ec57bcf7
променени са 1 файла, в които са добавени 17 реда и са изтрити 10 реда
  1. 17 10
      dashboard/src/components/channel/ChapterInChannelList.tsx

+ 17 - 10
dashboard/src/components/channel/ChapterInChannelList.tsx

@@ -9,6 +9,7 @@ import { DeleteOutlined } from "@ant-design/icons";
 import { get } from "../../request";
 import { get } from "../../request";
 
 
 import { IChapterListResponse } from "../../components/api/Corpus";
 import { IChapterListResponse } from "../../components/api/Corpus";
+import { IArticleParam } from "../../pages/studio/recent/list";
 
 
 const { Text } = Typography;
 const { Text } = Typography;
 
 
@@ -27,9 +28,9 @@ interface IItem {
 }
 }
 interface IWidget {
 interface IWidget {
   channelId?: string;
   channelId?: string;
-  onChange?: Function;
+  onSelect?: Function;
 }
 }
-const ChpaterInChannelListWidget = ({ channelId, onChange }: IWidget) => {
+const ChpaterInChannelListWidget = ({ channelId, onSelect }: IWidget) => {
   const intl = useIntl();
   const intl = useIntl();
 
 
   return (
   return (
@@ -56,16 +57,22 @@ const ChpaterInChannelListWidget = ({ channelId, onChange }: IWidget) => {
             return (
             return (
               <div key={index}>
               <div key={index}>
                 <div key={1}>
                 <div key={1}>
-                  <Link
-                    to={
-                      `/article/chapter/${row.book}-${row.paragraph}` +
-                      channelId
-                        ? `?channel=${channelId}`
-                        : ""
-                    }
+                  <Button
+                    type="link"
+                    onClick={(event) => {
+                      if (typeof onSelect !== "undefined") {
+                        const chapter: IArticleParam = {
+                          type: "chapter",
+                          articleId: `${row.book}-${row.paragraph}`,
+                          mode: "read",
+                          channelId: channelId,
+                        };
+                        onSelect(event, chapter);
+                      }
+                    }}
                   >
                   >
                     {row.title ? row.title : row.subTitle}
                     {row.title ? row.title : row.subTitle}
-                  </Link>
+                  </Button>
                 </div>
                 </div>
                 <Text type="secondary" key={2}>
                 <Text type="secondary" key={2}>
                   {row.subTitle}
                   {row.subTitle}