From 0b646569a295da41eed5cbbcc80309a7472a47a0 Mon Sep 17 00:00:00 2001 From: ZhuDongming <773644075@qq.com> Date: Wed, 12 Jun 2019 15:30:47 +0800 Subject: [PATCH] 更改上传导包*问题 --- src/main/webapp/js/moralmap.js | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/main/webapp/js/moralmap.js b/src/main/webapp/js/moralmap.js index 5017183..35bb72c 100644 --- a/src/main/webapp/js/moralmap.js +++ b/src/main/webapp/js/moralmap.js @@ -956,17 +956,23 @@ } moralMap.callJS = function(condition) { - var condition = JSON.parse(condition); - var new_point = new BMap.Point(condition.longitude, condition.latitude); - baiduMap.panTo(new_point); - baiduMap.setCenter(new_point); - if (condition.type == "mpoint") { - baiduMap.setZoom(17); - moralMap.openInfoWindow(moralMap.getMpoint(condition.id)["infoWindow"], new_point); - } else if (condition.type == "device") { - baiduMap.setZoom(18); - moralMap.openInfoWindow(moralMap.getEquipment(condition.mac)["infoWindow"], new_point); - } + var new_point = new BMap.Point(condition.longitude, condition.latitude); + baiduMap.panTo(new_point); + baiduMap.setCenter(new_point); + baiduMap.setZoom(condition.type == "mpoint" ? 17 : 18); + var interval = setInterval(function(){ + var marker; + if (condition.type == "mpoint") { + marker = moralMap.getMpoint(condition.id); + } else if (condition.type == "device") { + marker = moralMap.getEquipment(condition.mac); + } + if(marker){ + clearInterval(interval); + moralMap.openInfoWindow(marker["infoWindow"], new_point); + } + }, 50); + } -- Gitblit v1.8.0