From 534ef3f5e1104cb8f2d835c82c4788cf31d993d8 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 02 Mar 2026 15:43:18 +0800
Subject: [PATCH] feat:更新小程序空域信息搜索
---
applications/mobile-web-view/src/appComponents/LeafletMap/indexWX.vue | 10 ++++++++++
applications/mobile-web-view/src/appPages/AirMap/searchBar.vue | 16 +++++++++++++++-
2 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/applications/mobile-web-view/src/appComponents/LeafletMap/indexWX.vue b/applications/mobile-web-view/src/appComponents/LeafletMap/indexWX.vue
index 60789d8..05745e3 100644
--- a/applications/mobile-web-view/src/appComponents/LeafletMap/indexWX.vue
+++ b/applications/mobile-web-view/src/appComponents/LeafletMap/indexWX.vue
@@ -419,6 +419,10 @@
weight: 0, // 隐藏多边形边框,使用折线作为边框
});
+ polygon.on('click', function(e) {
+ handlePolygonClick(item, e);
+ });
+
// 创建折线(边框)
const polyline = L.polyline([...latLngs, latLngs[0]], { // 闭合多边形
color: item.airspaceType === '0' ? '#00ff06' : '#ff0000',
@@ -434,6 +438,12 @@
});
}
+// 点击事件处理函数
+function handlePolygonClick(item, event) {
+ // 把值返回给父组件
+ EventBus.emit('mapClickAirspace', item)
+}
+
const mapClearMarker = () => {
addressMarkersLayer.clearLayers()
}
diff --git a/applications/mobile-web-view/src/appPages/AirMap/searchBar.vue b/applications/mobile-web-view/src/appPages/AirMap/searchBar.vue
index 81b41af..a400946 100644
--- a/applications/mobile-web-view/src/appPages/AirMap/searchBar.vue
+++ b/applications/mobile-web-view/src/appPages/AirMap/searchBar.vue
@@ -93,7 +93,7 @@
// 使用新接口搜索地址
const searchWithNewAPI = () => {
// 获取微信小程序带过来的头部参数
- console.log(route.query, '9999')
+ // console.log(route.query, '9999')
// 构建请求参数,搜索框为空时不传递airspaceName
const params = {
current: 1,
@@ -166,6 +166,15 @@
getAddressList()
}
+// 获取点击的空域区域
+const getClickAirspace = () => {
+ EventBus.on('mapClickAirspace', item => {
+ searchVal.value = item.taskName
+ height.value = 150
+ searchWithNewAPI()
+ })
+}
+
const flyToAddress = item => {
// if (!item.location) {
// showToast('当前地址无坐标信息')
@@ -193,6 +202,7 @@
watch(
() => route.query,
(newValue, oldValue) => {
+ console.log(newValue, oldValue, '111111')
if (newValue.updateKey) {
height.value = anchors[0]
}
@@ -211,6 +221,10 @@
}
}
getAddressList()
+ getClickAirspace()
+})
+onUnmounted(() => {
+ EventBus.off('mapClickAirspace')
})
</script>
--
Gitblit v1.9.3