From 356ea218473cec82668490a2641d1d6712686c1a Mon Sep 17 00:00:00 2001 From: air <30444667+sszdot@users.noreply.github.com> Date: Mon, 23 Jun 2025 21:13:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=20=20=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afeat=20=E3=80=90=E5=8E=9F=20=20=E5=9B=A0=E3=80=91?= =?UTF-8?q?=EF=BC=9A=E9=A3=9E=E6=9C=BA=E5=9C=A8poprp=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E6=A1=86=20=E5=AE=9E=E6=97=B6=E6=98=BE=E7=A4=BA=E9=A3=9E?= =?UTF-8?q?=E6=9C=BA=E7=8A=B6=E6=80=81=20=20=E5=8C=85=E6=8B=AC=E9=9B=86?= =?UTF-8?q?=E7=BE=A4=E6=8E=A7=E5=88=B6=20=20=E5=92=8C=20=20=E6=A6=82?= =?UTF-8?q?=E5=BF=B5=E9=A1=B5=E9=9D=A2=20=E3=80=90=E8=BF=87=20=20=E7=A8=8B?= =?UTF-8?q?=E3=80=91=EF=BC=9A=20=E3=80=90=E5=BD=B1=20=20=E5=93=8D=E3=80=91?= =?UTF-8?q?=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- .gitignore | 1 + src/components/MapBox.vue | 120 ++++++++- src/components/PlaneStatus.vue | 25 +- src/components/Statistics.vue | 2 +- src/components/SwarmStatus.vue | 254 ------------------ .../layout/components/main/home/index.vue | 14 + src/views/layout/components/main/home/set.vue | 10 +- .../layout/components/main/planes/index.vue | 20 ++ .../layout/components/main/planes/swarm.vue | 31 ++- 9 files changed, 191 insertions(+), 286 deletions(-) delete mode 100644 src/components/SwarmStatus.vue diff --git a/.gitignore b/.gitignore index 57494a3..bf3ef72 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /dist /package-lock.json /src/components/statistics.vue +/src/components/SwarmStatus.vue diff --git a/src/components/MapBox.vue b/src/components/MapBox.vue index db225a7..2ed2b08 100644 --- a/src/components/MapBox.vue +++ b/src/components/MapBox.vue @@ -882,19 +882,30 @@ export default { */ makePlane (plane, index = 0) { const customIcon = document.createElement('div') - customIcon.className = 'custom-marker' // 添加自定义样式类名 - customIcon.style.backgroundImage = `url(${planeIcon})` // 使用引入的 SVG 图标 - customIcon.style.width = '64px' // 图标宽度 - customIcon.style.height = '64px' // 图标高度 - // 创建一个marker对象 - this.planes[index] = new mapboxgl.Marker(customIcon) + customIcon.className = 'custom-marker' + customIcon.style.backgroundImage = `url(${planeIcon})` + customIcon.style.width = '64px' + customIcon.style.height = '64px' + + const marker = new mapboxgl.Marker(customIcon) .setLngLat([plane.lon, plane.lat]) - .setPopup( - new mapboxgl.Popup({ offset: 25 }).setHTML( - '
macID:' + plane.macadd + '
' - ) - ) // 添加弹出窗口 .addTo(this.map) + + // 创建popup,但不绑定到marker,手动控制显示 + const popup = new mapboxgl.Popup({ + offset: 25, + closeButton: true, + closeOnClick: true + }).setHTML(`心跳:
+解锁状态: + + ${stateObj.isUnlock ? '已解锁' : '未解锁'} + +
+模式: ${stateObj.getPlaneMode ?? '未知'}
+定位状态: ${stateObj.fixType ?? '--'}
+卫星颗数: ${stateObj.satCount ?? '--'}
+电压: ${stateObj.voltagBattery ?? '--'} V
+电流: ${stateObj.currentBattery ?? '--'} A
+高度: ${lastPos[2] ?? '--'} 米
+纬度: ${lastPos[0] ?? '--'}°
+经度: ${lastPos[1] ?? '--'}°
+对地速度: ${stateObj.groundSpeed ?? '--'} 米/秒
+ ` + + const popup = plane.getPopup() + if (popup) { + popup.setHTML(popupContent) + } + }, /** * @description: 镜头跳转 * @param {obj} lonLat {lon:lon,lat:lat} 经纬度 @@ -1047,4 +1122,27 @@ export default { .adsb-icon { will-change: transform; } + +/*飞机popup 心跳图标样式*/ +@keyframes heartbeat { + 0%, 100% { transform: scale(1); } + 50% { transform: scale(1.3); } +} + +.heart-icon { + display: inline-block; + width: 16px; + height: 16px; + margin-left: 5px; + border-radius: 50%; +} + +.heart-online { + background-color: green; + animation: heartbeat 1s infinite; +} + +.heart-offline { + background-color: gray; +} diff --git a/src/components/PlaneStatus.vue b/src/components/PlaneStatus.vue index aca87cd..7392a2f 100644 --- a/src/components/PlaneStatus.vue +++ b/src/components/PlaneStatus.vue @@ -2,11 +2,7 @@