Bladeren bron

地图顾问位置点击优化

xhj 2 jaren geleden
bovenliggende
commit
a06a0afb05
1 gewijzigde bestanden met toevoegingen van 26 en 18 verwijderingen
  1. 26 18
      card/cardFound/cardFound.vue

+ 26 - 18
card/cardFound/cardFound.vue

@@ -167,6 +167,7 @@ export default {
 		async clickMap(e){
 			console.log('e==',e.detail)
 			let markerId = e.detail.markerId
+			let oldIndex = this.covers.findIndex(item=>item.did==this.cabInfo.id)
 			let index = this.covers.findIndex(item=>item.id==markerId)
 			// if(this.markerId == this.covers[markerId-1].column && this.markerId != 0) return false;
 			this.cabBottom = '-100%';
@@ -178,21 +179,27 @@ export default {
 				
 				for(let i=0;i<this.covers.length;i++){
 					let it = this.covers[i]
-					let markerLogo = await this.getMarkerLogo(it.logo,it.id==markerId?2:null)
-					let obj = {
-						latitude: it.latitude,
-						longitude: it.longitude,
-						width: 80,
-						height: 92,
-						logo:it.logo,
-						id:it.id,
-						// iconPath: '/static/images/jg_map_ico.png',
-						// 'https://img.zhiqiyun.com/test/2023/07/27/ec50eeee1ab3358d9ba397c86ae8fcc6.jpeg'
-						iconPath: markerLogo//显示的图标     
-						// radius: it.column_4[0].radius,//检索的半径,单位为米
-						// joinCluster: true
+					if(i == index || i == oldIndex){
+						console.log('i 当前转换的下标',i,index,oldIndex,it.id==markerId)
+						let markerLogo = await this.getMarkerLogo(it.logo,it.id==markerId?2:null)
+						let obj = {
+							latitude: it.latitude,
+							longitude: it.longitude,
+							width: 80,
+							height: 92,
+							logo:it.logo,
+							id:it.id,
+							did:it.did,
+							// iconPath: '/static/images/jg_map_ico.png',
+							// 'https://img.zhiqiyun.com/test/2023/07/27/ec50eeee1ab3358d9ba397c86ae8fcc6.jpeg'
+							iconPath: markerLogo//显示的图标     
+							// radius: it.column_4[0].radius,//检索的半径,单位为米
+							// joinCluster: true
+						}
+						covers.push(obj)
+					}else{
+						covers.push(it)
 					}
-					covers.push(obj)
 				}
 			}
 			this.covers = JSON.parse(JSON.stringify(covers))
@@ -231,7 +238,7 @@ export default {
 				latitude: this.latitude,
 				longitude: this.longitude,
 				page:1,
-				limit:30
+				limit:10
 				// distance: 2000
 			}
 			return new Promise(async(resolve,reject)=>{
@@ -255,6 +262,7 @@ export default {
 							let markerLogo = await this.getMarkerLogo(it.logo)
 							let obj = {
 								id:i+1,
+								did:it.userId,
 								latitude: it.latitude,
 								longitude: it.longitude,
 								width: 80,
@@ -340,7 +348,7 @@ export default {
 				return new Promise(async(re,rj)=>{
 					let mapBgUrl = 'https://img.zhiqiyun.com/test/2023/07/27/2d30f06817365b83a5f78c455fce8974.png'
 					if(type&&type==2) mapBgUrl = 'https://img.zhiqiyun.com/test/2023/07/27/ad0bfade8dcffa6b20c045a53945dea3.png'
-					console.log('mapBgUrl',mapBgUrl)
+					// console.log('mapBgUrl',mapBgUrl)
 					const avatarp = this.getImageInfo(url); // 获取小程序码图
 					const mapBg = this.getImageInfo(mapBgUrl); // 获取小程序码图
 					Promise.all([avatarp,mapBg]).then(([avatar,mapIcon]) => {
@@ -362,7 +370,7 @@ export default {
 						uni.canvasToTempFilePath({
 							canvasId: 'logoIcon',
 							success: function(res) {
-								console.log('ctx.draw',res.tempFilePath)
+								// console.log('ctx.draw',res.tempFilePath)
 								that.canvasShow = false
 								re(res.tempFilePath)
 							},
@@ -376,7 +384,7 @@ export default {
 				})
 			},
 			getImageInfo(url) {
-				console.log('getImageInfo',url)
+				// console.log('getImageInfo',url)
 				return new Promise((resolve, reject) => {
 					if (!url) {
 						resolve();