张延森 4 年前
父节点
当前提交
fc6e247937
共有 1 个文件被更改,包括 24 次插入2 次删除
  1. 24
    2
      src/pages/recommend/index.jsx

+ 24
- 2
src/pages/recommend/index.jsx 查看文件

15
   const user = useSelector(state => state.user);
15
   const user = useSelector(state => state.user);
16
   const [isopen, setIsOpen] = useState(false);
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
   return (
27
   return (
19
     <View
28
     <View
20
       className="recommend-view-card"
29
       className="recommend-view-card"
24
         className="recommend-view-img"
33
         className="recommend-view-img"
25
         mode="widthFix"
34
         mode="widthFix"
26
         src={image}
35
         src={image}
27
-        onClick={() => setIsOpen(!isopen)}
36
+        onClick={handleExpand}
28
         style={{zIndex:1}}
37
         style={{zIndex:1}}
29
       ></Image>
38
       ></Image>
30
 
39
 
51
   const [list, setList] = useState({});
60
   const [list, setList] = useState({});
52
   const [id, setId] = useState();
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
   useEffect(() => {
76
   useEffect(() => {
55
     const lst = groupby(props.dataSource || [], 'groupName')
77
     const lst = groupby(props.dataSource || [], 'groupName')
56
     // setList(props.dataSource || []);
78
     // setList(props.dataSource || []);
117
                     return (
139
                     return (
118
                       <View className="recommend-view">
140
                       <View className="recommend-view">
119
                         <ContainerLayout className="recommend-view-layout">
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
                         </ContainerLayout>
143
                         </ContainerLayout>
122
                       </View>
144
                       </View>
123
                     );
145
                     );