This commit is contained in:
冯辉
2025-11-12 17:42:27 +08:00
parent 73f5cb8750
commit 4953bee633
3 changed files with 129 additions and 24 deletions

View File

@@ -13,10 +13,10 @@
</view>
<text class="text-content button-click">{{ content }}</text>
<template v-if="showButton">
<button class="popup-button button-click" v-if="isTip" @click="close">{{ buttonText }}</button>
<button class="popup-button button-click reset-button" v-if="isTip" @click="close">{{ buttonText }}</button>
<view v-else class="confirm-btns">
<button class="popup-button button-click" @click="close">{{ cancelText }}</button>
<button class="popup-button button-click" @click="confirm">{{ confirmText }}</button>
<button class="popup-button button-click reset-button" @click="close">{{ cancelText }}</button>
<button class="popup-button button-click reset-button" @click="confirm">{{ confirmText }}</button>
</view>
</template>
</view>
@@ -138,8 +138,8 @@ export default {
}
}
// 重置button样式
button {
// 重置button样式,使用类选择器代替标签选择器
.reset-button {
padding: 0;
margin: 0;
border: none;
@@ -148,7 +148,7 @@ button {
line-height: inherit;
}
button::after {
.reset-button::after {
border: none;
}
</style>

View File

@@ -2,8 +2,8 @@
<view class="empty" :style="{ background: bgcolor, marginTop: mrTop + 'rpx' }">
<view class="ty_content" :style="{ paddingTop: pdTop + 'rpx' }">
<view class="content_top btn-shaky">
<image v-if="pictrue" :src="pictrue" mode=""></image>
<image v-else src="@/static/icon/empty.png" mode=""></image>
<image v-if="pictrue" :src="pictrue" mode="" class="empty-image"></image>
<image v-else src="@/static/icon/empty.png" mode="" class="empty-image"></image>
</view>
<view class="content_c">{{ content }}</view>
</view>
@@ -47,7 +47,8 @@ export default {
</script>
<style lang="scss" scoped>
image {
// 使用类选择器代替标签选择器
.empty-image {
width: 100%;
height: 100%;
}

View File

@@ -7,7 +7,7 @@
</template>
<template #headerright>
<view class="btn mar_ri10">
<image src="@/static/icon/collect3.png" v-if="!companyInfo.isCollection"></image>
<image src="@/static/icon/collect3.png" v-if="!companyInfo?.isCollection"></image>
<image src="@/static/icon/collect2.png" v-else></image>
</view>
</template>
@@ -17,16 +17,19 @@
<image src="@/static/icon/companyIcon.png" mode=""></image>
</view>
<view class="companyinfo-right">
<view class="row1">{{ companyInfo?.companyName }}</view>
<view class="row1">{{ companyInfo?.name || '未知公司' }}</view>
<view class="row2">
{{ companyInfo?.scale }}
互联网
</view>
<view class="row2">
{{ getScaleLabel(companyInfo?.scale) }}
</view>
</view>
</view>
<view class="conetent-info" :class="{ expanded: isExpanded }">
<view class="info-title">公司介绍</view>
<view class="info-desirption">{{
companyInfo.companyIntroduction
companyInfo?.description || '暂无公司介绍'
}}</view>
<!-- <view class="info-title title2">公司地址</view>
<view class="locationCompany"></view> -->
@@ -95,9 +98,9 @@
} from "@dcloudio/uni-app";
import dictLabel from "@/components/dict-Label/dict-Label.vue";
import config from "@/config.js";
import {
storeToRefs
} from "pinia";
import { storeToRefs } from "pinia";
import useDictStore from '@/stores/useDictStore';
const dictStore = useDictStore();
import useLocationStore from "@/stores/useLocationStore";
const {
longitudeVal,
@@ -120,7 +123,6 @@
const companyInfo = ref({
jobInfoList: [],
});
const baseUrl = config.imgBaseUrl;
const getItemBackgroundStyle = (imageName) => ({
backgroundImage: `url(${baseUrl}/jobfair/${imageName})`,
@@ -129,9 +131,47 @@
backgroundRepeat: "no-repeat",
});
onLoad((options) => {
companyInfo.value = JSON.parse(options.job);
// 已移除重复的onLoad函数保留下面的async版本
// 根据公司ID获取公司详情
function getCompanyDetailsById(companyId) {
// 使用全局注入的$api调用接口
$api.createRequest('/app/company/' + companyId, 'GET', 9100).then((resData) => {
if (resData && resData.code === 200 && resData.data) {
console.log('Company details:', resData.data);
// 确保数据格式符合页面需求,并为关键字段提供默认值
companyInfo.value = {
...resData.data,
name: resData.data.name || '未知公司',
scale: resData.data.scale || '未知规模',
description: resData.data.description || '暂无公司介绍',
isCollection: resData.data.isCollection || 0,
jobInfoList: [] // 新数据格式中没有岗位列表,初始化为空数组
};
console.log('Company details loaded successfully');
} else {
console.error('Failed to load company details:', resData?.msg || 'Unknown error');
// 设置默认值,避免页面白屏
companyInfo.value = {
name: '加载失败',
scale: '-',
description: '无法获取公司信息,请稍后重试',
isCollection: 0,
jobInfoList: []
};
}
}).catch((error) => {
console.error('API error when fetching company details:', error);
// 错误情况下也设置默认值
companyInfo.value = {
name: '请求失败',
scale: '-',
description: '网络请求失败,请检查网络连接',
isCollection: 0,
jobInfoList: []
};
});
}
function expand() {
isExpanded.value = !isExpanded.value;
@@ -148,9 +188,9 @@
if (resData1.code == 200) {
$api.myRequest("/system/user/login/user/info", {}, "GET", 10100, headers).then((resData) => {
$api.myRequest("/jobfair/public/job-fair-person-job/insert", {
jobFairId: companyInfo.value.jobFairId, // 招聘会id
jobFairId: companyInfo.value?.jobFairId, // 招聘会id
personId: resData.info.userId, // 当前登录用户id
enterpriseId: companyInfo.value.companyId, // 企业id
enterpriseId: companyInfo.value?.companyId, // 企业id
jobId: job.jobId, // 岗位id
idCard:resData.info.personCardNo
}, "post", 9100, {
@@ -169,6 +209,70 @@
});
}
// 获取企业规模字典数据
onLoad(async (options) => {
// 初始化companyInfo
companyInfo.value = { jobInfoList: [] };
// 加载字典数据
await dictStore.getDictData();
if (options.job && typeof options.job === 'string') {
try {
companyInfo.value = JSON.parse(options.job);
} catch (error) {
console.error('Error parsing job data:', error);
companyInfo.value = { jobInfoList: [] };
}
// 处理companyId参数
} else if (options.companyId) {
console.log('Getting company details by companyId:', options.companyId);
// 调用API获取公司详情
getCompanyDetailsById(options.companyId);
// 处理bussinessId参数如果需要
} else if (options.bussinessId) {
console.log('Handling bussinessId:', options.bussinessId);
// 这里可以根据需要处理bussinessId
// 目前先作为companyId处理
getCompanyDetailsById(options.bussinessId);
} else {
console.warn('No valid parameters provided');
companyInfo.value = { jobInfoList: [] };
}
});
// 根据scale值获取对应的文本
function getScaleLabel(scale) {
// 处理空值、undefined、null等情况
if (scale === undefined || scale === null || scale === '') return '-';
try {
// 调试日志追踪scale值处理
console.log('Processing scale value:', scale);
// 确保scale是字符串类型
const scaleStr = String(scale);
// 使用dictStore获取企业规模标签
const label = dictStore.dictLabel('scale', scaleStr);
console.log('Retrieved scale label:', label, 'for scale:', scaleStr);
// 如果字典中没有找到对应标签,使用预设的默认映射
if (!label) {
const defaultScaleMap = {
'1': '少于50人',
'2': '50-100人',
'3': '100-500人',
'4': '500-1000人',
'5': '1000人以上'
};
const defaultLabel = defaultScaleMap[scaleStr];
console.log('Using default label:', defaultLabel, 'for scale:', scaleStr);
return defaultLabel || '-';
}
return label;
} catch (error) {
console.error('获取企业规模标签失败:', error);
return '-';
}
}
</script>
<style lang="stylus" scoped>