新筛选页面开发

This commit is contained in:
冯辉
2026-03-12 14:22:44 +08:00
parent cefa9b7614
commit ce63c8ef8e
2 changed files with 453 additions and 31 deletions

View File

@@ -478,6 +478,13 @@
</view>
<!-- 筛选 -->
<select-filter ref="selectFilterModel" />
<!-- 新筛选页面 -->
<new-filter-page
:show="showNewFilter"
@confirm="handleNewFilterConfirm"
@close="handleNewFilterClose"
@update:show="(value) => showNewFilter = value"
/>
<!-- 微信授权登录弹窗 -->
<WxAuthLogin ref="wxAuthLoginRef" @success="handleLoginSuccess" />
@@ -601,6 +608,7 @@ import useDictStore from '@/stores/useDictStore';
const { getTransformChildren, oneDictData, dictLabel: getDictLabel, industryLabel } = useDictStore();
import useLocationStore from '@/stores/useLocationStore';
import selectFilter from '@/components/selectFilter/selectFilter.vue';
import newFilterPage from '@/components/new-filter-page/new-filter-page.vue';
import { useRecommedIndexedDBStore, jobRecommender } from '@/stores/useRecommedIndexedDBStore.js';
import { useScrollDirection } from '@/hook/useScrollDirection';
import { useColumnCount } from '@/hook/useColumnCount';
@@ -724,6 +732,7 @@ const inputText = ref('');
const showFilter = ref(false);
const selectFilterModel = ref(null);
const showModel = ref(false);
const showNewFilter = ref(false);
// 选中的城市
const selectedCity = ref({ code: '', name: '' });
const rangeOptions = ref([
@@ -882,14 +891,7 @@ const handleLoginSuccess = () => {
getIsFourLevelLinkagePurview()
};
// H5环境下从URL获取token并自动登录
onLoad(() => {
// #ifdef H5
const token = uni.getStorageSync('zkr-token');
if (token) {
useUserStore().loginSetToken(token);
}
// #endif
});
// onLoad 函数已移至下方,包含筛选参数处理
// 处理附近工作点击
const handleNearbyClick = (options ) => {
@@ -1088,34 +1090,65 @@ function navToService(serviceType) {
function openFilter() {
isInteractingWithFilter.value = true;
showFilter.value = true;
showNewFilter.value = true;
emits('onShowTabbar', false);
selectFilterModel.value?.open({
title: '筛选',
maskClick: true,
success: (values) => {
pageState.search = {
...pageState.search,
};
for (const [key, value] of Object.entries(values)) {
// 特殊处理岗位类型,直接传递数字值
}
function handleNewFilterConfirm(values) {
pageState.search = {
...pageState.search,
};
for (const [key, value] of Object.entries(values)) {
// 特殊处理岗位类型,直接传递数字值
if (key === 'jobType') {
pageState.search.type = value;
} else if (value) {
pageState.search[key] = value;
} else {
// 如果值为空,删除该搜索条件
delete pageState.search[key];
}
}
showNewFilter.value = false;
getJobList('refresh');
// 短暂延迟后解除交互锁,避免数据刷新导致顶部区域回弹
setTimeout(() => { isInteractingWithFilter.value = false; }, 400);
emits('onShowTabbar', true);
}
// 监听页面加载,接收筛选参数
onLoad((options) => {
// #ifdef H5
const token = uni.getStorageSync('zkr-token');
if (token) {
useUserStore().loginSetToken(token);
}
// #endif
// 接收从筛选页面传递过来的参数
if (options.filterParams) {
try {
const filterParams = JSON.parse(options.filterParams);
console.log('filterParams:', filterParams);
for (const [key, value] of Object.entries(filterParams)) {
if (key === 'jobType') {
pageState.search.type = value.join(',');
} else {
pageState.search[key] = value.join(',');
pageState.search.type = value;
} else if (value) {
pageState.search[key] = value;
}
}
showFilter.value = false;
console.log('pageState.search:', pageState.search);
getJobList('refresh');
// 短暂延迟后解除交互锁,避免数据刷新导致顶部区域回弹
setTimeout(() => { isInteractingWithFilter.value = false; }, 400);
},
cancel: () => {
showFilter.value = false;
emits('onShowTabbar', true);
setTimeout(() => { isInteractingWithFilter.value = false; }, 200);
},
});
} catch (error) {
console.error('解析筛选参数失败:', error);
}
}
});
function handleNewFilterClose() {
showNewFilter.value = false;
emits('onShowTabbar', true);
setTimeout(() => { isInteractingWithFilter.value = false; }, 200);
}
function handleFilterConfirm(e) {