Procházet zdrojové kódy

点击课跳转到课内容显示

visuddhinanda před 3 roky
rodič
revize
564e0bc86e
1 změnil soubory, kde provedl 12 přidání a 3 odebrání
  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 { Col, Row } from "antd";
+import { useNavigate } from "react-router-dom";
 import AnthologyDetail from "../article/AnthologyDetail";
 import AnthologyDetail from "../article/AnthologyDetail";
 
 
 interface IWidget {
 interface IWidget {
   anthologyId?: string;
   anthologyId?: string;
+  courseId?: string;
 }
 }
-const Widget = ({ anthologyId }: IWidget) => {
+const Widget = ({ anthologyId, courseId }: IWidget) => {
+  const navigate = useNavigate();
+
   console.log("anthologyId", anthologyId);
   console.log("anthologyId", anthologyId);
   return (
   return (
     <div style={{ backgroundColor: "#f5f5f5" }}>
     <div style={{ backgroundColor: "#f5f5f5" }}>
       <Row>
       <Row>
         <Col flex="auto"></Col>
         <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>
         <Col flex="auto"></Col>
         <Col flex="auto"></Col>
       </Row>
       </Row>