Browse Source

地图显示修复

remotes/origin/HEAD
wally 5 years ago
parent
commit
8684e718fe
  1. 39
      components/history-map/history-map.vue
  2. 2
      pages/statistics/components/location-map.vue
  3. 1
      store/modules/user/actions.js

39
components/history-map/history-map.vue

@ -7,18 +7,18 @@
:polyline="polyline"
id="map"
ref="map"
scale="12"
show-location="true"
:include-points="markers"
style="width: 100%; height: 1000rpx;"
style="width: 100%; min-height: 1000rpx;height:100%"
/>
</template>
<script>
export default {
props: {
markers: { type: Array, default: null },
polyline: { type: Array, default: null },
polygons: { type: Array, default: null },
markers: { type: Array, default: () => [] },
polyline: { type: Array, default: () => [] },
polygons: { type: Array, default: () => [] },
},
data() {
return {
@ -26,24 +26,19 @@ export default {
longitude: 112.55067,
};
},
onLoad() {
this.getLocation();
},
methods: {
//
// mapgcj02
getLocation() {
uni.getLocation({
type: 'gcj02',
success: res => {
this.longitude = res.longitude;
this.latitude = res.latitude;
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
watch: {
markers: {
deep: true,
handler(value) {
if (value && value.length) {
const { latitude, longitude } = value[0];
this.latitude = latitude;
this.longitude = longitude;
} else {
this.latitude = 37.87059;
this.longitude = 112.55067;
}
},
});
},
},
};

2
pages/statistics/components/location-map.vue

@ -33,6 +33,7 @@ export default {
this.schoolSigns.forEach(item => {
const content = `${item.siteName}\n${item.number}`;
const obj = {
id: Math.random(),
latitude: item.latitude,
longitude: item.longitude,
iconPath: '/static/location.png',
@ -48,6 +49,7 @@ export default {
};
result.push(obj);
});
console.log('result: ', result);
return result;
},

1
store/modules/user/actions.js

@ -78,7 +78,6 @@ const actions = {
.post(GET_USER_INFO, params)
.then(res => {
hideLoading();
console.log('getUserInfo data: ', res.data);
const { data } = res.data;
resolve(data);
// 获取自己的信息采取设置

Loading…
Cancel
Save