diff --git a/src/App.vue b/src/App.vue index 061e71ce..f196b8ea 100644 --- a/src/App.vue +++ b/src/App.vue @@ -14,4 +14,8 @@ body, width: 100%; height: 100%; } +.BMap_cpyCtrl, + .anchorBL { + display: none !important; + } diff --git a/src/views/distribution/reservation/atlas1.vue b/src/views/distribution/reservation/atlas1.vue index 800e3aff..c1910a84 100644 --- a/src/views/distribution/reservation/atlas1.vue +++ b/src/views/distribution/reservation/atlas1.vue @@ -1,26 +1,26 @@ @@ -41,46 +41,44 @@ reservationData: [], reservationIds: [], mapLoc: null, + // datalist:[] }); - onMounted(() => { + onMounted(()=>{ + initmap() + }) + watchEffect(()=>{ details.item = JSON.parse(router.currentRoute.value.query.item); selectStockArticleAtlasInfo(details.item.id).then(res => { const data = res.data.data; console.log('res------------->', data); + details.reservationData=data setTimeout(() => { init(data); }, 1500); }); - // setTimeout(()=>{ - // details.mapLoc.clearOverlays(); - - // },9500) - }); - - function init(data) { + }) + function initmap(){ details.mapLoc = new BMapGL.Map('container'); // 创建地图实例 - let point = new BMapGL.Point(116.404, 39.915); // 创建点坐标 details.mapLoc.centerAndZoom(point, 12); details.mapLoc.enableScrollWheelZoom(true); + } + function init(data) { + // maplabel() - if (details.mapLoc) { - details.mapLoc.clearOverlays(); //清除地图的label + if (details?.mapLoc) { + details?.mapLoc.clearOverlays(); //清除地图的label } - let a = data; - a.forEach((item,index)=>{ - console.log('item------------->', item); + data.map((item,index)=>{ maplabel(item.customerAddress, item.customerName+"--"+item.customerAddress+"--"+item.customerTelephone, index); - // maplabel('中国四川省成都市简阳市石桥镇简阳市石桥镇红星美凯龙雄州商场-1-26-154', '周娅', 0); }) - // maplabel('四川成都龙泉驿区','展示的内容', 0); } function maplabel(address,contents, index) { let myGeo = new BMapGL.Geocoder(); myGeo.getPoint(address, function (point) { if (point) { - console.log(point, '---------------'); + // console.log(point, '---------------'); if (index == 0) { details.mapLoc.centerAndZoom(point, 12); } @@ -99,10 +97,10 @@ borderRadius: '20px', padding: '5px 10px', }); - console.log(label, '---------------'); + // console.log(label, '---------------'); } else { // alert('您选择的地址没有解析到结果!'); - console.log(point); + // console.log(point); console.log('您选择的地址没有解析到结果!'); } }); @@ -115,8 +113,9 @@