公交周边地铁线路不能选择bug修复
This commit is contained in:
@@ -110,6 +110,10 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
<!-- 筛选 -->
|
<!-- 筛选 -->
|
||||||
<select-filter ref="selectFilterModel"></select-filter>
|
<select-filter ref="selectFilterModel"></select-filter>
|
||||||
|
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
|
<selectPopup ref="selectPopupRef"></selectPopup>
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -117,7 +121,28 @@
|
|||||||
import { reactive, inject, watch, ref, onMounted, onBeforeUnmount } from 'vue';
|
import { reactive, inject, watch, ref, onMounted, onBeforeUnmount } from 'vue';
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||||
const { $api, navTo, debounce, customSystem } = inject('globalFunction');
|
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 { storeToRefs } from 'pinia';
|
||||||
import useLocationStore from '@/stores/useLocationStore';
|
import useLocationStore from '@/stores/useLocationStore';
|
||||||
import useUserStore from '@/stores/useUserStore';
|
import useUserStore from '@/stores/useUserStore';
|
||||||
@@ -128,6 +153,9 @@ const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
|
|||||||
import point2 from '@/static/icon/point2.png';
|
import point2 from '@/static/icon/point2.png';
|
||||||
import LocationPng from '@/static/icon/Location.png';
|
import LocationPng from '@/static/icon/Location.png';
|
||||||
import selectFilter from '@/components/selectFilter/selectFilter.vue';
|
import selectFilter from '@/components/selectFilter/selectFilter.vue';
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
import selectPopup from '@/components/selectPopup/selectPopup.vue';
|
||||||
|
// #endif
|
||||||
const emit = defineEmits(['onFilter']);
|
const emit = defineEmits(['onFilter']);
|
||||||
// status
|
// status
|
||||||
const showFiltersubway = ref(false);
|
const showFiltersubway = ref(false);
|
||||||
@@ -205,18 +233,21 @@ function openFilter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openFilterSubway() {
|
function openFilterSubway() {
|
||||||
|
showFiltersubway.value = true;
|
||||||
const diti = state.subwayList.map((item) => ({ ...item, label: item.lineName, value: item.lineId }));
|
const diti = state.subwayList.map((item) => ({ ...item, label: item.lineName, value: item.lineId }));
|
||||||
openSelectPopup({
|
openSelectPopup({
|
||||||
title: '地铁',
|
title: '地铁',
|
||||||
maskClick: true,
|
maskClick: true,
|
||||||
data: [diti],
|
data: [diti],
|
||||||
success: (_, [value]) => {
|
success: (_, [value]) => {
|
||||||
|
showFiltersubway.value = false;
|
||||||
|
if (!value) return;
|
||||||
subwayCurrent.value = value;
|
subwayCurrent.value = value;
|
||||||
state.subwayId = value.value;
|
state.subwayId = value.value;
|
||||||
state.value = value.value;
|
state.value = value.value;
|
||||||
const points = value.subwayStationList;
|
const points = value.subwayStationList;
|
||||||
state.downup = true;
|
state.downup = true;
|
||||||
if (points.length) {
|
if (points && points.length) {
|
||||||
state.dont = 0;
|
state.dont = 0;
|
||||||
state.dontObj = points[0];
|
state.dontObj = points[0];
|
||||||
state.subwayStart = points[0];
|
state.subwayStart = points[0];
|
||||||
@@ -224,6 +255,9 @@ function openFilterSubway() {
|
|||||||
getJobList('refresh');
|
getJobList('refresh');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
cancel: () => {
|
||||||
|
showFiltersubway.value = false;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,8 +285,8 @@ function selectSubwayStation(point, index) {
|
|||||||
|
|
||||||
function inputText(id) {
|
function inputText(id) {
|
||||||
if (id) {
|
if (id) {
|
||||||
const text = range.value.filter((item) => item.value === id)[0].text;
|
const foundItem = range.value.filter((item) => item.value === id)[0];
|
||||||
return text;
|
return foundItem ? foundItem.text : '';
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -260,13 +294,15 @@ function inputText(id) {
|
|||||||
|
|
||||||
function bindPickerChange(e) {
|
function bindPickerChange(e) {
|
||||||
const lineId = range.value[e.detail.value];
|
const lineId = range.value[e.detail.value];
|
||||||
|
if (!lineId) return;
|
||||||
const value = state.subwayList.filter((iv) => iv.lineId === lineId.value)[0];
|
const value = state.subwayList.filter((iv) => iv.lineId === lineId.value)[0];
|
||||||
|
if (!value) return;
|
||||||
subwayCurrent.value = value;
|
subwayCurrent.value = value;
|
||||||
state.value = e.detail.value;
|
state.value = e.detail.value;
|
||||||
state.subwayId = value.lineId;
|
state.subwayId = value.lineId;
|
||||||
const points = value.subwayStationList;
|
const points = value.subwayStationList;
|
||||||
state.downup = true;
|
state.downup = true;
|
||||||
if (points.length) {
|
if (points && points.length) {
|
||||||
state.dont = 0;
|
state.dont = 0;
|
||||||
state.dontObj = points[0];
|
state.dontObj = points[0];
|
||||||
state.subwayStart = points[0];
|
state.subwayStart = points[0];
|
||||||
|
|||||||
@@ -680,7 +680,7 @@ const rangeOptions = ref([
|
|||||||
{ value: 0, text: '推荐' },
|
{ value: 0, text: '推荐' },
|
||||||
{ value: 1, text: '最热' },
|
{ value: 1, text: '最热' },
|
||||||
{ value: 2, text: '最新发布' },
|
{ value: 2, text: '最新发布' },
|
||||||
{ value: 3, text: '疆外' },
|
// { value: 3, text: '疆外' },
|
||||||
{ value: 4, text: '零工市场' }
|
{ value: 4, text: '零工市场' }
|
||||||
]);
|
]);
|
||||||
const isLoaded = ref(false);
|
const isLoaded = ref(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user