主要内容: - 包含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>
74 lines
2.5 KiB
Python
74 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
import json
|
|
import re
|
|
import subprocess
|
|
from datetime import datetime
|
|
|
|
# 读取提取的面试题数据
|
|
with open('complete_interview_questions.json', 'r', encoding='utf-8') as f:
|
|
job_group_questions = json.load(f)
|
|
|
|
# 读取现有mock文件
|
|
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# 备份文件
|
|
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
|
|
backup_file = f'src/mocks/resumeInterviewMock.js.backup_complete_{timestamp}'
|
|
with open(backup_file, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
print(f"已创建备份: {backup_file}")
|
|
|
|
# 更新每个岗位群的面试题
|
|
updated_count = 0
|
|
for job_group, questions in job_group_questions.items():
|
|
if not questions:
|
|
continue
|
|
|
|
# 构建subQuestions数组内容
|
|
sub_questions_items = []
|
|
for i, q in enumerate(questions):
|
|
question_obj = {
|
|
"id": f"q{i+1}",
|
|
"question": q['question'],
|
|
"answer": q['answer']
|
|
}
|
|
sub_questions_items.append(json.dumps(question_obj, ensure_ascii=False, indent=20))
|
|
|
|
# 创建完整的subQuestions内容
|
|
sub_questions_content = ',\n'.join(sub_questions_items)
|
|
|
|
# 查找并替换对应岗位群的subQuestions
|
|
pattern = rf'("question"\s*:\s*"{re.escape(job_group)}"[^}}]*?"subQuestions"\s*:\s*)\[[^\]]*\]'
|
|
replacement = rf'\1[\n{sub_questions_content}\n ]'
|
|
|
|
new_content = re.sub(pattern, replacement, content, flags=re.DOTALL)
|
|
|
|
if new_content != content:
|
|
content = new_content
|
|
updated_count += 1
|
|
print(f"✓ 已更新 {job_group} 的 {len(questions)} 道面试题")
|
|
|
|
# 保存更新后的文件
|
|
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
|
|
# 验证语法
|
|
try:
|
|
result = subprocess.run(['node', '-c', 'src/mocks/resumeInterviewMock.js'],
|
|
capture_output=True, text=True, encoding='utf-8')
|
|
if result.returncode == 0:
|
|
print(f"\n✓ 语法检查通过")
|
|
print(f"✓ 成功更新了 {updated_count} 个岗位群的面试题")
|
|
print(f"\n✅ 所有面试题更新成功完成!")
|
|
else:
|
|
print(f"\n✗ 语法检查失败: {result.stderr}")
|
|
# 恢复备份
|
|
with open(backup_file, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
print(f"已从备份恢复")
|
|
except Exception as e:
|
|
print(f"错误: {e}")
|