From 2e88885a27066e16740cbb8b3bef16cd712b7a81 Mon Sep 17 00:00:00 2001 From: lapuda <577732344@qq.com> Date: Wed, 15 Jul 2026 15:46:15 +0800 Subject: [PATCH] feat: implement job management for companies in public job fairs --- config/routes.ts | 1 + scripts/deploy-frontend.sh | 4 +- scripts/nginx-shz-admin.conf | 44 +++ src/access.ts | 12 +- .../Jobfair/PublicJobFair/Detail/index.tsx | 326 +++++++++++++----- .../components/CompanyJobManageModal.tsx | 170 +++++++++ .../PublicJobFair/components/JobFormModal.tsx | 79 +++++ src/pages/Jobfair/PublicJobFair/index.tsx | 183 +++++++--- src/pages/ThirdPartyRedirect.tsx | 5 +- src/services/jobfair/publicJobFair.ts | 84 ++++- src/types/jobfair/publicJobFair.d.ts | 27 +- 11 files changed, 804 insertions(+), 131 deletions(-) create mode 100644 scripts/nginx-shz-admin.conf create mode 100644 src/pages/Jobfair/PublicJobFair/components/CompanyJobManageModal.tsx create mode 100644 src/pages/Jobfair/PublicJobFair/components/JobFormModal.tsx diff --git a/config/routes.ts b/config/routes.ts index ae0a8a8..c75e63b 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -243,6 +243,7 @@ export default [ name: '招聘会详情', path: '/jobfair/public-job-fair/detail', component: './Jobfair/PublicJobFair/Detail', + access: 'canViewPublicJobFairDetail', }, { name: '报名人员', diff --git a/scripts/deploy-frontend.sh b/scripts/deploy-frontend.sh index 9adb625..7213774 100755 --- a/scripts/deploy-frontend.sh +++ b/scripts/deploy-frontend.sh @@ -4,7 +4,7 @@ set -Eeuo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" BUILD_DIR="${BUILD_DIR:-${ROOT_DIR}/shihezi}" -DEPLOY_HOST="${DEPLOY_HOST:-39.98.44.136}" +DEPLOY_HOST="${DEPLOY_HOST:-47.111.103.66}" DEPLOY_USER="${DEPLOY_USER:-root}" DEPLOY_SSH_PORT="${DEPLOY_SSH_PORT:-22}" DEPLOY_PATH="${DEPLOY_PATH:-/opt/service/project/shz-admin/dist}" @@ -40,7 +40,7 @@ usage() { 默认配置(均可通过环境变量覆盖): DEPLOY_USER SSH 用户名,默认 root DEPLOY_PATH 服务器上的前端静态文件目录,默认 /opt/service/project/shz-admin/dist - DEPLOY_HOST SSH 主机,默认 39.98.44.136 + DEPLOY_HOST SSH 主机,默认 47.111.103.66 DEPLOY_SSH_PORT SSH 端口,默认 22 BUILD_DIR 本地构建目录,默认 ./shihezi(由 config/config.ts 的 outputPath 决定) YARN_CMD Yarn 命令,默认 yarn diff --git a/scripts/nginx-shz-admin.conf b/scripts/nginx-shz-admin.conf new file mode 100644 index 0000000..245f14d --- /dev/null +++ b/scripts/nginx-shz-admin.conf @@ -0,0 +1,44 @@ +# shz-admin 前端与现有 SHZ 后端代理配置。 +# 安装位置:/etc/nginx/default.d/shz-admin.conf + +client_max_body_size 100m; + +location = /shihezi { + return 301 /shihezi/; +} + +location = /shihezi/index.html { + alias /opt/service/project/shz-admin/dist/index.html; + add_header Cache-Control "no-cache, no-store, must-revalidate" always; +} + +location /shihezi/ { + alias /opt/service/project/shz-admin/dist/; + try_files $uri $uri/ /shihezi/index.html; + add_header Cache-Control "no-cache" always; +} + +location /api/shihezi/ { + # 对外保留 /api/shihezi/ 前缀,转发到本机后端时剥离该前缀。 + proxy_pass http://127.0.0.1:9091/; + proxy_http_version 1.1; + proxy_set_header Host $proxy_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 300s; + proxy_send_timeout 300s; + proxy_buffering off; +} + +location /data/file/ { + proxy_pass http://127.0.0.1:9091/data/file/; + proxy_http_version 1.1; + proxy_set_header Host $proxy_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 300s; +} diff --git a/src/access.ts b/src/access.ts index 3d5bbdb..2552af4 100644 --- a/src/access.ts +++ b/src/access.ts @@ -5,6 +5,14 @@ import { clearTokenCache } from './utils/tokenCache'; * */ export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) { const { currentUser } = initialState ?? {}; + const roles = Array.isArray(currentUser?.roles) ? (currentUser.roles as unknown[]) : []; + const isEnterprise = + currentUser?.userType === 'view' || + roles.some((role) => { + if (typeof role === 'string') return role === 'view'; + if (!role || typeof role !== 'object') return false; + return (role as { roleKey?: string }).roleKey === 'view'; + }); const hasPerms = (perm: string) => { return matchPermission(initialState?.currentUser?.permissions, perm); }; @@ -13,6 +21,8 @@ export default function access(initialState: { currentUser?: API.CurrentUser } | }; return { canAdmin: currentUser && currentUser.access === 'admin', + isEnterprise, + canViewPublicJobFairDetail: !isEnterprise && hasPerms('cms:publicJobFair:query'), hasPerms, roleFiler, }; @@ -23,7 +33,7 @@ export function setSessionToken( refresh_token: string | undefined, expireTime: number, lcToken: string | undefined, -): void{ +): void { if (access_token) { localStorage.setItem('access_token', access_token); } else { diff --git a/src/pages/Jobfair/PublicJobFair/Detail/index.tsx b/src/pages/Jobfair/PublicJobFair/Detail/index.tsx index 82f9578..3a10486 100644 --- a/src/pages/Jobfair/PublicJobFair/Detail/index.tsx +++ b/src/pages/Jobfair/PublicJobFair/Detail/index.tsx @@ -1,25 +1,58 @@ import React, { useEffect, useState } from 'react'; -import { history, useSearchParams } from '@umijs/max'; -import { Button, Card, Collapse, Descriptions, message, Modal, Space, Tag, List } from 'antd'; +import { history, useAccess, useSearchParams } from '@umijs/max'; +import { + Button, + Card, + Collapse, + Descriptions, + Form, + Input, + List, + message, + Modal, + Radio, + Result, + Space, + Tag, +} from 'antd'; import { PageContainer } from '@ant-design/pro-components'; -import { ArrowLeftOutlined, PlusOutlined, DeleteOutlined } from '@ant-design/icons'; +import { ArrowLeftOutlined, AuditOutlined, DeleteOutlined, PlusOutlined } from '@ant-design/icons'; import { getPublicJobFairDetail, removeCompanyFromJobFair, removeJobFromJobFair, + reviewPublicJobFairCompany, } from '@/services/jobfair/publicJobFair'; import CompanySelectModal from '../components/CompanySelectModal'; import JobSelectModal from '../components/JobSelectModal'; +type ReviewFormValues = { + reviewStatus: '1' | '2'; + reviewRemark?: string; +}; + +const reviewStatusMap: Record = { + '0': { text: '待审核', color: 'gold' }, + '1': { text: '已通过', color: 'green' }, + '2': { text: '已驳回', color: 'red' }, +}; + const JobFairDetail: React.FC = () => { + const access = useAccess(); + const isEnterprise = Boolean(access.isEnterprise); const [searchParams] = useSearchParams(); const jobFairId = searchParams.get('id') || ''; - const [detail, setDetail] = useState(); + const [detail, setDetail] = useState(); const [loading, setLoading] = useState(false); const [companyModalOpen, setCompanyModalOpen] = useState(false); const [jobModalOpen, setJobModalOpen] = useState(false); const [currentCompany, setCurrentCompany] = useState(); + const [reviewModalOpen, setReviewModalOpen] = useState(false); + const [reviewCompany, setReviewCompany] = useState(); + const [reviewSubmitting, setReviewSubmitting] = useState(false); + const [reviewForm] = Form.useForm(); + const reviewStatus = Form.useWatch('reviewStatus', reviewForm); const fetchDetail = async () => { if (!jobFairId) return; @@ -28,19 +61,23 @@ const JobFairDetail: React.FC = () => { setLoading(false); if (res.code === 200) { setDetail(res.data); + } else { + message.error(res.msg || '招聘会详情获取失败'); } }; useEffect(() => { - fetchDetail(); - }, [jobFairId]); + if (!isEnterprise) { + fetchDetail(); + } + }, [jobFairId, isEnterprise]); - const handleRemoveCompany = (id: string) => { + const handleRemoveCompany = (company: API.PublicJobFair.CompanyInfo) => { Modal.confirm({ title: '确认移除', - content: '确定要移除该企业吗?', + content: `确定移除「${company.companyName}」吗?审核未通过的企业不能移除。`, onOk: async () => { - const res = await removeCompanyFromJobFair(id); + const res = await removeCompanyFromJobFair(company.id); if (res.code === 200) { message.success('移除成功'); fetchDetail(); @@ -51,24 +88,64 @@ const JobFairDetail: React.FC = () => { }); }; - const handleRemoveJob = (id: string) => { + const handleRemoveJob = (job: API.PublicJobFair.JobInfo) => { Modal.confirm({ - title: '确认移除', - content: '确定要移除该岗位吗?', + title: '确认移除岗位', + content: `确定移除「${job.jobTitle}」吗?`, onOk: async () => { - const res = await removeJobFromJobFair(id); + const res = job.fairRelationId + ? await removeJobFromJobFair(job.fairRelationId) + : { code: 500, msg: '未找到招聘会岗位关联' }; if (res.code === 200) { - message.success('移除成功'); + message.success('岗位已移除'); fetchDetail(); } else { - message.error(res.msg || '移除失败'); + message.error(res.msg || '岗位移除失败'); } }, }); }; + const openReviewModal = (company: API.PublicJobFair.CompanyInfo) => { + setReviewCompany(company); + reviewForm.setFieldsValue({ reviewStatus: '1', reviewRemark: '' }); + setReviewModalOpen(true); + }; + + const submitReview = async (values: ReviewFormValues) => { + if (!reviewCompany) return; + setReviewSubmitting(true); + const res = await reviewPublicJobFairCompany(jobFairId, reviewCompany.id, values); + setReviewSubmitting(false); + if (res.code === 200) { + message.success('审核完成'); + setReviewModalOpen(false); + setReviewCompany(undefined); + fetchDetail(); + } else { + message.error(res.msg || '审核失败'); + } + }; + const jobFairTypeMap: Record = { '1': '线上', '2': '线下' }; + if (isEnterprise) { + return ( + + history.replace('/jobfair/public-job-fair')}> + 返回招聘会列表 + + } + /> + + ); + } + return ( { ], }} > - history.push(`/jobfair/public-job-fair/signups?id=${jobFairId}`)}> - 查看全部报名 - - }> + history.push(`/jobfair/public-job-fair/signups?id=${jobFairId}`)}> + 查看全部报名 + + } + > {detail?.jobFairTitle} @@ -107,82 +188,135 @@ const JobFairDetail: React.FC = () => { {detail?.crossDomainCities || '-'} - {detail?.jobFairIntroduction} + + {detail?.jobFairIntroduction} + } onClick={() => setCompanyModalOpen(true)}> - 添加企业 - + access.hasPerms('cms:publicJobFair:company:add') ? ( + + ) : null } > {detail?.companyList?.length ? ( - {detail.companyList.map((company) => ( - - {company.companyName} - {company.industry} - {company.scale} - - } - extra={ - e.stopPropagation()}> - - - - } - > - ( - { + const reviewStatusValue = company.reviewStatus || '0'; + const reviewStatus = reviewStatusMap[reviewStatusValue] || reviewStatusMap['0']; + const isApproved = reviewStatusValue === '1'; + const canReview = access.hasPerms('cms:publicJobFair:review'); + const canAdminAddJob = Boolean( + isApproved && access.hasPerms('cms:publicJobFair:job:add'), + ); + const canRemoveCompany = Boolean( + isApproved && access.hasPerms('cms:publicJobFair:company:remove'), + ); + const canRemoveJob = + isApproved && + access.hasPerms('cms:publicJobFair:job:remove') && + (company.jobInfoList || []).length > 0; + + return ( + + {company.companyName} + {company.industry} + {company.scale} + {reviewStatus.text} + + } + extra={ + e.stopPropagation()}> + {canReview && ( , - ]} - > - - {job.jobTitle} - {job.minSalary}K-{job.maxSalary}K - {job.education} - 招{job.vacancies}人 - - + 审核 + + )} + {canAdminAddJob && ( + + )} + {canRemoveCompany && ( + + )} + + } + > + {company.reviewStatus === '2' && company.reviewRemark && ( +
+ 驳回原因:{company.reviewRemark} +
)} - locale={{ emptyText: '暂无岗位' }} - /> -
- ))} + ( + handleRemoveJob(job)} + > + 移除 + , + ] + : []), + ]} + > + + {job.jobTitle} + + {job.minSalary || job.maxSalary + ? `${job.minSalary || 0}-${job.maxSalary || 0} 元/月` + : '面议'} + + {job.education && {job.education}} + {job.experience && {job.experience}} + {job.vacancies !== undefined && 招{job.vacancies}人} + + + )} + locale={{ emptyText: '暂无岗位' }} + /> + + ); + })}
) : (
暂无参会企业
@@ -213,6 +347,34 @@ const JobFairDetail: React.FC = () => { fetchDetail(); }} /> + + { + setReviewModalOpen(false); + setReviewCompany(undefined); + }} + onOk={() => reviewForm.submit()} + destroyOnClose + > +
+ + + 通过 + 驳回 + + + + + +
+
); }; diff --git a/src/pages/Jobfair/PublicJobFair/components/CompanyJobManageModal.tsx b/src/pages/Jobfair/PublicJobFair/components/CompanyJobManageModal.tsx new file mode 100644 index 0000000..cf7a06e --- /dev/null +++ b/src/pages/Jobfair/PublicJobFair/components/CompanyJobManageModal.tsx @@ -0,0 +1,170 @@ +import React, { useCallback, useEffect, useState } from 'react'; +import { Button, List, message, Modal, Space, Tag } from 'antd'; +import { DeleteOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons'; +import { + addCurrentCompanyJob, + getCurrentCompanyJobs, + removeCurrentCompanyJob, + updateCurrentCompanyJob, + type PublicJobFairJobForm, +} from '@/services/jobfair/publicJobFair'; +import JobFormModal from './JobFormModal'; + +interface CompanyJobManageModalProps { + open: boolean; + jobFairId: string; + jobFairTitle?: string; + onCancel: () => void; +} + +/** 企业报名通过后,直接在列表弹窗维护自己的报名岗位。 */ +const CompanyJobManageModal: React.FC = ({ + open, + jobFairId, + jobFairTitle, + onCancel, +}) => { + const [jobs, setJobs] = useState([]); + const [loading, setLoading] = useState(false); + const [jobFormOpen, setJobFormOpen] = useState(false); + const [editingJob, setEditingJob] = useState(); + + const loadJobs = useCallback(async () => { + if (!jobFairId) return; + setLoading(true); + try { + const res = await getCurrentCompanyJobs(jobFairId); + if (res.code === 200) { + setJobs(res.data || []); + } else { + message.error(res.msg || '报名岗位获取失败'); + } + } catch { + message.error('报名岗位获取失败,请稍后重试'); + } finally { + setLoading(false); + } + }, [jobFairId]); + + useEffect(() => { + if (!open) return; + setEditingJob(undefined); + void loadJobs(); + }, [open, loadJobs]); + + const closeJobForm = () => { + setJobFormOpen(false); + setEditingJob(undefined); + }; + + const submitJob = async (values: PublicJobFairJobForm) => { + if (editingJob) { + return updateCurrentCompanyJob(jobFairId, editingJob.jobId, values); + } + return addCurrentCompanyJob(jobFairId, values); + }; + + const removeJob = (job: API.PublicJobFair.JobInfo) => { + Modal.confirm({ + title: '确认删除报名岗位', + content: `确定删除「${job.jobTitle}」吗?删除后需要重新新增才能报名该岗位。`, + onOk: async () => { + const res = await removeCurrentCompanyJob(jobFairId, job.jobId); + if (res.code === 200) { + message.success('报名岗位已删除'); + loadJobs(); + } else { + message.error(res.msg || '报名岗位删除失败'); + } + }, + }); + }; + + return ( + <> + { + closeJobForm(); + onCancel(); + }} + destroyOnClose + > +
+ +
+ ( + } + onClick={() => { + setEditingJob(job); + setJobFormOpen(true); + }} + > + 编辑 + , + , + ]} + > + + {job.jobTitle} + + {job.minSalary || job.maxSalary + ? `${job.minSalary || 0}-${job.maxSalary || 0} 元/月` + : '面议'} + + {job.education && {job.education}} + {job.experience && {job.experience}} + {job.vacancies !== undefined && 招{job.vacancies}人} + + + )} + /> +
+ + { + closeJobForm(); + loadJobs(); + }} + /> + + ); +}; + +export default CompanyJobManageModal; diff --git a/src/pages/Jobfair/PublicJobFair/components/JobFormModal.tsx b/src/pages/Jobfair/PublicJobFair/components/JobFormModal.tsx new file mode 100644 index 0000000..a9c1292 --- /dev/null +++ b/src/pages/Jobfair/PublicJobFair/components/JobFormModal.tsx @@ -0,0 +1,79 @@ +import React, { useEffect } from 'react'; +import { ModalForm, ProFormDigit, ProFormText, ProFormTextArea } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import type { PublicJobFairJobForm } from '@/services/jobfair/publicJobFair'; + +interface JobFormModalProps { + open: boolean; + job?: API.PublicJobFair.JobInfo; + onCancel: () => void; + onSuccess: () => void; + onSubmit: (values: PublicJobFairJobForm) => Promise; +} + +/** 企业报名岗位新增/编辑表单。企业 ID 由后端从登录用户解析,不接受前端传入。 */ +const JobFormModal: React.FC = ({ + open, + job, + onCancel, + onSuccess, + onSubmit, +}) => { + const [form] = Form.useForm(); + + useEffect(() => { + if (!open) return; + form.resetFields(); + if (job) { + form.setFieldsValue({ + jobId: job.jobId, + jobTitle: job.jobTitle, + minSalary: job.minSalary, + maxSalary: job.maxSalary, + education: job.education, + experience: job.experience, + vacancies: job.vacancies, + jobAddress: job.jobAddress, + description: job.description, + jobCategory: job.jobCategory, + type: job.type, + }); + } + }, [open, job, form]); + + return ( + + title={job ? '编辑报名岗位' : '新增报名岗位'} + form={form} + open={open} + width={680} + modalProps={{ destroyOnClose: true, onCancel }} + onFinish={async (values) => { + const res = await onSubmit({ ...values, jobId: job?.jobId }); + if (res.code === 200) { + message.success(job ? '岗位修改成功' : '岗位新增成功'); + onSuccess(); + return true; + } + message.error(res.msg || '岗位操作失败'); + return false; + }} + > + + + + + + + + + + ); +}; + +export default JobFormModal; diff --git a/src/pages/Jobfair/PublicJobFair/index.tsx b/src/pages/Jobfair/PublicJobFair/index.tsx index f47d735..c558630 100644 --- a/src/pages/Jobfair/PublicJobFair/index.tsx +++ b/src/pages/Jobfair/PublicJobFair/index.tsx @@ -1,26 +1,37 @@ import React, { useRef, useState, useEffect } from 'react'; import { useAccess, history } from '@umijs/max'; -import { Button, FormInstance, message, Modal } from 'antd'; +import { Button, FormInstance, message, Modal, Tag } from 'antd'; import { ActionType, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components'; -import { PlusOutlined, DeleteOutlined, FormOutlined, ExportOutlined, EyeOutlined } from '@ant-design/icons'; +import { + PlusOutlined, + DeleteOutlined, + FormOutlined, + ExportOutlined, + EyeOutlined, +} from '@ant-design/icons'; import { getDictValueEnum } from '@/services/system/dict'; import DictTag from '@/components/DictTag'; import { getPublicJobFairList, getPublicJobFairDetail, + signupPublicJobFair, addPublicJobFair, updatePublicJobFair, deletePublicJobFair, exportPublicJobFair, } from '@/services/jobfair/publicJobFair'; import EditModal from './components/EditModal'; +import CompanyJobManageModal from './components/CompanyJobManageModal'; const PublicJobFairList: React.FC = () => { const access = useAccess(); + const isEnterprise = Boolean(access.isEnterprise); const formRef = useRef(); const actionRef = useRef(); const [modalVisible, setModalVisible] = useState(false); const [currentRow, setCurrentRow] = useState(); + const [companyJobModalOpen, setCompanyJobModalOpen] = useState(false); + const [currentJobFair, setCurrentJobFair] = useState(); const [jobFairTypeEnum, setJobFairTypeEnum] = useState({}); const [yesNoEnum, setYesNoEnum] = useState({}); const [selectedRowKeys, setSelectedRowKeys] = useState([]); @@ -47,6 +58,22 @@ const PublicJobFairList: React.FC = () => { }); }; + const handleSignup = (record: API.PublicJobFair.JobFairItem) => { + Modal.confirm({ + title: '报名线上招聘会', + content: `确定报名「${record.jobFairTitle}」吗?报名后需要等待管理员审核。`, + onOk: async () => { + const res = await signupPublicJobFair(record.jobFairId); + if (res.code === 200) { + message.success('报名成功,请等待管理员审核'); + actionRef.current?.reload(); + } else { + message.error(res.msg || '报名失败'); + } + }, + }); + }; + const buildListSearchParams = (values: Record): API.PublicJobFair.ListParams => { const { dateRange, current, pageSize, ...rest } = values || {}; const params = { ...rest } as API.PublicJobFair.ListParams; @@ -102,6 +129,32 @@ const PublicJobFairList: React.FC = () => { valueEnum: jobFairTypeEnum, render: (_, record) => , }, + { + title: '报名审核状态', + dataIndex: 'enterpriseReviewStatus', + hideInSearch: true, + hideInTable: !isEnterprise, + render: (_, record) => { + if (record.isSignUp === undefined) return '-'; + if (record.isSignUp !== '1') return 未报名; + const statusMap: Record = { + '0': { text: '待审核', color: 'gold' }, + '1': { text: '已通过', color: 'green' }, + '2': { text: '已驳回', color: 'red' }, + }; + const status = statusMap[record.enterpriseReviewStatus || '0'] || statusMap['0']; + return ( + + {status.text} + {record.enterpriseReviewComments && ( + + (有意见) + + )} + + ); + }, + }, { title: '是否跨域', dataIndex: 'isCrossDomain', @@ -130,46 +183,85 @@ const PublicJobFairList: React.FC = () => { { title: '操作', valueType: 'option', - width: 200, + width: 360, fixed: 'right', - render: (_, record) => [ - , - , - , - ], + render: (_, record) => { + const canViewDetail = !isEnterprise && access.hasPerms('cms:publicJobFair:query'); + const canSignUp = + isEnterprise && + access.hasPerms('cms:publicJobFair:signup') && + (record.canSignUp ?? (record.isSignUp !== '1' || record.enterpriseReviewStatus === '2')); + const canEditCompanyJobs = + isEnterprise && + access.hasPerms('cms:publicJobFair:job:edit') && + (record.canEditJobs ?? record.enterpriseReviewStatus === '1'); + + return [ + canViewDetail && ( + + ), + canSignUp && ( + + ), + canEditCompanyJobs && ( + + ), + , + , + ]; + }, }, ]; @@ -248,6 +340,15 @@ const PublicJobFairList: React.FC = () => { } }} /> + { + setCompanyJobModalOpen(false); + setCurrentJobFair(undefined); + }} + /> ); }; diff --git a/src/pages/ThirdPartyRedirect.tsx b/src/pages/ThirdPartyRedirect.tsx index a2d1592..b747caf 100644 --- a/src/pages/ThirdPartyRedirect.tsx +++ b/src/pages/ThirdPartyRedirect.tsx @@ -112,10 +112,11 @@ 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?type=1') + window.location.replace( + `${window.location.origin}/shihezi/management/management/list/index?type=1`, + ); } } - } else { message.error('暂时无法加载您的信息'); setIsError(true); diff --git a/src/services/jobfair/publicJobFair.ts b/src/services/jobfair/publicJobFair.ts index 5d31caa..63c1e33 100644 --- a/src/services/jobfair/publicJobFair.ts +++ b/src/services/jobfair/publicJobFair.ts @@ -3,6 +3,28 @@ import { downLoadXlsx } from '@/utils/downloadfile'; const BASE_URL = '/api/cms/publicJobFair'; +/** 企业报名审核请求 */ +export interface PublicJobFairCompanyReviewParams { + reviewStatus: '0' | '1' | '2'; + reviewRemark?: string; +} + +/** 企业报名岗位表单 */ +export interface PublicJobFairJobForm { + jobId?: number; + jobTitle: string; + minSalary?: number; + maxSalary?: number; + education?: string; + experience?: string; + vacancies?: number; + jobLocation?: string; + jobAddress?: string; + description?: string; + jobCategory?: string; + type?: string; +} + /** 跨域招聘会岗位列表项 */ export interface CrossDomainJobItem { jobId: number; @@ -61,6 +83,28 @@ export async function getPublicJobFairDetail(jobFairId: string) { }); } +/** 企业报名招聘会 */ +export async function signupPublicJobFair(jobFairId: string) { + return request(`${BASE_URL}/${jobFairId}/company/signup`, { + method: 'POST', + }); +} + +/** 管理员审核企业报名 */ +export async function reviewPublicJobFairCompany( + jobFairId: string, + relationId: string, + data: PublicJobFairCompanyReviewParams, +) { + return request( + `${BASE_URL}/${jobFairId}/companies/${relationId}/review`, + { + method: 'PUT', + data, + }, + ); +} + /** 新增招聘会 */ export async function addPublicJobFair(data: API.PublicJobFair.JobFairForm) { return request(BASE_URL, { @@ -92,7 +136,6 @@ export async function addCompanyToJobFair(data: API.PublicJobFair.AddCompanyPara }); } - /** 批量添加企业到招聘会 */ export async function batchAddCompanyToJobFair(data: API.PublicJobFair.AddCompanyParams[]) { return request(`${BASE_URL}/company/batch`, { @@ -131,8 +174,45 @@ export async function removeJobFromJobFair(id: string) { }); } +/** 企业新增报名岗位 */ +export async function addCurrentCompanyJob(jobFairId: string, data: PublicJobFairJobForm) { + return request(`${BASE_URL}/${jobFairId}/company/jobs`, { + method: 'POST', + data, + }); +} + +/** 企业修改报名岗位 */ +export async function updateCurrentCompanyJob( + jobFairId: string, + jobId: number, + data: PublicJobFairJobForm, +) { + return request(`${BASE_URL}/${jobFairId}/company/jobs/${jobId}`, { + method: 'PUT', + data, + }); +} + +/** 企业删除报名岗位 */ +export async function removeCurrentCompanyJob(jobFairId: string, jobId: number) { + return request(`${BASE_URL}/${jobFairId}/company/jobs/${jobId}`, { + method: 'DELETE', + }); +} + +/** 查询当前企业在招聘会中已报名的岗位 */ +export async function getCurrentCompanyJobs(jobFairId: string) { + return request(`${BASE_URL}/${jobFairId}/company/jobs`, { + method: 'GET', + }); +} + /** 查询招聘会报名列表 */ -export async function getJobFairSignups(jobFairId: string, params?: { userName?: string; status?: string }) { +export async function getJobFairSignups( + jobFairId: string, + params?: { userName?: string; status?: string }, +) { return request(`${BASE_URL}/signups/${jobFairId}`, { method: 'GET', params, diff --git a/src/types/jobfair/publicJobFair.d.ts b/src/types/jobfair/publicJobFair.d.ts index 2d49cb8..76980c0 100644 --- a/src/types/jobfair/publicJobFair.d.ts +++ b/src/types/jobfair/publicJobFair.d.ts @@ -34,6 +34,12 @@ declare namespace API.PublicJobFair { isCrossDomain?: string; crossDomainCities?: string; createTime?: string; + isSignUp?: string; + canSignUp?: boolean; + canEditJobs?: boolean; + enterpriseId?: string; + enterpriseReviewStatus?: '0' | '1' | '2'; + enterpriseReviewComments?: string; } /** 招聘会列表响应 */ @@ -47,6 +53,7 @@ declare namespace API.PublicJobFair { /** 岗位信息 */ export interface JobInfo { id?: string; + fairRelationId?: string; jobId: number; jobTitle: string; minSalary?: number; @@ -54,6 +61,10 @@ declare namespace API.PublicJobFair { education?: string; experience?: string; vacancies?: number; + jobAddress?: string; + description?: string; + jobCategory?: string; + type?: string; } /** 企业信息 */ @@ -64,10 +75,17 @@ declare namespace API.PublicJobFair { scale?: string; industry?: string; companyType?: string; + reviewStatus?: '0' | '1' | '2'; + reviewBy?: string; + reviewTime?: string; + reviewRemark?: string; + canReview?: boolean; + canAddJob?: boolean; + canRemoveCompany?: boolean; + canEditJobs?: boolean; jobInfoList?: JobInfo[]; } - /** 招聘会详情响应 */ export interface DetailResult { code: number; @@ -137,4 +155,11 @@ declare namespace API.PublicJobFair { msg?: string; data?: any; } + + /** 当前企业报名岗位响应 */ + export interface CompanyJobsResult { + code: number; + msg?: string; + data?: JobInfo[]; + } }