index.jsx 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import "@/assets/css/iconfont.css";
  2. import Taro from "@tarojs/taro";
  3. import { Image } from "@tarojs/components";
  4. import { getImgURL } from "@/utils/image";
  5. import BrokerShare from "@/components/brokerShare";
  6. import "./index.scss";
  7. import { useSelector } from "react-redux";
  8. import { ROLE_CODE } from "@/constants/user";
  9. export default function ProjectListItem(props) {
  10. const person = useSelector(({user}) => user.userInfo?.person);
  11. const { Data = {}, ShowImgIcon = true } = props;
  12. const { uvList = [] } = Data;
  13. const LinkTo = () => {
  14. if (Data.eventType === "news") {
  15. // 资讯
  16. Taro.navigateTo({
  17. url: `/pages/index/newsDetail/index?id=${Data.targetId}&eventType=${Data.type}`,
  18. });
  19. } else if (Data.eventType === "activity") {
  20. // 活动
  21. Taro.navigateTo({
  22. url: `/pages/index/activityDetail/index?id=${Data.targetId}&eventType=${Data.type}`,
  23. });
  24. } else {
  25. // 楼盘
  26. Taro.navigateTo({
  27. url: `/pages/index/buildingDetail/index?id=${
  28. Data.buildingId || Data.targetId
  29. }`,
  30. });
  31. }
  32. };
  33. return (
  34. <view className="components ProjectListItem" onClick={LinkTo}>
  35. <view className="ProjectListItem-top flex-h">
  36. <view className="Img">
  37. <view>
  38. <Image
  39. mode="aspectFill"
  40. className="centerLabel"
  41. src={getImgURL(
  42. (Data?.buildingListImg || []).length
  43. ? Data.buildingListImg[0].url
  44. : Data.activityImg || null
  45. )}
  46. />
  47. {(Data?.panoramaList || []).length > 0 && ShowImgIcon && (
  48. <Image
  49. mode="heightFix"
  50. className="Tips Vr"
  51. src={require("@/assets/index-icon18.png")}
  52. />
  53. )}
  54. {Data.videoUrl !== null && ShowImgIcon && (
  55. <Image
  56. mode="heightFix"
  57. className="Tips Video"
  58. src={require("@/assets/index-icon19.png")}
  59. />
  60. )}
  61. </view>
  62. </view>
  63. <view className="flex-item">
  64. <view className="Name flex-h">
  65. <view className="flex-item">
  66. <text>{Data.buildingName}</text>
  67. </view>
  68. <text></text>
  69. </view>
  70. <text className="Price">{Data.price}</text>
  71. <text className="Address">{Data.address}</text>
  72. <view className="Tags">
  73. {(Data.buildingTag || []).map((item, index) => (
  74. <text key={`Tags-${index}`}>{item.tagName}</text>
  75. ))}
  76. </view>
  77. <view className="ShareInfo">
  78. <text className="iconfont icon-fenxiang"></text>
  79. <text>{299 + (Data.shareNum || 0)}次分享</text>
  80. <view className="Users">
  81. {(uvList?.records || []).slice(0, 3).map((item, index) => (
  82. <view key={`uv-${index}`}>
  83. <Image
  84. mode="aspectFill"
  85. className="centerLabel"
  86. src={item.photoOravatar}
  87. />
  88. </view>
  89. ))}
  90. </view>
  91. <text>
  92. {(uvList?.records || []).length > 0 ? "..." : ""}
  93. {299 + (Data.pvNum || 0)}人围观
  94. </text>
  95. </view>
  96. </view>
  97. </view>
  98. {Data?.isBroker && person?.personType === ROLE_CODE.BROKER && (
  99. <BrokerShare buildingId={Data.buildingId}></BrokerShare>
  100. )}
  101. </view>
  102. );
  103. }