张延森 5 年之前
父節點
當前提交
a61ca291fe
共有 3 個文件被更改,包括 14 次插入66 次删除
  1. 3
    4
      src/pages/project/album/index.js
  2. 10
    61
      src/pages/project/index.js
  3. 1
    1
      src/pages/project/item/index.js

+ 3
- 4
src/pages/project/album/index.js 查看文件

@@ -56,13 +56,12 @@ export default class Index extends Component {
56 56
   }
57 57
 
58 58
   render () {
59
-    const { projectDetail: { buildingApartment } } = this.props
59
+    const { projectDetail: { buildingApartment = [] } } = this.props
60 60
     const list = buildingApartment.filter(item => item.apartmentType === 'photo')
61 61
     const { current } = this.state
62
-    const imgList = list[current].buildingImgList
62
+    const imgList = (list[current] || {}).buildingImgList || []
63 63
     let _photosImgs = imgList.map(img => img.url)
64 64
 
65
-
66 65
     return (
67 66
       <View className='photos'>
68 67
         <ScrollView scrollX>
@@ -71,7 +70,7 @@ export default class Index extends Component {
71 70
             <View className="around-tab">
72 71
               {list.map((item, index) => {
73 72
                 const { apartmentName } = item || {}
74
-                const buildingImgList = item.buildingImgList
73
+                const buildingImgList = item.buildingImgList || []
75 74
 
76 75
                 console.log(item, '22333333222')
77 76
                 return (<View>

+ 10
- 61
src/pages/project/index.js 查看文件

@@ -89,76 +89,27 @@ export default class Index extends Component {
89 89
     const { cityList, userInfo: { person: { org } } } = this.props
90 90
     let defaultCity = cityList.filter(item => {
91 91
       return item.id == org.defaultCityId
92
-    })
93
-
94
-
92
+    })[0]
95 93
     console.log('-----defaultCity-->', defaultCity)
94
+
96 95
     Taro.getLocation().then(location => {
97 96
       Taro.setStorageSync('lat', location.latitude)
98 97
       Taro.setStorageSync('lon', location.longitude)
98
+
99 99
       console.log(location, 'location')
100 100
 
101 101
       const payload = { location: `${location.longitude},${location.latitude}` }
102
-      console.log(payload, 'payload')
103 102
 
104 103
       getLocationCity(payload).then(res => {
105
-        let cityId = res.id
106
-        let curCity = cityList.filter(item => {
107
-          return item.id == cityId
108
-        })
109
-
104
+        const curCity = res
105
+        this.updateCity(curCity)
106
+      }).catch(err=>{
110 107
         Taro.showToast({
111
-          title: `当前定位城市:${res.name}`,
108
+          title: `定位错误: ${err.message}`,
112 109
           icon: 'none',
113 110
         })
114
-
115
-        this.updateCity(curCity[0] || defaultCity[0])
116
-        console.log(curCity, 'location')
117
-
118
-
119
-        // this.qqmapsdk.getLocationCity({
120
-
121
-
122
-        //   location,
123
-        //   success: (res) => {
124
-        //     // debugger
125
-        //     let city = res.result.address_component.city
126
-
127
-        //     console.log('-----city-->', city)
128
-        //     console.log('-----cityList-->', cityList)
129
-
130
-
131
-        //     let curCity = cityList.filter(item => {
132
-        //       return item.name == city
133
-        //     })
134
-
135
-
136
-
137
-
138
-        //     Taro.showToast({
139
-        //       title: `当前定位城市:${(curCity[0] || {}).name}`,
140
-        //       icon: 'none',
141
-        //     })
142
-
143
-        //     this.updateCity(curCity[0] || defaultCity[0])
144
-        //   },
145
-        //   fail: (error) => {
146
-
147
-
148
-        //     Taro.showToast({
149
-        //       title: `定位错误: ${error.message}`,
150
-        //       icon: 'none',
151
-        //     })
152
-        //     console.error(err)
153
-        //     this.updateCity(defaultCity[0])
154
-        //   },
155
-      }).catch(err=>{
156
-               Taro.showToast({
157
-              title: `定位错误: ${error.message}`,
158
-              icon: 'none',
159
-            })
160
-            console.error(err)
161
-            this.updateCity(defaultCity[0])
111
+        console.error(err)
112
+        this.updateCity(defaultCity)
162 113
       })
163 114
     }).catch(err => {
164 115
       if (err.errMsg === 'getLocation:fail auth deny') {
@@ -173,13 +124,11 @@ export default class Index extends Component {
173 124
         })
174 125
       }
175 126
       console.error(err)
176
-      this.updateCity(defaultCity[0])
127
+      this.updateCity(defaultCity)
177 128
     })
178 129
   }
179 130
 
180 131
   updateCity (payload) {
181
-
182
-
183 132
     this.props.dispatchCitySelected(payload).then(res => {
184 133
       this.loadData()
185 134
     })

+ 1
- 1
src/pages/project/item/index.js 查看文件

@@ -20,7 +20,7 @@ export default class Index extends Component {
20 20
     const { data, onClick } = this.props
21 21
     const { uvList = {}, buildingTag = [], buildingListImg, shareList = {} } = data
22 22
     const { records = [], total = 0 } = uvList
23
-    const imgSrc = (buildingListImg && buildingListImg[0]) ? buildingListImg[0].url : getThumbnail('https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/images/default.jpg')
23
+    const imgSrc = (buildingListImg && buildingListImg[0]) ? buildingListImg[0].url : 'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/images/default.jpg'
24 24
 
25 25
     return (
26 26
       <View className='item' onClick={onClick.bind(this, data)}>