detail.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view><map class="map" :latitude="item.lat" :longitude="item.lng" :polygons="polygons" show-compass="true"></map></view>
  3. </template>
  4. <script>
  5. export default {
  6. data() {
  7. return {
  8. param: { pageNum: 1, pageSize: 10, markerType: 0 },
  9. item: { lat: 29.431988858402345, lng: 88.2551640092571 },
  10. list: [],
  11. covers: [],
  12. polygons: [
  13. {
  14. strokeWidth: 3,
  15. strokeColor: '#2196F3',
  16. fillColor: '#03a9f482',
  17. points: []
  18. }
  19. ]
  20. };
  21. },
  22. onLoad() {
  23. this.getData();
  24. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  25. },
  26. methods: {
  27. //获取数据
  28. getData() {
  29. this.$http.request({
  30. url: this.$http.urls.getPageMarker,
  31. data: this.param,
  32. loading: 'false',
  33. success: res => {
  34. console.log('asd:' + JSON.stringify(this.item));
  35. res.data.rows.forEach(item => {
  36. item.locationSet = JSON.parse(item.locationSet);
  37. this.list.push(item);
  38. });
  39. this.item = this.list[0];
  40. this.item.locationSet.forEach(item => {
  41. this.polygons[0].points.push({ latitude: item.lat, longitude: item.lng });
  42. });
  43. //this.covers.push({ latitude: this.item.locationSet.lat, longitude: this.item.locationSet.lng, iconPath: this.$http.urls.ip + this.item.iconPictures });
  44. }
  45. });
  46. }
  47. }
  48. };
  49. </script>
  50. <style lang="scss">
  51. .map {
  52. position: fixed;
  53. width: 100%;
  54. height: 100%;
  55. top: 0px;
  56. }
  57. </style>