chore: 更新数据文件和组件优化
主要更新内容: - 优化UI组件(视频播放器、HR访问模态框、岗位信息展示等) - 更新数据文件(简历、岗位、项目案例等) - 添加新的图片资源(面试状态图标等) - 新增AgentPage等页面组件 - 清理旧的备份文件,提升代码库整洁度 - 优化岗位等级和面试状态的数据结构 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
129
remove_fake_modified.py
Normal file
129
remove_fake_modified.py
Normal file
@@ -0,0 +1,129 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
def create_backup(file_path):
|
||||
"""创建备份文件"""
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
backup_path = f"{file_path}.backup_{timestamp}"
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
with open(backup_path, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
print(f"已创建备份: {backup_path}")
|
||||
return backup_path
|
||||
|
||||
def remove_fake_modified_versions():
|
||||
"""删除没有真实修改版的岗位的modified字段"""
|
||||
file_path = 'src/mocks/resumeInterviewMock.js'
|
||||
|
||||
# 创建备份
|
||||
create_backup(file_path)
|
||||
|
||||
# 有真实修改版的岗位列表(这些要保留modified)
|
||||
real_modified_positions = [
|
||||
"会展策划师",
|
||||
"会展执行助理",
|
||||
"会展讲解员",
|
||||
"活动策划师",
|
||||
"活动执行",
|
||||
"漫展策划师",
|
||||
"旅游规划师",
|
||||
"旅游计调专员",
|
||||
"景区运营专员",
|
||||
"文旅运营总监助理"
|
||||
]
|
||||
|
||||
# 读取文件内容
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# 找到所有包含position和modified的代码块
|
||||
# 匹配模式:从position: "岗位名" 开始,到包含modified字段的整个content对象
|
||||
pattern = r'position:\s*"([^"]+)".*?content:\s*\{[^}]*?original:\s*`[^`]*?`[^}]*?modified:\s*`[^`]*?`[^}]*?\}'
|
||||
|
||||
def process_match(match):
|
||||
full_match = match.group(0)
|
||||
position_name = match.group(1)
|
||||
|
||||
# 如果是有真实修改版的岗位,保持不变
|
||||
if position_name in real_modified_positions:
|
||||
print(f"✓ 保留 {position_name} 的修改版")
|
||||
return full_match
|
||||
|
||||
# 否则,删除modified字段
|
||||
# 找到modified字段的开始位置
|
||||
modified_pattern = r',\s*modified:\s*`[^`]*?`'
|
||||
new_content = re.sub(modified_pattern, '', full_match)
|
||||
print(f"✗ 删除 {position_name} 的假修改版")
|
||||
return new_content
|
||||
|
||||
# 执行替换
|
||||
new_content = re.sub(pattern, process_match, content, flags=re.DOTALL)
|
||||
|
||||
# 保存文件
|
||||
with open(file_path, 'w', encoding='utf-8') as f:
|
||||
f.write(new_content)
|
||||
|
||||
print("\n处理完成!")
|
||||
|
||||
def verify_results():
|
||||
"""验证处理结果"""
|
||||
file_path = 'src/mocks/resumeInterviewMock.js'
|
||||
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# 统计所有有modified字段的岗位
|
||||
pattern = r'position:\s*"([^"]+)".*?modified:\s*`'
|
||||
matches = re.findall(pattern, content, re.DOTALL)
|
||||
|
||||
print("\n验证结果:")
|
||||
print("=" * 50)
|
||||
print(f"还有modified字段的岗位(共{len(matches)}个):")
|
||||
for position in matches:
|
||||
print(f" - {position}")
|
||||
|
||||
# 期望的岗位列表
|
||||
expected = [
|
||||
"会展策划师",
|
||||
"会展执行助理",
|
||||
"会展讲解员",
|
||||
"活动策划师",
|
||||
"活动执行",
|
||||
"漫展策划师",
|
||||
"旅游规划师",
|
||||
"旅游计调专员",
|
||||
"景区运营专员",
|
||||
"文旅运营总监助理"
|
||||
]
|
||||
|
||||
# 检查是否匹配
|
||||
print("\n检查结果:")
|
||||
for position in expected:
|
||||
if position in matches:
|
||||
print(f" ✓ {position} - 已保留modified")
|
||||
else:
|
||||
print(f" ✗ {position} - 未找到modified(可能有问题)")
|
||||
|
||||
# 检查是否有不应该有modified的岗位
|
||||
unexpected = [p for p in matches if p not in expected]
|
||||
if unexpected:
|
||||
print("\n⚠️ 警告:以下岗位不应该有modified字段:")
|
||||
for position in unexpected:
|
||||
print(f" - {position}")
|
||||
|
||||
def main():
|
||||
print("开始处理没有真实修改版的岗位...")
|
||||
print("=" * 50)
|
||||
|
||||
# 删除假的修改版
|
||||
remove_fake_modified_versions()
|
||||
|
||||
# 验证结果
|
||||
verify_results()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user