以房找人
This commit is contained in:
		| @@ -131,11 +131,10 @@ export default { | ||||
|       retryMapCount: 0, | ||||
|       building: {}, | ||||
|       buildPopup: false, | ||||
|  | ||||
|       latitude: 30.606355, | ||||
|       longitude: 114.429633, | ||||
|       // latitude: 23.099994, | ||||
| 			// longitude: 113.324520, | ||||
|       // latitude: 30.606355, | ||||
|       // longitude: 114.429633, | ||||
|       latitude: '', | ||||
| 			longitude: '', | ||||
|       _mapContext: null, | ||||
|       markList: [], | ||||
|       statusBarHeight: uni.getSystemInfoSync().statusBarHeight, | ||||
| @@ -143,13 +142,13 @@ export default { | ||||
|   }, | ||||
|   computed: {...mapState(['user'])}, | ||||
|   mounted() { | ||||
|     // uni.getLocation({ | ||||
|     //   type: 'wgs84', | ||||
|     //   success: (res) => { | ||||
|     //     this.latitude = res.latitude | ||||
|     //     this.longitude = res.longitude | ||||
|     //   } | ||||
|     // }); | ||||
|     uni.getLocation({ | ||||
|       type: 'wgs84', | ||||
|       success: (res) => { | ||||
|         this.latitude = res.latitude | ||||
|         this.longitude = res.longitude | ||||
|       } | ||||
|     }); | ||||
|     this._mapContext = uni.createMapContext("map", this); | ||||
|     // 仅调用初始化,才会触发 on.("markerClusterCreate", (e) => {}) | ||||
|     this._mapContext.initMarkerCluster({ | ||||
|   | ||||
| @@ -18,12 +18,12 @@ | ||||
|           <span class="status" :class="'color'+item.locationStatus" | ||||
|                 v-text="$dict.getLabel('BuildLocationStatus', item.locationStatus)"/> | ||||
|         </div> | ||||
|         <!-- <div class="item-btn" v-if="item.locationStatus != 1" @click="toMap(item.id, item.areaId)"> | ||||
|         <div class="item-btn" v-if="item.locationStatus != 1" @click="toMap(item.id, item.lat, item.lng)"> | ||||
|           <span>去定位</span> | ||||
|         </div> | ||||
|         <div class="item-btn" v-if="item.locationStatus == 1" @click="toMap(item.id, item.areaId)"> | ||||
|         <div class="item-btn" v-if="item.locationStatus == 1" @click="toMap(item.id, item.lat, item.lng)"> | ||||
|           <span>重新定位</span> | ||||
|         </div> --> | ||||
|         </div> | ||||
|       </div> | ||||
|       <AiEmpty v-if="!list.length"/> | ||||
|     </div> | ||||
| @@ -92,8 +92,8 @@ export default { | ||||
|     toDetail(id) { | ||||
|       uni.navigateTo({url: `./detail?id=${id}`}) | ||||
|     }, | ||||
|     toMap(id, areaId) { | ||||
|       uni.navigateTo({url: `./map?id=${id}&areaId=${areaId}`}) | ||||
|     toMap(id, lat, lng) { | ||||
|       uni.navigateTo({url: `./map?id=${id}&lat=${lat}&lng=${lng}`}) | ||||
|     } | ||||
|  | ||||
|   }, | ||||
|   | ||||
| @@ -1,10 +1,13 @@ | ||||
| <template> | ||||
|   <div class="map"> | ||||
|     <u-navbar back-icon-color="#000" title="以房找人" title-color="#000" title-width="300" title-size="32"  | ||||
|       :title-bold="true" :background="backgroundNavbar" :is-fixed="true" height="44"></u-navbar> | ||||
|     <div class="build-btn"> | ||||
|       <img src="./components/img/model-icon.png" alt="" @click="toDetail"> 楼栋<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> --> | ||||
|       <map style="width: 100%; height: 100%;" id="map" :show-location="true" :longitude="longitude" :latitude="latitude" :scale="14" @tap="mapClick" :markers="markers"></map> | ||||
|     </div> | ||||
|     <div class="footer"> | ||||
|       <div class="click" @click="isFlag=true">点击定位</div> | ||||
| @@ -51,6 +54,7 @@ | ||||
| import {mapState} from 'vuex' | ||||
|  | ||||
| export default { | ||||
|   customNavigation: true, | ||||
|   data() { | ||||
|     return { | ||||
|       ops: {}, | ||||
| @@ -59,59 +63,96 @@ export default { | ||||
|       markerLayer: '', | ||||
|       isFlag: false, | ||||
|       latLng: {lat: '', lng: ''}, | ||||
|       retryTimes: 0 | ||||
|       retryTimes: 0, | ||||
|       id: '', | ||||
|       backgroundNavbar: { | ||||
|         background: 'url(https://cdn.sinoecare.com/i/2024/07/12/6690a1309c7d3.png) no-repeat', | ||||
|         backgroundSize: 'cover', | ||||
|       }, | ||||
|       markers: [], | ||||
|       longitude: '', | ||||
|       latitude: '' | ||||
|     } | ||||
|   }, | ||||
|   computed: {...mapState(['user', ])}, | ||||
|   mounted() { | ||||
|     this.initMap() | ||||
|   }, | ||||
|   onShow() { | ||||
|     // document.title = "以房找人" | ||||
|  | ||||
|   onLoad(option) { | ||||
|     uni.getLocation({ | ||||
|       type: 'wgs84', | ||||
|       success: (res) => { | ||||
|         this.latitude = res.latitude | ||||
|         this.longitude = res.longitude | ||||
|       } | ||||
|     }); | ||||
|     this.id = option.id | ||||
|     if(option.lat) { | ||||
|       this.markers = [{ | ||||
|         id: 0, | ||||
|         latitude: option.lat, | ||||
|         longitude: option.lat, | ||||
|         iconPath: "https://cdn.sinoecare.com/i/2024/07/18/6698c40bdc9e3.png", | ||||
|         width: 40, | ||||
|         height: 40, | ||||
|       }] | ||||
|     } | ||||
|  | ||||
|     // this.initMap() | ||||
|   }, | ||||
|   methods: { | ||||
|     initMap() {  //初始化地图 | ||||
|       this.$nextTick(() => { | ||||
|         let {lib: TMap, map, retryTimes} = this | ||||
|         if (map) { | ||||
|           map.setZoom(15) | ||||
|           map.on("click", (evt) => { | ||||
|             if (this.markerLayer) { | ||||
|               this.markerLayer.setMap(null); | ||||
|             } | ||||
|     // initMap() {  //初始化地图 | ||||
|     //   this.$nextTick(() => { | ||||
|     //     let {lib: TMap, 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.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 { | ||||
|           if (retryTimes < 5) | ||||
|             setTimeout(() => { | ||||
|               this.retryTimes++ | ||||
|               this.initMap() | ||||
|             }, 1000) | ||||
|         } | ||||
|       }) | ||||
|     //       }); | ||||
|     //     } else { | ||||
|     //       if (retryTimes < 5) | ||||
|     //         setTimeout(() => { | ||||
|     //           this.retryTimes++ | ||||
|     //           this.initMap() | ||||
|     //         }, 1000) | ||||
|     //     } | ||||
|     //   }) | ||||
|     // }, | ||||
|     mapClick(e) { | ||||
|       console.log(e) | ||||
|       if(!this.isFlag) return | ||||
|       this.markers = [{ | ||||
|         id: 0, | ||||
|         latitude: e.detail.latitude, | ||||
|         longitude: e.detail.longitude, | ||||
|         iconPath: "https://cdn.sinoecare.com/i/2024/07/18/6698c40bdc9e3.png", | ||||
|         width: 40, | ||||
|         height: 40, | ||||
|       }] | ||||
|       this.latLng = {lat: e.detail.latitude, lng: e.detail.longitude} | ||||
|     }, | ||||
|     confirm() { | ||||
|       if (!this.latLng.lat) { | ||||
|         return this.$u.toast(`未获取到定位信息,无法定位`) | ||||
|       } | ||||
|       let {id} = this.$route.query | ||||
|       this.$instance.post(`/app/appcommunitybuildinginfo/updateLocation`, null, { | ||||
|         params: { | ||||
|           id, | ||||
|           id: this.id, | ||||
|           lat: this.latLng.lat, | ||||
|           lng: this.latLng.lng, | ||||
|         } | ||||
| @@ -126,7 +167,7 @@ export default { | ||||
|       }) | ||||
|     }, | ||||
|     toDetail() { | ||||
|       uni.navigateTo({url: `./detail?id=${this.$route.query.id}`}) | ||||
|       uni.navigateTo({url: `./detail?id=${this.id}`}) | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -63,7 +63,8 @@ | ||||
|             <div class="file-flex"> | ||||
|               <label class="left"> | ||||
|                 <img src="https://cdn.cunwuyun.cn/dvcp/h5/common/appendix.png" alt=""> | ||||
|                 <span>{{item.name}}.{{item.postfix}}</span> | ||||
|                 <span>{{item.name}}</span> | ||||
|                 <!-- .{{item.postfix}} --> | ||||
|               </label> | ||||
|               <span>{{(item.size/1024).toFixed(2)}}KB</span> | ||||
|             </div> | ||||
| @@ -269,6 +270,7 @@ | ||||
|       box-sizing: border-box; | ||||
|       position: fixed; | ||||
|       left: 32px; | ||||
|       z-index: 3; | ||||
|  | ||||
|       .select-content { | ||||
|         width: 100%; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user