guess_like.tsx 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 GuessLike(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.hot_rec}`}>
  19. <Header title={componentName || "猜你喜欢"} showBtn={false} />
  20. {configs?.[0]?.bookInfo ? <>
  21. <div className={styles.list}>
  22. {
  23. configs?.map((item: { bookInfo: any }, index: Key | null | undefined) => {
  24. return <div className={styles.top} key={index}>
  25. <span>
  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. </span>
  31. <div>
  32. <strong>{item?.bookInfo?.bookName || "书名"}</strong>
  33. <span>{item?.bookInfo?.bookDesc || "描述"}</span>
  34. <div>
  35. <span>{item?.bookInfo?.authorInfo?.authorName || item?.bookInfo?.authorName}·{item?.bookInfo?.wordCount}万字·{item?.bookInfo?.bookStatus == 0 ? "连载中" : "完结"}</span>
  36. <Tag >{item?.bookInfo?.labelInfoList?.[0]?.name}</Tag>
  37. </div>
  38. </div>
  39. </div>
  40. })
  41. }
  42. </div>
  43. </> : <div className={styles.banners_box} style={{ display: "flex", alignItems: 'center', justifyContent: 'center', minHeight: 'calc(100vw / 10)', }}>
  44. <div style={{ justifyContent: 'center', display: 'flex', width: '100%' }}><Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="此组件无自定义配置,由系统自动生成内容" /></div>
  45. </div>
  46. }
  47. </div>
  48. }