2022-01-25 16:31:39 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="map">
|
2022-02-10 16:44:41 +08:00
|
|
|
<!-- <div class="build-btn">
|
2022-01-25 16:31:39 +08:00
|
|
|
<img src="./components/img/model-icon.png" alt="" @click="toDetail"> 楼栋<br/>模型
|
2022-02-10 16:44:41 +08:00
|
|
|
</div> -->
|
|
|
|
|
<!-- <div class="build-btn locate">
|
2022-01-26 12:02:32 +08:00
|
|
|
<img src="https://cdn.cunwuyun.cn/dvcp/h5/Location2.png" alt="" @click="getLocale"/>
|
|
|
|
|
当前<br>位置
|
2022-02-10 16:44:41 +08:00
|
|
|
</div> -->
|
2022-01-25 16:31:39 +08:00
|
|
|
<div class="map-content">
|
2022-03-15 18:54:01 +08:00
|
|
|
<AiTMap :map.sync="map" :lib.sync="lib" :ops="ops" :libraries="['service', 'tools']"/>
|
2022-01-25 16:31:39 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="footer">
|
|
|
|
|
<div class="btn" @click="confirm">确认定位</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- <u-popup v-model="show" mode="bottom" border-radius="14">
|
|
|
|
|
<div class="popup">
|
|
|
|
|
<div class="bg"></div>
|
|
|
|
|
<div class="title">恒大城西社区居委会</div>
|
|
|
|
|
<p class="address">山东省济南市历城区王舍人街道恒大商业广场蓝天新城</p>
|
|
|
|
|
<div class="info-flex">
|
|
|
|
|
<span class="label">所属社区</span>
|
|
|
|
|
<span class="value">后西一街袁集村</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-flex">
|
|
|
|
|
<span class="label">所属小区</span>
|
|
|
|
|
<span class="value">蓝天新城世纪花园</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-flex">
|
|
|
|
|
<span class="label">房屋类型</span>
|
|
|
|
|
<span class="value">单元(公寓)楼</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-flex">
|
|
|
|
|
<span class="label">所属网格</span>
|
|
|
|
|
<span class="value">蓝天新城基础网格一</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-flex">
|
|
|
|
|
<span class="label">网格管理员</span>
|
|
|
|
|
<span class="value">林珊珊</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-flex">
|
|
|
|
|
<span class="label">楼栋长</span>
|
|
|
|
|
<span class="value">林珊珊 13782951281
|
|
|
|
|
<img :src="$cdn + 'common/phone.png'" alt="" @click="call(item)" class="phone-icon">
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="popup-btn">查看楼栋模型</div>
|
|
|
|
|
</u-popup> -->
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {mapState} from 'vuex'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
ops: {},
|
|
|
|
|
lib: null,
|
|
|
|
|
map: null,
|
|
|
|
|
markerLayer: '',
|
|
|
|
|
isFlag: false,
|
|
|
|
|
latLng: {lat: '', lng: ''},
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-03-15 18:54:01 +08:00
|
|
|
computed: {...mapState(['user'])},
|
2022-01-25 16:31:39 +08:00
|
|
|
mounted() {
|
|
|
|
|
this.initMap()
|
|
|
|
|
},
|
|
|
|
|
onShow() {
|
2022-02-16 16:17:41 +08:00
|
|
|
document.title = "楼栋定位"
|
2022-01-25 16:31:39 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
2022-03-15 18:54:01 +08:00
|
|
|
initMap(retryTimes = 0) { //初始化地图
|
2022-01-25 16:31:39 +08:00
|
|
|
this.$nextTick(() => {
|
2022-03-15 18:54:01 +08:00
|
|
|
let {map} = this
|
2022-01-25 16:31:39 +08:00
|
|
|
if (map) {
|
|
|
|
|
map.setZoom(15)
|
|
|
|
|
map.on("click", (evt) => {
|
2022-01-26 12:02:32 +08:00
|
|
|
this.handleMapClick(evt)
|
2022-01-25 16:31:39 +08:00
|
|
|
});
|
|
|
|
|
} else {
|
2022-03-15 18:54:01 +08:00
|
|
|
if (retryTimes < 10)
|
2022-01-25 16:31:39 +08:00
|
|
|
setTimeout(() => {
|
2022-03-15 18:54:01 +08:00
|
|
|
this.initMap(++retryTimes)
|
|
|
|
|
}, 500)
|
|
|
|
|
else console.error("地图渲染失败")
|
2022-01-25 16:31:39 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2022-01-26 12:02:32 +08:00
|
|
|
getLocale() {
|
|
|
|
|
wx.getLocation({
|
|
|
|
|
type: 'gcj02',
|
|
|
|
|
success: res => {
|
|
|
|
|
let {latitude: lat, longitude: lng} = res
|
|
|
|
|
this.handleMapClick({latlng: {lat, lng}})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleMapClick(evt) {
|
|
|
|
|
let {lib: TMap, map} = this
|
|
|
|
|
if (this.markerLayer) {
|
|
|
|
|
this.markerLayer.setMap(null);
|
|
|
|
|
}
|
|
|
|
|
this.markerLayer = new TMap.MultiMarker({id: 'marker-layer', map});
|
|
|
|
|
this.markerLayer.add({
|
|
|
|
|
position: evt.latLng
|
|
|
|
|
});
|
2022-02-10 16:44:41 +08:00
|
|
|
this.latLng = evt.latLng
|
2022-01-26 12:02:32 +08:00
|
|
|
},
|
2022-01-25 16:31:39 +08:00
|
|
|
confirm() {
|
|
|
|
|
if (!this.latLng.lat) {
|
|
|
|
|
return this.$u.toast(`未获取到定位信息,无法定位`)
|
|
|
|
|
}
|
|
|
|
|
let {id} = this.$route.query
|
|
|
|
|
this.$http.post(`/app/appcommunitybuildinginfo/updateLocation`, null, {
|
2022-01-26 12:02:32 +08:00
|
|
|
params: {id, ...this.latLng}
|
2022-01-25 16:31:39 +08:00
|
|
|
}).then(res => {
|
2022-01-26 12:02:32 +08:00
|
|
|
if (res?.code == 0) {
|
2022-01-25 16:31:39 +08:00
|
|
|
this.$u.toast('提交成功')
|
|
|
|
|
uni.$emit('updateList')
|
|
|
|
|
setTimeout(() => {
|
2022-01-26 12:02:32 +08:00
|
|
|
uni.navigateBack({})
|
2022-01-25 16:31:39 +08:00
|
|
|
}, 600)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
toDetail() {
|
|
|
|
|
uni.navigateTo({url: `./detail?id=${this.$route.query.id}`})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
uni-page-body {
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.map {
|
|
|
|
|
height: 100vh;
|
|
|
|
|
|
|
|
|
|
.build-btn {
|
|
|
|
|
width: 80px;
|
|
|
|
|
height: 160px;
|
|
|
|
|
background: #FFF;
|
|
|
|
|
box-shadow: 0 4px 8px 0 rgba(138, 138, 138, 0.5);
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 136px;
|
|
|
|
|
right: 24px;
|
|
|
|
|
z-index: 99999;
|
|
|
|
|
padding: 16px 16px 0;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #666;
|
|
|
|
|
line-height: 30px;
|
|
|
|
|
|
2022-01-26 12:02:32 +08:00
|
|
|
&.locate {
|
|
|
|
|
transform: translateY(calc(-100% - 20px));
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-25 16:31:39 +08:00
|
|
|
img {
|
|
|
|
|
width: 48px;
|
|
|
|
|
height: 48px;
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.map-content {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.footer {
|
|
|
|
|
width: 100%;
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
z-index: 99999;
|
|
|
|
|
display: flex;
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
height: 112px;
|
|
|
|
|
line-height: 112px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
|
|
.click {
|
|
|
|
|
flex: 1;
|
|
|
|
|
color: #333;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.btn {
|
|
|
|
|
flex: 2;
|
|
|
|
|
background: #1365DD;
|
|
|
|
|
color: #FFF;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|