Selaa lähdekoodia

点击课跳转到课内容显示

visuddhinanda 3 vuotta sitten
vanhempi
sitoutus
564e0bc86e
1 muutettua tiedostoa jossa 12 lisäystä ja 3 poistoa
  1. 12 3
      dashboard/src/components/course/TextBook.tsx

+ 12 - 3
dashboard/src/components/course/TextBook.tsx

@@ -1,17 +1,26 @@
 import { Col, Row } from "antd";
+import { useNavigate } from "react-router-dom";
 import AnthologyDetail from "../article/AnthologyDetail";
 
 interface IWidget {
   anthologyId?: string;
+  courseId?: string;
 }
-const Widget = ({ anthologyId }: IWidget) => {
+const Widget = ({ anthologyId, courseId }: IWidget) => {
+  const navigate = useNavigate();
+
   console.log("anthologyId", anthologyId);
   return (
     <div style={{ backgroundColor: "#f5f5f5" }}>
       <Row>
         <Col flex="auto"></Col>
-        <Col flex="1260px">
-          <AnthologyDetail aid={anthologyId} />
+        <Col flex="960px">
+          <AnthologyDetail
+            aid={anthologyId}
+            onArticleSelect={(keys: string[]) => {
+              navigate(`/article/textbook/${courseId}/${keys[0]}`);
+            }}
+          />
         </Col>
         <Col flex="auto"></Col>
       </Row>