From 888d4450f1d70d621c6e085f33da0aee65bbaf91 Mon Sep 17 00:00:00 2001 From: xuxin <15279969124@163.com> Date: Sat, 9 May 2026 18:56:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=8F=E5=8E=86=E8=AF=86=E5=88=AB=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SidebarPanel.tsx | 22 +- src/lib/constants.ts | 49 ++- src/lib/experienceSection.ts | 652 ++++++++++++++++++++++++++++++++ 3 files changed, 707 insertions(+), 16 deletions(-) create mode 100644 src/lib/experienceSection.ts diff --git a/src/components/SidebarPanel.tsx b/src/components/SidebarPanel.tsx index 0183b73..c415df2 100644 --- a/src/components/SidebarPanel.tsx +++ b/src/components/SidebarPanel.tsx @@ -12,6 +12,7 @@ import { detectPickerField } from "~lib/pickerDetector" import { detectAndUploadResume } from "~lib/resumeUpload" import { getMockResumeData } from "~lib/constants" import { getResumeFieldValue } from "~lib/resumeDataHelper" +import { locateExperienceSections, expandExperienceSections } from "~lib/experienceSection" import type { MatchedFormField, ResumeData } from "~lib/types" import "./SidebarPanel.scss" @@ -63,18 +64,17 @@ export function SidebarPanel({ onClose }: SidebarPanelProps) { setResumeData(currentResumeData) console.log(`===== OfferPie: 已加载简历数据,教育${currentResumeData.education.length}段 工作${currentResumeData.work.length}段 实习${currentResumeData.internship.length}段 项目${currentResumeData.project.length}段 竞赛${currentResumeData.competition.length}段 =====`) - // 4.1 检测并上传简历文件 - const resumeUrl = "https://offerpie.oss-cn-guangzhou.aliyuncs.com/%E4%BA%8E%E5%A4%A7%E6%98%A5.pdf" - const uploaded = await detectAndUploadResume(resumeUrl) - console.log(`===== OfferPie: 简历上传 ${uploaded ? "成功" : "跳过(未找到上传按钮或失败)"} =====`) - if (uploaded) await delay(1000) // 等待网站解析简历 + // // 4.1 检测并上传简历文件 + // const resumeUrl = "https://offerpie.oss-cn-guangzhou.aliyuncs.com/%E4%BA%8E%E5%A4%A7%E6%98%A5.pdf" + // const uploaded = await detectAndUploadResume(resumeUrl) + // console.log(`===== OfferPie: 简历上传 ${uploaded ? "成功" : "跳过(未找到上传按钮或失败)"} =====`) + // if (uploaded) await delay(1000) // 等待网站解析简历 - // 4.5 查找教育背景(教育经历)、实习经历、工作经历、项目经历、竞赛经历位置和添加按钮,根据要填的简历数据添加相应的经历条数 + // 4.5 定位经历区块并统计已展开段数 + const sectionResults = locateExperienceSections(document.body, lang) + // 4.6 对比简历数据段数,点击添加按钮补足不够的段数 + const expandedResults = await expandExperienceSections(sectionResults, currentResumeData, lang) // TODO: 后续实现步骤: - // 1. 遍历 EXPERIENCE_SECTION_CONFIGS,在 DOM 中查找每种经历的区块标题元素 - // 2. 对比简历数据中该经历的段数 vs 页面已展开的段数 - // 3. 如果简历数据段数 > 页面已展开段数,查找并点击"添加"按钮补足差额 - // 4. 每次点击添加按钮后等待 DOM 更新,重新计数确认 // 5. 对5种经历的标签关系数据做特殊标记(后续完善) // 6. 所有经历段数添加完毕后,再进入统一的字段匹配和填写流程 @@ -151,7 +151,7 @@ export function SidebarPanel({ onClose }: SidebarPanelProps) {
{/* 顶部操作栏:反馈、设置、关闭按钮 */}
- 反馈3 + 反馈5 设置 {/* 关闭按钮:点击后隐藏侧边栏 */}