- 包含4个产业方向的前端项目:智能开发、智能制造、大健康、财经商贸 - 已清理node_modules、.yoyo等大文件,项目大小从2.6GB优化至631MB - 配置完善的.gitignore文件 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
303 lines
9.3 KiB
JavaScript
303 lines
9.3 KiB
JavaScript
const fs = require('fs');
|
||
const path = require('path');
|
||
|
||
// 处理修改版简历文本
|
||
function processModifiedResume(content) {
|
||
// 1. 删除所有删除线内容(包括删除线符号和内容)
|
||
content = content.replace(/~~[^~]+~~/g, '');
|
||
|
||
// 2. 去掉加粗符号但保留内容
|
||
content = content.replace(/\*\*([^*]+)\*\*/g, '$1');
|
||
|
||
// 3. 清理多余的空行
|
||
content = content.replace(/\n\s*\n\s*\n/g, '\n\n');
|
||
|
||
// 4. 清理行尾空格
|
||
content = content.replace(/ +$/gm, '');
|
||
|
||
return content.trim();
|
||
}
|
||
|
||
// 读取修改版简历文件夹
|
||
const modifiedResumesDir = './网页未导入数据/智能开发产业/智能开发修改版简历';
|
||
const modifiedFiles = fs.readdirSync(modifiedResumesDir)
|
||
.filter(file => file.endsWith('.md'));
|
||
|
||
console.log(`找到 ${modifiedFiles.length} 个修改版简历文件`);
|
||
|
||
// 读取所有修改版简历
|
||
const modifiedResumes = {};
|
||
modifiedFiles.forEach(file => {
|
||
const positionName = file.replace('.md', '');
|
||
const filePath = path.join(modifiedResumesDir, file);
|
||
const content = fs.readFileSync(filePath, 'utf-8');
|
||
const processedContent = processModifiedResume(content);
|
||
modifiedResumes[positionName] = processedContent;
|
||
console.log(`- 处理了 ${positionName} 的修改版简历`);
|
||
});
|
||
|
||
// 读取现有的resumeInterviewMock.js文件
|
||
const mockFilePath = './src/mocks/resumeInterviewMock.js';
|
||
const mockContent = fs.readFileSync(mockFilePath, 'utf-8');
|
||
|
||
// 读取智能开发岗位简历数据
|
||
const smartDevData = JSON.parse(
|
||
fs.readFileSync('./网页未导入数据/智能开发产业/智能开发岗位简历.json', 'utf-8')
|
||
);
|
||
|
||
// 按岗位群分组
|
||
const groupedData = {};
|
||
smartDevData.forEach(item => {
|
||
const group = item['简历岗位群'];
|
||
if (!groupedData[group]) {
|
||
groupedData[group] = {
|
||
positions: [],
|
||
questions: item['面试题'],
|
||
questionsContent: item['面试题内容']
|
||
};
|
||
}
|
||
groupedData[group].positions.push(item);
|
||
});
|
||
|
||
// 生成industries数组
|
||
const industries = [];
|
||
let industryIndex = 0;
|
||
|
||
Object.keys(groupedData).sort().forEach(groupName => {
|
||
const groupData = groupedData[groupName];
|
||
industryIndex++;
|
||
|
||
// 解析面试题 - 每个岗位群只有一个面试题卡片
|
||
const questions = [];
|
||
if (groupData.questionsContent) {
|
||
const sections = groupData.questionsContent.split(/# [一二三四五六七八九十]+、/);
|
||
const allSubQuestions = [];
|
||
let questionIndex = 0;
|
||
|
||
sections.forEach((section, sectionIndex) => {
|
||
if (sectionIndex === 0 || !section.trim()) return;
|
||
|
||
const lines = section.split('\n');
|
||
lines.forEach(line => {
|
||
const questionMatch = line.match(/^\d+\.\s+(.+)/);
|
||
if (questionMatch) {
|
||
questionIndex++;
|
||
const question = questionMatch[1].trim();
|
||
let answer = '';
|
||
const lineIndex = lines.indexOf(line);
|
||
for (let i = lineIndex + 1; i < lines.length; i++) {
|
||
if (lines[i].match(/^示例答案[::]/)) {
|
||
answer = lines[i].replace(/^示例答案[::]/, '').trim();
|
||
for (let j = i + 1; j < lines.length; j++) {
|
||
if (lines[j].match(/^\d+\./)) break;
|
||
if (lines[j].trim()) {
|
||
answer += ' ' + lines[j].trim();
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
allSubQuestions.push({
|
||
id: `q_${questionIndex}`,
|
||
question: question,
|
||
answer: answer || "请根据实际情况回答"
|
||
});
|
||
}
|
||
});
|
||
});
|
||
|
||
if (allSubQuestions.length > 0) {
|
||
const limitedQuestions = allSubQuestions.slice(0, 10);
|
||
questions.push({
|
||
id: `group_q1`,
|
||
question: `# ${groupData.questions || groupName + '面试题'}`,
|
||
subQuestions: limitedQuestions
|
||
});
|
||
}
|
||
}
|
||
|
||
const industry = {
|
||
id: `smartdev_${industryIndex}`,
|
||
name: groupName,
|
||
positions: groupData.positions.map((pos, index) => ({
|
||
id: `smartdev_${industryIndex}_${index + 1}`,
|
||
title: pos['岗位名称'],
|
||
level: pos['岗位等级标签'],
|
||
avatar: pos['简历头像url'],
|
||
department: groupName,
|
||
type: "全职",
|
||
experience: "1-3年",
|
||
education: "大专",
|
||
salary: "6-12K",
|
||
location: "苏州",
|
||
updateTime: "2024-01-20",
|
||
description: `负责${pos['岗位名称']}相关工作`,
|
||
requirements: extractRequirements(pos['简历内容'])
|
||
})),
|
||
questions: questions
|
||
};
|
||
|
||
industries.push(industry);
|
||
});
|
||
|
||
// 生成resumeTemplates对象,包含修改版内容
|
||
const resumeTemplates = {};
|
||
|
||
Object.keys(groupedData).sort().forEach(groupName => {
|
||
const groupData = groupedData[groupName];
|
||
|
||
resumeTemplates[groupName] = groupData.positions.map(pos => {
|
||
const positionName = pos['岗位名称'];
|
||
|
||
// 检查是否有修改版简历
|
||
const hasModified = modifiedResumes.hasOwnProperty(positionName);
|
||
const modifiedContent = hasModified ? modifiedResumes[positionName] : pos['简历内容'];
|
||
|
||
return {
|
||
position: positionName,
|
||
level: pos['岗位等级标签'],
|
||
avatar: pos['简历头像url'],
|
||
content: {
|
||
original: pos['简历内容'],
|
||
modified: modifiedContent // 使用处理后的修改版内容
|
||
},
|
||
studentInfo: extractStudentInfo(pos['简历内容'])
|
||
};
|
||
});
|
||
});
|
||
|
||
// 辅助函数
|
||
function extractRequirements(resumeContent) {
|
||
const requirements = [];
|
||
const coreSkillsMatch = resumeContent.match(/### (一)核心能力\s*\n\n([\s\S]*?)### (二)/);
|
||
|
||
if (coreSkillsMatch) {
|
||
const skills = coreSkillsMatch[1].split('\n')
|
||
.filter(line => line.match(/^\d+\./))
|
||
.slice(0, 4)
|
||
.map(line => line.replace(/^\d+\.\s*/, '').trim());
|
||
|
||
return skills.length > 0 ? skills : getDefaultRequirements();
|
||
}
|
||
|
||
return getDefaultRequirements();
|
||
}
|
||
|
||
function getDefaultRequirements() {
|
||
return [
|
||
"具备相关专业知识和技能",
|
||
"熟悉行业标准和规范",
|
||
"良好的团队协作能力",
|
||
"持续学习和创新能力"
|
||
];
|
||
}
|
||
|
||
function extractStudentInfo(resumeContent) {
|
||
const info = {
|
||
project_experience: {},
|
||
core_skills: [],
|
||
composite_skills: [],
|
||
personal_summary: ""
|
||
};
|
||
|
||
const projectMatch = resumeContent.match(/### (一)项目名称[::]\s*(.+)/);
|
||
const positionMatch = resumeContent.match(/### (二)实习岗位[::]\s*(.+)/);
|
||
const timeMatch = resumeContent.match(/### ([三四])实习时间[::]\s*(.+)/);
|
||
const companyMatch = resumeContent.match(/### ([三四])实习单位[::]\s*(.+)/);
|
||
|
||
if (projectMatch) info.project_experience.project_name = projectMatch[1].trim();
|
||
if (positionMatch) info.project_experience.position = positionMatch[1].trim();
|
||
if (timeMatch) info.project_experience.time_period = timeMatch[1].trim();
|
||
if (companyMatch) info.project_experience.company = companyMatch[1].trim();
|
||
|
||
const dutiesMatch = resumeContent.match(/### (五)岗位职责[::]\s*\n\n([\s\S]*?)#/);
|
||
if (dutiesMatch) {
|
||
info.project_experience.description = dutiesMatch[1]
|
||
.split('\n')
|
||
.filter(line => line.match(/^\d+\./))
|
||
.map(line => line.replace(/^\d+\.\s*/, '').trim())
|
||
.join(' ;\n');
|
||
}
|
||
|
||
const coreSkillsMatch = resumeContent.match(/### (一)核心能力\s*\n\n([\s\S]*?)### (二)/);
|
||
if (coreSkillsMatch) {
|
||
info.core_skills = coreSkillsMatch[1]
|
||
.split('\n')
|
||
.filter(line => line.match(/^\d+\./))
|
||
.map(line => line.replace(/^\d+\.\s*/, '').trim());
|
||
}
|
||
|
||
const compositeSkillsMatch = resumeContent.match(/### (二)复合能力\s*\n\n([\s\S]*?)#/);
|
||
if (compositeSkillsMatch) {
|
||
info.composite_skills = compositeSkillsMatch[1]
|
||
.split('\n')
|
||
.filter(line => line.match(/^\d+\./))
|
||
.map(line => line.replace(/^\d+\.\s*/, '').split(/[::]/)[0].trim())
|
||
.slice(0, 2);
|
||
}
|
||
|
||
const summaryMatch = resumeContent.match(/# 三、个人[总评][结价]\s*\n\n([\s\S]*?)$/);
|
||
if (summaryMatch) {
|
||
info.personal_summary = summaryMatch[1].trim();
|
||
}
|
||
|
||
return info;
|
||
}
|
||
|
||
// 生成最终的Mock数据结构
|
||
const mockData = `// 简历与面试题Mock数据
|
||
|
||
// 岗位群列表
|
||
const industries = ${JSON.stringify(industries, null, 2)};
|
||
|
||
// 简历模板数据
|
||
const resumeTemplates = ${JSON.stringify(resumeTemplates, null, 2)};
|
||
|
||
// 我的简历数据
|
||
const myResume = {
|
||
personalInfo: {
|
||
name: "张明",
|
||
phone: "138****8888",
|
||
email: "zhangming@example.com",
|
||
age: 22,
|
||
education: "苏州信息职业技术学院 2020.9-2023.6",
|
||
experience: "应届毕业生",
|
||
location: "苏州"
|
||
},
|
||
workExperience: [
|
||
{
|
||
company: "苏州某智能科技企业",
|
||
position: "AI开发实习生",
|
||
duration: "2023.03-2023.06",
|
||
description: "负责AI模型开发与应用相关工作"
|
||
}
|
||
],
|
||
skills: ["Python编程", "机器学习", "深度学习", "数据分析"],
|
||
projects: [
|
||
{
|
||
name: "智能应用开发项目",
|
||
role: "AI开发实习生",
|
||
duration: "2023.04-2023.06",
|
||
description: "参与智能应用的模型开发和部署"
|
||
}
|
||
]
|
||
};
|
||
|
||
// 获取页面mock数据的函数
|
||
export function getMockPageData() {
|
||
return resumeInterviewMockData;
|
||
}
|
||
|
||
// 导出合并的数据
|
||
export const resumeInterviewMockData = {
|
||
industries,
|
||
resumeTemplates,
|
||
myResume
|
||
};`;
|
||
|
||
// 写入更新后的数据
|
||
fs.writeFileSync('./src/mocks/resumeInterviewMock.js', mockData, 'utf-8');
|
||
|
||
console.log('\n✅ 修改版简历导入完成!');
|
||
console.log('\n有修改版的岗位列表:');
|
||
console.log(Object.keys(modifiedResumes)); |