leavelinemap.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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="width: 100%; height: 600px;" :latitude="latitude" :longitude="longitude" :markers="markets"
  20. enable-zoom="true" :polyline="polylines" :scale="scale">
  21. </map>
  22. </view>
  23. <!-- <view class="item-button-group">
  24. <view v-for="item in areaList" :key="item.id" class="item-button" @click="onAreaClick(item)">
  25. <view class="items-line">
  26. <uni-icons class="input-uni-icon" type="close" size="18" color="coral" />
  27. <text class="button-text">{{ item.name }}</text>
  28. </view>
  29. </view>
  30. </view> -->
  31. </view>
  32. </view>
  33. </template>
  34. <!-- <script src="../../static/js/gcoord.global.prod.js" type="module"></script> -->
  35. <script>
  36. import {
  37. gcoord
  38. } from '@/static/js/gcoord.global.prod.js'
  39. import http from '@/http/api.js';
  40. import {
  41. pathToBase64,
  42. base64ToPath
  43. } from '@/js_sdk/mmmm-image-tools/index.js';
  44. import {
  45. oss,
  46. devUrl,
  47. prodUrl
  48. } from '@/common/setting';
  49. export default {
  50. components: {
  51. },
  52. onLoad(options) {
  53. this.id = options.id;
  54. this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
  55. let that = this;
  56. let postData = {};
  57. postData['id'] = this.id;
  58. http.request({
  59. url: '/galaxy-business/map/leaveline/detail',
  60. method: 'GET',
  61. data: postData
  62. }).then(res => {
  63. console.log(res)
  64. if (res.data != null) {
  65. let p = {};
  66. let ps = res.data.points.map(item => {
  67. let l = gcoord.transform(
  68. [item.pointLng, item.pointLat],
  69. gcoord.WGS84,
  70. gcoord.GCJ02
  71. );
  72. return {
  73. latitude: l[1],
  74. longitude: l[0],
  75. }
  76. })
  77. p['points'] = ps;
  78. p['color'] = '#EE6666';
  79. that.polylines.push(p);
  80. let c = gcoord.transform(
  81. [res.data.centerPointLng, res.data.centerPointLat],
  82. gcoord.WGS84,
  83. gcoord.GCJ02
  84. );
  85. console.log(c)
  86. that.latitude = c[1];
  87. that.longitude = c[0];
  88. that.scale = 16;
  89. }
  90. }).catch(err => {
  91. console.log(err)
  92. })
  93. },
  94. data() {
  95. return {
  96. title: '地图测试',
  97. id: 0,
  98. title: 'map',
  99. areaList: [],
  100. areaIndex: 0,
  101. latitude: 40.848119,
  102. longitude: 111.755426,
  103. zoom: true,
  104. scale: 16,
  105. markets: [],
  106. polylines: [],
  107. }
  108. },
  109. computed: {
  110. },
  111. onShow() {
  112. },
  113. created() {
  114. },
  115. methods: {
  116. toOss(path) {
  117. return oss + path;
  118. },
  119. toBack() {
  120. uni.navigateBack({
  121. delta: 1
  122. })
  123. },
  124. onAreaClick(item) {
  125. let p = {};
  126. p['points'] = item.data;
  127. let dashArray = [];
  128. dashArray.push(10);
  129. dashArray.push(10);
  130. p['dashArray'] = dashArray;
  131. p['strokeColor'] = '#FFF';
  132. p['fillColor'] = '#A500337D';
  133. this.polygons = [];
  134. this.polygons.push(p);
  135. let center = item.center;
  136. this.latitude = center[1];
  137. this.longitude = center[0];
  138. },
  139. }
  140. }
  141. </script>
  142. <style>
  143. /* page {
  144. background-color: rgb(240, 242, 244);
  145. } */
  146. .uni-body {
  147. font-size: 0.7rem;
  148. }
  149. </style>