Skip to content

Commit

Permalink
fix: map locate popup logic
Browse files Browse the repository at this point in the history
  • Loading branch information
lastsunday committed Jul 18, 2024
1 parent 45fdd6d commit 15a5fe4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

1. (SidePanel)添加讨论区板块,根据省市区区分。

### 🐛 Fixed

1. (SidePanel)修复地图模式下的定位,气泡开启逻辑。

## 1.18.0(2024-07-16)

### ⭐ Added
Expand Down
6 changes: 4 additions & 2 deletions src/sidepanel/views/CompanyView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ const reset = async () => {
};
const search = async () => {
if (mapMode && mapSearchMode) {
if (mapMode.value && mapSearchMode.value) {
map.value.leafletObject.closePopup();
}
let searchResult = await CompanyApi.searchCompany(getSearchParam());
Expand Down Expand Up @@ -743,7 +743,9 @@ const mapSearchMode = ref(false);
watch(mapSearchMode, async (newValue, oldValue) => {
if (newValue) {
map.value.leafletObject.on("moveend", async (event) => {
await search();
if (mapMode.value && mapSearchMode.value) {
await search();
}
});
await search();
} else {
Expand Down
9 changes: 4 additions & 5 deletions src/sidepanel/views/JobView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ const reset = async () => {
};
const search = async () => {
if (mapMode && mapSearchMode) {
if (mapMode.value && mapSearchMode.value) {
map.value.leafletObject.closePopup();
}
let searchResult = await JobApi.searchJob(getSearchParam());
Expand Down Expand Up @@ -706,9 +706,6 @@ watch(mapMode, async (newValue, oldValue) => {
if (newValue) {
nextTick(() => {
map.value.leafletObject.invalidateSize();
map.value.leafletObject.on("moveend", async (event) => {
await search();
});
if (popups.value.length > 0) {
map.value.leafletObject.fitBounds(popups.value.map(item => item.latLng));
} else {
Expand All @@ -731,7 +728,9 @@ const mapSearchMode = ref(false);
watch(mapSearchMode, async (newValue, oldValue) => {
if (newValue) {
map.value.leafletObject.on("moveend", async (event) => {
await search();
if (mapMode.value && mapSearchMode.value) {
await search();
}
});
await search();
} else {
Expand Down

0 comments on commit 15a5fe4

Please sign in to comment.