This commit is contained in:
liuye
2022-02-10 17:44:26 +08:00
parent 37f4c3d8d4
commit bdc7307497
2 changed files with 46 additions and 21 deletions

View File

@@ -40,6 +40,7 @@ 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';
@@ -54,19 +55,6 @@ export default {
var latLng = {} var latLng = {}
if(this.config.lat) { //通用版 if(this.config.lat) { //通用版
latLng = this.config latLng = this.config
}else { //上架版
wx.getLocation({
type: 'gcj02', // 默认为wgs84的gps坐标如果要返回直接给openLocation用的火星坐标可传入'gcj02'
success: (res) => {
console.log(res)
latLng = {
lat: res.latitude,
lng: res.longitude
}
}
});
}
this.mapLib = TMap this.mapLib = TMap
this.tmap = new TMap.Map(this.$refs.tmap, { this.tmap = new TMap.Map(this.$refs.tmap, {
zoom: 11, zoom: 11,
@@ -77,6 +65,39 @@ export default {
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 { //上架版
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
// }
// }
// });
}
}, },
fitBounds(latLngList, count = 0) { fitBounds(latLngList, count = 0) {
// 由多边形顶点坐标数组计算能完整呈现该多边形的最小矩形范围 // 由多边形顶点坐标数组计算能完整呈现该多边形的最小矩形范围

View File

@@ -108,13 +108,17 @@
<div class="item" v-for="(item, index) in list" :key="index"> <div class="item" v-for="(item, index) in list" :key="index">
<p>{{item.content}}</p> <p>{{item.content}}</p>
<div>{{item.createTime}} <div>{{item.createTime}}
<span>{{item.createUserName}}</span> <span>
网格员<AiOpenData v-if="item.createUserName" type="userName" :openid="item.createUserName" />
</span>
</div> </div>
</div> </div>
</div> </div>
<div class="item-flex" v-if="info.releaseName"> <div class="item-flex" v-if="info.releaseName">
<div class="label">异常解除人</div> <div class="label">异常解除人</div>
<div class="value">{{info.releaseName}}</div> <div class="value">
<AiOpenData v-if="info.releaseName" type="userName" :openid="info.releaseName" />
</div>
</div> </div>
<div class="item-flex" v-if="info.releaseName"> <div class="item-flex" v-if="info.releaseName">
<div class="label">异常解除时间</div> <div class="label">异常解除时间</div>