|
@@ -4,7 +4,7 @@ import './index.scss'
|
4
|
4
|
import Banner from '../banner'
|
5
|
5
|
import HelpGroupBanner from '../swiper'
|
6
|
6
|
import Poster from './poster'
|
7
|
|
-import ActivityItem from '../../activity/item'
|
|
7
|
+import PoiAround from '@components/amap/PoiAround'
|
8
|
8
|
import BackHomeBtn from '@components/BackHomeBtn'
|
9
|
9
|
import {
|
10
|
10
|
addItemUv,
|
|
@@ -20,6 +20,7 @@ import 'dayjs/locale/zh-cn' // 按需加载
|
20
|
20
|
import ready from '@utils/ready'
|
21
|
21
|
import Notice from '@components/Notice'
|
22
|
22
|
import { getDownloadURL, getThumbnail } from '@utils/tools'
|
|
23
|
+import { getPoiAround } from '@utils/amap'
|
23
|
24
|
import { connect } from '@tarojs/redux'
|
24
|
25
|
import { dispatchProjectDetail } from '@actions/project'
|
25
|
26
|
import getUserPhone from '@utils/getUserPhone'
|
|
@@ -47,25 +48,8 @@ export default class Index extends Component {
|
47
|
48
|
helpList: [],
|
48
|
49
|
groupList: [],
|
49
|
50
|
statusOpts: ['待定', '在建', '在售'],
|
50
|
|
- circumOpts: [
|
51
|
|
- {
|
52
|
|
- name: '交通',
|
53
|
|
- id: 'buildingTransport'
|
54
|
|
- },
|
55
|
|
- {
|
56
|
|
- name: '教育',
|
57
|
|
- id: 'buildingEdu'
|
58
|
|
- },
|
59
|
|
- {
|
60
|
|
- name: '医疗',
|
61
|
|
- id: 'buildingHospital'
|
62
|
|
- },
|
63
|
|
- {
|
64
|
|
- name: '商业',
|
65
|
|
- id: 'buildingMall'
|
66
|
|
- }
|
67
|
|
- ],
|
68
|
|
- curTab: 'buildingTransport',
|
|
51
|
+ circumOpts: [],
|
|
52
|
+ curTab: 'Transport',
|
69
|
53
|
recordId: null,
|
70
|
54
|
posterShow: 'none',
|
71
|
55
|
current: 1,
|
|
@@ -78,8 +62,7 @@ export default class Index extends Component {
|
78
|
62
|
const router = Taro.getStorageSync('router')
|
79
|
63
|
const id = this.$router.params.id || router.query.id
|
80
|
64
|
// const id='82b54f4a1f5b981df572253792afbfa1'
|
81
|
|
- console.info('project-1:', router)
|
82
|
|
- console.info('project-2:', this.$router)
|
|
65
|
+
|
83
|
66
|
this.setState({
|
84
|
67
|
buildingId: id
|
85
|
68
|
}, () => {
|
|
@@ -111,7 +94,16 @@ export default class Index extends Component {
|
111
|
94
|
const { recordId } = this.state
|
112
|
95
|
recordId && updatePoint(recordId)
|
113
|
96
|
}
|
114
|
|
- loadHelpGroupList () {
|
|
97
|
+
|
|
98
|
+ loadMapAround(building) {
|
|
99
|
+ const [lat, lng] = (building.coordinate || '').split(',')
|
|
100
|
+
|
|
101
|
+ if (!lat || !lng) return Promise.reject()
|
|
102
|
+
|
|
103
|
+ return getPoiAround({ lng, lat})
|
|
104
|
+ }
|
|
105
|
+
|
|
106
|
+ loadHelpGroupList() {
|
115
|
107
|
const { buildingId } = this.state
|
116
|
108
|
queryHelpGroup({ buildingId: buildingId }).then(res => {
|
117
|
109
|
console.log(res, "buildingId")
|
|
@@ -132,8 +124,8 @@ export default class Index extends Component {
|
132
|
124
|
)
|
133
|
125
|
}
|
134
|
126
|
|
135
|
|
- loadDetail () {
|
136
|
|
- const { buildingId, circumOpts } = this.state
|
|
127
|
+ loadDetail() {
|
|
128
|
+ const { buildingId } = this.state
|
137
|
129
|
const { dispatchProjectDetail } = this.props
|
138
|
130
|
this.setState({
|
139
|
131
|
loaded: false,
|
|
@@ -144,25 +136,32 @@ export default class Index extends Component {
|
144
|
136
|
})
|
145
|
137
|
|
146
|
138
|
dispatchProjectDetail(buildingId).then(res => {
|
147
|
|
- circumOpts.map(item => {
|
148
|
|
- let arr = res[item.id] ? res[item.id].split(',') : []
|
149
|
|
- item.content = arr
|
150
|
|
- item.num = arr.length
|
151
|
|
- })
|
|
139
|
+ this.loadMapAround(res).then(data => {
|
|
140
|
+ const newCircumOpts = data.map((item) => {
|
|
141
|
+ const dtKey = `building${item.key}`
|
|
142
|
+ const manualDt = res[dtKey] ? res[dtKey].split(',') : []
|
|
143
|
+
|
|
144
|
+ return {
|
|
145
|
+ ...item,
|
|
146
|
+ manualDt,
|
|
147
|
+ num: manualDt.length + item.poisData.length
|
|
148
|
+ }
|
|
149
|
+ })
|
152
|
150
|
|
153
|
|
- this.setState({
|
154
|
|
- loaded: true,
|
155
|
|
- circumOpts,
|
156
|
|
- isSaved: res.isSave
|
157
|
|
- }, () => {
|
158
|
|
- if (res.posters && res.posters.length) {
|
159
|
|
- this.setState({
|
160
|
|
- posterShow: 'flex'
|
161
|
|
- })
|
162
|
|
- }
|
|
151
|
+ this.setState({
|
|
152
|
+ loaded: true,
|
|
153
|
+ circumOpts: newCircumOpts,
|
|
154
|
+ isSaved: res.isSave
|
|
155
|
+ }, () => {
|
|
156
|
+ if (res.posters && res.posters.length) {
|
|
157
|
+ this.setState({
|
|
158
|
+ posterShow: 'flex'
|
|
159
|
+ })
|
|
160
|
+ }
|
|
161
|
+ })
|
|
162
|
+
|
|
163
|
+ Taro.hideToast()
|
163
|
164
|
})
|
164
|
|
- Taro.hideToast()
|
165
|
|
- // WxParse.wxParse('article', 'html', res.remark, this.$scope, 0)
|
166
|
165
|
})
|
167
|
166
|
}
|
168
|
167
|
|
|
@@ -490,13 +489,11 @@ export default class Index extends Component {
|
490
|
489
|
})
|
491
|
490
|
}
|
492
|
491
|
|
493
|
|
- // changeCurrent (current) {
|
494
|
|
- // console.log(current, 'current')
|
495
|
|
- // this.setState({
|
496
|
|
- // current: current
|
497
|
|
- // })
|
498
|
|
- // }
|
499
|
|
- renderBottomMenu () {
|
|
492
|
+ handleMarkerTap = (marker) => {
|
|
493
|
+
|
|
494
|
+ }
|
|
495
|
+
|
|
496
|
+ renderBottomMenu() {
|
500
|
497
|
const { userInfo: { person: { personType } } } = this.props
|
501
|
498
|
const { posterShow } = this.state
|
502
|
499
|
return (
|
|
@@ -622,7 +619,8 @@ export default class Index extends Component {
|
622
|
619
|
rendercircum () {
|
623
|
620
|
const { curTab, circumOpts } = this.state
|
624
|
621
|
const { projectDetail } = this.props
|
625
|
|
- const panel = circumOpts.filter(item => item.id === curTab)[0]
|
|
622
|
+ const panel = circumOpts.filter(item => item.key === curTab)[0]
|
|
623
|
+ const [lat, lng] = (projectDetail.coordinate || '').split(',')
|
626
|
624
|
|
627
|
625
|
return (
|
628
|
626
|
<View className="section circum">
|
|
@@ -634,25 +632,39 @@ export default class Index extends Component {
|
634
|
632
|
{
|
635
|
633
|
circumOpts.map(item => (
|
636
|
634
|
<Text
|
637
|
|
- key={item.id}
|
638
|
|
- className={curTab === item.id ? 'selected item' : 'item'}
|
639
|
|
- onClick={this.HandleCircumTabClick.bind(this, item.id)}>{item.name}({item.num})</Text>
|
|
635
|
+ key={item.key}
|
|
636
|
+ className={curTab === item.key ? 'selected item' : 'item'}
|
|
637
|
+ onClick={this.HandleCircumTabClick.bind(this, item.key)}>{item.label}({item.num})</Text>
|
640
|
638
|
))
|
641
|
639
|
}
|
642
|
640
|
</View>
|
643
|
641
|
|
644
|
642
|
<View className='map'>
|
645
|
|
- <Image src={getThumbnail(projectDetail.mapImg)} className='map__img' mode="widthFix"></Image>
|
|
643
|
+ <PoiAround markers={panel.markers} longitude={lng} latitude={lat} onMarkerClick={this.handleMarkerTap}/>
|
646
|
644
|
</View>
|
647
|
645
|
<ScrollView className="body" scrollY >
|
648
|
|
- {
|
649
|
|
- panel.content.map((text, index) => (
|
650
|
|
- <View className="row" key={index}>
|
651
|
|
- {text}</View>
|
652
|
|
- ))
|
653
|
|
- }
|
|
646
|
+ <View class="">
|
|
647
|
+ <View></View>
|
|
648
|
+ {
|
|
649
|
+ panel.poisData.map((poi, inx) => (
|
|
650
|
+ <View className="row flex" key={`poi-${inx}`}>
|
|
651
|
+ <View>{inx + 1}</View>
|
|
652
|
+ <View>{poi.name}</View>
|
|
653
|
+ <View>{poi.distance} m</View>
|
|
654
|
+ </View>
|
|
655
|
+ ))
|
|
656
|
+ }
|
|
657
|
+ </View>
|
|
658
|
+ <View class="">
|
|
659
|
+ <View>其他</View>
|
|
660
|
+ {
|
|
661
|
+ panel.manualDt.map((text, index) => (
|
|
662
|
+ <View className="row" key={`mt-${index}`}>{text}</View>
|
|
663
|
+ ))
|
|
664
|
+ }
|
|
665
|
+ </View>
|
654
|
666
|
</ScrollView>
|
655
|
|
- <Button className='map-more-btn' onClick={this.openMap.bind(this)}>查看全部配套</Button>
|
|
667
|
+ <Button className='map-more-btn' onClick={this.openMap.bind(this)}>立即前往</Button>
|
656
|
668
|
</View>
|
657
|
669
|
</View>
|
658
|
670
|
)
|