zlisen 4 years ago
parent
commit
236e37e857
2 changed files with 28 additions and 13 deletions
  1. 22
    7
      src/pages/map/index.jsx
  2. 6
    6
      src/pages/recommend/index.jsx

+ 22
- 7
src/pages/map/index.jsx View File

35
         request({ url: `/taHouse/${houseId}` }).then((res) => {
35
         request({ url: `/taHouse/${houseId}` }).then((res) => {
36
             console.log(res.data.data,type, 'getDetail')
36
             console.log(res.data.data,type, 'getDetail')
37
             if (type == "address") {
37
             if (type == "address") {
38
-                setAddress(res.data.data.address)
39
-                setLngLat(res.data.data.lngLat)
38
+                setAddress({
39
+                    address:res.data.data.address,
40
+                    lngLat:res.data.data.lngLat
41
+                })
42
+                // setAddress(res.data.data.address)
43
+                // setLngLat(res.data.data.lngLat)
40
             }else if (type == 'park'){
44
             }else if (type == 'park'){
41
-                setAddress(res.data.data.parking)
42
-                setLngLat(res.data.data.parkLngLat)
45
+
46
+                setAddress({
47
+                    address:res.data.data.parking,
48
+                    lngLat:res.data.data.parkLngLat
49
+                })
50
+                // address(res.data.data)
51
+                // setAddress(res.data.data.parking)
52
+                // setLngLat(res.data.data.parkLngLat)
43
             }
53
             }
44
 
54
 
45
         })
55
         })
74
         // setLngLat(e.detail.value)
84
         // setLngLat(e.detail.value)
75
     }
85
     }
76
     const onChooseLocation = () => {
86
     const onChooseLocation = () => {
77
-        // console.log(333)
87
+        console.log(333)
78
         wx.chooseLocation({
88
         wx.chooseLocation({
79
             success: (res) => {
89
             success: (res) => {
80
                 console.log(res)
90
                 console.log(res)
81
 
91
 
82
                 setAddress(res)
92
                 setAddress(res)
83
-            }
93
+            },
94
+            fail: (err) => {
95
+                console.log(err)
96
+
97
+                // setAddress(res)
98
+            },
84
         })
99
         })
85
     }
100
     }
86
 
101
 
113
             <View className='map-view'>
128
             <View className='map-view'>
114
                 <Text className='title'>具体地址</Text>
129
                 <Text className='title'>具体地址</Text>
115
                 <Container className='map-view-card'>
130
                 <Container className='map-view-card'>
116
-                    <Input value={address.lngLat} onInput={onChange} placeholderClass='placeholderinput' className='input' type='text' placeholder='小区/写字楼/大厦等' />
131
+                    <Input  onInput={onChange} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
117
                 </Container>
132
                 </Container>
118
             </View>
133
             </View>
119
         </Layout>
134
         </Layout>

+ 6
- 6
src/pages/recommend/index.jsx View File

17
     const { value, houseId,...prop } = props
17
     const { value, houseId,...prop } = props
18
 
18
 
19
     // const [state, setState] = useState(1)
19
     // const [state, setState] = useState(1)
20
-    // const [list, setList] = useState([])
20
+    const [list, setList] = useState([])
21
     const [id, setId] = useState()
21
     const [id, setId] = useState()
22
 
22
 
23
-    const list = props.dataSource || []
23
+    // let list = props.dataSource || []
24
 
24
 
25
-    // useEffect(() => {
26
-    //     getImageList()
27
-    // }, [])
25
+    useEffect(() => {
26
+        setList(props.dataSource || [])
27
+    }, [props.dataSource])
28
 
28
 
29
     // const getImageList=()=>{
29
     // const getImageList=()=>{
30
     //     request({url:'/taHouseSurround',params:{houseId:houseId}}).then((res)=>{
30
     //     request({url:'/taHouseSurround',params:{houseId:houseId}}).then((res)=>{
52
                     if (res.confirm) {
52
                     if (res.confirm) {
53
                         console.log('用户点击确定')
53
                         console.log('用户点击确定')
54
                         request({url: `/taHouseSurround/${item.surroundId}`, method: 'DELETE'}).then((res)=>{
54
                         request({url: `/taHouseSurround/${item.surroundId}`, method: 'DELETE'}).then((res)=>{
55
-                            getImageList()
55
+                            setList(list.filter((x)=>x.surroundId!=item.surroundId))
56
                         })
56
                         })
57
                        
57
                        
58
 
58