2025-05-13 11:10:38 +08:00
|
|
|
|
<template>
|
2025-12-08 21:46:55 +08:00
|
|
|
|
<transition-group name="blur-fade-stagger" tag="view">
|
|
|
|
|
|
<view v-for="job in dataSource" :key="job.id || job.jobId" :style="{ '--i': 2 }">
|
|
|
|
|
|
<view v-if="!job.isTitle" class="cards" @click="nextDetail(job)">
|
|
|
|
|
|
<view class="card-company">
|
|
|
|
|
|
<text class="company">{{ job.jobTitle }}</text>
|
|
|
|
|
|
<view class="salary">
|
|
|
|
|
|
<Salary-Expectation
|
|
|
|
|
|
:max-salary="job.maxSalary"
|
|
|
|
|
|
:min-salary="job.minSalary"
|
|
|
|
|
|
></Salary-Expectation>
|
|
|
|
|
|
</view>
|
2025-05-13 11:10:38 +08:00
|
|
|
|
</view>
|
2025-12-08 21:46:55 +08:00
|
|
|
|
<view class="card-companyName">{{ job.gwmc }}</view>
|
|
|
|
|
|
<view class="card-tags">
|
|
|
|
|
|
<view class="tag">
|
|
|
|
|
|
<dict-Label dictType="education" :value="job.education"></dict-Label>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="tag">
|
|
|
|
|
|
<dict-Label dictType="experience" :value="job.experience"></dict-Label>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="tag">
|
|
|
|
|
|
{{ vacanciesTo(job.vacancies) }}
|
|
|
|
|
|
</view>
|
2025-05-13 11:10:38 +08:00
|
|
|
|
</view>
|
2025-12-08 21:46:55 +08:00
|
|
|
|
<view class="card-bottom">
|
|
|
|
|
|
<view>{{ job.postingDate }}</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<convert-distance
|
|
|
|
|
|
:alat="job.latitude"
|
|
|
|
|
|
:along="job.longitude"
|
|
|
|
|
|
:blat="latitude"
|
|
|
|
|
|
:blong="longitude"
|
|
|
|
|
|
></convert-distance>
|
|
|
|
|
|
<dict-Label class="mar_le10" dictType="area" :value="job.jobLocationAreaCode"></dict-Label>
|
|
|
|
|
|
</view>
|
2025-05-13 11:10:38 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-12-08 21:46:55 +08:00
|
|
|
|
<view class="date-jobTitle" v-else>
|
|
|
|
|
|
{{ job.title }}
|
2025-05-13 11:10:38 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-12-08 21:46:55 +08:00
|
|
|
|
</transition-group>
|
2025-05-13 11:10:38 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-12-08 21:46:55 +08:00
|
|
|
|
import { inject, computed, toRaw, ref, watch } from 'vue';
|
2025-05-13 11:10:38 +08:00
|
|
|
|
const { insertSortData, navTo, vacanciesTo } = inject('globalFunction');
|
|
|
|
|
|
import { useRecommedIndexedDBStore } from '@/stores/useRecommedIndexedDBStore.js';
|
|
|
|
|
|
const recommedIndexDb = useRecommedIndexedDBStore();
|
2025-12-08 21:46:55 +08:00
|
|
|
|
const dataSource = ref([]);
|
2025-05-13 11:10:38 +08:00
|
|
|
|
const props = defineProps({
|
|
|
|
|
|
list: {
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
default: '标题',
|
|
|
|
|
|
},
|
|
|
|
|
|
longitude: {
|
|
|
|
|
|
type: Number,
|
|
|
|
|
|
default: 120.382665,
|
|
|
|
|
|
},
|
|
|
|
|
|
latitude: {
|
|
|
|
|
|
type: Number,
|
|
|
|
|
|
default: 36.066938,
|
|
|
|
|
|
},
|
|
|
|
|
|
seeDate: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: '',
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const listData = computed(() => {
|
|
|
|
|
|
if (props.seeDate && props.list.length) {
|
|
|
|
|
|
const ulist = toRaw(props.list);
|
|
|
|
|
|
const [reslist, lastDate] = insertSortData(ulist, props.seeDate);
|
|
|
|
|
|
return reslist;
|
|
|
|
|
|
}
|
|
|
|
|
|
return props.list;
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2025-12-08 21:46:55 +08:00
|
|
|
|
const processedIds = new Set();
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => props.list,
|
|
|
|
|
|
(newList) => {
|
|
|
|
|
|
if (!Array.isArray(newList)) return;
|
2025-12-09 11:13:32 +08:00
|
|
|
|
|
|
|
|
|
|
// --- 新增逻辑开始 ---
|
|
|
|
|
|
// 判断是否需要重置数据 (例如:点击了搜索、切换了Tab、或下拉刷新)
|
|
|
|
|
|
let shouldReset = false;
|
|
|
|
|
|
|
|
|
|
|
|
// 场景1: 新列表长度比当前渲染的列表短,说明发生了重置(如从20条变成了10条)
|
|
|
|
|
|
if (dataSource.value.length > newList.length) {
|
|
|
|
|
|
shouldReset = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
// 场景2: 列表不为空,且第一条数据的ID发生了变化,说明是全新的搜索结果
|
|
|
|
|
|
else if (dataSource.value.length > 0 && newList.length > 0) {
|
|
|
|
|
|
const oldId = dataSource.value[0].id || dataSource.value[0].jobId;
|
|
|
|
|
|
const newId = newList[0].id || newList[0].jobId;
|
|
|
|
|
|
if (oldId !== newId) {
|
|
|
|
|
|
shouldReset = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 如果判定为重置,则清空现有数据和ID记录
|
|
|
|
|
|
if (shouldReset) {
|
|
|
|
|
|
dataSource.value = [];
|
|
|
|
|
|
processedIds.clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
// --- 新增逻辑结束 ---
|
|
|
|
|
|
|
|
|
|
|
|
const newItems = newList.filter((item) => !processedIds.has(item.id || item.jobId));
|
|
|
|
|
|
|
2025-12-08 21:46:55 +08:00
|
|
|
|
if (newItems.length === 0) return;
|
2025-12-09 11:13:32 +08:00
|
|
|
|
|
|
|
|
|
|
newItems.forEach((item) => processedIds.add(item.id || item.jobId));
|
2025-12-08 21:46:55 +08:00
|
|
|
|
const delay = 50;
|
|
|
|
|
|
newItems.forEach((item, index) => {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
dataSource.value.push(item);
|
|
|
|
|
|
}, index * delay);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2025-12-09 11:13:32 +08:00
|
|
|
|
{ immediate: true, deep: true } // 建议加上 deep,虽然这里监听的是数组引用变化
|
2025-12-08 21:46:55 +08:00
|
|
|
|
);
|
|
|
|
|
|
|
2025-05-13 11:10:38 +08:00
|
|
|
|
function nextDetail(job) {
|
|
|
|
|
|
// 记录岗位类型,用作数据分析
|
|
|
|
|
|
if (job.jobCategory) {
|
|
|
|
|
|
const recordData = recommedIndexDb.JobParameter(job);
|
|
|
|
|
|
recommedIndexDb.addRecord(recordData);
|
|
|
|
|
|
}
|
2025-11-23 18:20:28 +08:00
|
|
|
|
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}&dataType=1`);
|
2025-05-13 11:10:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
|
|
.date-jobTitle{
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #495265;
|
|
|
|
|
|
padding: 28rpx 0 0 20rpx
|
|
|
|
|
|
}
|
|
|
|
|
|
.cards{
|
|
|
|
|
|
padding: 32rpx;
|
|
|
|
|
|
background: #FFFFFF;
|
|
|
|
|
|
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04);
|
|
|
|
|
|
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
|
|
|
|
|
margin-top: 22rpx;
|
|
|
|
|
|
.card-company{
|
|
|
|
|
|
display: flex
|
|
|
|
|
|
justify-content: space-between
|
|
|
|
|
|
align-items: flex-start
|
|
|
|
|
|
.company{
|
2025-07-09 15:15:37 +08:00
|
|
|
|
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
|
2025-05-13 11:10:38 +08:00
|
|
|
|
font-weight: 500;
|
2025-11-07 11:30:07 +08:00
|
|
|
|
font-size: 30rpx;
|
2025-05-13 11:10:38 +08:00
|
|
|
|
color: #333333;
|
|
|
|
|
|
}
|
|
|
|
|
|
.salary{
|
2025-07-09 15:15:37 +08:00
|
|
|
|
font-family: DIN-Medium;
|
2025-05-13 11:10:38 +08:00
|
|
|
|
font-weight: 500;
|
2025-11-07 11:30:07 +08:00
|
|
|
|
font-size: 26rpx;
|
2025-05-13 11:10:38 +08:00
|
|
|
|
color: #4C6EFB;
|
|
|
|
|
|
white-space: nowrap
|
|
|
|
|
|
line-height: 48rpx
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.card-companyName{
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #6C7282;
|
|
|
|
|
|
}
|
|
|
|
|
|
.card-tags{
|
|
|
|
|
|
display: flex
|
|
|
|
|
|
flex-wrap: wrap
|
|
|
|
|
|
.tag{
|
2025-07-09 15:15:37 +08:00
|
|
|
|
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
|
2025-05-13 11:10:38 +08:00
|
|
|
|
width: fit-content;
|
|
|
|
|
|
height: 30rpx;
|
|
|
|
|
|
background: #F4F4F4;
|
|
|
|
|
|
border-radius: 4rpx;
|
|
|
|
|
|
padding: 6rpx 20rpx;
|
|
|
|
|
|
line-height: 30rpx;
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
color: #6C7282;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
margin-top: 14rpx;
|
|
|
|
|
|
white-space: nowrap
|
|
|
|
|
|
margin-right: 20rpx
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.card-bottom{
|
|
|
|
|
|
margin-top: 32rpx
|
|
|
|
|
|
display: flex
|
|
|
|
|
|
justify-content: space-between
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
color: #6C7282;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|
2025-12-05 18:09:45 +08:00
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
@media(min-width: 800px){
|
|
|
|
|
|
.cards{
|
|
|
|
|
|
.card-company{
|
|
|
|
|
|
.company{
|
|
|
|
|
|
font-size: 38rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
.salary{
|
|
|
|
|
|
font-size: 34rpx;
|
|
|
|
|
|
::v-deep .texts {
|
|
|
|
|
|
.num {
|
|
|
|
|
|
font-size: 40rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
.unit {
|
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
.gap {
|
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.card-companyName{
|
|
|
|
|
|
margin-top: 14rpx;
|
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
.card-bottom{
|
|
|
|
|
|
font-size: 34rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
.card-tags{
|
|
|
|
|
|
margin-top: 14rpx;
|
|
|
|
|
|
.tag{
|
|
|
|
|
|
padding: 10rpx 30rpx;
|
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
|
border-radius: 6rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|