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

This commit is contained in:
francis-fh
2026-06-16 19:11:36 +08:00
parent f2da3d6929
commit bcb5c6af19
7 changed files with 91 additions and 11 deletions

View File

@@ -32,7 +32,7 @@ import {
getEmptyCompetitivenessRadar,
} from '@/services/jobportal/competitiveness';
import { isJobPortalLoggedIn } from '@/utils/jobPortalAuth';
import { favoriteJob, unfavoriteJob, applyJob } from '@/services/jobportal/user';
import { favoriteJob, unfavoriteJob, applyJob, browseJob } from '@/services/jobportal/user';
import { ensureJobPortalLogin, requireJobPortalUserId } from '@/utils/jobPortalAuth';
import { getDictLabel, resolveIndustryLabel } from '@/utils/jobPortalDict';
import { getDictValueEnum } from '@/services/system/dict';
@@ -265,6 +265,23 @@ const JobDetailPage: React.FC = () => {
}
}, [originalJobData?.jobId, originalJobData?.id, id]);
// 仅登录且有真实岗位 id 时上报浏览记录
useEffect(() => {
if (!isJobPortalLoggedIn()) {
return;
}
const jobIdRaw =
originalJobData?.jobId
?? originalJobData?.id
?? id;
const jobIdNum = Number(jobIdRaw);
if (!Number.isNaN(jobIdNum) && jobIdNum > 0) {
browseJob({ jobId: jobIdNum }).catch(() => {
// 浏览上报失败不阻塞页面
});
}
}, [originalJobData?.jobId, originalJobData?.id, id]);
const fetchCompetitiveness = async (jobIdNum: number) => {
if (!isJobPortalLoggedIn()) {
setOverallScore(0);
@@ -385,6 +402,9 @@ const JobDetailPage: React.FC = () => {
});
if (response?.code === 200) {
message.success('申请成功');
if (originalJobData) {
setOriginalJobData({ ...originalJobData, isApply: 1 });
}
} else {
message.error(response?.msg || '申请失败');
}
@@ -456,9 +476,10 @@ const JobDetailPage: React.FC = () => {
type="primary"
size="large"
block
disabled={originalJobData?.isApply === 1}
onClick={handleApply}
>
{originalJobData?.isApply === 1 ? '已投递' : '立即申请'}
</Button>
</div>
</Col>