主要内容: - 包含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>
86 lines
3.2 KiB
Python
86 lines
3.2 KiB
Python
#!/usr/bin/env python3
|
||
import json
|
||
import re
|
||
import os
|
||
|
||
# 读取视觉设计岗位简历.json文件
|
||
json_file = '网页未导入数据/视觉设计产业/视觉设计岗位简历.json'
|
||
mock_file = 'src/mocks/resumeInterviewMock.js'
|
||
|
||
print("正在读取面试题数据...")
|
||
with open(json_file, 'r', encoding='utf-8') as f:
|
||
positions_data = json.load(f)
|
||
|
||
# 创建岗位名称到面试题的映射
|
||
interview_questions_map = {}
|
||
for position in positions_data:
|
||
position_name = position.get("岗位名称", "")
|
||
interview_content = position.get("面试题内容", "")
|
||
if position_name and interview_content:
|
||
interview_questions_map[position_name] = interview_content
|
||
print(f"找到 {position_name} 的面试题")
|
||
|
||
print(f"\n总共找到 {len(interview_questions_map)} 个岗位的面试题")
|
||
|
||
# 读取resumeInterviewMock.js文件
|
||
print("\n正在读取 resumeInterviewMock.js...")
|
||
with open(mock_file, 'r', encoding='utf-8') as f:
|
||
content = f.read()
|
||
|
||
# 创建备份
|
||
backup_file = f"{mock_file}.backup_interview_{os.popen('date +%Y%m%d_%H%M%S').read().strip()}"
|
||
with open(backup_file, 'w', encoding='utf-8') as f:
|
||
f.write(content)
|
||
print(f"已创建备份文件: {backup_file}")
|
||
|
||
# 更新面试题
|
||
update_count = 0
|
||
not_found = []
|
||
|
||
for position_name, interview_content in interview_questions_map.items():
|
||
# 转义特殊字符
|
||
escaped_name = re.escape(position_name)
|
||
|
||
# 准备替换的面试题内容,需要转义反斜杠和反引号
|
||
escaped_content = interview_content.replace('\\', '\\\\').replace('`', '\\`')
|
||
|
||
# 首先尝试查找并更新已存在的interviewQuestions字段
|
||
# 注意:"position"字段也可能带引号
|
||
pattern_existing = rf'''("position":\s*["']{escaped_name}["'].*?)"interviewQuestions":\s*`[^`]*?`'''
|
||
|
||
if re.search(pattern_existing, content, re.DOTALL):
|
||
# 如果已存在interviewQuestions字段,替换它
|
||
replacement = rf'\1"interviewQuestions": `{escaped_content}`'
|
||
content = re.sub(pattern_existing, replacement, content, flags=re.DOTALL)
|
||
update_count += 1
|
||
print(f"✓ 已更新 {position_name} 的面试题(替换已有)")
|
||
else:
|
||
# 如果不存在,尝试在content字段后添加
|
||
pattern_add = rf'''(position:\s*["']{escaped_name}["'].*?content:\s*{{[^}}]*?}})(\s*}})'''
|
||
|
||
if re.search(pattern_add, content, re.DOTALL):
|
||
# 在content字段后添加interviewQuestions
|
||
replacement = rf'\1,\n interviewQuestions: `{escaped_content}`\2'
|
||
content = re.sub(pattern_add, replacement, content, flags=re.DOTALL)
|
||
update_count += 1
|
||
print(f"✓ 已更新 {position_name} 的面试题(新增字段)")
|
||
else:
|
||
not_found.append(position_name)
|
||
|
||
# 写回文件
|
||
print(f"\n正在写入更新后的内容...")
|
||
with open(mock_file, 'w', encoding='utf-8') as f:
|
||
f.write(content)
|
||
|
||
print(f"\n更新完成!")
|
||
print(f"成功更新: {update_count} 个岗位")
|
||
if not_found:
|
||
print(f"未找到以下岗位: {', '.join(not_found)}")
|
||
|
||
# 验证语法
|
||
print("\n验证文件语法...")
|
||
result = os.popen(f'node -c {mock_file} 2>&1').read()
|
||
if result:
|
||
print(f"❌ 语法错误: {result}")
|
||
else:
|
||
print("✓ 语法验证通过") |