公交周边地铁线路不能选择bug修复
This commit is contained in:
@@ -110,6 +110,10 @@
|
||||
</scroll-view>
|
||||
<!-- 筛选 -->
|
||||
<select-filter ref="selectFilterModel"></select-filter>
|
||||
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<selectPopup ref="selectPopupRef"></selectPopup>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user