Files
ALL-teach_sys/frontend_土木水利/update_interview_questions.py
KQL cd2e307402 初始化12个产业教务系统项目
主要内容:
- 包含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>
2025-09-24 14:14:14 +08:00

90 lines
3.9 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
更新resumeInterviewMock.js中的面试题数据
"""
import json
import re
from datetime import datetime
def update_interview_questions():
# 读取提取的面试题数据
with open('interview_questions_data.json', 'r', encoding='utf-8') as f:
interview_data = json.load(f)
# 读取当前的mock文件
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
mock_content = f.read()
# 备份原文件
backup_name = f'src/mocks/resumeInterviewMock.js.backup_{datetime.now().strftime("%Y%m%d_%H%M%S")}_interview_questions'
with open(backup_name, 'w', encoding='utf-8') as f:
f.write(mock_content)
print(f"已创建备份文件: {backup_name}")
# 创建岗位群名称到面试题的映射
job_group_mapping = {
"BIM建筑信息模型": interview_data.get("BIM建筑信息模型", []),
"房地产经纪": interview_data.get("房地产经纪", []),
"工程采购": interview_data.get("工程采购", []),
"工程监理": interview_data.get("工程监理", []),
"工程造价与资料管理": interview_data.get("工程造价与资料管理", []),
"建筑安装工程": interview_data.get("建筑安装工程", []),
"建筑测量": interview_data.get("建筑测量", []),
"建筑工程检测": interview_data.get("建筑工程检测", []),
"建筑工程设计": interview_data.get("建筑工程设计", []),
"建筑工程制图": interview_data.get("建筑工程制图", []),
"建筑节能": interview_data.get("建筑节能", []),
"建筑施工与施工管理": interview_data.get("建筑施工与施工管理", []),
"施工安全管理": interview_data.get("施工安全管理", []),
"室内设计": interview_data.get("室内设计", []),
"招投标管理": interview_data.get("招投标管理", [])
}
# 查找industries数组的位置
industries_match = re.search(r'const\s+industries\s*=\s*\[', mock_content)
if not industries_match:
print("未找到industries数组")
return
# 逐个查找并更新每个岗位群的questions字段
updated = 0
for job_group, questions in job_group_mapping.items():
if not questions:
continue
# 查找该岗位群的位置
pattern = rf'"name":\s*"{re.escape(job_group)}"[^}}]*?"questions":\s*\[[^\]]*?\]'
matches = list(re.finditer(pattern, mock_content, re.DOTALL))
if matches:
for match in matches:
# 构建新的questions数组
questions_json = json.dumps([{
"id": f"group_{job_group}_q1",
"question": f"{job_group}面试题",
"subQuestions": questions[:10] # 限制每个岗位群最多10道题避免太长
}], ensure_ascii=False, indent=4)
# 缩进调整
questions_json = questions_json.replace('\n', '\n ')
# 替换questions字段
new_questions = f'"questions": {questions_json}'
old_questions_match = re.search(r'"questions":\s*\[[^\]]*?\]', match.group(0), re.DOTALL)
if old_questions_match:
new_section = match.group(0).replace(old_questions_match.group(0), new_questions)
mock_content = mock_content[:match.start()] + new_section + mock_content[match.end():]
updated += 1
print(f"已更新 {job_group} 的面试题 ({len(questions)} 道题)")
# 写入更新后的文件
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.write(mock_content)
print(f"\n总共更新了 {updated} 个岗位群的面试题数据")
print("更新完成!")
if __name__ == "__main__":
update_interview_questions()