|
@@ -95,15 +95,23 @@ Page({
|
|
|
}],
|
|
|
surroundingFacilities: [
|
|
|
{
|
|
|
- name: '重庆市第11中学', type: '教育'
|
|
|
+ id: 1, name: '重庆市第11中学', type: '教育',
|
|
|
+ longitude: 106.599916, latitude: 29.582458
|
|
|
}, {
|
|
|
- name: '弹子石老街景区', type: '商业'
|
|
|
+ id: 2, name: '弹子石老街景区', type: '商业',
|
|
|
+ longitude: 106.587890, latitude: 29.579806
|
|
|
}, {
|
|
|
- name: '泽科弹子石中心', type: '商业'
|
|
|
+ id: 3, name: '泽科弹子石中心', type: '商业',
|
|
|
+ longitude: 106.591454, latitude: 29.583796
|
|
|
}
|
|
|
]
|
|
|
}],
|
|
|
- peripherytabsindex:0,
|
|
|
+ peripherytabsindex:0,
|
|
|
+ markers: [],
|
|
|
+ centerPoint: {
|
|
|
+ longitude: 106.596361,
|
|
|
+ latitude: 29.579387,
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -111,15 +119,40 @@ Page({
|
|
|
*/
|
|
|
onLoad(options) {
|
|
|
const _this = this
|
|
|
+ let markers = []
|
|
|
+ _this.data.list.forEach(item => {
|
|
|
+ item.surroundingFacilities.forEach(map => {
|
|
|
+ markers.push({
|
|
|
+ id: map.id,
|
|
|
+ latitude: map.latitude,
|
|
|
+ longitude: map.longitude,
|
|
|
+ callout: {
|
|
|
+ content: map.name,
|
|
|
+ fontSize: 11,
|
|
|
+ padding: 5,
|
|
|
+ borderRadius: 5,
|
|
|
+ display: 'ALWAYS'
|
|
|
+ },
|
|
|
+ iconPath: imgUrl + '/location.png',
|
|
|
+ width: 20,
|
|
|
+ height: 25,
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
this.setData({
|
|
|
headerStyle: wx.getMenuButtonBoundingClientRect(),
|
|
|
dataIndex: options.index,
|
|
|
+ markers,
|
|
|
polygons: [{
|
|
|
dashArray: [10, 10],
|
|
|
strokeColor: '#ffe20063',
|
|
|
fillColor: '#ffe20063',
|
|
|
points: _this.data.list[options.index].polygon
|
|
|
- }]
|
|
|
+ }],
|
|
|
+ centerPoint: {
|
|
|
+ longitude: _this.data.list[options.index].longitude,
|
|
|
+ latitude: _this.data.list[options.index].latitude,
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -169,7 +202,10 @@ Page({
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage() {
|
|
|
-
|
|
|
+ return {
|
|
|
+ title: this.data.list[this.data.dataIndex].name,
|
|
|
+ imageUrl: imgUrl + '/tdcr/share.jpg'
|
|
|
+ }
|
|
|
},
|
|
|
tabEvent(e) {
|
|
|
this.setData({
|
|
@@ -192,5 +228,14 @@ Page({
|
|
|
console.log(e);
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ mapMarkerEvent(e) {
|
|
|
+ const map = this.data.list[this.data.dataIndex].surroundingFacilities.filter(item => item.id == e.target.dataset.id)
|
|
|
+ this.setData({
|
|
|
+ centerPoint: {
|
|
|
+ longitude: map[0].longitude,
|
|
|
+ latitude: map[0].latitude,
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|