leavelinemap.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <!--
  2. * @Title:
  3. * @Description: 转移路线地图信息
  4. * @Author: swp
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <view class="container">
  11. <uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
  12. @clickLeft="toBack">
  13. <view class="nav-title">
  14. <text>{{title}}</text>
  15. </view>
  16. </uni-nav-bar>
  17. <view class="page-body">
  18. <view class="page-section page-section-gap">
  19. <map :style="mapStyles" :latitude="latitude" :longitude="longitude" :markers="markets"
  20. enable-zoom="true" :polyline="polylines" :scale="scale">
  21. </map>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import {
  28. gcoord
  29. } from '@/static/js/gcoord.global.prod.js'
  30. import http from '@/http/api.js';
  31. import {
  32. pathToBase64,
  33. base64ToPath
  34. } from '@/js_sdk/mmmm-image-tools/index.js';
  35. import {
  36. oss,
  37. devUrl,
  38. prodUrl
  39. } from '@/common/setting';
  40. export default {
  41. components: {
  42. },
  43. onLoad(options) {
  44. this.mapStyles.height = (uni.getWindowInfo().windowHeight - 50) + "px";
  45. this.id = options.id;
  46. this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
  47. let that = this;
  48. let postData = {};
  49. postData['id'] = this.id;
  50. http.request({
  51. url: '/galaxy-business/map/leaveline/detail',
  52. method: 'GET',
  53. data: postData
  54. }).then(res => {
  55. console.log(res)
  56. if (res.data != null) {
  57. let p = {};
  58. let ps = res.data.points.map(item => {
  59. let l = gcoord.transform(
  60. [item.pointLng, item.pointLat],
  61. gcoord.WGS84,
  62. gcoord.GCJ02
  63. );
  64. return {
  65. latitude: l[1],
  66. longitude: l[0],
  67. }
  68. })
  69. p['points'] = ps;
  70. p['color'] = '#EE6666';
  71. that.polylines.push(p);
  72. let c = gcoord.transform(
  73. [res.data.centerPointLng, res.data.centerPointLat],
  74. gcoord.WGS84,
  75. gcoord.GCJ02
  76. );
  77. console.log(c)
  78. that.latitude = c[1];
  79. that.longitude = c[0];
  80. that.scale = 16;
  81. }
  82. }).catch(err => {
  83. console.log(err)
  84. })
  85. },
  86. data() {
  87. return {
  88. title: '转移路线地图',
  89. id: 0,
  90. areaList: [],
  91. areaIndex: 0,
  92. latitude: 40.848119,
  93. longitude: 111.755426,
  94. zoom: true,
  95. scale: 16,
  96. markets: [],
  97. polylines: [],
  98. mapStyles: {
  99. width: '100%',
  100. height: '600px'
  101. },
  102. }
  103. },
  104. computed: {
  105. },
  106. onShow() {
  107. },
  108. methods: {
  109. toBack() {
  110. uni.navigateBack({
  111. delta: 1
  112. })
  113. },
  114. }
  115. }
  116. </script>
  117. <style>
  118. .uni-body {
  119. font-size: 0.7rem;
  120. }
  121. </style>