diff --git a/src/views/DialogTabs/component/streetscape.vue b/src/views/DialogTabs/component/streetscape.vue index 77d2b28..a01802d 100644 --- a/src/views/DialogTabs/component/streetscape.vue +++ b/src/views/DialogTabs/component/streetscape.vue @@ -17,6 +17,7 @@ panorama: null, poiCircle: null, poiImages: [], + poiData: [], }); // 初始化街景地图 const initePanoramaMap = () => { @@ -39,47 +40,54 @@ method: 'GET', params: { location: `${AllData.poiCircle[1]},${AllData.poiCircle[0]}`, - radius: 500, + radius: 1000, query: '公交站$商场$著名景点$学校', }, }); console.log(poiData, 'poiDatapoiDatapoiData'); if (poiData && poiData.data.length) { - console.log('poiData---', poiData); - poiData.data.forEach(element => { - console.log(element, 'elementelementelement'); - getStreetImg([element.location.lng, element.location.lat]); - console.log(a.value, '111111111----'); + AllData.poiData = poiData.data; + // console.log('poiData---', poiData); + // poiData.data.forEach(element => { + // console.log(element, 'elementelementelement'); + // getStreetImg([element.location.lng, element.location.lat]); + // console.log(a.value, '111111111----'); + // AllData.poiImages.push({ + // name: element.name, + // lonlat: [element.location.lng, element.location.lat], + // imagesUrl: data.data.base64, + // }); + // }); + //console.log('AllData.poiData---', AllData.poiData); + getStreetImg(); + } +}; +const a = ref(''); +//获取全景静态图 +const getStreetImg = async () => { + AllData.poiImages = []; + console.log('AllData.poiData---', AllData.poiData); + AllData.poiData.forEach(async element => { + let data = await request({ + url: `/bdApi//baiduservice/panorama`, + method: 'GET', + params: { + location: `${element.location.lng},${element.location.lat}`, + fov: 180, + height: 256, + width: 512, + }, + }); + if (data && data.data) { + data.data.base64 = 'data:image/jpeg;base64,' + data.data.base64; AllData.poiImages.push({ name: element.name, lonlat: [element.location.lng, element.location.lat], imagesUrl: data.data.base64, }); - }); - console.log('AllData.poiImages---', AllData.poiImages); - } -}; -const a = ref(''); -//获取全景静态图 -const getStreetImg = async lonlat => { - console.log(lonlat, 'lonlatlonlatlonlatlonlat'); - let data = await request({ - url: `/bdApi//baiduservice/panorama`, - method: 'GET', - params: { - location: `${lonlat[0]},${lonlat[1]}`, - fov: 180, - height: 256, - width: 512, - }, + } }); - if (data && data.data) { - console.log(data.data.base64, 'data.data.base64'); - data.data.base64 = 'data:image/jpeg;base64,' + data.data.base64; - a.value = data.data.base64; - console.log(a.value, '22222222-'); - return data.data.base64; - } + console.log('AllData.poiImages---', AllData.poiImages); }; onMounted(() => { initePanoramaMap(); @@ -93,6 +101,7 @@ new BMapGL.Point(position_Street.geometry.coordinates[0], position_Street.geometry.coordinates[1]) ); searchPoiByLonlat(); + //getStreetImg(); gcoord.transform(position_Street, gcoord.BD09, gcoord.WGS84); }); });