diff --git a/src/views/mediaMap/index.vue b/src/views/mediaMap/index.vue index 0112cbf..043c9b0 100644 --- a/src/views/mediaMap/index.vue +++ b/src/views/mediaMap/index.vue @@ -5,9 +5,9 @@ - @@ -57,6 +57,8 @@ const { proxy } = getCurrentInstance() const { apiKey, secretKey } = window._CONFIG +// 中心点名称 +const centerPointName = ref(null) // map实例 const mapInstance = ref(null) const massMarks = ref(null) @@ -92,7 +94,7 @@ const points = ref([]) const data = reactive({ queryParams: { - keyword: undefined, + keyword: undefined, // 媒体名称关键字 x: undefined, //中心点经度 y: undefined, //中心点纬度 distance: undefined, @@ -103,7 +105,7 @@ const { queryParams } = toRefs(data) /** 清除条件操作 */ const resetQuery = () => { queryParams.value = { - keyword: undefined, + keyword: undefined, // 媒体名称关键字 x: undefined, //中心点经度 y: undefined, //中心点纬度 distance: undefined, @@ -152,7 +154,8 @@ const getLocaleListList = (searchValue) => { const currentSelect = (val) => { console.log('val', val) selectConfig.value = val - queryParams.value.keyword = val.name + centerPointName.value = val.name + // queryParams.value.keyword = val.name queryParams.value.x = val.location.lng queryParams.value.y = val.location.lat queryParams.value.distance = circleRadius.value diff --git a/src/views/outdoorMedia/index.vue b/src/views/outdoorMedia/index.vue index 55f65c8..c7704e3 100644 --- a/src/views/outdoorMedia/index.vue +++ b/src/views/outdoorMedia/index.vue @@ -296,6 +296,9 @@ const getOutMediaPageList = () => { outdoorMediaList.value = res.data.rows total.value = res.data.total loading.value = false + + // 在地图完全加载后执行点数据处理 + renderMassMarks(); }) } /** 搜索按钮操作 */ @@ -382,8 +385,8 @@ const loadMap = () => { // 添加缩放变化监听 mapInstance.value.on('zoomchange', handleZoomChange); - // 在地图完全加载后执行点数据处理 - renderMassMarks(); + //// 在地图完全加载后执行点数据处理 + //renderMassMarks(); resolve(); }).catch(e => { @@ -556,10 +559,11 @@ const renderMassMarks = () => { ]; // 调用接口,获取数据点 points.value = [] - // outdoorMediaList.value.forEach(itemPoint => { - // if (itemPoint.businessType == 1) points.value.push({ "lnglat": [itemPoint.x, itemPoint.y], "name": itemPoint.mediaId, "style": 0 }) - // if (itemPoint.businessType == 2) points.value.push({ "lnglat": [itemPoint.x, itemPoint.y], "name": itemPoint.mediaId, "style": 1 }) - // }); + outdoorMediaList.value.forEach(itemPoint => { + console.log('itemPoint', itemPoint) + if (itemPoint.businessType == 1) points.value.push({ "lnglat": [itemPoint.mapX, itemPoint.mapY], "name": itemPoint.mediaName, "mediaId": itemPoint.id, "style": 0 }) + if (itemPoint.businessType == 2) points.value.push({ "lnglat": [itemPoint.mapX, itemPoint.mapY], "name": itemPoint.mediaName, "mediaId": itemPoint.id, "style": 1 }) + }); console.log('points', points.value) // 创建MassMarks对象 massMarks.value = new AMap.MassMarks(points.value, {