Compare commits

..

No commits in common. "0b9bda229f04bb61106da2d2aa95bcb6870459cc" and "a220fbb1ef55c2816e5221350e5547ad923ee53a" have entirely different histories.

View File

@ -34,13 +34,13 @@
} }
.top-panel-number { .top-panel-number {
/* line-height: 60px; */ /* line-height: 60px; // 删除或注释掉这一行 */
font-size: 30px; font-size: 30px;
border-right: 1px solid #eceff9; border-right: 1px solid #eceff9;
height: 100%; height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center; /* 可选:让数字水平居中 */
} }
.top-panel-tips{ .top-panel-tips{
line-height:30px; line-height:30px;
@ -153,7 +153,7 @@
<body> <body>
<div class="layuimini-main"> <div class="layuimini-main">
<div class="layui-row layui-col-space30 flex-row" style="margin-bottom: 1em;"> <div class="layui-row layui-col-space30 flex-row" style="margin-bottom: 2em;">
<div class="layui-col-xs12 layui-col-md6"> <div class="layui-col-xs12 layui-col-md6">
<div class="layui-card top-panel stats-panel"> <div class="layui-card top-panel stats-panel">
<div class="layui-card-header">设备数量</div> <div class="layui-card-header">设备数量</div>
@ -399,19 +399,24 @@
currentBaseLayer = mapLayers[mapType]; currentBaseLayer = mapLayers[mapType];
map.getLayers().insertAt(0, currentBaseLayer); map.getLayers().insertAt(0, currentBaseLayer);
// 更新我的位置标记,使用正确的坐标系
updateMyLocationForMapType(mapType); updateMyLocationForMapType(mapType);
// 更新设备标记
addDeviceMarkers(); addDeviceMarkers();
} }
// 根据地图类型更新我的位置标记 // 根据地图类型更新我的位置标记
function updateMyLocationForMapType(mapType) { function updateMyLocationForMapType(mapType) {
if (myLocationFeature) { if (myLocationFeature) {
// 获取原始坐标
var originalCoords = myLocationFeature.get('originalCoords'); var originalCoords = myLocationFeature.get('originalCoords');
if (originalCoords) { if (originalCoords) {
var lat = originalCoords.lat; var lat = originalCoords.lat;
var lon = originalCoords.lon; var lon = originalCoords.lon;
var coordinates; var coordinates;
// 根据地图类型进行坐标转换
if (mapType === 'amap' || mapType === 'amap_satellite') { if (mapType === 'amap' || mapType === 'amap_satellite') {
// 高德地图使用GCJ-02坐标系需要转换 // 高德地图使用GCJ-02坐标系需要转换
var gcjCoord = transform(lat, lon); var gcjCoord = transform(lat, lon);
@ -421,14 +426,17 @@
coordinates = ol.proj.fromLonLat([lon, lat]); coordinates = ol.proj.fromLonLat([lon, lat]);
} }
// 更新位置标记的几何坐标
myLocationFeature.getGeometry().setCoordinates(coordinates); myLocationFeature.getGeometry().setCoordinates(coordinates);
} }
} }
} }
function addDeviceMarkers() { function addDeviceMarkers() {
// 保存我的位置标记
var savedMyLocationFeature = myLocationFeature; var savedMyLocationFeature = myLocationFeature;
// 清除现有标记
vectorSource.clear(); vectorSource.clear();
greenFeatures = []; greenFeatures = [];
orangeFeatures = []; orangeFeatures = [];