- 包含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>
114 lines
3.3 KiB
JavaScript
114 lines
3.3 KiB
JavaScript
import fs from 'fs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
// 读取面试题数据
|
|
const interviewQuestionsData = JSON.parse(
|
|
fs.readFileSync(path.join(__dirname, 'src/data/interviewQuestions.json'), 'utf-8')
|
|
);
|
|
|
|
// 解析面试题内容
|
|
function 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+\./.test(line)) {
|
|
// 保存上一个问题
|
|
if (currentQuestion && currentAnswer) {
|
|
questions.push({
|
|
id: `q${questionIndex + 1}`,
|
|
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) {
|
|
currentAnswer += ' ';
|
|
}
|
|
currentAnswer += line;
|
|
}
|
|
}
|
|
|
|
// 保存最后一个问题
|
|
if (currentQuestion && currentAnswer) {
|
|
questions.push({
|
|
id: `q${questionIndex + 1}`,
|
|
question: currentQuestion,
|
|
answer: currentAnswer.trim()
|
|
});
|
|
}
|
|
|
|
return questions;
|
|
}
|
|
|
|
// 岗位群名称映射
|
|
const groupNameMapping = {
|
|
'品牌策划与推广': 'brand',
|
|
'销售': 'sales',
|
|
'私域运营': 'privateOperation',
|
|
'游戏运营': 'game',
|
|
'二次元周边店铺运营': 'acgshop',
|
|
'山地户外运动策划与执行': 'outdoor',
|
|
'主题公园策划与执行': 'themepark',
|
|
'粤港澳大湾区户外运动向导/研学导师': 'outdoorguide'
|
|
};
|
|
|
|
// 生成所有岗位群的面试题
|
|
interviewQuestionsData.forEach(item => {
|
|
const groupName = item['岗位群名称'];
|
|
const groupId = groupNameMapping[groupName];
|
|
|
|
if (!groupId) return;
|
|
|
|
const questions = parseInterviewQuestions(item['面试题内容']);
|
|
|
|
console.log(`\n// ${groupName}岗位群面试题`);
|
|
console.log(`const ${groupId}Questions = [`);
|
|
|
|
questions.slice(0, 10).forEach((q, index) => {
|
|
console.log(` {`);
|
|
console.log(` id: "${q.id}",`);
|
|
console.log(` question: "${q.question.replace(/"/g, '\\"')}",`);
|
|
console.log(` answer: \`${q.answer.replace(/`/g, '\\`')}\``);
|
|
console.log(` }${index < questions.length - 1 && index < 9 ? ',' : ''}`);
|
|
});
|
|
|
|
console.log(`];`);
|
|
console.log(`// 共${questions.length}道题,已显示前${Math.min(10, questions.length)}道`);
|
|
}); |