11
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled
This commit is contained in:
@@ -34,7 +34,7 @@ import {
|
||||
import { isJobPortalLoggedIn } from '@/utils/jobPortalAuth';
|
||||
import { favoriteJob, unfavoriteJob, applyJob } from '@/services/jobportal/user';
|
||||
import { ensureJobPortalLogin, PORTAL_LOGIN_URL } from '@/utils/jobPortalAuth';
|
||||
import { getDictLabel, findTreeLabelById } from '@/utils/jobPortalDict';
|
||||
import { getDictLabel, resolveIndustryLabel } from '@/utils/jobPortalDict';
|
||||
import { getDictValueEnum } from '@/services/system/dict';
|
||||
import { getCmsIndustryTreeList } from '@/services/classify/industry';
|
||||
import type { DictValueEnumObj } from '@/components/DictTag';
|
||||
@@ -113,9 +113,9 @@ const transformJobData = (jobData: any) => {
|
||||
<p>3. 具备良好的团队协作能力;</p>
|
||||
`,
|
||||
companyInfo: {
|
||||
name: jobData.companyName || jobData.company || jobData.companyVo?.name,
|
||||
scale: jobData.companyVo?.scale ?? jobData.scale ?? '',
|
||||
industry: jobData.companyVo?.industry ?? jobData.industry ?? '',
|
||||
name: jobData.companyName || jobData.companyVo?.name || jobData.company,
|
||||
scale: jobData.scale ?? '',
|
||||
industry: jobData.industry ?? '',
|
||||
description:
|
||||
jobData.companyVo?.companyDescription
|
||||
|| jobData.companyDescription
|
||||
@@ -217,20 +217,22 @@ const JobDetailPage: React.FC = () => {
|
||||
}, []);
|
||||
|
||||
const companyMetaItems = useMemo(() => {
|
||||
const company = originalJobData?.companyVo || {};
|
||||
const rawScale = company.scale ?? originalJobData?.scale ?? jobDetail.companyInfo?.scale;
|
||||
const rawIndustry =
|
||||
company.industry ?? originalJobData?.industry ?? jobDetail.companyInfo?.industry;
|
||||
if (!originalJobData) {
|
||||
return [];
|
||||
}
|
||||
const rawScale = originalJobData.scale;
|
||||
const rawIndustry = originalJobData.industry;
|
||||
|
||||
const items: string[] = [];
|
||||
const scaleLabel = getDictLabel(scaleEnum, rawScale) || rawScale;
|
||||
const industryLabel = findTreeLabelById(industryTree, rawIndustry) || rawIndustry;
|
||||
|
||||
if (rawScale != null && rawScale !== '') {
|
||||
const scaleLabel = getDictLabel(scaleEnum, rawScale) || String(rawScale);
|
||||
if (scaleLabel) items.push(scaleLabel);
|
||||
}
|
||||
const industryLabel = resolveIndustryLabel(industryTree, rawIndustry);
|
||||
if (industryLabel) items.push(industryLabel);
|
||||
|
||||
return items;
|
||||
}, [originalJobData, jobDetail.companyInfo, scaleEnum, industryTree]);
|
||||
}, [originalJobData, scaleEnum, industryTree]);
|
||||
|
||||
useEffect(() => {
|
||||
// 首先尝试从传递的数据中获取职位信息
|
||||
|
||||
@@ -29,7 +29,7 @@ import { getDictValueEnum } from '@/services/system/dict';
|
||||
import JobPortalHeader from '@/components/JobPortalHeader';
|
||||
import { favoriteJob, unfavoriteJob, applyJob } from '@/services/jobportal/user';
|
||||
import { ensureJobPortalLogin, PORTAL_LOGIN_URL } from '@/utils/jobPortalAuth';
|
||||
import { getDictLabel, findTreeLabelById } from '@/utils/jobPortalDict';
|
||||
import { getDictLabel, findTreeLabelById, resolveIndustryLabel } from '@/utils/jobPortalDict';
|
||||
import { getJobTitleTreeSelect } from '@/services/common/jobTitle';
|
||||
import { getCmsIndustryTreeList } from '@/services/classify/industry';
|
||||
import type { DictValueEnumObj } from '@/components/DictTag';
|
||||
@@ -256,15 +256,15 @@ const JobListPage: React.FC = () => {
|
||||
|
||||
const selectedCompanyMetaItems = useMemo(() => {
|
||||
if (!selectedJob) return [];
|
||||
const company = selectedJob.companyVo || {};
|
||||
const rawScale = company.scale ?? selectedJob.scale;
|
||||
const rawIndustry = company.industry ?? selectedJob.industry;
|
||||
const rawScale = selectedJob.scale;
|
||||
const rawIndustry = selectedJob.industry;
|
||||
|
||||
const items: string[] = [];
|
||||
const scaleLabel = getDictLabel(scaleEnum, rawScale) || rawScale;
|
||||
const industryLabel = findTreeLabelById(industryTree, rawIndustry) || rawIndustry;
|
||||
|
||||
if (rawScale != null && rawScale !== '') {
|
||||
const scaleLabel = getDictLabel(scaleEnum, rawScale) || String(rawScale);
|
||||
if (scaleLabel) items.push(scaleLabel);
|
||||
}
|
||||
const industryLabel = resolveIndustryLabel(industryTree, rawIndustry);
|
||||
if (industryLabel) items.push(industryLabel);
|
||||
return items;
|
||||
}, [selectedJob, scaleEnum, industryTree]);
|
||||
|
||||
@@ -60,5 +60,18 @@ export function findTreeLabelById(
|
||||
return '';
|
||||
}
|
||||
|
||||
/** 所属行业:数字 id 走行业树,已是文案则直接展示 */
|
||||
export function resolveIndustryLabel(
|
||||
tree: any[] | undefined,
|
||||
value?: string | number | null,
|
||||
): string {
|
||||
const str = value == null ? '' : String(value).trim();
|
||||
if (!str) return '';
|
||||
if (/^\d+$/.test(str)) {
|
||||
return findTreeLabelById(tree, str) || str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/** @deprecated 使用 findTreeLabelById */
|
||||
export const findIndustryLabelInTree = findTreeLabelById;
|
||||
|
||||
Reference in New Issue
Block a user