描述:地图

This commit is contained in:
SelfRidicule 2024-03-06 20:27:42 +08:00
parent 2be3c7ab11
commit 85b20d5c11
2 changed files with 40 additions and 13 deletions

View File

@ -1,7 +1,10 @@
const app = getApp() const app = getApp()
import { import {
meetingRoomDetailRq meetingRoomDetailRq,
selectCoordinateRq
} from "../../../api/meeting/meetingRoom.js" } from "../../../api/meeting/meetingRoom.js"
Page({ Page({
/** /**
@ -13,16 +16,7 @@ Page({
meetingRoomId: null, meetingRoomId: null,
detail: {}, detail: {},
bannerList: [], bannerList: [],
mapData: { mapData: {}
latitude: 33.601291,
longitude: 119.031829,
markers: [{
id: 1,
latitude: 33.601291,
longitude: 119.031829,
title: '淮安茂业天地购物中心'
}]
}
}, },
/** /**
@ -40,6 +34,39 @@ Page({
bannerList: [res.roomContent.indoorPicUrl] bannerList: [res.roomContent.indoorPicUrl]
}) })
}) })
// 获取地址信息
_this.getAddress()
},
// 获取地址信息
getAddress() {
let _this = this;
selectCoordinateRq().then(res => {
_this.setData({
address: res,
mapData: {
latitude: res.lat,
longitude: res.lng,
markers: [{
id: 1,
latitude: res.lat,
longitude: res.lng,
title: res.address,
}]
},
})
})
},
// 打开地图
openMap(e) {
console.log('openMap', e);
let _this = this;
wx.openLocation({
name: _this.data.address.address,
latitude: _this.data.address.lat,
longitude: _this.data.address.lng,
})
}, },
// 切换内容展示 // 切换内容展示

View File

@ -60,7 +60,7 @@
<!-- 地图 --> <!-- 地图 -->
<view class="mapView"> <view class="mapView">
<view class="leftLineTitle">空间周边</view> <view class="leftLineTitle">空间周边</view>
<map class="myMap" latitude="{{mapData.latitude}}" longitude="{{mapData.longitude}}" markers="{{mapData.markers}}" show-location></map> <map class="myMap" latitude="{{mapData.latitude}}" longitude="{{mapData.longitude}}" markers="{{mapData.markers}}" show-location bindtap="openMap"></map>
</view> </view>
<!-- 预约 --> <!-- 预约 -->