classic_books.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import styles from './index.less'
  2. import Header from "./header";
  3. import { Empty, Tag } from "antd";
  4. import { ReactElement, JSXElementConstructor, ReactNode, ReactPortal, Key } from "react";
  5. import { MyIcon } from "@/global";
  6. // 口碑佳作
  7. export function ClassicBooks(props: {
  8. data: {
  9. appComponentId: number | string;
  10. componentType: string;
  11. showRightButton?: boolean;
  12. componentName?: string;
  13. remark?: string;
  14. configs?: any[];
  15. }
  16. }) {
  17. const { data: { configs, componentName, showRightButton } } = props
  18. return <div className={`${styles.classic_books}`}>
  19. <Header title={componentName || "经典热书"} showBtn={showRightButton} />
  20. {configs?.[0]?.bookInfo ? <>
  21. <div className={styles.list}>
  22. {
  23. configs?.map((item: { bookInfo: { vipFree: any, picUrl: string | undefined; bookName: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined; }; }, index: Key | null | undefined) => {
  24. return <div key={index} className={styles.box}>
  25. <div>
  26. {item?.bookInfo?.vipFree && <MyIcon type="icon-vipmianfei" style={{ fontSize: 35, position: 'absolute', zIndex: 1 }} />}
  27. <img src={item?.bookInfo?.picUrl} onError={(e: any) => {
  28. e.target.src = localStorage.getItem("nocover")
  29. }} />
  30. </div>
  31. <span>{item?.bookInfo?.bookName}</span>
  32. </div>
  33. })
  34. }
  35. </div>
  36. </> : <div className={styles.banners_box} style={{ display: "flex", alignItems: 'center', justifyContent: 'center', minHeight: 'calc(100vw / 10)', }}>
  37. <div style={{ justifyContent: 'center', display: 'flex', width: '100%' }}><Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据请选中后设置,不配置将使用系统默认配置" /></div>
  38. </div>
  39. }
  40. </div>
  41. }