Files
ks-app-employment-service/components/new-filter-page/new-filter-page.vue

442 lines
13 KiB
Vue
Raw Normal View History

2026-03-12 14:22:44 +08:00
<template>
<view v-if="show" class="filter-container">
<!-- 头部 -->
<!-- <view class="filter-header">
<text class="back-btn" @click="handleClose">
<uni-icons type="left" size="24"></uni-icons>
</text>
<text class="filter-title">喀什智慧就业平台</text>
<view class="back-btn"></view>
</view> -->
<!-- 标签页 -->
<view class="filter-tabs">
<view
v-for="(tab, index) in tabs"
:key="index"
class="tab-item"
:class="{ active: activeTab === tab.key }"
@click="activeTab = tab.key"
>
{{ tab.label }}
</view>
</view>
<!-- 内容区域 -->
<view class="filter-content">
<!-- 学历要求 -->
<view v-if="activeTab === 'education'" class="content-section">
<radio-group @change="(e) => handleSelect('education', e)">
<label
v-for="option in educationOptions"
:key="option.value"
class="radio-item"
:class="{ checked: selectedValues['education'] === String(option.value) }"
>
<radio
:value="String(option.value)"
:checked="selectedValues['education'] === String(option.value)"
/>
<text class="option-label">{{ option.label }}</text>
</label>
</radio-group>
</view>
<!-- 工作经验 -->
<view v-if="activeTab === 'experience'" class="content-section">
<radio-group @change="(e) => handleSelect('experience', e)">
<label
v-for="option in experienceOptions"
:key="option.value"
class="radio-item"
:class="{ checked: selectedValues['experience'] === String(option.value) }"
>
<radio
:value="String(option.value)"
:checked="selectedValues['experience'] === String(option.value)"
/>
<text class="option-label">{{ option.label }}</text>
</label>
</radio-group>
</view>
<!-- 公司规模 -->
<view v-if="activeTab === 'scale'" class="content-section">
<radio-group @change="(e) => handleSelect('scale', e)">
<label
v-for="option in scaleOptions"
:key="option.value"
class="radio-item"
:class="{ checked: selectedValues['scale'] === String(option.value) }"
>
<radio
:value="String(option.value)"
:checked="selectedValues['scale'] === String(option.value)"
/>
<text class="option-label">{{ option.label }}</text>
</label>
</radio-group>
</view>
<!-- 岗位类型 -->
<view v-if="activeTab === 'jobType'" class="content-section">
<radio-group @change="(e) => handleSelect('jobType', e)">
<label
v-for="option in jobTypeOptions"
:key="option.value"
class="radio-item"
:class="{ checked: selectedValues['jobType'] === String(option.value) }"
>
<radio
:value="String(option.value)"
:checked="selectedValues['jobType'] === String(option.value)"
/>
<text class="option-label">{{ option.label }}</text>
</label>
</radio-group>
</view>
2026-03-13 11:50:45 +08:00
<!-- 地区 -->
<view v-if="activeTab === 'area'" class="content-section">
<radio-group @change="(e) => handleSelect('area', e)">
<label
v-for="option in areaOptions"
:key="option.value"
class="radio-item"
:class="{ checked: selectedValues['area'] === String(option.value) }"
>
<radio
:value="String(option.value)"
:checked="selectedValues['area'] === String(option.value)"
/>
<text class="option-label">{{ option.label }}</text>
</label>
</radio-group>
</view>
2026-03-13 14:44:54 +08:00
<!-- 底部按钮 -->
<view class="filter-footer">
<button class="footer-btn clear-btn" @click="handleClear">清除</button>
<button class="footer-btn confirm-btn" @click="handleConfirm">确认</button>
</view>
2026-03-12 14:22:44 +08:00
</view>
2026-03-13 14:44:54 +08:00
2026-03-12 14:22:44 +08:00
</view>
</template>
<script setup>
2026-03-13 14:46:29 +08:00
import { ref, reactive, onBeforeMount, watch } from 'vue';
2026-03-12 14:22:44 +08:00
import useDictStore from '@/stores/useDictStore';
const { getTransformChildren } = useDictStore();
const props = defineProps({
show: Boolean,
});
const emit = defineEmits(['confirm', 'close', 'update:show']);
// 岗位类型数据
const getJobTypeData = () => {
return [
{ label: '常规岗位', value: 0, text: '常规岗位' },
{ label: '就业见习岗位', value: 1, text: '就业见习岗位' },
{ label: '实习实训岗位', value: 2, text: '实习实训岗位' },
{ label: '社区实践岗位', value: 3, text: '社区实践岗位' }
];
};
// 标签页数据
const tabs = [
{ key: 'education', label: '学历要求' },
{ key: 'experience', label: '工作经验' },
{ key: 'scale', label: '公司规模' },
2026-03-13 11:50:45 +08:00
{ key: 'jobType', label: '岗位类型' },
{ key: 'area', label: '地区' }
2026-03-12 14:22:44 +08:00
];
// 当前激活的标签
const activeTab = ref('education');
// 存储已选中的值
const selectedValues = reactive({
education: '',
experience: '',
scale: '',
2026-03-13 11:50:45 +08:00
jobType: '',
area: ''
2026-03-12 14:22:44 +08:00
});
// 从字典获取的选项数据
const educationOptions = ref([]);
const experienceOptions = ref([]);
const scaleOptions = ref([]);
const jobTypeOptions = ref([]);
2026-03-13 11:50:45 +08:00
const areaOptions = ref([]);
2026-03-12 14:22:44 +08:00
// 初始化获取数据
2026-03-13 14:46:29 +08:00
const initData = () => {
2026-03-12 14:22:44 +08:00
educationOptions.value = getTransformChildren('education', '学历要求').options || [];
experienceOptions.value = getTransformChildren('experience', '工作经验').options || [];
scaleOptions.value = getTransformChildren('scale', '公司规模').options || [];
jobTypeOptions.value = getJobTypeData();
2026-03-13 11:50:45 +08:00
areaOptions.value = getTransformChildren('area', '地区').options || [];
2026-03-13 14:46:29 +08:00
};
// 组件挂载时初始化数据
onBeforeMount(() => {
initData();
});
// 监听组件显示状态,当显示时重新初始化数据
watch(() => props.show, (newVal) => {
if (newVal) {
initData();
}
2026-03-12 14:22:44 +08:00
});
// 处理选项选择
const handleSelect = (key, e) => {
selectedValues[key] = e.detail.value;
};
// 清除所有选择
const handleClear = () => {
Object.keys(selectedValues).forEach((key) => {
selectedValues[key] = '';
});
};
// 确认筛选
const handleConfirm = () => {
console.log('selectedValues:', selectedValues);
emit('confirm', selectedValues);
handleClose();
};
// 关闭弹窗
const handleClose = () => {
emit('update:show', false);
emit('close');
};
</script>
<style lang="scss" scoped>
.filter-container {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: #fff;
z-index: 9999;
display: flex;
2026-03-13 14:44:54 +08:00
flex-direction: row;
box-sizing: border-box;
2026-03-12 14:22:44 +08:00
}
.filter-header {
2026-03-12 17:10:34 +08:00
height: 144rpx;
2026-03-12 14:22:44 +08:00
display: flex;
align-items: center;
justify-content: space-between;
2026-03-12 17:10:34 +08:00
padding: 0 48rpx;
2026-03-12 14:22:44 +08:00
border-bottom: 1rpx solid #eee;
background-color: #fff;
2026-03-12 17:10:34 +08:00
box-shadow: 0 3rpx 15rpx rgba(0, 0, 0, 0.05);
2026-03-12 14:22:44 +08:00
.back-btn {
2026-03-12 17:10:34 +08:00
font-size: 54rpx;
width: 72rpx;
2026-03-12 14:22:44 +08:00
display: flex;
align-items: center;
justify-content: center;
2026-03-12 17:10:34 +08:00
padding: 15rpx;
2026-03-12 14:22:44 +08:00
border-radius: 50%;
transition: all 0.3s ease;
&:active {
background-color: rgba(37, 107, 250, 0.1);
}
}
.filter-title {
2026-03-12 17:10:34 +08:00
font-size: 51rpx;
2026-03-12 14:22:44 +08:00
font-weight: 600;
color: #333;
}
}
.filter-tabs {
display: flex;
2026-03-13 14:44:54 +08:00
flex-direction: column;
width: 250rpx;
border-right: 1rpx solid #eee;
background-color: #f9f9f9;
box-shadow: 3rpx 0 15rpx rgba(0, 0, 0, 0.05);
height: 100vh;
padding-top: 84rpx;
box-sizing: border-box;
2026-03-12 14:22:44 +08:00
.tab-item {
2026-03-13 14:44:54 +08:00
height: 130rpx;
line-height: 130rpx;
2026-03-12 14:22:44 +08:00
text-align: center;
2026-03-13 14:44:54 +08:00
font-size: 42rpx;
2026-03-12 14:22:44 +08:00
color: #666;
position: relative;
transition: all 0.3s ease;
2026-03-13 14:44:54 +08:00
border-bottom: 1rpx solid #f0f0f0;
2026-03-12 14:22:44 +08:00
&.active {
color: #256BFA;
font-weight: 600;
2026-03-13 14:44:54 +08:00
background-color: #fff;
box-shadow: 3rpx 0 10rpx rgba(37, 107, 250, 0.1);
2026-03-12 14:22:44 +08:00
&::after {
content: '';
position: absolute;
2026-03-13 14:44:54 +08:00
right: 0;
top: 25%;
width: 6rpx;
height: 50%;
2026-03-12 14:22:44 +08:00
background-color: #256BFA;
2026-03-13 14:44:54 +08:00
border-radius: 3rpx 0 0 3rpx;
2026-03-12 14:22:44 +08:00
}
}
&:active {
background-color: rgba(37, 107, 250, 0.05);
}
}
}
.filter-content {
flex: 1;
2026-03-13 14:44:54 +08:00
padding: 60rpx 0rpx;
// overflow-y: auto;
display: flex;
flex-direction: column;
padding-top: 100rpx;
padding-bottom: 160rpx;
box-sizing: border-box;
2026-03-12 14:22:44 +08:00
}
.content-section {
2026-03-13 14:44:54 +08:00
padding: 0 4%;
overflow-y: auto;
2026-03-13 14:52:43 +08:00
flex: 12;
2026-03-12 14:22:44 +08:00
.radio-item {
display: flex;
align-items: center;
2026-03-12 17:10:34 +08:00
padding: 45rpx 0;
2026-03-12 14:22:44 +08:00
border-bottom: 1rpx solid #f0f0f0;
transition: all 0.3s ease;
position: relative;
&:last-child {
border-bottom: none;
}
&:active {
background-color: rgba(37, 107, 250, 0.05);
}
radio {
2026-03-12 17:10:34 +08:00
width: 42rpx;
height: 42rpx;
margin-right: 36rpx;
2026-03-12 14:22:44 +08:00
transform: scale(1);
display: flex;
align-items: center;
justify-content: center;
}
radio .wx-radio-input {
2026-03-12 17:10:34 +08:00
width: 42rpx;
height: 42rpx;
2026-03-12 14:22:44 +08:00
border-radius: 50%;
2026-03-12 17:10:34 +08:00
border: 3rpx solid #ccc;
2026-03-12 14:22:44 +08:00
background: transparent;
}
radio .wx-radio-input.wx-radio-input-checked {
border-color: #256BFA !important;
background: #256BFA !important;
}
radio .wx-radio-input::before {
2026-03-12 17:10:34 +08:00
width: 24rpx;
height: 24rpx;
line-height: 24rpx;
2026-03-12 14:22:44 +08:00
text-align: center;
2026-03-12 17:10:34 +08:00
font-size: 18rpx;
2026-03-12 14:22:44 +08:00
color: #fff;
background: transparent;
transform: translate(-50%, -50%) scale(0);
-webkit-transform: translate(-50%, -50%) scale(0);
}
radio .wx-radio-input.wx-radio-input-checked::before {
transform: translate(-50%, -50%) scale(1);
-webkit-transform: translate(-50%, -50%) scale(1);
}
.option-label {
2026-03-12 17:10:34 +08:00
font-size: 45rpx;
2026-03-12 14:22:44 +08:00
color: #333;
flex: 1;
font-weight: 400;
2026-03-12 17:10:34 +08:00
line-height: 60rpx;
2026-03-12 14:22:44 +08:00
}
}
}
.filter-footer {
2026-03-13 14:44:54 +08:00
height: 200rpx;
flex: 1;
2026-03-12 14:22:44 +08:00
display: flex;
border-top: 1rpx solid #eee;
background-color: #fff;
2026-03-12 17:10:34 +08:00
box-shadow: 0 -3rpx 15rpx rgba(0, 0, 0, 0.05);
2026-03-13 14:44:54 +08:00
padding: 30rpx 0;
2026-03-12 14:22:44 +08:00
flex-shrink: 0;
z-index: 10;
2026-03-13 14:44:54 +08:00
margin-top: auto;
box-sizing: border-box;
2026-03-12 14:22:44 +08:00
.footer-btn {
flex: 1;
2026-03-13 14:44:54 +08:00
margin: 0 40rpx;
2026-03-12 17:10:34 +08:00
border-radius: 24rpx;
2026-03-13 14:44:54 +08:00
height: 100rpx;
line-height: 100rpx;
font-size: 45rpx;
2026-03-12 14:22:44 +08:00
transition: all 0.3s ease;
font-weight: 500;
&:first-child {
2026-03-12 17:10:34 +08:00
margin-right: 30rpx;
2026-03-12 14:22:44 +08:00
background-color: #f5f5f5;
color: #666;
border: 1rpx solid #e0e0e0;
&:active {
background-color: #e0e0e0;
transform: scale(0.98);
}
}
&:last-child {
background-color: #256BFA;
color: #fff;
border: none;
&:active {
background-color: #1a56d9;
transform: scale(0.98);
}
}
}
}
</style>