From 58a113b34d5880dcad10993d592be98f45c1d9b6 Mon Sep 17 00:00:00 2001 From: francis_fh <13935151924@163.com> Date: Tue, 3 Feb 2026 18:51:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E4=BA=A4=E5=91=A8=E8=BE=B9=E5=9C=B0?= =?UTF-8?q?=E9=93=81=E7=BA=BF=E8=B7=AF=E4=B8=8D=E8=83=BD=E9=80=89=E6=8B=A9?= =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packageA/pages/nearby/components/three.vue | 46 +++++++++++++++++++--- pages/index/components/index-one.vue | 2 +- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/packageA/pages/nearby/components/three.vue b/packageA/pages/nearby/components/three.vue index 1126a62..779c511 100644 --- a/packageA/pages/nearby/components/three.vue +++ b/packageA/pages/nearby/components/three.vue @@ -110,6 +110,10 @@ + + + + @@ -117,7 +121,28 @@ import { reactive, inject, watch, ref, onMounted, onBeforeUnmount } from 'vue'; import { onLoad, onShow } from '@dcloudio/uni-app'; const { $api, navTo, debounce, customSystem } = inject('globalFunction'); -const openSelectPopup = inject('openSelectPopup'); +// #ifdef H5 +const injectedOpenSelectPopup = inject('openSelectPopup', null); +// #endif + +// #ifdef MP-WEIXIN +const selectPopupRef = ref(); +// #endif + +// 创建本地的 openSelectPopup 函数,兼容 H5 和微信小程序 +const openSelectPopup = (config) => { + // #ifdef MP-WEIXIN + if (selectPopupRef.value) { + selectPopupRef.value.open(config); + } + // #endif + + // #ifdef H5 + if (injectedOpenSelectPopup) { + injectedOpenSelectPopup(config); + } + // #endif +}; import { storeToRefs } from 'pinia'; import useLocationStore from '@/stores/useLocationStore'; import useUserStore from '@/stores/useUserStore'; @@ -128,6 +153,9 @@ const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore()); import point2 from '@/static/icon/point2.png'; import LocationPng from '@/static/icon/Location.png'; import selectFilter from '@/components/selectFilter/selectFilter.vue'; +// #ifdef MP-WEIXIN +import selectPopup from '@/components/selectPopup/selectPopup.vue'; +// #endif const emit = defineEmits(['onFilter']); // status const showFiltersubway = ref(false); @@ -205,18 +233,21 @@ function openFilter() { } function openFilterSubway() { + showFiltersubway.value = true; const diti = state.subwayList.map((item) => ({ ...item, label: item.lineName, value: item.lineId })); openSelectPopup({ title: '地铁', maskClick: true, data: [diti], success: (_, [value]) => { + showFiltersubway.value = false; + if (!value) return; subwayCurrent.value = value; state.subwayId = value.value; state.value = value.value; const points = value.subwayStationList; state.downup = true; - if (points.length) { + if (points && points.length) { state.dont = 0; state.dontObj = points[0]; state.subwayStart = points[0]; @@ -224,6 +255,9 @@ function openFilterSubway() { getJobList('refresh'); } }, + cancel: () => { + showFiltersubway.value = false; + }, }); } @@ -251,8 +285,8 @@ function selectSubwayStation(point, index) { function inputText(id) { if (id) { - const text = range.value.filter((item) => item.value === id)[0].text; - return text; + const foundItem = range.value.filter((item) => item.value === id)[0]; + return foundItem ? foundItem.text : ''; } else { return ''; } @@ -260,13 +294,15 @@ function inputText(id) { function bindPickerChange(e) { const lineId = range.value[e.detail.value]; + if (!lineId) return; const value = state.subwayList.filter((iv) => iv.lineId === lineId.value)[0]; + if (!value) return; subwayCurrent.value = value; state.value = e.detail.value; state.subwayId = value.lineId; const points = value.subwayStationList; state.downup = true; - if (points.length) { + if (points && points.length) { state.dont = 0; state.dontObj = points[0]; state.subwayStart = points[0]; diff --git a/pages/index/components/index-one.vue b/pages/index/components/index-one.vue index cdd8b45..b790abe 100644 --- a/pages/index/components/index-one.vue +++ b/pages/index/components/index-one.vue @@ -680,7 +680,7 @@ const rangeOptions = ref([ { value: 0, text: '推荐' }, { value: 1, text: '最热' }, { value: 2, text: '最新发布' }, - { value: 3, text: '疆外' }, + // { value: 3, text: '疆外' }, { value: 4, text: '零工市场' } ]); const isLoaded = ref(false);