feat: 更新简历详情页面教育经历为苏州信息职业技术学院
- 统一所有岗位简历的教育经历显示为苏州信息职业技术学院 - 更新简历详情页面组件,确保教育经历信息一致性 - 优化简历信息展示格式和样式 - 添加新的面试题库和项目库数据 - 完善文旅产业相关简历模板
This commit is contained in:
79
src/utils/interviewQuestionMapper.js
Normal file
79
src/utils/interviewQuestionMapper.js
Normal file
@@ -0,0 +1,79 @@
|
||||
import interviewQuestionsData from '@/data/interviewQuestions.json';
|
||||
|
||||
// 创建岗位群名称到面试题内容的映射
|
||||
const createInterviewQuestionsMap = () => {
|
||||
const map = {};
|
||||
|
||||
interviewQuestionsData.forEach(item => {
|
||||
// 根据岗位群名称创建映射
|
||||
map[item['岗位群名称']] = {
|
||||
groupName: item['岗位群名称'],
|
||||
questionTitle: item['面试题名称'],
|
||||
content: item['面试题内容']
|
||||
};
|
||||
});
|
||||
|
||||
return map;
|
||||
};
|
||||
|
||||
// 导出映射
|
||||
export const interviewQuestionsMap = createInterviewQuestionsMap();
|
||||
|
||||
// 根据岗位群名称获取面试题内容
|
||||
export const getInterviewQuestionsByGroup = (groupName) => {
|
||||
return interviewQuestionsMap[groupName] || null;
|
||||
};
|
||||
|
||||
// 将Markdown格式的内容解析为结构化数据(用于简单展示)
|
||||
export const parseInterviewContent = (content) => {
|
||||
if (!content) return [];
|
||||
|
||||
const sections = [];
|
||||
const lines = content.split('\n');
|
||||
let currentSection = null;
|
||||
let currentQuestion = null;
|
||||
|
||||
lines.forEach(line => {
|
||||
// 匹配一级标题(章节)
|
||||
if (line.startsWith('# ')) {
|
||||
if (currentSection) {
|
||||
sections.push(currentSection);
|
||||
}
|
||||
currentSection = {
|
||||
title: line.replace('# ', '').trim(),
|
||||
questions: []
|
||||
};
|
||||
currentQuestion = null;
|
||||
}
|
||||
// 匹配问题(数字开头)
|
||||
else if (/^\d+\.\s/.test(line)) {
|
||||
if (currentQuestion && currentSection) {
|
||||
currentSection.questions.push(currentQuestion);
|
||||
}
|
||||
currentQuestion = {
|
||||
question: line.replace(/^\d+\.\s/, '').trim(),
|
||||
answer: ''
|
||||
};
|
||||
}
|
||||
// 匹配答案或示例回答
|
||||
else if (line.includes('答案:') || line.includes('示例回答:') || line.includes('参考答案:')) {
|
||||
if (currentQuestion) {
|
||||
currentQuestion.answer = line.replace(/^(答案:|示例回答:|参考答案:)/, '').trim();
|
||||
}
|
||||
}
|
||||
// 继续收集答案内容
|
||||
else if (currentQuestion && currentQuestion.answer && line.trim()) {
|
||||
currentQuestion.answer += '\n' + line.trim();
|
||||
}
|
||||
});
|
||||
|
||||
// 添加最后的section和question
|
||||
if (currentQuestion && currentSection) {
|
||||
currentSection.questions.push(currentQuestion);
|
||||
}
|
||||
if (currentSection) {
|
||||
sections.push(currentSection);
|
||||
}
|
||||
|
||||
return sections;
|
||||
};
|
||||
93
src/utils/interviewQuestionsFormatter.js
Normal file
93
src/utils/interviewQuestionsFormatter.js
Normal file
@@ -0,0 +1,93 @@
|
||||
// 将面试题内容.json的Markdown格式转换为组件需要的结构化数据
|
||||
import interviewQuestionsData from '../data/interviewQuestions.json';
|
||||
|
||||
// 解析Markdown格式的面试题内容
|
||||
export const parseInterviewQuestions = (content) => {
|
||||
if (!content) return [];
|
||||
|
||||
const questions = [];
|
||||
const lines = content.split('\n').filter(line => line.trim());
|
||||
|
||||
let currentQuestion = null;
|
||||
let currentAnswer = '';
|
||||
let collectingAnswer = false;
|
||||
let questionIndex = 0;
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i].trim();
|
||||
|
||||
// 跳过标题行
|
||||
if (line.startsWith('#')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 匹配问题(数字开头)
|
||||
if (/^\d+\.\s/.test(line)) {
|
||||
// 保存上一个问题
|
||||
if (currentQuestion && currentAnswer) {
|
||||
questions.push({
|
||||
id: `q${questionIndex}`,
|
||||
question: currentQuestion,
|
||||
answer: currentAnswer.trim()
|
||||
});
|
||||
questionIndex++;
|
||||
}
|
||||
|
||||
// 开始新问题
|
||||
currentQuestion = line.replace(/^\d+\.\s/, '').trim();
|
||||
currentAnswer = '';
|
||||
collectingAnswer = false;
|
||||
}
|
||||
// 匹配答案标记
|
||||
else if (line.includes('答案:') || line.includes('示例回答:') || line.includes('参考答案:')) {
|
||||
collectingAnswer = true;
|
||||
// 提取答案内容(可能在同一行)
|
||||
const answerMatch = line.match(/(?:答案:|示例回答:|参考答案:)(.*)/);
|
||||
if (answerMatch && answerMatch[1]) {
|
||||
currentAnswer = answerMatch[1].trim();
|
||||
}
|
||||
}
|
||||
// 收集答案内容
|
||||
else if (collectingAnswer && line) {
|
||||
// 如果是新的段落或列表项,添加换行
|
||||
if (currentAnswer && !line.startsWith('-') && !line.startsWith('•')) {
|
||||
currentAnswer += ' ';
|
||||
}
|
||||
currentAnswer += line;
|
||||
}
|
||||
}
|
||||
|
||||
// 保存最后一个问题
|
||||
if (currentQuestion && currentAnswer) {
|
||||
questions.push({
|
||||
id: `q${questionIndex}`,
|
||||
question: currentQuestion,
|
||||
answer: currentAnswer.trim()
|
||||
});
|
||||
}
|
||||
|
||||
return questions;
|
||||
};
|
||||
|
||||
// 创建岗位群到面试题的映射
|
||||
export const createInterviewQuestionsMap = () => {
|
||||
const map = {};
|
||||
|
||||
interviewQuestionsData.forEach(item => {
|
||||
const groupName = item['岗位群名称'];
|
||||
const questions = parseInterviewQuestions(item['面试题内容']);
|
||||
|
||||
// 只保留前10个问题(避免内容过多)
|
||||
map[groupName] = questions.slice(0, 10);
|
||||
});
|
||||
|
||||
return map;
|
||||
};
|
||||
|
||||
// 导出映射
|
||||
export const interviewQuestionsMap = createInterviewQuestionsMap();
|
||||
|
||||
// 根据岗位群名称获取格式化的面试题
|
||||
export const getFormattedQuestions = (groupName) => {
|
||||
return interviewQuestionsMap[groupName] || [];
|
||||
};
|
||||
Reference in New Issue
Block a user