单位详情页面优化

This commit is contained in:
冯辉
2025-11-13 00:01:52 +08:00
parent d5a2198278
commit e2108b0f0c

View File

@@ -18,9 +18,6 @@
</view> </view>
<view class="companyinfo-right"> <view class="companyinfo-right">
<view class="row1">{{ companyInfo?.name || '未知公司' }}</view> <view class="row1">{{ companyInfo?.name || '未知公司' }}</view>
<view class="row2">
互联网
</view>
<view class="row2"> <view class="row2">
{{ getScaleLabel(companyInfo?.scale) }} {{ getScaleLabel(companyInfo?.scale) }}
</view> </view>
@@ -41,41 +38,41 @@
</view> </view>
<scroll-view scroll-y class="Detailscroll-view"> <scroll-view scroll-y class="Detailscroll-view">
<view class="views"> <view class="views">
<view class="Detail-title"><text class="title">在招职位</text></view> <view class="Detail-title"><text class="title">在招职位</text></view>
<template v-if="companyInfo.jobInfoList.length != 0"> <template v-if="companyInfo.jobList && companyInfo.jobList.length != 0">
<view v-for="job in companyInfo.jobInfoList" :key="job.id"> <view v-for="job in companyInfo.jobList" :key="job.jobId">
<!-- @click="navTo(`/packageA/pages/post/post?jobId=${JSON.stringify(job)}`)" --> <view class="cards" @click="navToJobDetail(job.jobId)">
<!-- :style="getItemBackgroundStyle('bj2.png')" --> <view class="card-company">
<view class="cards"> <text class="company">{{ job.jobTitle }}</text>
<view class="card-company"> <view class="salary"> {{ job.minSalary }}-{{ job.maxSalary }}/ </view>
<text class="company">{{ job.jobTitle }}</text> </view>
<view class="salary"> {{ job.salaryRange }}/ </view> <view class="card-tags">
<view class="tag jy">
<image :src="`${baseUrl}/jobfair/jy.png`" mode=""></image>
{{ getExperienceLabel(job.experience) }}
</view> </view>
<view class="card-tags"> <view class="tag xl">
<view class="tag jy"> <image :src="`${baseUrl}/jobfair/xx.png`" mode=""></image>
<image :src="`${baseUrl}/jobfair/jy.png`" mode=""></image> {{ getEducationLabel(job.education) }}
{{ job.experienceRequirement }}
</view>
<view class="tag xl">
<image :src="`${baseUrl}/jobfair/xx.png`" mode=""></image>
{{ job.educationRequirement }}
</view>
<view class="tag yd" v-if="job.jobRequirement">
<image :src="`${baseUrl}/jobfair/lx-1.png`" mode=""></image>
{{ job.jobRequirement }}
</view>
</view> </view>
<view class="card-companyName"> <view class="tag yd" v-if="job.vacancies">
{{ job.jobDescription }} <image :src="`${baseUrl}/jobfair/lx-1.png`" mode=""></image>
招聘{{ job.vacancies }}
</view> </view>
<view class="deliver-box"> </view>
<view class="deliver-btn" @click="deliverResume(job)"> <view class="card-info">
简历投递 <view class="company-address" v-if="job.jobLocation">
</view> <image class="point3" src="/static/icon/point3.png"></image>
{{ job.jobLocation }}
</view>
<view class="push-time" v-if="job.postingDate">
<image class="point3" src="/static/icon/point3.png"></image>
{{ job.postingDate.split(' ')[0] }}
</view> </view>
</view> </view>
</view> </view>
</template> </view>
</template>
<empty v-else pdTop="200"></empty> <empty v-else pdTop="200"></empty>
</view> </view>
</scroll-view> </scroll-view>
@@ -121,7 +118,7 @@
pageSize: 10, pageSize: 10,
}); });
const companyInfo = ref({ const companyInfo = ref({
jobInfoList: [], jobList: [],
}); });
const baseUrl = config.imgBaseUrl; const baseUrl = config.imgBaseUrl;
const getItemBackgroundStyle = (imageName) => ({ const getItemBackgroundStyle = (imageName) => ({
@@ -146,7 +143,7 @@
scale: resData.data.scale || '未知规模', scale: resData.data.scale || '未知规模',
description: resData.data.description || '暂无公司介绍', description: resData.data.description || '暂无公司介绍',
isCollection: resData.data.isCollection || 0, isCollection: resData.data.isCollection || 0,
jobInfoList: [] // 新数据格式中没有岗位列表,初始化为空数组 jobList: resData.data.jobList || [] // 使用正确的jobList字段
}; };
console.log('Company details loaded successfully'); console.log('Company details loaded successfully');
} else { } else {
@@ -157,7 +154,7 @@
scale: '-', scale: '-',
description: '无法获取公司信息,请稍后重试', description: '无法获取公司信息,请稍后重试',
isCollection: 0, isCollection: 0,
jobInfoList: [] jobList: []
}; };
} }
}).catch((error) => { }).catch((error) => {
@@ -168,7 +165,7 @@
scale: '-', scale: '-',
description: '网络请求失败,请检查网络连接', description: '网络请求失败,请检查网络连接',
isCollection: 0, isCollection: 0,
jobInfoList: [] jobList: []
}; };
}); });
} }
@@ -213,7 +210,7 @@
// 获取企业规模字典数据 // 获取企业规模字典数据
onLoad(async (options) => { onLoad(async (options) => {
// 初始化companyInfo // 初始化companyInfo
companyInfo.value = { jobInfoList: [] }; companyInfo.value = { jobList: [] };
// 加载字典数据 // 加载字典数据
await dictStore.getDictData(); await dictStore.getDictData();
@@ -222,7 +219,7 @@
companyInfo.value = JSON.parse(options.job); companyInfo.value = JSON.parse(options.job);
} catch (error) { } catch (error) {
console.error('Error parsing job data:', error); console.error('Error parsing job data:', error);
companyInfo.value = { jobInfoList: [] }; companyInfo.value = { jobList: [] };
} }
// 处理companyId参数 // 处理companyId参数
} else if (options.companyId) { } else if (options.companyId) {
@@ -237,7 +234,7 @@
getCompanyDetailsById(options.bussinessId); getCompanyDetailsById(options.bussinessId);
} else { } else {
console.warn('No valid parameters provided'); console.warn('No valid parameters provided');
companyInfo.value = { jobInfoList: [] }; companyInfo.value = { jobList: [] };
} }
}); });
@@ -273,6 +270,91 @@
return '-'; return '-';
} }
} }
// 根据experience值获取对应的文本
function getExperienceLabel(experience) {
if (experience === undefined || experience === null || experience === '') return '经验不限';
try {
const experienceStr = String(experience);
const label = dictStore.dictLabel('experience', experienceStr);
if (!label) {
const defaultExperienceMap = {
'0': '经验不限',
'1': '1年以内',
'2': '1-3年',
'3': '3-5年',
'4': '5-10年',
'5': '10年以上'
};
return defaultExperienceMap[experienceStr] || '经验不限';
}
return label;
} catch (error) {
console.error('获取经验标签失败:', error);
return '经验不限';
}
}
// 根据education值获取对应的文本
function getEducationLabel(education) {
if (education === undefined || education === null || education === '') return '学历不限';
try {
const educationStr = String(education);
const label = dictStore.dictLabel('education', educationStr);
if (!label) {
const defaultEducationMap = {
'-1': '学历不限',
'1': '初中及以下',
'2': '高中',
'3': '中专',
'4': '大专',
'5': '本科',
'6': '硕士',
'7': '博士'
};
return defaultEducationMap[educationStr] || '学历不限';
}
return label;
} catch (error) {
console.error('获取学历标签失败:', error);
return '学历不限';
}
}
// 格式化发布时间
function formatPublishTime(publishTime) {
if (!publishTime) return '';
try {
const date = new Date(publishTime);
const now = new Date();
const diffTime = Math.abs(now - date);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
if (diffDays === 1) {
return '今天发布';
} else if (diffDays <= 7) {
return `${diffDays}天前发布`;
} else {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}发布`;
}
} catch (error) {
console.error('格式化发布时间失败:', error);
return '';
}
}
// 跳转到职位详情页面
function navToJobDetail(jobId) {
if (jobId) {
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(jobId)}`);
}
}
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
@@ -420,24 +502,23 @@
border-radius: 20rpx 20rpx 20rpx 20rpx; border-radius: 20rpx 20rpx 20rpx 20rpx;
margin-top: 22rpx; margin-top: 22rpx;
padding-bottom: 18rpx; padding-bottom: 18rpx;
background: #f2f8fc; background: #FFFFFF;
.card-company { .card-company {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: flex-start;
border-bottom: 1rpx solid #c2d7ea;
.company { .company {
font-weight: 600; font-weight: 600;
font-size: 32rpx; font-size: 32rpx;
color: #207AC7; color: #333333;
} }
.salary { .salary {
font-weight: 600; // font-weight: 600;
font-size: 28rpx; font-size: 28rpx;
color: #F83A3C; color: #1677FF;
white-space: nowrap; white-space: nowrap;
line-height: 48rpx; line-height: 48rpx;
} }
@@ -475,7 +556,7 @@
.card-tags { .card-tags {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
margin: 25rpx 0 35rpx; margin: 25rpx 0 20rpx;
image { image {
width: 24rpx; width: 24rpx;
@@ -484,18 +565,18 @@
} }
.jy { .jy {
background: #D9EDFF; background: #F5F5F5;
color: #0086FF; color: #333333;
} }
.xl { .xl {
background: #FFF1D5; background: #F5F5F5;
color: #FF7F01; color: #333333;
} }
.yd { .yd {
background: #FFD8D8; background: #F5F5F5;
color: #F83A3C; color: #333333;
} }
.tag { .tag {
@@ -514,6 +595,62 @@
} }
} }
.card-info {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
flex-wrap: wrap;
.point3 {
width: 12rpx;
height: 12rpx;
}
.company-address {
display: flex;
align-items: center;
font-weight: 400;
font-size: 24rpx;
color: #6C7282;
line-height: 34rpx;
flex: 1;
min-width: 0;
margin-right: 20rpx;
image {
width: 24rpx;
height: 24rpx;
margin-right: 8rpx;
flex-shrink: 0;
}
text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.push-time {
display: flex;
align-items: center;
font-weight: 400;
font-size: 24rpx;
color: #6C7282;
line-height: 34rpx;
flex-shrink: 0;
white-space: nowrap;
image {
width: 24rpx;
height: 24rpx;
margin-right: 8rpx;
flex-shrink: 0;
}
}
}
.card-bottom { .card-bottom {
margin-top: 32rpx; margin-top: 32rpx;
display: flex; display: flex;