Browse Source

地图显示修复

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

41
components/history-map/history-map.vue

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

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

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

1
store/modules/user/actions.js

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

Loading…
Cancel
Save