You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
220 lines
6.6 KiB
220 lines
6.6 KiB
/**
|
|
* 岗位相关类型定义
|
|
*/
|
|
|
|
/** 岗位评级等级 */
|
|
export type JobLevel = 'excellent' | 'good' | 'medium';
|
|
|
|
/** 岗位 */
|
|
export interface Job {
|
|
id: string;
|
|
/** 公司名 */
|
|
companyName: string;
|
|
/** 公司地点,如 "北京 · 海淀区" */
|
|
companyLocation: string;
|
|
/** 岗位名称 */
|
|
positionName: string;
|
|
/** 最低薪资(K) */
|
|
salaryMin: number;
|
|
/** 最高薪资(K) */
|
|
salaryMax: number;
|
|
/** 匹配分数(0-100) */
|
|
score: number;
|
|
/** 评级等级(由接口层按分数计算) */
|
|
level: JobLevel;
|
|
/** 经验要求,如 "3-5年" */
|
|
experience: string;
|
|
/** 学历要求,如 "本科" */
|
|
education: string;
|
|
/** 所属行业,如 "互联网/IT" */
|
|
industry: string;
|
|
/** 城市,如 "北京" */
|
|
city: string;
|
|
/** 福利标签 */
|
|
benefits: string[];
|
|
}
|
|
|
|
/** 岗位排序方式 */
|
|
export type SortType = 'comprehensive' | 'latest' | 'salary';
|
|
|
|
/** 岗位列表查询参数(接口层排序/筛选/搜索/分页) */
|
|
export interface JobListParams {
|
|
/** 排序方式 */
|
|
sortBy: SortType;
|
|
/** 搜索关键词 */
|
|
keyword?: string;
|
|
/** 行业筛选 */
|
|
industry?: string;
|
|
/** 城市筛选 */
|
|
city?: string;
|
|
/** 薪资范围(多选;空数组表示不筛选) */
|
|
salary?: string[];
|
|
/** 经验要求(多选;空数组表示不筛选) */
|
|
experience?: string[];
|
|
/** 学历要求(多选;空数组表示不筛选) */
|
|
education?: string[];
|
|
/** 页码(从 1 开始) */
|
|
page?: number;
|
|
/** 每页数量 */
|
|
pageSize?: number;
|
|
}
|
|
|
|
/** 岗位详情(继承 Job,增加详情页专属字段;industry/benefits 复用 Job 已有定义) */
|
|
export interface JobDetail extends Job {
|
|
/** 公司规模,如 "10000人以上" */
|
|
companySize: string;
|
|
/** 发布状态,如 "刚发布" */
|
|
status: string;
|
|
/** 浏览次数,如 1286 */
|
|
views: number;
|
|
/** 薪资月数,如 14(展示为 "14薪") */
|
|
salaryMonths: number;
|
|
}
|
|
|
|
/** 岗位详情维度评分(雷达图 8 维度,与用户端 DimensionScore 区分命名) */
|
|
export interface JobDimensionScore {
|
|
id: string;
|
|
/** 维度名称,如 "岗位真实性" */
|
|
name: string;
|
|
/** 分值(0-100) */
|
|
value: number;
|
|
}
|
|
|
|
/** 岗位综合评分 */
|
|
export interface JobOverallScore {
|
|
/** 总分,如 92 */
|
|
totalScore: number;
|
|
/** 等级,如 "优秀" */
|
|
level: string;
|
|
/** 排名文案,如 "超过91%同行业岗位" */
|
|
rank: string;
|
|
/** 8 个维度评分 */
|
|
dimensions: JobDimensionScore[];
|
|
}
|
|
|
|
/** 薪资区间(按经验分段) */
|
|
export interface SalaryRange {
|
|
/** 经验段,如 "1-3年" */
|
|
experience: string;
|
|
/** 最低薪资(K) */
|
|
min: number;
|
|
/** 最高薪资(K) */
|
|
max: number;
|
|
}
|
|
|
|
/** 薪资数据(真实薪资区间) */
|
|
export interface SalaryData {
|
|
/** 各经验段薪资区间 */
|
|
ranges: SalaryRange[];
|
|
/** 数据来源说明,如 "基于2,846份真实简历数据" */
|
|
dataSource: string;
|
|
/** 样本总数,如 2846 */
|
|
totalCount: number;
|
|
}
|
|
|
|
/** 员工评价 */
|
|
/** 岗位评价状态:草稿 / 待审 / 已发布 / 已驳回 / 已删除 */
|
|
export type JobReviewStatus = 'DRAFT' | 'PENDING' | 'PUBLISHED' | 'REJECTED' | 'DELETED';
|
|
|
|
export interface EmployeeReview {
|
|
id: string;
|
|
/** 用户名(脱敏),如 "张**" */
|
|
userName: string;
|
|
/** 身份标签,如 "在职员工,前端开发" */
|
|
userRole: string;
|
|
/** 时间,如 "3天前" */
|
|
time: string;
|
|
/** 评价内容 */
|
|
content: string;
|
|
/** 评价标签 */
|
|
tags: string[];
|
|
/** 综合评分 1-5(后端公开列表含八维评分,这里用单分概括) */
|
|
rating?: number;
|
|
/** 八维评分,键见 constants/review 的 REVIEW_DIMENSIONS,值为 1-5 */
|
|
dimensionScores?: Record<string, number>;
|
|
/** 审核状态;列表只返回 PUBLISHED */
|
|
status?: JobReviewStatus;
|
|
/** 当前用户是否可编辑/删除(后端对本人评价下发的标志;mock 由归属判断) */
|
|
canEdit?: boolean;
|
|
/** 最近更新时间 ISO;用于编辑态展示 */
|
|
updatedAt?: string;
|
|
}
|
|
|
|
/**
|
|
* 创建岗位评价入参(对齐 POST /jobs/{jobId}/reviews 的请求体)。
|
|
* 不含 jobId —— 岗位由路径参数给定,请求体里再带一份是冗余且易与路径不一致。
|
|
*/
|
|
export interface JobReviewCreateInput {
|
|
/** 综合评分 1-5 */
|
|
rating: number;
|
|
/** 评价内容 */
|
|
content: string;
|
|
/** 标签 */
|
|
tags: string[];
|
|
/** 八维评分键值对 */
|
|
dimensionScores: Record<string, number>;
|
|
}
|
|
|
|
/** 修改岗位评价入参(对齐 PUT /jobs/{jobId}/reviews/{reviewId},字段均可选) */
|
|
export interface JobReviewUpdateInput {
|
|
rating?: number;
|
|
content?: string;
|
|
tags?: string[];
|
|
dimensionScores?: Record<string, number>;
|
|
status?: JobReviewStatus;
|
|
}
|
|
|
|
/** 岗位评价汇总(对齐 GET /jobs/{jobId}/reviews/summary) */
|
|
export interface JobReviewSummary {
|
|
/** 平均分 0-5 */
|
|
averageRating: number;
|
|
/** 评价总数 */
|
|
total: number;
|
|
/** 各星级分布(5→1),count 为条数 */
|
|
distribution: { rating: number; count: number }[];
|
|
/** 热门标签 Top5 */
|
|
topTags: string[];
|
|
}
|
|
|
|
|
|
/* ===================== 后端岗位 DTO(真实响应形态) =====================
|
|
* 来源:2026-09-30 对 /jobs/search、/jobs/public/{jobId} 的实网采样。
|
|
* 后端字段名与前端 Job 差异很大(title vs positionName、company.name vs companyName、
|
|
* 薪资单位为「元/月」而前端按「K/月」渲染),因此真实分支必须先经 mapBackendJobItem 转换,
|
|
* 不能直接把后端对象 cast 成 Job —— 直接 cast 会让列表渲染出一堆 undefined。
|
|
*/
|
|
export interface BackendJobCompany {
|
|
id: number;
|
|
name: string;
|
|
verified?: boolean;
|
|
}
|
|
|
|
export interface BackendJobItem {
|
|
id: number;
|
|
title: string;
|
|
description?: string;
|
|
requirements?: string;
|
|
city?: string;
|
|
/** 雇佣类型枚举:INTERN / FULL_TIME / PART_TIME 等(英文大写 token) */
|
|
employmentType?: string;
|
|
/** 薪资下限,单位:元/月(前端按 K/月 展示,需 /1000) */
|
|
salaryMin?: number | null;
|
|
/** 薪资上限,单位:元/月 */
|
|
salaryMax?: number | null;
|
|
/** 岗位状态英文 token:PUBLISHED / CLOSED 等 */
|
|
status?: string;
|
|
publishedAt?: string;
|
|
createdAt?: string;
|
|
company?: BackendJobCompany | null;
|
|
}
|
|
|
|
/** 后端岗位评价汇总 DTO(GET /jobs/{jobId}/reviews/summary 实网采样) */
|
|
export interface BackendJobReviewSummary {
|
|
jobId?: number;
|
|
/** 评价总数(前端字段名是 total) */
|
|
totalReviews?: number;
|
|
averageRating?: number;
|
|
/** 星级分布:键为 rating5…rating1(前端要的是 {rating,count}[]) */
|
|
ratingDistribution?: Record<string, number>;
|
|
topTags?: string[];
|
|
}
|
|
|