以房找人调整完毕

This commit is contained in:
aixianling
2022-01-26 12:02:32 +08:00
parent f16e4b90c2
commit 00e03c6117
3 changed files with 40 additions and 35 deletions

View File

@@ -5,21 +5,18 @@
</template> </template>
<script> <script>
import Detail from './detail'
import Add from './add' import SearchMap from "./components/searchMap";
import List from './list'
import SearchMap from './components/searchMap'
import Map from './map'
export default { export default {
name: 'AppBuilding', name: 'AppBuilding',
components: {SearchMap},
appName: '以房找人', appName: '以房找人',
data() { data() {
return { return {
show: true show: true
} }
}, },
components: {Detail, Add, List, SearchMap, Map},
onShow() { onShow() {
this.show = false this.show = false
this.$nextTick(() => { this.$nextTick(() => {

View File

@@ -108,6 +108,7 @@
import {mapState} from 'vuex' import {mapState} from 'vuex'
export default { export default {
name:"searchMap",
data() { data() {
return { return {
ops: {}, ops: {},

View File

@@ -3,11 +3,15 @@
<div class="build-btn"> <div class="build-btn">
<img src="./components/img/model-icon.png" alt="" @click="toDetail"> 楼栋<br/>模型 <img src="./components/img/model-icon.png" alt="" @click="toDetail"> 楼栋<br/>模型
</div> </div>
<div class="build-btn locate">
<img src="https://cdn.cunwuyun.cn/dvcp/h5/Location2.png" alt="" @click="getLocale"/>
当前<br>位置
</div>
<div class="map-content"> <div class="map-content">
<AiTMap v-if="user.areaId" :areaId="user.areaId" :map.sync="map" :lib.sync="lib" :ops="ops" :libraries="['service', 'tools']"></AiTMap> <AiTMap v-if="user.areaId" :areaId="user.areaId" :map.sync="map" :lib.sync="lib" :ops="ops"
:libraries="['service', 'tools']"/>
</div> </div>
<div class="footer"> <div class="footer">
<div class="click" @click="isFlag=true">点击定位</div>
<div class="btn" @click="confirm">确认定位</div> <div class="btn" @click="confirm">确认定位</div>
</div> </div>
<!-- <u-popup v-model="show" mode="bottom" border-radius="14"> <!-- <u-popup v-model="show" mode="bottom" border-radius="14">
@@ -72,28 +76,11 @@ export default {
methods: { methods: {
initMap() { //初始化地图 initMap() { //初始化地图
this.$nextTick(() => { this.$nextTick(() => {
let {lib: TMap, map, retryTimes} = this let {map, retryTimes} = this
if (map) { if (map) {
map.setZoom(15) map.setZoom(15)
map.on("click", (evt) => { map.on("click", (evt) => {
if (this.markerLayer) { this.handleMapClick(evt)
this.markerLayer.setMap(null);
}
this.markerLayer = new TMap.MultiMarker({
id: 'marker-layer',
map: map
});
if (this.isFlag) {
this.markerLayer.add({
position: evt.latLng
});
this.latLng = {
lat: evt.latLng.lat,
lng: evt.latLng.lng
}
}
}); });
} else { } else {
if (retryTimes < 5) if (retryTimes < 5)
@@ -104,23 +91,39 @@ export default {
} }
}) })
}, },
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
});
this.latLng = evt.latlng
},
confirm() { confirm() {
if (!this.latLng.lat) { if (!this.latLng.lat) {
return this.$u.toast(`未获取到定位信息,无法定位`) return this.$u.toast(`未获取到定位信息,无法定位`)
} }
let {id} = this.$route.query let {id} = this.$route.query
this.$http.post(`/app/appcommunitybuildinginfo/updateLocation`, null, { this.$http.post(`/app/appcommunitybuildinginfo/updateLocation`, null, {
params: { params: {id, ...this.latLng}
id,
lat: this.latLng.lat,
lng: this.latLng.lng,
}
}).then(res => { }).then(res => {
if (res.code == 0) { if (res?.code == 0) {
this.$u.toast('提交成功') this.$u.toast('提交成功')
uni.$emit('updateList') uni.$emit('updateList')
setTimeout(() => { setTimeout(() => {
uni.navigateBack() uni.navigateBack({})
}, 600) }, 600)
} }
}) })
@@ -158,6 +161,10 @@ uni-page-body {
color: #666; color: #666;
line-height: 30px; line-height: 30px;
&.locate {
transform: translateY(calc(-100% - 20px));
}
img { img {
width: 48px; width: 48px;
height: 48px; height: 48px;