TextBook.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { Col, Row } from "antd";
  2. import { useNavigate } from "react-router";
  3. import AnthologyDetail from "../article/AnthologyDetail";
  4. import { fullUrl } from "../../utils";
  5. interface IWidget {
  6. anthologyId?: string;
  7. courseId?: string;
  8. }
  9. const TextBookWidget = ({ anthologyId, courseId }: IWidget) => {
  10. const navigate = useNavigate();
  11. console.log("anthologyId", anthologyId);
  12. return (
  13. <div style={{ backgroundColor: "#f5f5f5" }}>
  14. <Row>
  15. <Col flex="auto"></Col>
  16. <Col flex="960px">
  17. <AnthologyDetail
  18. aid={anthologyId}
  19. onArticleClick={(
  20. _anthologyId: string,
  21. articleId: string,
  22. target: string
  23. ) => {
  24. const url = `/article/textbook/${articleId}?mode=read&course=${courseId}`;
  25. if (target === "_blank") {
  26. window.open(fullUrl(url), "_blank");
  27. } else {
  28. navigate(url);
  29. }
  30. }}
  31. />
  32. </Col>
  33. <Col flex="auto"></Col>
  34. </Row>
  35. </div>
  36. );
  37. };
  38. export default TextBookWidget;