From bcb5c6af19cd07c9ba67f890042b11f236e51488 Mon Sep 17 00:00:00 2001 From: francis-fh Date: Tue, 16 Jun 2026 19:11:36 +0800 Subject: [PATCH] 11 --- .codegraph/.gitignore | 16 +++++++++++++ .codegraph/daemon.pid | 6 +++++ src/components/Footer/index.tsx | 10 ++++---- src/pages/JobPortal/Detail/index.tsx | 25 ++++++++++++++++++-- src/pages/JobPortal/List/index.tsx | 34 +++++++++++++++++++++++++--- src/pages/ThirdPartyRedirect.tsx | 2 +- src/services/jobportal/user.ts | 9 ++++++++ 7 files changed, 91 insertions(+), 11 deletions(-) create mode 100644 .codegraph/.gitignore create mode 100644 .codegraph/daemon.pid diff --git a/.codegraph/.gitignore b/.codegraph/.gitignore new file mode 100644 index 0000000..9de0f16 --- /dev/null +++ b/.codegraph/.gitignore @@ -0,0 +1,16 @@ +# CodeGraph data files +# These are local to each machine and should not be committed + +# Database +*.db +*.db-wal +*.db-shm + +# Cache +cache/ + +# Logs +*.log + +# Hook markers +.dirty diff --git a/.codegraph/daemon.pid b/.codegraph/daemon.pid new file mode 100644 index 0000000..942b784 --- /dev/null +++ b/.codegraph/daemon.pid @@ -0,0 +1,6 @@ +{ + "pid": 8432, + "version": "0.9.9", + "socketPath": "\\\\.\\pipe\\codegraph-ae68fa88b3ffb91a", + "startedAt": 1781608072582 +} diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index 28969f1..a3aa0b2 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -5,19 +5,19 @@ import {getYear} from '@/utils/tools' const Footer: React.FC = () => { return ( { } }, [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 ? '已投递' : '立即申请'} diff --git a/src/pages/JobPortal/List/index.tsx b/src/pages/JobPortal/List/index.tsx index d9cda51..38f120d 100644 --- a/src/pages/JobPortal/List/index.tsx +++ b/src/pages/JobPortal/List/index.tsx @@ -26,7 +26,7 @@ import { import { history, useLocation } from '@umijs/max'; import { getJobList } from '@/services/common/jobTitle'; import JobPortalHeader from '@/components/JobPortalHeader'; -import { favoriteJob, unfavoriteJob, applyJob } from '@/services/jobportal/user'; +import { favoriteJob, unfavoriteJob, applyJob, browseJob } from '@/services/jobportal/user'; import { ensureJobPortalLogin, requireJobPortalUserId } from '@/utils/jobPortalAuth'; import { getDictValueEnum } from '@/services/system/dict'; import { getDictLabel, findTreeLabelById, resolveIndustryLabel } from '@/utils/jobPortalDict'; @@ -321,6 +321,20 @@ const JobListPage: React.FC = () => { } }, [selectedJob]); + // 当 selectedJob 变化时,上报浏览记录(仅登录) + useEffect(() => { + if (!selectedJob) return; + if (!isJobPortalLoggedIn()) { + return; + } + const jobIdNum = Number(selectedJob?.jobId || selectedJob?.id); + if (!Number.isNaN(jobIdNum) && jobIdNum > 0) { + browseJob({ jobId: jobIdNum }).catch(() => { + // 浏览上报失败不阻塞页面 + }); + } + }, [selectedJob]); + const fetchCompetitiveness = async (jobIdNum: number) => { if (!isJobPortalLoggedIn()) { setOverallScore(0); @@ -491,6 +505,15 @@ const JobListPage: React.FC = () => { }); if (response?.code === 200) { message.success('申请成功'); + if (selectedJob) { + setSelectedJob({ ...selectedJob, isApply: 1 }); + setJobList(jobList.map(job => + (job.jobId === jobId || job.id === jobId) ? { ...job, isApply: 1 } : job + )); + setFilteredJobList(filteredJobList.map(job => + (job.jobId === jobId || job.id === jobId) ? { ...job, isApply: 1 } : job + )); + } } else { message.error(response?.msg || '申请失败'); } @@ -795,8 +818,13 @@ const JobListPage: React.FC = () => { > {favorited ? '已收藏' : '收藏'} - diff --git a/src/pages/ThirdPartyRedirect.tsx b/src/pages/ThirdPartyRedirect.tsx index cb6bc3e..a2d1592 100644 --- a/src/pages/ThirdPartyRedirect.tsx +++ b/src/pages/ThirdPartyRedirect.tsx @@ -112,7 +112,7 @@ export default function ThirdPartyRedirect() { console.log('userType value:', userInfo?.userType, 'type:', typeof userInfo?.userType); if (menus && menus.length > 0 && userInfo?.userType !== 'common') { setRemoteMenu(menus); - window.location.replace('http://39.98.44.136:6024/shihezi/management/management/list/index') + window.location.replace('http://39.98.44.136:6024/shihezi/management/management/list/index?type=1') } } diff --git a/src/services/jobportal/user.ts b/src/services/jobportal/user.ts index ca305e2..df64aef 100644 --- a/src/services/jobportal/user.ts +++ b/src/services/jobportal/user.ts @@ -70,6 +70,15 @@ export async function applyJob(params: { jobId: string; userId: string }, option }); } +/** 浏览岗位 POST /api/cms/job/browse */ +export async function browseJob(params: { jobId: number }, options?: Record) { + return request('/api/cms/job/browse', { + method: 'POST', + data: params, + ...(options || {}), + }); +} + /** 获取消息列表 GET /api/cms/appUser/getMessages */ export async function getMessages(params?: { pageNum?: number; pageSize?: number; noticeType?: number; isRead?: number }, options?: Record) { return request('/api/cms/notice/appNoticList', {