2
0

TextBook.tsx 1.1 KB

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