BUG 27215
This commit is contained in:
@@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import {mapActions, mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "AiTMap",
|
name: "AiTMap",
|
||||||
props: {
|
props: {
|
||||||
@@ -40,7 +41,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['wxInvoke']),
|
|
||||||
injectLib(url, cb) {
|
injectLib(url, cb) {
|
||||||
const script = document.createElement('script')
|
const script = document.createElement('script')
|
||||||
script.type = 'text/javascript';
|
script.type = 'text/javascript';
|
||||||
@@ -52,58 +52,42 @@ export default {
|
|||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
},
|
},
|
||||||
initTMap() {
|
initTMap() {
|
||||||
// var latLng = {}
|
let latLng = {}
|
||||||
// if(this.config.lat) { //通用版
|
if (this.config.lat) { //通用版
|
||||||
// latLng = this.config
|
latLng = this.config
|
||||||
// this.mapLib = TMap
|
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
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
this.tmap = new TMap.Map(this.$refs.tmap, {
|
this.tmap = new TMap.Map(this.$refs.tmap, {
|
||||||
zoom: 11,
|
zoom: 11,
|
||||||
|
center: new TMap.LatLng(latLng.lat, latLng.lng),
|
||||||
...this.ops
|
...this.ops
|
||||||
})
|
})
|
||||||
this.$emit('loaded')
|
this.$emit('loaded')
|
||||||
this.$emit('update:lib', TMap)
|
this.$emit('update:lib', TMap)
|
||||||
this.$emit('update:map', this.tmap)
|
this.$emit('update:map', this.tmap)
|
||||||
this.areaId && this.getMapArea()
|
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) {
|
fitBounds(latLngList, count = 0) {
|
||||||
// 由多边形顶点坐标数组计算能完整呈现该多边形的最小矩形范围
|
// 由多边形顶点坐标数组计算能完整呈现该多边形的最小矩形范围
|
||||||
|
|||||||
Reference in New Issue
Block a user