1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <template>
- <view><map class="map" :latitude="item.lat" :longitude="item.lng" :polygons="polygons" show-compass="true"></map></view>
- </template>
- <script>
- export default {
- data() {
- return {
- param: { pageNum: 1, pageSize: 10, markerType: 0 },
- item: { lat: 29.431988858402345, lng: 88.2551640092571 },
- list: [],
- covers: [],
- polygons: [
- {
- strokeWidth: 3,
- strokeColor: '#2196F3',
- fillColor: '#03a9f482',
- points: []
- }
- ]
- };
- },
- onLoad() {
- this.getData();
- this.windowHeight = uni.getSystemInfoSync().windowHeight;
- },
- methods: {
- //获取数据
- getData() {
- this.$http.request({
- url: this.$http.urls.getPageMarker,
- data: this.param,
- loading: 'false',
- success: res => {
- console.log('asd:' + JSON.stringify(this.item));
- res.data.rows.forEach(item => {
- item.locationSet = JSON.parse(item.locationSet);
- this.list.push(item);
- });
- this.item = this.list[0];
- this.item.locationSet.forEach(item => {
- this.polygons[0].points.push({ latitude: item.lat, longitude: item.lng });
- });
- //this.covers.push({ latitude: this.item.locationSet.lat, longitude: this.item.locationSet.lng, iconPath: this.$http.urls.ip + this.item.iconPictures });
- }
- });
- }
- }
- };
- </script>
- <style lang="scss">
- .map {
- position: fixed;
- width: 100%;
- height: 100%;
- top: 0px;
- }
- </style>
|