主要内容: - 包含12个产业的完整教务系统前端代码 - 智能启动脚本 (start-industry.sh) - 可视化产业导航页面 (index.html) - 项目文档 (README.md) 优化内容: - 删除所有node_modules和.yoyo文件夹,从7.5GB减少到2.7GB - 添加.gitignore文件避免上传不必要的文件 - 自动依赖管理和智能启动系统 产业列表: 1. 文旅产业 (5150) 2. 智能制造 (5151) 3. 智能开发 (5152) 4. 财经商贸 (5153) 5. 视觉设计 (5154) 6. 交通物流 (5155) 7. 大健康 (5156) 8. 土木水利 (5157) 9. 食品产业 (5158) 10. 化工产业 (5159) 11. 能源产业 (5160) 12. 环保产业 (5161) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
225 lines
6.7 KiB
JavaScript
225 lines
6.7 KiB
JavaScript
const fs = require('fs');
|
||
const path = require('path');
|
||
|
||
// 读取视觉设计岗位简历数据
|
||
const positionsData = JSON.parse(
|
||
fs.readFileSync('网页未导入数据/视觉设计产业/视觉设计岗位简历.json', 'utf-8')
|
||
);
|
||
|
||
// 读取mock文件
|
||
const mockFile = 'src/mocks/resumeInterviewMock.js';
|
||
let mockContent = fs.readFileSync(mockFile, 'utf-8');
|
||
|
||
// 创建备份
|
||
const backup = `${mockFile}.backup_${Date.now()}`;
|
||
fs.writeFileSync(backup, mockContent);
|
||
console.log(`备份已创建: ${backup}`);
|
||
|
||
// 提取visualDesignIndustries数据
|
||
const startMatch = mockContent.match(/const visualDesignIndustries = \[/);
|
||
if (!startMatch) {
|
||
console.error('未找到visualDesignIndustries');
|
||
process.exit(1);
|
||
}
|
||
|
||
// 找到数组的结束位置
|
||
let startPos = startMatch.index;
|
||
let bracketCount = 0;
|
||
let inArray = false;
|
||
let endPos = startPos;
|
||
|
||
for (let i = startPos; i < mockContent.length; i++) {
|
||
if (mockContent[i] === '[') {
|
||
bracketCount++;
|
||
inArray = true;
|
||
} else if (mockContent[i] === ']') {
|
||
bracketCount--;
|
||
if (bracketCount === 0 && inArray) {
|
||
endPos = i + 1;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 提取数组内容并解析
|
||
const arrayStr = mockContent.substring(startPos, endPos + 1);
|
||
let visualDesignIndustries;
|
||
try {
|
||
// 使用eval解析(因为文件中是JS而不是JSON)
|
||
eval('visualDesignIndustries = ' + arrayStr.replace('const visualDesignIndustries = ', ''));
|
||
} catch (e) {
|
||
console.error('解析失败:', e);
|
||
process.exit(1);
|
||
}
|
||
|
||
// 岗位到产业的映射
|
||
const positionToIndustry = {
|
||
"包装设计师": "包装设计",
|
||
"插画师": "插画设计",
|
||
"影视灯光": "灯光",
|
||
"角色原画师": "动画设计",
|
||
"特效设计师": "后期特效",
|
||
"剪辑师": "剪辑",
|
||
"品牌视觉内容策划": "品牌设计",
|
||
"平面设计师": "平面设计",
|
||
"3D建模师": "三维设计",
|
||
"影视摄像": "摄影/摄像",
|
||
"室内设计师": "室内设计",
|
||
"调色师": "调色",
|
||
"自媒体运营专员": "新媒体运营",
|
||
"音效设计师": "音频处理",
|
||
"导演": "影视节目策划",
|
||
"直播运营": "直播"
|
||
};
|
||
|
||
// 提取面试题函数
|
||
function extractQuestions(interviewContent) {
|
||
const questions = [];
|
||
const lines = interviewContent.split('\n');
|
||
let currentQuestion = null;
|
||
let currentAnswer = '';
|
||
let collectingAnswer = false;
|
||
|
||
for (const line of lines) {
|
||
const lineStripped = line.trim();
|
||
|
||
// 检测问题行
|
||
if (lineStripped && lineStripped[0] && lineStripped[0].match(/\d/) &&
|
||
(lineStripped.includes('问题') || lineStripped.includes(':'))) {
|
||
// 保存上一个问题
|
||
if (currentQuestion) {
|
||
let answer = currentAnswer.trim();
|
||
if (answer.length > 400) {
|
||
answer = answer.substring(0, 400) + '...';
|
||
}
|
||
questions.push({
|
||
question: currentQuestion,
|
||
answer: answer || "请根据您的实际经验和项目情况进行回答。"
|
||
});
|
||
}
|
||
|
||
// 提取新问题
|
||
let questionText = '';
|
||
if (lineStripped.includes('问题:')) {
|
||
questionText = lineStripped.split('问题:')[1]?.trim() || '';
|
||
} else if (lineStripped.includes('问题:')) {
|
||
questionText = lineStripped.split('问题:')[1]?.trim() || '';
|
||
} else if (lineStripped.includes('. ')) {
|
||
const parts = lineStripped.split('. ');
|
||
questionText = parts[1]?.trim() || '';
|
||
}
|
||
|
||
currentQuestion = questionText;
|
||
currentAnswer = '';
|
||
collectingAnswer = false;
|
||
}
|
||
// 检测答案开始
|
||
else if (['参考回答:', '参考答案:', '答案:'].some(marker => line.includes(marker))) {
|
||
collectingAnswer = true;
|
||
for (const marker of ['参考回答:', '参考答案:', '答案:']) {
|
||
if (line.includes(marker)) {
|
||
const answerPart = line.split(marker)[1]?.trim();
|
||
if (answerPart) {
|
||
currentAnswer = answerPart;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
// 收集答案内容
|
||
else if (collectingAnswer && lineStripped) {
|
||
if (lineStripped.startsWith('#') ||
|
||
(lineStripped[0] && lineStripped[0].match(/\d/) && lineStripped.includes('问题'))) {
|
||
collectingAnswer = false;
|
||
} else {
|
||
if (currentAnswer) currentAnswer += ' ';
|
||
currentAnswer += lineStripped;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 保存最后一个问题
|
||
if (currentQuestion) {
|
||
let answer = currentAnswer.trim();
|
||
if (answer.length > 400) {
|
||
answer = answer.substring(0, 400) + '...';
|
||
}
|
||
questions.push({
|
||
question: currentQuestion,
|
||
answer: answer || "请根据您的实际经验和项目情况进行回答。"
|
||
});
|
||
}
|
||
|
||
return questions.slice(0, 16); // 最多16个问题
|
||
}
|
||
|
||
// 更新产业面试题
|
||
let updateCount = 0;
|
||
for (const industry of visualDesignIndustries) {
|
||
if (industry.name === 'UI设计') continue; // 跳过已更新的
|
||
|
||
// 找到对应的岗位数据
|
||
const positionName = Object.keys(positionToIndustry).find(
|
||
key => positionToIndustry[key] === industry.name
|
||
);
|
||
|
||
if (!positionName) {
|
||
console.log(`未找到 ${industry.name} 对应的岗位`);
|
||
continue;
|
||
}
|
||
|
||
const positionData = positionsData.find(p => p['岗位名称'] === positionName);
|
||
if (!positionData || !positionData['面试题内容']) {
|
||
console.log(`未找到 ${positionName} 的面试题`);
|
||
continue;
|
||
}
|
||
|
||
// 提取面试题
|
||
const questions = extractQuestions(positionData['面试题内容']);
|
||
if (questions.length === 0) {
|
||
console.log(`${industry.name} 没有有效的面试题`);
|
||
continue;
|
||
}
|
||
|
||
console.log(`更新 ${industry.name}: ${questions.length} 个问题`);
|
||
|
||
// 构建新的questions数组
|
||
const subQuestions = questions.map((qa, index) => ({
|
||
id: `${industry.questions[0].subQuestions[0].id.split('_')[0]}_${index + 1}`,
|
||
question: qa.question,
|
||
answer: qa.answer
|
||
}));
|
||
|
||
// 更新industry的questions
|
||
industry.questions = [{
|
||
id: industry.questions[0].id,
|
||
question: `# ${industry.name}面试题`,
|
||
subQuestions: subQuestions
|
||
}];
|
||
|
||
updateCount++;
|
||
}
|
||
|
||
// 将更新后的数组转回字符串
|
||
const updatedArrayStr = 'const visualDesignIndustries = ' +
|
||
JSON.stringify(visualDesignIndustries, null, 2) + ';';
|
||
|
||
// 替换文件内容
|
||
const newMockContent = mockContent.substring(0, startPos) +
|
||
updatedArrayStr +
|
||
mockContent.substring(endPos + 1);
|
||
|
||
// 写入文件
|
||
fs.writeFileSync(mockFile, newMockContent);
|
||
console.log(`\n成功更新 ${updateCount} 个产业的面试题`);
|
||
|
||
// 验证语法
|
||
const { execSync } = require('child_process');
|
||
try {
|
||
execSync(`node -c ${mockFile}`);
|
||
console.log('✓ 语法验证通过');
|
||
} catch (error) {
|
||
console.error('❌ 语法错误,恢复备份');
|
||
fs.writeFileSync(mockFile, mockContent);
|
||
console.log('已恢复备份');
|
||
} |