BUG 27215

This commit is contained in:
aixianling
2022-02-11 17:52:08 +08:00
parent 6a670e28c4
commit ab39267fe1

View File

@@ -6,7 +6,8 @@
<script>
import {mapActions, mapState} from 'vuex'
import {mapState} from 'vuex'
export default {
name: "AiTMap",
props: {
@@ -40,7 +41,6 @@ export default {
}
},
methods: {
...mapActions(['wxInvoke']),
injectLib(url, cb) {
const script = document.createElement('script')
script.type = 'text/javascript';
@@ -52,58 +52,42 @@ export default {
document.body.appendChild(script);
},
initTMap() {
// var latLng = {}
// if(this.config.lat) { //通用版
// latLng = this.config
// this.mapLib = TMap
// this.tmap = new TMap.Map(this.$refs.tmap, {
// zoom: 11,
// center: new TMap.LatLng(latLng.lat, latLng.lng),
// ...this.ops
// })
// this.$emit('loaded')
// this.$emit('update:lib', TMap)
// this.$emit('update:map', this.tmap)
// this.areaId && this.getMapArea()
// }else { //上架版
// this.wxInvoke(['getLocation', {
// }, (res) => {
// latLng = {
// lat: res.latitude,
// lng: res.longitude
// }
// this.mapLib = TMap
// this.tmap = new TMap.Map(this.$refs.tmap, {
// zoom: 11,
// center: new TMap.LatLng(latLng.lat, latLng.lng),
// ...this.ops
// })
// this.$emit('loaded')
// this.$emit('update:lib', TMap)
// this.$emit('update:map', this.tmap)
// this.areaId && this.getMapArea()
// }])
// wx.getLocation({
// type: 'gcj02', // 默认为wgs84的gps坐标如果要返回直接给openLocation用的火星坐标可传入'gcj02'
// success: (res) => {
// console.log(res)
// latLng = {
// lat: res.latitude,
// lng: res.longitude
// }
// }
// });
let latLng = {}
if (this.config.lat) { //通用版
latLng = this.config
this.mapLib = TMap
this.tmap = new TMap.Map(this.$refs.tmap, {
zoom: 11,
center: new TMap.LatLng(latLng.lat, latLng.lng),
...this.ops
})
this.$emit('loaded')
this.$emit('update:lib', TMap)
this.$emit('update:map', this.tmap)
this.areaId && this.getMapArea()
} else { //上架版
uni.getLocation({
type: "gcj02",
success: res => {
latLng = {
lat: res.latitude,
lng: res.longitude
}
if (latLng.lat) {
this.mapLib = TMap
this.tmap = new TMap.Map(this.$refs.tmap, {
zoom: 11,
center: new TMap.LatLng(latLng.lat, latLng.lng),
...this.ops
})
this.$emit('loaded')
this.$emit('update:lib', TMap)
this.$emit('update:map', this.tmap)
this.areaId && this.getMapArea()
}
}
})
}
},
fitBounds(latLngList, count = 0) {
// 由多边形顶点坐标数组计算能完整呈现该多边形的最小矩形范围