以房找人调整完毕
This commit is contained in:
@@ -5,21 +5,18 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Detail from './detail'
|
||||
import Add from './add'
|
||||
import List from './list'
|
||||
import SearchMap from './components/searchMap'
|
||||
import Map from './map'
|
||||
|
||||
import SearchMap from "./components/searchMap";
|
||||
|
||||
export default {
|
||||
name: 'AppBuilding',
|
||||
components: {SearchMap},
|
||||
appName: '以房找人',
|
||||
data() {
|
||||
return {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
components: {Detail, Add, List, SearchMap, Map},
|
||||
onShow() {
|
||||
this.show = false
|
||||
this.$nextTick(() => {
|
||||
|
||||
@@ -108,6 +108,7 @@
|
||||
import {mapState} from 'vuex'
|
||||
|
||||
export default {
|
||||
name:"searchMap",
|
||||
data() {
|
||||
return {
|
||||
ops: {},
|
||||
|
||||
@@ -3,11 +3,15 @@
|
||||
<div class="build-btn">
|
||||
<img src="./components/img/model-icon.png" alt="" @click="toDetail"> 楼栋<br/>模型
|
||||
</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">
|
||||
<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 class="footer">
|
||||
<div class="click" @click="isFlag=true">点击定位</div>
|
||||
<div class="btn" @click="confirm">确认定位</div>
|
||||
</div>
|
||||
<!-- <u-popup v-model="show" mode="bottom" border-radius="14">
|
||||
@@ -62,7 +66,7 @@ export default {
|
||||
retryTimes: 0
|
||||
}
|
||||
},
|
||||
computed: {...mapState(['user', ])},
|
||||
computed: {...mapState(['user',])},
|
||||
mounted() {
|
||||
this.initMap()
|
||||
},
|
||||
@@ -72,28 +76,11 @@ export default {
|
||||
methods: {
|
||||
initMap() { //初始化地图
|
||||
this.$nextTick(() => {
|
||||
let {lib: TMap, map, retryTimes} = this
|
||||
let {map, retryTimes} = this
|
||||
if (map) {
|
||||
map.setZoom(15)
|
||||
map.on("click", (evt) => {
|
||||
if (this.markerLayer) {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
this.handleMapClick(evt)
|
||||
});
|
||||
} else {
|
||||
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() {
|
||||
if (!this.latLng.lat) {
|
||||
return this.$u.toast(`未获取到定位信息,无法定位`)
|
||||
}
|
||||
let {id} = this.$route.query
|
||||
this.$http.post(`/app/appcommunitybuildinginfo/updateLocation`, null, {
|
||||
params: {
|
||||
id,
|
||||
lat: this.latLng.lat,
|
||||
lng: this.latLng.lng,
|
||||
}
|
||||
params: {id, ...this.latLng}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res?.code == 0) {
|
||||
this.$u.toast('提交成功')
|
||||
uni.$emit('updateList')
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
uni.navigateBack({})
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
@@ -158,6 +161,10 @@ uni-page-body {
|
||||
color: #666;
|
||||
line-height: 30px;
|
||||
|
||||
&.locate {
|
||||
transform: translateY(calc(-100% - 20px));
|
||||
}
|
||||
|
||||
img {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
|
||||
Reference in New Issue
Block a user