Commit fd0463c1 by wangzhihui

地图切换

1 parent f66b9639
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</template> </template>
<script> <script>
import '../../assets/spritesmith-generated/sprite.css' import '../../assets/spritesmith-generated/sprite.css'
import mapService from 'utils/mapService.js' import mapService from 'utils/mapBService.js'
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'
export default{ export default{
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 'wangzhihui' '1733904062@qq.com' * @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2024-12-06 14:10:32 * @Date: 2024-12-06 14:10:32
* @LastEditors: 'wangzhihui' '1733904062@qq.com' * @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2024-12-21 15:52:17 * @LastEditTime: 2024-12-23 14:10:33
* @FilePath: \oEshield\src\utils\mapBService.js * @FilePath: \oEshield\src\utils\mapBService.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -100,18 +100,16 @@ MapService.prototype = { ...@@ -100,18 +100,16 @@ MapService.prototype = {
this.map.invoke('distanceToolclose') // 关闭测距 this.map.invoke('distanceToolclose') // 关闭测距
}, },
getCurrentLocation: function() { getCurrentLocation: function() {
var self = this; var self = this
self.map.invoke('Geolocation', res => { const { map } = this
console.log(res,999) self.currentMarker && map.invoke('removeOverlay', self.currentMarker)
// self.currentMarker && self.map.remove(self.currentMarker); map.invoke('Geolocation', res => {
// var lnglatXY = self.getLngLat(res.point.lng, res.point.lat); console.log(res, 'Geolocation')
var lnglatXY = self.getLngLat(116.404, 39.915); const lngLatXY = self.getLngLat(res.longitude, res.latitude)
console.log(lnglatXY,'lnglatXY') self.currentMarker = self.createMarker(lngLatXY)
self.currentMarker = self.createMarker(lnglatXY); console.log(self.currentMarker, 'self.currentMarker')
// self.setFitView() map.invoke('addOverlay', self.currentMarker)
}) })
}, },
createMarker: function(lnglatXY) { createMarker: function(lnglatXY) {
let that=this, let that=this,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!