|
@@ -1,7 +1,11 @@
|
|
|
<template>
|
|
|
<view class="chooseCity">
|
|
|
- <!-- 地图 -->
|
|
|
- <view class="map">地图</view>
|
|
|
+ <view class="map">
|
|
|
+ <view class="page-section page-section-gap">
|
|
|
+ <map style="width: 100%; height: 300px;" :latitude="latitude" :longitude="longitude" :markers="covers">
|
|
|
+ </map>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<view class="nearsMap">附近地址</view>
|
|
|
<view class="city">
|
|
|
<view class="citeItem1">某某省某某市某某区某某</view>
|
|
@@ -23,8 +27,46 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { getHomePage } from '@/api/home';
|
|
|
export default {
|
|
|
-
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ id:0, // 使用 marker点击事件 需要填写id
|
|
|
+ title: 'map',
|
|
|
+ latitude: 0,
|
|
|
+ longitude: 0,
|
|
|
+ covers: [{
|
|
|
+ latitude: 0,
|
|
|
+ longitude: 0,
|
|
|
+ iconPath: '../../../static/location.png'
|
|
|
+ }, {
|
|
|
+ latitude: 0,
|
|
|
+ longitude: 0,
|
|
|
+ iconPath: '../../../static/location.png'
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ onShow() {
|
|
|
+ uni.getLocation({
|
|
|
+ type: 'gcj02',
|
|
|
+ success: res => {
|
|
|
+ console.log('当前位置的经度:' + res.longitude);
|
|
|
+ console.log('当前位置的纬度:' + res.latitude);
|
|
|
+ this.location.longitude = res.longitude;
|
|
|
+ this.location.latitude = res.latitude;
|
|
|
+ this.$store.commit('SET_LOCATION', { longitude: res.longitude, latitude: res.latitude });
|
|
|
+ getHomePage(this.location)
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
@@ -37,7 +79,6 @@ export default {
|
|
|
height: 600rpx;
|
|
|
text-align: center;
|
|
|
line-height: 600rpx;
|
|
|
- background-color: pink;
|
|
|
}
|
|
|
|
|
|
.nearsMap {
|