主要更新内容: - 优化UI组件(视频播放器、HR访问模态框、岗位信息展示等) - 更新数据文件(简历、岗位、项目案例等) - 添加新的图片资源(面试状态图标等) - 新增AgentPage等页面组件 - 清理旧的备份文件,提升代码库整洁度 - 优化岗位等级和面试状态的数据结构 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
89 lines
3.1 KiB
Python
89 lines
3.1 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
|
||
import json
|
||
import re
|
||
|
||
# 读取清理后的数据
|
||
with open('resume_updates_cleaned.json', 'r', encoding='utf-8') as f:
|
||
updates = json.load(f)
|
||
|
||
# 读取resumeInterviewMock.js
|
||
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
|
||
content = f.read()
|
||
|
||
print("批量更新所有岗位的完整studentInfo数据...")
|
||
|
||
# 需要更新的所有岗位
|
||
all_positions = [
|
||
'文创产品设计师',
|
||
'文创产品策划师',
|
||
'文创产品设计师助理',
|
||
'品牌策划运营专员',
|
||
'品牌公关',
|
||
'品牌推广专员',
|
||
'ip运营',
|
||
'ip运营总监助理',
|
||
'品牌公关管培生'
|
||
]
|
||
|
||
success_count = 0
|
||
|
||
for position in all_positions:
|
||
update_data = next((u for u in updates if u['position'] == position), None)
|
||
if not update_data:
|
||
print(f"⚠ 未找到{position}的更新数据")
|
||
continue
|
||
|
||
# 准备完整的studentInfo数据
|
||
student_info = update_data['studentInfo']
|
||
|
||
# 构建完整的studentInfo字符串
|
||
student_info_str = f'''studentInfo: {{
|
||
project_experience: {{
|
||
project_name: "{student_info['project_experience']['project_name']}",
|
||
position: "{student_info['project_experience']['position']}",
|
||
time_period: "{student_info['project_experience']['time_period']}",
|
||
company: "{student_info['project_experience']['company']}",
|
||
description: `{student_info['project_experience']['description']}`
|
||
}},
|
||
core_skills: {json.dumps(student_info['core_skills'], ensure_ascii=False, indent=10).replace('"', '`')},
|
||
compound_skills: {json.dumps(student_info['compound_skills'], ensure_ascii=False, indent=10).replace('"', '`')},
|
||
personal_summary: "{student_info['personal_summary']}"
|
||
}}'''
|
||
|
||
# 使用正则表达式替换整个studentInfo部分
|
||
# 查找模式:position: "岗位名"...studentInfo: {...}
|
||
pattern = rf'(position:\s*"{re.escape(position)}"[^}}]*?)studentInfo:\s*{{[^}}]*(?:{{[^}}]*}}[^}}]*)*}}'
|
||
|
||
# 替换为新的studentInfo
|
||
replacement = rf'\1{student_info_str}'
|
||
|
||
# 执行替换
|
||
new_content, count = re.subn(pattern, replacement, content, flags=re.DOTALL)
|
||
|
||
if count > 0:
|
||
content = new_content
|
||
print(f"✓ {position} studentInfo已完整更新")
|
||
success_count += 1
|
||
else:
|
||
print(f"⚠ {position} 未能匹配到studentInfo位置")
|
||
|
||
# 保存更新后的文件
|
||
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
|
||
f.write(content)
|
||
|
||
print(f"\n✓ 成功更新 {success_count}/{len(all_positions)} 个岗位的数据!")
|
||
|
||
# 验证更新
|
||
print("\n验证更新结果...")
|
||
for position in all_positions[:3]: # 验证前3个
|
||
if f'position: "{position}"' in content:
|
||
pos = content.find(f'position: "{position}"')
|
||
section = content[pos:pos+500]
|
||
if 'project_experience: null' in section:
|
||
print(f" ✗ {position} 仍有null值")
|
||
elif 'project_experience: {' in section:
|
||
print(f" ✓ {position} 已更新")
|
||
else:
|
||
print(f" ? {position} 状态未知") |