Files
shz-admin/src/services/jobportal/outdoorFair.ts
lapuda bdb1516570
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
feat: add enterprise outdoor fair viewer
2026-07-23 10:52:38 +08:00

322 lines
8.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { request } from '@umijs/max';
import type { VenueBoothItem } from './venueInfo';
/** 户外招聘会列表项 */
export interface OutdoorFairItem {
id: number;
/** 招聘会标题 */
title: string;
/** 举办单位 */
hostUnit: string;
/** 招聘会类型 */
fairType: string;
/** 举办区域 */
region: string;
/** 绑定场地ID */
venueId?: number;
/** 绑定场地 */
venueName?: string;
/** 举办地址 */
address: string;
/** 展位数量 */
boothCount: number;
/** 已预定摊位数 */
reservedBoothCount?: number;
/** 举办时间 */
holdTime: string;
/** 截止时间 */
endTime: string;
/** 开放申请 */
applyStartTime: string;
/** 截止申请 */
applyEndTime: string;
/** 是否开启线上申请 */
onlineApply: boolean;
/** 招聘会照片 */
photoUrl: string;
/** 招聘会简介 */
fairIntroduction?: string;
/** 招聘会整体流程 */
fairProcess?: string;
/** 企业参加招聘会需携带的资料 */
requiredMaterials?: string;
/** 企业到场须知 */
attendanceNotes?: string;
/** 当前企业ID */
companyId?: number;
/** 当前企业名称 */
companyName?: string;
/** 当前企业是否已报名 */
signedUp?: boolean;
/** 当前企业公共 H5 页面链接 */
h5Url?: string;
/** 二维码内容,通常与 h5Url 一致 */
qrCodeContent?: string;
/** 当前企业报名审核状态0待审核 1通过 2驳回 */
reviewStatus?: string;
/** 当前企业报名审核备注 */
reviewRemark?: string;
createTime?: string;
updateTime?: string;
}
/** 户外招聘会查询参数 */
export interface OutdoorFairListParams {
title?: string;
hostUnit?: string;
fairType?: string;
region?: string;
venueId?: number;
onlineApply?: boolean;
current?: number;
pageSize?: number;
}
/** 户外招聘会列表响应 */
export interface OutdoorFairListResult {
code: number;
msg?: string;
total: number;
rows: OutdoorFairItem[];
}
/** 户外招聘会新增/编辑表单 */
export interface OutdoorFairForm {
id?: number;
title: string;
hostUnit: string;
fairType: string;
region: string;
venueId?: number;
venueName?: string;
address: string;
boothCount: number;
holdTime: string;
endTime: string;
applyStartTime: string;
applyEndTime: string;
onlineApply: boolean;
photoUrl: string;
/** 招聘会简介 */
fairIntroduction?: string;
/** 招聘会整体流程 */
fairProcess?: string;
/** 企业参加招聘会需携带的资料 */
requiredMaterials?: string;
/** 企业到场须知 */
attendanceNotes?: string;
/** 更换场地时确认清空旧展位图与预定,并按新模板重建 */
resetBoothMap?: boolean;
}
/** 通用响应 */
export interface OutdoorFairCommonResult {
code: number;
msg?: string;
data?: any;
url?: string;
fileName?: string;
newFileName?: string;
originalFilename?: string;
}
/** 企业报名/二维码信息 */
export interface OutdoorFairCompanyQrCodeInfo {
fairId: number;
companyId: number;
companyName?: string;
signedUp?: boolean;
reviewStatus?: string;
reviewRemark?: string;
deviceId?: number;
deviceCode?: string;
h5Url: string;
qrCodeContent: string;
}
/** 企业审核通过后可读取的只读展位图。 */
export interface OutdoorFairCompanyBoothMap {
currentCompanyId: number;
booths: VenueBoothItem[];
}
/** 户外招聘会字典新增表单 */
export interface OutdoorFairDictForm {
dictType: 'outdoor_fair_type' | 'outdoor_fair_region';
dictLabel: string;
}
const CMS_OUTDOOR_FAIR_BASE = '/api/cms/outdoor-fair';
const formatDateTime = (value: any) => {
if (value && typeof value.format === 'function') {
return value.format('YYYY-MM-DD HH:mm:ss');
}
return value;
};
const toApiPayload = (data: OutdoorFairForm) => ({
...data,
holdTime: formatDateTime(data.holdTime),
endTime: formatDateTime(data.endTime),
applyStartTime: formatDateTime(data.applyStartTime),
applyEndTime: formatDateTime(data.applyEndTime),
});
/**
* 获取户外招聘会管理列表
* GET /api/cms/outdoor-fair/list
*/
export async function getOutdoorFairList(params?: OutdoorFairListParams) {
return request<OutdoorFairListResult>(`${CMS_OUTDOOR_FAIR_BASE}/list`, {
method: 'GET',
params,
});
}
/**
* 获取户外招聘会详情
* GET /api/cms/outdoor-fair/{id}
*/
export async function getOutdoorFairInfo(id: number) {
return request<OutdoorFairCommonResult>(`${CMS_OUTDOOR_FAIR_BASE}/${id}`, {
method: 'GET',
});
}
/**
* 当前企业查看户外招聘会展位图。
* 服务端会校验当前企业已报名且审核通过,接口只提供读取能力。
*/
export async function getCurrentCompanyOutdoorFairBoothMap(fairId: number) {
return request<{ code: number; msg?: string; data?: OutdoorFairCompanyBoothMap }>(
`${CMS_OUTDOOR_FAIR_BASE}/${fairId}/company/booth-map`,
{ method: 'GET' },
);
}
/** 招聘会统计-时间桶序列项(曲线图用) */
export interface OutdoorFairStatisticsSeriesItem {
time: string;
fairCount: number;
companyCount: number;
jobCount: number;
}
/** 招聘会数同比/环比 */
export interface OutdoorFairStatisticsRate {
fairCount: number;
previousFairCount: number;
/** 增长率:(current-previous)/previous上期为 0 时为 null */
rate?: number | null;
}
/** 招聘会统计结果dashboard */
export interface OutdoorFairStatisticsResult {
granularity: 'day' | 'week' | 'month' | 'year';
totals: { fairCount: number; companyCount: number; jobCount: number };
yoy: OutdoorFairStatisticsRate;
mom: OutdoorFairStatisticsRate;
series: OutdoorFairStatisticsSeriesItem[];
}
/** 招聘会统计查询参数 */
export interface OutdoorFairStatisticsParams {
/** 粒度day/week/month/year */
granularity?: 'day' | 'week' | 'month' | 'year';
/** 起始时间 yyyy-MM-dd HH:mm:ss */
startTime?: string;
/** 截止时间 yyyy-MM-dd HH:mm:ss */
endTime?: string;
}
/**
* 招聘会数据统计
* GET /api/cms/outdoor-fair/statistics
* skipErrorHandler: 由调用方自行处理错误,避免全局弹窗把 null msg 显示成 "null"
*/
export async function getOutdoorFairStatistics(params: OutdoorFairStatisticsParams) {
return request<{ code: number; msg?: string; data: OutdoorFairStatisticsResult }>(
`${CMS_OUTDOOR_FAIR_BASE}/statistics`,
{ method: 'GET', params, skipErrorHandler: true },
);
}
/**
* 新增户外招聘会
* POST /api/cms/outdoor-fair
*/
export async function addOutdoorFair(data: OutdoorFairForm) {
return request<OutdoorFairCommonResult>(CMS_OUTDOOR_FAIR_BASE, {
method: 'POST',
data: toApiPayload(data),
});
}
/**
* 修改户外招聘会
* PUT /api/cms/outdoor-fair
*/
export async function updateOutdoorFair(data: OutdoorFairForm) {
return request<OutdoorFairCommonResult>(CMS_OUTDOOR_FAIR_BASE, {
method: 'PUT',
data: toApiPayload(data),
});
}
/**
* 删除户外招聘会
* DELETE /api/cms/outdoor-fair/{id}
*/
export async function deleteOutdoorFair(id: number) {
return request<OutdoorFairCommonResult>(`${CMS_OUTDOOR_FAIR_BASE}/${id}`, {
method: 'DELETE',
});
}
/**
* 新增户外招聘会页面使用的字典项
* POST /api/cms/outdoor-fair/dict-data
*/
export async function addOutdoorFairDictOption(data: OutdoorFairDictForm) {
return request<OutdoorFairCommonResult>(`${CMS_OUTDOOR_FAIR_BASE}/dict-data`, {
method: 'POST',
data,
});
}
/**
* 当前企业报名户外招聘会
* POST /api/cms/outdoor-fair/{fairId}/company/signup
*/
export async function signupOutdoorFair(fairId: number) {
return request<{ code: number; msg?: string; data: OutdoorFairCompanyQrCodeInfo }>(
`${CMS_OUTDOOR_FAIR_BASE}/${fairId}/company/signup`,
{ method: 'POST' },
);
}
/**
* 获取当前企业户外招聘会二维码
* GET /api/cms/outdoor-fair/{fairId}/company/qrcode
*/
export async function getMyOutdoorFairQrCode(fairId: number) {
return request<{ code: number; msg?: string; data: OutdoorFairCompanyQrCodeInfo }>(
`${CMS_OUTDOOR_FAIR_BASE}/${fairId}/company/qrcode`,
{ method: 'GET' },
);
}
/**
* 上传户外招聘会照片
* POST /api/common/upload
*/
export async function uploadOutdoorFairPhoto(file: File) {
const formData = new FormData();
formData.append('file', file);
return request<OutdoorFairCommonResult>('/api/common/upload', {
method: 'POST',
data: formData,
});
}