张延森 4 年 前
コミット
fc6e247937
共有1 個のファイルを変更した24 個の追加2 個の削除を含む
  1. 24
    2
      src/pages/recommend/index.jsx

+ 24
- 2
src/pages/recommend/index.jsx ファイルの表示

@@ -15,6 +15,15 @@ const ImageCard = props => {
15 15
   const user = useSelector(state => state.user);
16 16
   const [isopen, setIsOpen] = useState(false);
17 17
 
18
+  const handleExpand = () => {
19
+    if (!isopen) {
20
+      if (props.onExpand) {
21
+        props.onExpand()
22
+      }
23
+    }
24
+    setIsOpen(!isopen)
25
+  }
26
+
18 27
   return (
19 28
     <View
20 29
       className="recommend-view-card"
@@ -24,7 +33,7 @@ const ImageCard = props => {
24 33
         className="recommend-view-img"
25 34
         mode="widthFix"
26 35
         src={image}
27
-        onClick={() => setIsOpen(!isopen)}
36
+        onClick={handleExpand}
28 37
         style={{zIndex:1}}
29 38
       ></Image>
30 39
 
@@ -51,6 +60,19 @@ const recommend = props => {
51 60
   const [list, setList] = useState({});
52 61
   const [id, setId] = useState();
53 62
 
63
+  const handleExpand = item => {
64
+    // 埋点
65
+    request({
66
+      url: `/surround-track`,
67
+      method: "POST",
68
+      data: {
69
+        houseId: item.houseId,
70
+        imageId: item.imageId,
71
+        surroundId: item.surroundId
72
+      }
73
+    })
74
+  }
75
+
54 76
   useEffect(() => {
55 77
     const lst = groupby(props.dataSource || [], 'groupName')
56 78
     // setList(props.dataSource || []);
@@ -117,7 +139,7 @@ const recommend = props => {
117 139
                     return (
118 140
                       <View className="recommend-view">
119 141
                         <ContainerLayout className="recommend-view-layout">
120
-                          <ImageCard image={x.image} onDelete={() => onClick(x)} />
142
+                          <ImageCard image={x.image} onDelete={() => onClick(x)} onExpand={() => handleExpand(x)} />
121 143
                         </ContainerLayout>
122 144
                       </View>
123 145
                     );