一体机和小程序样式错乱问题修复。

This commit is contained in:
francis-fh
2026-07-16 12:36:56 +08:00
parent 43eb458c6a
commit 9ce22a7949
5 changed files with 195 additions and 45 deletions

View File

@@ -40,7 +40,7 @@
<view class="nav-hidden hidden-animation" :class="{ 'hidden-height': shouldHideTop }">
<view class="container-search" v-if="shouldShowJobSeekerContent">
<view class="search-input button-click" @click="navTo('/pages/search/search')">
<view class="search-input button-click" @click="navToSearch">
<uni-icons class="iconsearch" color="#666666" type="search" size="18"></uni-icons>
<text class="inpute">职位名称薪资要求等</text>
</view>
@@ -263,9 +263,14 @@
{{ item.text }}
</view>
</view>
<view class="btm-right button-click" @click="openFilter">
筛选
<image class="right-sx" :class="{ active: showFilter }" src="@/static/icon/shaixun.png"></image>
<view class="btm-right-wrap">
<view class="button-click clear-btn" v-if="hasFilterConditions" @click="clearFilter">
清除筛选
</view>
<view class="btm-right button-click" @click="openFilter">
筛选
<image class="right-sx" :class="{ active: showFilter }" src="@/static/icon/shaixun.png"></image>
</view>
</view>
</view>
</view>
@@ -564,6 +569,12 @@ const shouldShowCompanyContent = computed(() => {
return userType === 0;
});
// 判断是否有筛选条件(用于显示/隐藏清除按钮)
const hasFilterConditions = computed(() => {
const searchKeys = Object.keys(pageState.search).filter((k) => k !== 'order' && pageState.search[k]);
return searchKeys.length > 0 || Object.keys(conditionSearch.value).length > 0 || Boolean(selectedCity.value.code);
});
// 判断当前用户是否为招聘者(企业用户)
const isRecruiter = computed(() => {
if (!hasLogin.value) {
@@ -1067,6 +1078,38 @@ function openFilter() {
emits('onShowTabbar', false);
}
// 跳转到搜索页,并携带筛选条件
function navToSearch() {
const query = {};
// 携带筛选弹窗中选择的地区(确保是逗号分隔字符串)
const areaVal = pageState.search.area;
if (areaVal && String(areaVal)) {
query.area = String(areaVal);
}
// 携带城市选择器中选择的regionCode
if (conditionSearch.value.regionCode) {
query.regionCode = String(conditionSearch.value.regionCode);
}
console.log('[navToSearch] query params:', query);
navTo('/pages/search/search', { query });
}
// 清除所有筛选条件
function clearFilter() {
// 保留 order 排序方式
const currentOrder = pageState.search.order;
pageState.search = { order: currentOrder };
// 清除城市选择
conditionSearch.value = {};
selectedCity.value = { code: '', name: '' };
// 刷新列表
if (state.tabIndex === 'all') {
getJobRecommend('refresh');
} else {
getJobList('refresh');
}
}
function handleNewFilterConfirm(values) {
pageState.search = {
...pageState.search,
@@ -1993,16 +2036,26 @@ defineExpose({ loadData });
font-weight: 500;
font-size: 32rpx;
color: #256BFA;
.btm-right
font-family: 'PingFangSC-Regular', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 400;
font-size: 32rpx;
color: #6C7282;
.right-sx
width: 26rpx;
height: 26rpx;
.active
transform: rotate(180deg)
.btm-right-wrap
display: flex
align-items: center
.clear-btn
font-family: 'PingFangSC-Regular', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 400;
font-size: 28rpx;
color: #999;
margin-right: 20rpx;
white-space: nowrap;
.btm-right
font-family: 'PingFangSC-Regular', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: 400;
font-size: 32rpx;
color: #6C7282;
.right-sx
width: 26rpx;
height: 26rpx;
.active
transform: rotate(180deg)
.table-list
background: #F4F4F4
flex: 1

View File

@@ -1,9 +1,9 @@
<template>
<view class="container safe-area-top">
<!-- 自定义头部搜索框 -->
<view class="custom-header">
<view class="custom-header" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="top">
<!-- <image class="btnback button-click" src="@/static/icon/back.png" @click="navBack"></image> -->
<image class="btnback button-click" src="@/static/icon/back.png" @click="navBack"></image>
<view class="search-box">
<uni-icons
class="iconsearch"
@@ -55,6 +55,11 @@ import { storeToRefs } from 'pinia';
import { useColumnCount } from '@/hook/useColumnCount';
import img from '@/static/icon/filter.png';
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
const statusBarHeight = ref(0);
// #ifdef H5
const sysInfo = uni.getSystemInfoSync();
statusBarHeight.value = sysInfo.statusBarHeight || 0;
// #endif
const searchValue = ref('');
const historyList = ref([]);
const searchParams = ref({});
@@ -79,7 +84,16 @@ onLoad((query) => {
if (arr) {
historyList.value = uni.getStorageSync('searchList');
}
const {job} = query;
const {job, area, regionCode} = query;
// 从首页筛选条件传入的地区和区域编码
console.log('[search-page] onLoad query:', JSON.stringify(query));
if (area) {
pageState.search.area = String(area);
console.log('[search-page] set area:', pageState.search.area);
}
if (regionCode) {
pageState.search.regionCode = String(regionCode);
}
if (job) {
searchValue.value = job;
searchBtn();
@@ -161,6 +175,7 @@ function getJobList(type = 'add') {
...pageState.search,
jobTitle: searchValue.value,
};
console.log('[search-page] getJobList params:', JSON.stringify(params));
$api.createRequest('/app/job/list', params, 'GET', true).then((resData) => {
const { rows, total } = resData;