Fly 5 月之前
父節點
當前提交
9f35a4a808

+ 34 - 21
components/bab-Touchbox/bab-Touchbox.vue

@@ -39,6 +39,7 @@
 				isend: false, // 触摸结束
 				isfirst: true, // 手指第一次触摸
 				tapboxtop: 0, // 手指距离顶部距离
+				startTop: 0
 			};
 		},
 
@@ -101,16 +102,16 @@
 		computed: {},
 		methods: {
 			// 隐藏
-			concealList(){
+			concealList() {
 				const H_ = uni.getSystemInfoSync().windowHeight;
 				this.fixboxtop = H_ - uni.upx2px(200)
 			},
 			tap(e) {
 				// console.log(e)
 			},
-			getstart(e) {  
+			getstart(e) {
 				e.preventDefault();
-				const {clientY , screenY } = e.touches[0];
+				const { clientY, screenY } = e.touches[0];
 				let Y = clientY || screenY;
 				// //#ifdef MP-WEIXIN
 				// Y = e.touches[0].clientY;
@@ -131,7 +132,6 @@
 					this.tapboxtop = Y - this.fixboxtop;
 				}
 				this.fixboxtop = Y - this.tapboxtop;
-				console.log('this.fixboxtop > this.firsttop = ' ,Y , this.tapboxtop)
 				if (this.fixboxtop > this.firsttop) {
 					if (this.fixboxtop >= this.windowHeight * (1 - this.smallHeight)) {
 						this.fixboxtop = this.windowHeight * (1 - this.smallHeight);
@@ -147,32 +147,45 @@
 			getend() {
 				this.isend = true;
 				this.isfirst = true;
-				//中间高度以下
-				if (this.fixboxtop > this.firsttop) {
-					//当超过平衡值
-					if (this.fixboxtop - this.firsttop >= this.phoneMinTop) {
-						this.fixboxtop = this.windowHeight * (1 - this.smallHeight);
-					} else {
-						this.fixboxtop = this.windowHeight * (1 - this.minHeight);
+				console.log("this.fixboxtop > this.firsttop = ", this.fixboxtop, this.startTop)
+				if (!this.startTop) {
+					// 中间高度以下
+					if (this.fixboxtop > this.firsttop) {
+						//当超过平衡值
+						if (this.fixboxtop - this.firsttop >= this.phoneMinTop) {
+							this.fixboxtop = this.windowHeight * (1 - this.smallHeight);
+						} else {
+							this.fixboxtop = this.windowHeight * (1 - this.minHeight);
+						}
 					}
-				}
-				//中间高度以上
-				else {
-					//滑动距离小于平衡值
-					if (this.firsttop - this.fixboxtop <= this.phonetop) {
-						this.fixboxtop = this.firsttop;
-					} else {
-						this.fixboxtop = this.windowHeight * (1 - this.maxHeight);
+					//中间高度以上
+					else {
+						//滑动距离小于平衡值
+						if (this.firsttop - this.fixboxtop <= this.phonetop) {
+							this.fixboxtop = this.firsttop;
+						} else {
+							this.fixboxtop = this.windowHeight * (1 - this.maxHeight);
+						}
 					}
+				} else if (this.fixboxtop < this.startTop) {
+					this.fixboxtop = this.windowHeight * (1 - this.maxHeight);
+					console.log("向上滑动", this.fixboxtop)
+				} else {
+					this.fixboxtop = this.windowHeight * (1 - this.minHeight);
+					console.log("向下滑动", this.fixboxtop)
 				}
+
 				this.$emit('currentHeight', this.windowHeight - this.fixboxtop);
+
+
+				this.startTop = this.fixboxtop - 0;
 			},
 		},
 	};
 </script>
 
 <style lang="scss" scoped>
-	.tapBoxTouchLine { 
+	.tapBoxTouchLine {
 		display: flex;
 		align-items: center;
 		justify-content: center;
@@ -206,6 +219,6 @@
 		background-color: #ffffff;
 		padding: 0 12px;
 		transition-property: top;
-		transition-duration: 0.8s;
+		transition-duration: 0.4s;
 	}
 </style>

+ 160 - 0
components/city/city - 副本.vue

@@ -0,0 +1,160 @@
+<template>
+	<uni-popup ref="popupRef" type="bottom" border-radius="10px 10px 0 0">
+
+		<!-- :indicator-style="indicatorStyle"   -->
+		<div class="city-box">
+			<div class="city-picker-btn">
+				<text @click.stop="cancel()">取消</text>
+				<text @click.stop="confirm()">确定</text>
+			</div>
+			<picker-view indicator-class="indicator-class" :value="value||[]" class="picker-view" @change="bindChange">
+				<picker-view-column>
+					<view class="item" v-for="(item,index) in sheng" :key="index">{{item.label}}</view>
+				</picker-view-column>
+				<picker-view-column>
+					<view class="item" v-for="(item,index) in shi" :key="index">{{item.label}}</view>
+				</picker-view-column>
+				<picker-view-column>
+					<view class="item" v-for="(item,index) in qu" :key="index">{{item.label}}</view>
+				</picker-view-column>
+			</picker-view>
+		</div> 
+	</uni-popup>
+
+</template>
+
+<script>
+	import { cityJson } from "./json.js"
+	export default {
+		name: "city",
+		props: {
+			code: {
+				type: String | Array,
+				default: null
+			}
+		},
+		data() {
+			return {
+				codeValue: [],
+				labelValue:'',
+				value: [0, 0, 0],
+				sheng: [cityJson[16]],
+				shi: [],
+				qu: []
+			}
+		},
+		watch: {
+			value: {
+				handler(newV, oldV) {
+					const indexArr = newV || []
+					this.shi = [];
+					this.qu = []; 
+					// 省
+					const sh_l = indexArr[0] || 0;
+					const sheng_ = this.sheng[sh_l];
+					let shi_ = null;
+					let qu_ = null;
+					let code = [sheng_.value];
+					let label = sheng_.label;
+
+					if (sheng_.children && sheng_.children.length > 0) {
+						// 市
+						this.shi = sheng_.children;
+						const s_l = indexArr[1] || 0;
+						shi_ = this.shi[s_l]
+						code.push(shi_.value)
+						label = `${label}/${shi_.label}`
+					}
+
+
+					if (shi_ && shi_.children && shi_.children.length > 0) {
+						// 区
+						this.qu = shi_.children;
+						const q_l = indexArr[2] || 0;
+						const qu_ = this.qu[q_l]
+						code.push(qu_.value)
+						label = `${label}/${qu_.label}`
+					}
+
+					this.codeValue = code;
+					this.labelValue = label;
+				},
+				immediate: true,
+				deep: true
+			}
+		},
+		created() {
+
+		},
+		mounted() {
+			
+
+		},
+		methods: {
+			open(){
+				this.$refs.popupRef.open()
+			},
+			bindChange(val) {
+				const { value } = val.detail;
+
+				console.log("bindChange = ", value, this.value)
+				if (value[0] !== this.value[0]) {
+					this.value = [value[0], 0, 0];
+					return
+				}
+				if (value[1] !== this.value[1]) {
+					this.value = [value[0], value[1], 0];
+					return
+				}
+				this.value = value;
+			},
+			confirm(){ 
+				this.$emit("update:code", this.codeValue);
+				this.$emit("cityName", this.labelValue);
+				this.$emit("onConfirm")
+				this.cancel();
+			},
+			cancel(){
+				this.$refs.popupRef.close()
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.uni-popup {
+		z-index: 1002;
+
+		.city-box {
+			height: 55vh;
+			background-color: #fff;
+			border-radius: 30rpx 30rpx 0 0;
+
+			.city-picker-btn {
+				height: 100rpx;
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				padding: 0 30rpx;
+			}
+
+			.picker-view {
+				height: calc(100% - 100rpx);
+				text-align: center;
+
+			}
+		}
+	}
+
+	/deep/ .indicator-class {
+		height: 100rpx;
+	}
+
+	/deep/ .uni-picker-view-content {
+		.item {
+			text-align: center;
+
+			line-height: 100rpx;
+		}
+	}
+</style>

+ 30 - 66
components/city/city.vue

@@ -9,16 +9,10 @@
 			</div>
 			<picker-view indicator-class="indicator-class" :value="value||[]" class="picker-view" @change="bindChange">
 				<picker-view-column>
-					<view class="item" v-for="(item,index) in sheng" :key="index">{{item.label}}</view>
-				</picker-view-column>
-				<picker-view-column>
-					<view class="item" v-for="(item,index) in shi" :key="index">{{item.label}}</view>
-				</picker-view-column>
-				<picker-view-column>
-					<view class="item" v-for="(item,index) in qu" :key="index">{{item.label}}</view>
+					<view class="item" v-for="(item,index) in cityList" :key="index">{{item.label}}</view>
 				</picker-view-column>
 			</picker-view>
-		</div> 
+		</div>
 	</uni-popup>
 
 </template>
@@ -36,85 +30,55 @@
 		data() {
 			return {
 				codeValue: [],
-				labelValue:'',
-				value: [0, 0, 0],
-				sheng: [cityJson[16]],
-				shi: [],
-				qu: []
+				labelValue: '',
+				value: [0],
+				// sheng: [cityJson[16]],
+				// shi: [],
+				// qu: [],
+
+				cityList: cityJson
 			}
 		},
 		watch: {
-			value: {
-				handler(newV, oldV) {
-					const indexArr = newV || []
-					this.shi = [];
-					this.qu = []; 
-					// 省
-					const sh_l = indexArr[0] || 0;
-					const sheng_ = this.sheng[sh_l];
-					let shi_ = null;
-					let qu_ = null;
-					let code = [sheng_.value];
-					let label = sheng_.label;
-
-					if (sheng_.children && sheng_.children.length > 0) {
-						// 市
-						this.shi = sheng_.children;
-						const s_l = indexArr[1] || 0;
-						shi_ = this.shi[s_l]
-						code.push(shi_.value)
-						label = `${label}/${shi_.label}`
-					}
-
-
-					if (shi_ && shi_.children && shi_.children.length > 0) {
-						// 区
-						this.qu = shi_.children;
-						const q_l = indexArr[2] || 0;
-						const qu_ = this.qu[q_l]
-						code.push(qu_.value)
-						label = `${label}/${qu_.label}`
-					}
-
-					this.codeValue = code;
-					this.labelValue = label;
-				},
-				immediate: true,
-				deep: true
-			}
+
 		},
 		created() {
 
 		},
 		mounted() {
-			
+
 
 		},
 		methods: {
-			open(){
+			open() {
 				this.$refs.popupRef.open()
 			},
 			bindChange(val) {
 				const { value } = val.detail;
 
-				console.log("bindChange = ", value, this.value)
-				if (value[0] !== this.value[0]) {
-					this.value = [value[0], 0, 0];
-					return
-				}
-				if (value[1] !== this.value[1]) {
-					this.value = [value[0], value[1], 0];
-					return
-				}
+				// console.log("bindChange = ", value, this.value)
+				// if (value[0] !== this.value[0]) {
+				// 	this.value = [value[0], 0, 0];
+				// 	return
+				// }
+				// if (value[1] !== this.value[1]) {
+				// 	this.value = [value[0], value[1], 0];
+				// 	return
+				// }
 				this.value = value;
 			},
-			confirm(){ 
-				this.$emit("update:code", this.codeValue);
-				this.$emit("cityName", this.labelValue);
+			confirm() {
+
+				console.log("this.value  = ", this.value)
+				const index = this.value[0]
+				const { value, label } = this.cityList[index];
+				// value: '420113', label: '汉南区'
+				this.$emit("update:code", value);
+				this.$emit("cityName", label);
 				this.$emit("onConfirm")
 				this.cancel();
 			},
-			cancel(){
+			cancel() {
 				this.$refs.popupRef.close()
 			}
 		}

File diff suppressed because it is too large
+ 16305 - 0
components/city/json - 副本.js


File diff suppressed because it is too large
+ 75 - 15688
components/city/json.js


+ 107 - 45
components/tiandituMap/tiandituMap.vue

@@ -1,7 +1,6 @@
 <template>
 	<view id="mapDiv" class="mapDiv" :apikey="apiKey" :prop="option" :change:prop="Trenderjs.initTMap">
-		<!-- :change:prop="Trenderjs.initTMap" -->
-		<!-- <view class="position" @click.stop="Trenderjs.onPosition">
+		<view class="position" @click.stop="Trenderjs.onPosition">
 			<svg t="1734080022350" class="position-icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
 				p-id="4287" xmlns:xlink="http://www.w3.org/1999/xlink">
 				<path d="M512 512m-80 0a80 80 0 1 0 160 0 80 80 0 1 0-160 0Z" p-id="4288"></path>
@@ -10,7 +9,7 @@
 					p-id="4289"></path>
 			</svg>
 
-		</view> -->
+		</view>
 	</view>
 </template>
 
@@ -44,18 +43,15 @@
 
 		},
 		mounted() {
-			EventBus.$on('TianDiTuSite', (res) => {
-				const { longitude, latitude } = res;
-				this.Trenderjs.SelectedDot(longitude, latitude)
-				console.log('Event received with payload:', res);
-			});
+
 		},
 		beforeDestroy() {
-			EventBus.$off('someEvent'); // 确保在组件销毁前移除事件监听
+			// EventBus.$off('someEvent'); // 确保在组件销毁前移除事件监听
 		},
 		methods: {
 			compliteonLoadTianDiTu() {
 				this.$emit('onLoadTianDiTu')
+				
 			},
 			initCharts(lng, lat, iconPng) {
 				this.option = {
@@ -110,51 +106,89 @@
 	}
 </script>
 <script module="Trenderjs" lang="renderjs">
+	import { EventBus } from "@/utils/vueBus.js"
 	var Tmap = null;
 	export default {
 		data() {
 			return {
 				options: {},
+				markerList: [],
+				labelLsit: []
 			}
 		},
 		mounted() {
 
 		},
 		beforeDestroy() {
-			this.removeMapMoveend()
+			this.removeMapEvent()
 		},
 		methods: {
-			onPosition(e) {
-				e.
-				console.log("---------------------")
+			onPosition() {
+				EventBus.$emit('TianDiTuSearch' , (res) => {
+					this.SelectedDot(res)
+				})
+				// this.SelectedDot({longitude:114.414431,latitude:30.482926}) 
 			},
-			addMapMoveend() {
+			addMapEvent() {
 				//移除地图的移动停止事件
-				console.log("Tmap = 11", Tmap)
-				this.removeMapMoveend()
-				if (Tmap) Tmap.addEventListener("moveend", this.MapMoveend);
+				this.getLocation()
+				this.removeMapEvent()
+				if (Tmap) {
+					Tmap.addEventListener("moveend", this.MapMoveend);
+					Tmap.addEventListener('zoomend', this.handleZoomEvent);
+				}
 			},
-			removeMapMoveend() {
+			removeMapEvent() {
 				//移除地图的移动停止事件
 				try {
-					if (Tmap) Tmap.removeEventListener("moveend", this.MapMoveend);
+					if (Tmap) {
+						Tmap.removeEventListener("moveend", this.MapMoveend);
+						Tmap.removeEventListener("zoomend", this.MapMoveend);
+					}
 				} catch (error) {
 					//TODO handle the exception
 				}
 			},
-
+			// 移动地图,获取中心点
 			MapMoveend(e) {
 				try {
+					// console.log("移动地图")
 					const v = e.target.getCenter()
 					const Lng = v.getLng();
-					const Lat = v.getLat()
-					console.log("MapMoveend 99= ", Lng, Lat)
+					const Lat = v.getLat();
 					this.$emit("moveMap", { Lng, Lat })
 				} catch (error) {
 					//TODO handle the exception
 				}
+			},
 
+			// 点击地图标注的点位
+			clickMapSite(e) {
+				const Lng = e.lnglat.getLng();
+				const Lat = e.lnglat.getLat();
+				this.$emit('handleMapSite', { Lng, Lat })
+
+			},
+			// 天地图缩放事件
+			handleZoomEvent(event) {
+				if (!this.labelLsit || this.labelLsit.length === 0) return;
+				// let currentZoom = event.target.getZoom();
+				// console.log("handleZoomEvent = 天地图缩放事件  " , currentZoom)
+				this.labelLsit.forEach(el => {
+					this.labelShowOrHide(el)
+				})
+			},
+			// 标签的显示与隐藏
+			labelShowOrHide(label) {
+				if (!Tmap) return
+				let currentZoom = Tmap.getZoom();
+				if (currentZoom >= 16) {
+					label.show()
+				} else {
+					label.hide()
+				}
 			},
+
 			initTmap() {
 				try {
 					Tmap = null;
@@ -177,7 +211,7 @@
 						document.head.appendChild(script)
 						setTimeout(() => {
 							this.$emit("handleSearch")
-						}, 500);
+						}, 1000);
 					} else {
 						const {
 							lng,
@@ -226,14 +260,14 @@
 				// Tmap.addEventListener("moveend", (e) => {
 				// 	console.log('addEventListener  = ' , e)
 				// });
-				this.addMapMoveend()
+				this.addMapEvent()
 			},
 			upDataChartsRender(lng, lat) {
 				if (!Tmap) return
 				this.setIcon(lng, lat, true)
 				Tmap.centerAndZoom(new T.LngLat(lng, lat), 15);
 			},
-			setIcon(lng, lat, isClear, iconU) {
+			setIcon(lng, lat, isClear, iconU, info) {
 				if (isClear) {
 					this.clearIcon()
 				}
@@ -245,31 +279,58 @@
 				const marker = new T.Marker(new T.LngLat(lng, lat), {
 					icon
 				});
+				// 点位注册点击事件
+				marker.addEventListener("click", this.clickMapSite);
+				// 缓存注册点击事件的点位
+				this.markerList.push(marker)
 				Tmap.addOverLay(marker);
+				if (info) {
+					try {
+						var label = new T.Label({
+							text: `<b>${info.locationName}<b>`,
+							position: marker.getLngLat(),
+							offset: new T.Point(-50, 15)
+						});
+						Tmap.addOverLay(label);
+						label.setLngLat(marker.getLngLat());
+						label.setBorderLine(0);
+						// label.setBackgroundColor ('transparent');
+						label.setFontSize(10);
+						this.labelLsit.push(label)
+						// 判断当前是否显示
+						this.labelShowOrHide(label)
+					} catch (error) {
+						//TODO handle the exception
+						console.log("info = error ", error)
+					}
+				}
 			},
+			// 移除点位,并注销点位绑定的点击事件
 			clearIcon() {
-				Tmap.clearOverLays()
+				try {
+					(this.markerList || []).forEach(el => {
+						el.removeEventListener("click", this.clickMapSite);
+					});
+					this.markerList = [];
+					this.labelLsit = [];
+					Tmap.clearOverLays();
+				} catch (error) {
+					//TODO handle the exception
+				}
 			},
 			getLocation() {
 				var lo = new T.Geolocation();
-				console.log('获取定位', lo)
-				const fn = (e) => {
-					console.log('eeeeeeeeeeeeeeeeeeee', e)
-					// if (this.getStatus() == 0) {
-					// 	map.centerAndZoom(e.lnglat, 15)
-					// 	alert("获取定位坐标:" + e.lnglat.lat + "," + e.lnglat.lng)
-					// 	var marker = new T.Marker(e.lnglat);
-					// 	map.addOverLay(marker);
+				console.log("天地图获取定位 = ", lo, lo.getStatus())
+				try {
 
-					// }
-					// if (this.getStatus() == 1) {
-					// 	map.centerAndZoom(e.lnglat, e.level)
-					// 	alert("获取定位坐标:" + e.lnglat.lat + "," + e.lnglat.lng)
-					// 	var marker = new T.Marker(e.lnglat);
-					// 	map.addOverLay(marker);
-					// }
+					lo.getCurrentPosition((res) => {
+						console.log('获取定位', res)
+
+					});
+				} catch (error) {
+					//TODO handle the exception
+					console.log("天地图获取定位 = error ", error)
 				}
-				lo.getCurrentPosition(fn);
 				// if (this.getStatus() == 0) {
 				// 	map.centerAndZoom(e.lnglat, 15)
 				// 	alert("获取定位坐标:" + e.lnglat.lat + "," + e.lnglat.lng)
@@ -284,8 +345,9 @@
 				// 	map.addOverLay(marker);
 				// }
 			},
-			SelectedDot(lng, lat) {
-				Tmap.panTo(new T.LngLat(lng, lat), 16); // 移动到选中的点位
+			SelectedDot(res) {
+				const { longitude, latitude } = res;
+				Tmap.panTo(new T.LngLat(longitude, latitude), 16); // 移动到选中的点位
 			}
 		},
 	}
@@ -299,7 +361,7 @@
 	.position {
 		position: fixed;
 		right: 30rpx;
-		bottom: 50vh;
+		bottom: 40vh;
 		z-index: 1000;
 		width: 80rpx;
 		height: 80rpx;

+ 10 - 1
config/index.js

@@ -1,4 +1,13 @@
 export default {
 	baseURL: "https://ditu.qqzzhou.com/oa",
-	// baseURL: "http://192.168.0.152:8282" 
+	// baseURL: "http://192.168.0.152:8282", 
+	
+	
+	
+	
+	// 高德
+	key:'f4226f3eb5a974d153652665b64b497c',
+	secretKey:'a9557f94a84a95b515bec96c3bed93f1',
+	// 天地图
+	tianKey:'1edd9c001a8425cb93631398109d5ab2'
 }

+ 80 - 43
pages/map/index.vue

@@ -1,16 +1,18 @@
 <template>
 	<view class="map-box">
-
 		<search ref="searchRef" @handleSearch="handleSearch" v-if="showMap" />
-		<tiandituMap ref="tiandituMapRefs" @handleSearch="handleSearch" @clickMap="handleClickMap" @moveMap="moveMapSearch"
-			@onLoadTianDiTu="initMaps" @onSelect="selectPoint" :apiKey="apiKey">
+		
+		<tiandituMap ref="tiandituMapRefs" @handleSearch="$refs.searchRef.handleSearch()" @clickMap="handleClickMap"
+			@moveMap="moveMapSearch" @onLoadTianDiTu="initMaps" @onSelect="selectPoint" :apiKey="apiKey"
+			@handleMapSite="handleMapSite">
 		</tiandituMap>
+		
 		<bab-Touchbox ref="TouchboxRef" v-if="showMap && siteListArr && siteListArr.length > 0" :zIndex="1001"
 			:minHeight="0.35" :maxHeight="0.8" :touchHeight="64" @currentHeight="setTouchHeight"
 			@maxtHeight="setScrollMaxHeight">
 			<scroll-view :style="{'height':TouchHeight - 40  +'px' }" scroll-y="true" :show-scrollbar="false">
 				<template v-for="item in siteListArr">
-					<siteListModel :info="item" />
+					<siteListModel :info="item" @checkSiteDetails="checkSiteDetails" />
 				</template>
 			</scroll-view>
 		</bab-Touchbox>
@@ -23,8 +25,10 @@
 	import search from "./model/search.vue"
 	import siteListModel from "./model/siteList.vue";
 	import { getMapCenterPoint_Api, getMapList_Api } from "@/api/map.js"
-	import { getLocation } from "@/utils/tool.js"
 	import siteDetails from "./model/siteDetails.vue"
+	import $config from "@/config/index.js"
+	import { EventBus } from "@/utils/vueBus.js"
+	import { getLocation } from "@/utils/tool.js"
 	export default {
 		name: 'tdtmap',
 		components: {
@@ -34,12 +38,10 @@
 		},
 		data() {
 			return {
-				selfLatitude: undefined,
-				selfLongitude: undefined,
 				showMap: false,
 				longitude: undefined,
 				latitude: undefined,
-				apiKey: '1edd9c001a8425cb93631398109d5ab2',
+				apiKey: $config.tianKey,
 				winWidth: 0,
 				winHeight: 0,
 				winTop: 0,
@@ -49,48 +51,43 @@
 				// domMinHeight: '0vh',
 				selectItem: {},
 				iStatusBarHeight: 0,
-				option: {
-					apikey: '123123',
-				},
+				 
 
 				siteListArr: [],
 				TouchHeight: 0,
 			}
 		},
 		created() {
-			console.log('获取位置失败 22211---------------');
+			getLocation();
+	 
+			this.getMapCenterPoint()
+		},
+		mounted() {
+			this.disableScroll()
+		},
+		beforeDestroy() {
 			try {
-				navigator.geolocation.getCurrentPosition(function(position) {
-					console.log("Latitude is :", position.coords.latitude);
-					console.log("Longitude is :", position.coords.longitude);
-				}, function(error) {
-					console.error("Error Code = " + error.code + " - " + error.message);
+				document.removeEventListener('touchmove');
+				document.body.removeEventListener('mousewheel');
+				document.body.removeEventListener('DOMMouseScroll');
+				document.removeEventListener('onmousewheel', function() {
+					window.event.returnValue = false;
 				});
 			} catch (error) {
 				//TODO handle the exception
-				console.log('获取位置失败 999999999999 ---------------', error);
 			}
-			console.log('获取位置失败 22233---------------');
-			this.getMapCenterPoint()
-		},
-		mounted() {
-
-			getLocation().then(res => {
-				this.selfLatitude = res.longitude;
-				this.selfLongitude = res.latitude;
-			})
 		},
 		watch: {
 			siteListArr: {
 				handler(newArr) {
-					console.log('newArr === ' , newArr)
 					try {
 						this.$refs.tiandituMapRefs.clearIcon();
 					} catch (error) {}
 					this.$nextTick(() => {
-						(newArr || []).forEach(el => {
+						(newArr || []).forEach((el, index) => {
 							const { longitude, latitude, mapTypeIcon } = el
-							this.$refs.tiandituMapRefs.setIcon(longitude, latitude, false, mapTypeIcon);
+							this.$refs.tiandituMapRefs.setIcon(longitude, latitude, false, mapTypeIcon,
+								el);
 						})
 					})
 				},
@@ -98,12 +95,44 @@
 			}
 		},
 		methods: {
+			disableScroll() {
+				if (typeof window.addEventListener === 'function') {
+					document.addEventListener('touchmove', function(e) {
+						e.preventDefault();
+					}, { passive: false });
+					document.body.addEventListener('mousewheel', function(e) {
+						e.preventDefault();
+					});
+					document.body.addEventListener('DOMMouseScroll', function(e) {
+						e.preventDefault();
+					});
+				} else {
+					document.attachEvent('onmousewheel', function() {
+						window.event.returnValue = false;
+					});
+				}
+			},
 			// 点击地图
 			handleClickMap() {
 				if (this.$refs.TouchboxRef) {
 					this.$refs.TouchboxRef.concealList()
 				}
 			},
+			// 点击地图标注点位
+			handleMapSite(parmas = {}) {
+				const { Lng, Lat } = parmas;
+				const item = (this.siteListArr || []).find(el => el.longitude == Lng && el.latitude == Lat);
+				this.checkSiteDetails(item)
+			},
+			// 查看点位详情
+			checkSiteDetails(info) {
+				if (info) {
+					this.$refs.tiandituMapRefs.Trenderjs.SelectedDot(info)
+					// EventBus.$emit('TianDiTuSite', info)
+					this.handleClickMap();
+					this.$refs.siteDetailsRef.openDetails(info)
+				}
+			},
 			// 获取地图中心点
 			getMapCenterPoint() {
 				uni.showLoading()
@@ -112,10 +141,7 @@
 					const { longitude, latitude, mapTypeIcon } = res || {};
 					this.longitude = longitude;
 					this.latitude = latitude;
-					this.open(longitude, latitude, mapTypeIcon)
-					// this.$nextTick(() => {
-					// 	this.handleSearch()
-					// })
+					this.open(longitude, latitude, mapTypeIcon);
 				}).catch(err => { this.open(null, null) }).finally(() => {
 					uni.hideLoading()
 				})
@@ -124,7 +150,7 @@
 				const { Lng, Lat } = parms;
 				this.longitude = Lng;
 				this.latitude = Lat;
-				this.$refs.searchRef.onSearchFocus()
+				this.$refs.searchRef.handleSearch()
 				// console.log("moveMapSearch", Lng, Lat)
 			},
 			handleSearch(val = {}) {
@@ -132,14 +158,12 @@
 					...val,
 					longitude: this.longitude,
 					latitude: this.latitude,
-					radius: 5000,
-					selfLatitude: this.selfLatitude,
-					selfLongitude: this.selfLongitude
+					radius: 5000
 				};
 				getMapList_Api(parms).then(res => {
 					if (!res || res.length === 0) {
 						uni.showToast({
-							title: "当前区域无服务",
+							title: "当前区域无办理点位",
 							icon: 'none'
 						})
 					}
@@ -147,9 +171,18 @@
 				}).catch(err => {
 					this.siteListArr = [];
 				})
-			},
-
-
+				// if (!this.selfLatitude || !this.selfLongitude) {
+				// 	getLocation().then(res => {
+				// 		this.selfLatitude = res.longitude;
+				// 		this.selfLongitude = res.latitude;
+				// 		this.onSearch(val)
+				// 	}).catch(err => {
+				// 		this.onSearch(val)
+				// 	})
+				// } else {
+				// 	this.onSearch(val)
+				// };
+			}, 
 
 			open(lon, lat, mapTypeIcon) {
 				if (lon && lat) {
@@ -309,7 +342,11 @@
 	.map-box {
 		width: 100vw;
 		height: 100vh;
-
+		/* 		position: fixed;
+		left: 0;
+		top:0;
+		right: 0;
+		bottom: 0; */
 	}
 
 

+ 71 - 15
pages/map/model/search.vue

@@ -10,8 +10,7 @@
 					</path>
 				</svg>
 				<input confirm-type="search" ref="searchInputRef" class="search-input" :auto-blur="true" type="text"
-					placeholder="请输入关键字" v-model="searchKey"  @blur="onSearchBlur()"
-					@confirm="onSearchFocus()" />
+					placeholder="请输入关键字" v-model="locationName" @blur="onSearchFocus()" />
 			</view>
 			<view class="search-select">
 				<view class="select-item" @click.stop="$refs.cityRef.open()">
@@ -34,12 +33,19 @@
 
 <script>
 	import { getMapList_Api } from "@/api/map.js"
+	import { EventBus } from "@/utils/vueBus.js"
+	import { getLocation } from "@/utils/tool.js"
 	export default {
-		data() { 
+		data() {
 			return {
-				searchKey: undefined,
+				locationPower: true,
+				locationName: undefined,
+				selfLatitude: undefined,
+				selfLongitude: undefined,
 
 				params: {
+					// selfLatitude: 30.482926,
+					// selfLongitude: 114.414431,
 					code: undefined,
 					codeLabel: undefined,
 
@@ -48,25 +54,75 @@
 				}
 			}
 		},
+		mounted() {
+			EventBus.$on('TianDiTuSearch', (callBack) => {
+				this.handleSearch(callBack)
+			}); // 确保在组件销毁前移除事件监听
+		},
+		beforeDestroy() {
+			EventBus.$off("TianDiTuSearch")
+		},
 		methods: {
 			init() {
 
 			},
-			onSearchBlur(){},
+			/**
+			 * 获取定位
+			 * 有callBack,着是手动定位,地图会平移调用搜索,所以无需再次搜索
+			 * 没有callBack,则需要手动收索
+			 * 
+			 */
+			handleSearch(callBack) {
+				try {
+					if (!callBack && !this.locationPower) {
+						this.onSearchFocus()
+						return
+					}
+					uni.showLoading({
+						mask: true
+					})
+					this.locationPower = true;
+					getLocation().then(res => {
+						const { longitude, latitude } = res || {}
+						if (longitude && latitude) {
+							this.selfLatitude = longitude;
+							this.selfLongitude = latitude;
+						}
+						callBack && callBack({ longitude: res.longitude, latitude: res.latitude })
+					}).catch(err => {
+						this.locationPower = false
+						uni.showToast({
+							title: '获取定位失败',
+							icon: 'none'
+						})
+					}).finally(() => {
+						if (!callBack) this.onSearchFocus()
+						uni.hideLoading()
+					})
+				} catch (error) {
+					console.log(999977999, error)
+					//TODO handle the exception
+				}
+			},
 			onSearchFocus() {
 				let pms = {};
-				if(this.params.code ){
-					pms.provinceCode = this.params.code[0] || undefined
-					pms.cityCode = this.params.code[1] || undefined
-					pms.areaCode = this.params.code[2] || undefined
+				try {
+					if (this.params.code) {
+						pms.areaCode = this.params.code || undefined
+					}
+					pms.mapTypeId = this.params.mapTypeId;
+					pms.selfLatitude = this.selfLatitude;
+					pms.selfLongitude = this.selfLongitude;
+					pms.locationName = this.locationName;
+				} catch (error) {
+					console.log("定位收索11 error", error)
+					//TODO handle the exception
 				}
-				pms.mapTypeId = this.params.mapTypeId;
-				pms.searchKey = this.searchKey; 
-				this.$emit("handleSearch" , pms)
+				this.$emit("handleSearch", pms)
 			},
-			getVal(){
+			getVal() {
 				return {
-					
+
 				}
 			},
 			getMapList() {
@@ -76,7 +132,7 @@
 		watch: {
 			params: {
 				handler(newV, oldV) {
-					this.onSearchFocus()
+					this.handleSearch()
 				},
 				deep: true
 			}

+ 21 - 20
pages/map/model/siteDetails.vue

@@ -9,7 +9,7 @@
 					</view>
 					<view class="site-distance">距离{{getDistance(info.distance)}}</view>
 					<view class="site-time">
-						<text>办公时间</text>
+						<text class="time-lable">办公时间</text>
 						<text class="site-time-val">{{info.workTimeRemark}}</text>
 					</view>
 				</template>
@@ -41,7 +41,7 @@
 </template>
 
 <script>
-	import { EventBus } from "@/utils/vueBus.js"
+	// import { EventBus } from "@/utils/vueBus.js"
 	import { openMap } from "@/utils/openApp.js"
 	import { distanceCalculate, PhoneCall } from "@/utils/tool.js";
 	export default {
@@ -56,13 +56,13 @@
 			this.scrollH = windowHeight * 0.7 - uni.upx2px(150)
 		},
 		mounted() {
-			EventBus.$on('TianDiTuSite', (res) => {
-				const { longitude, latitude } = res;
-				this.openDetails(res);
-			});
+			// EventBus.$on('TianDiTuSite', (res) => {
+			// 	const { longitude, latitude } = res;
+			// 	this.openDetails(res);
+			// });
 		},
 		beforeDestroy() {
-			EventBus.$off('someEvent'); // 确保在组件销毁前移除事件监听
+			// EventBus.$off('someEvent'); // 确保在组件销毁前移除事件监听
 		},
 		methods: {
 			getDistance(num) {
@@ -78,8 +78,7 @@
 
 				openMap({ name, code: code, type: "baidu" })
 			},
-			openDetails(res) {
-				console.log("res = ", res)
+			openDetails(res) { 
 				this.info = res;
 				this.$refs.siteDetailsPopupRef.open()
 			}
@@ -98,18 +97,20 @@
 			border-radius: 20rpx 20rpx 0 0;
 
 			.site-name {
-				font-size: 30rpx;
+				font-size: 36rpx;
 				padding-top: 30rpx;
-				padding-bottom: 5rpx;
+				padding-bottom: 15rpx;
 			}
 
 			.site-location,
 			.site-distance {
 				padding-top: 10rpx;
-				color: #8e8c8c;
+				// color: #8e8c8c;
 				font-size: 28rpx;
 			}
-
+			.site-distance{
+				color: #7D7D7D;
+			}
 			.site-time {
 				margin-top: 15rpx;
 				background-color: #fff;
@@ -117,13 +118,14 @@
 				padding: 15rpx 0;
 				display: flex;
 				justify-content: space-between;
-				font-size: 28rpx;
-				color: #7D7D7D;
+				font-size: 28rpx; 
 
 				text {
 					flex-shrink: 0;
 				}
-
+				.time-lable{
+					color: #7D7D7D;
+				}
 				.site-time-val {
 					width: 1rpx;
 					flex: 1;
@@ -147,10 +149,9 @@
 					display: flex;
 					justify-content: center;
 					align-items: center;
-					color: #000;
-					border: 1rpx solid #BBBBBB;
+					color: #fff; 
 					border-radius: 10rpx;
-
+					background-color: #3291F8;
 					&+.site-btn {
 						margin-left: 50rpx;
 					}
@@ -160,7 +161,7 @@
 						height: 50rpx;
 
 						path {
-							fill: #3291F8;
+							fill: #fff;
 						}
 					}
 

+ 9 - 7
pages/map/model/siteList.vue

@@ -34,7 +34,7 @@
 			</view>
 		</view>
 		<view class="site-time">
-			<text>办公时间</text>
+			<text class="time-lable">办公时间</text>
 			<text class="site-time-val">{{info.workTimeRemark}}</text>
 		</view>
 	</view>
@@ -75,7 +75,8 @@
 				openMap({ name, code: code, type: "baidu" })
 			},
 			openSite(info) {
-				EventBus.$emit('TianDiTuSite', info)
+				this.$emit('checkSiteDetails',info)
+				// EventBus.$emit('TianDiTuSite', info)
 			}
 		}
 	}
@@ -90,8 +91,8 @@
 		// background-color: #ccc;
 		.site-name {
 			padding-top: 30rpx;
-			font-size: 30rpx;
-			padding-bottom: 5rpx;
+			font-size: 36rpx;
+			padding-bottom: 15rpx;
 			background-color: #fff;
 		}
 
@@ -100,7 +101,7 @@
 			display: flex;
 			justify-content: space-between;
 			align-items: center;
-			color: #8e8c8c;
+		
 
 			.site-left {
 				width: 1px;
@@ -156,12 +157,13 @@
 			display: flex;
 			justify-content: space-between;
 			font-size: 28rpx;
-			color: #7D7D7D;
 
 			text {
 				flex-shrink: 0;
 			}
-
+			.time-lable{
+				color: #7D7D7D;
+			}
 			.site-time-val {
 				width: 1rpx;
 				flex: 1;

+ 3 - 2
utils/LonLatConvert.js

@@ -1,14 +1,15 @@
 import AMapLoader from '@amap/amap-jsapi-loader';
+import $config from "@/config/index.js"
 
 export const getCoord = (parmas) => {
 	return new Promise((reslove, reject) => {
 		const { name, code, type } = parmas;
 		window._AMapSecurityConfig = {
-			securityJsCode: "a9557f94a84a95b515bec96c3bed93f1",
+			securityJsCode: $config.secretKey,
 		};
 		// 配置高德API的key
 		AMapLoader.load({
-				"key": "f4226f3eb5a974d153652665b64b497c",
+				"key":  $config.key,
 				"version": "2.0",
 				"plugins": []
 			})

+ 1 - 1
utils/tool.js

@@ -44,7 +44,7 @@ export const getLocation = () => {
 			uni.getLocation({
 				type: 'wgs84', // 返回可以用于uni.openLocation的经纬度
 				success: (res) => {
-					console.log("getLocation = " , res)
+					console.log("getLocation 1111111111111111111= " , res)
 					// this.selfLatitude = res.longitude;
 					// this.selfLongitude = res.latitude;
 					resolve(res)