133 lines
4.7 KiB
Python
133 lines
4.7 KiB
Python
|
|
#!/usr/bin/env python3
|
|||
|
|
# -*- coding: utf-8 -*-
|
|||
|
|
|
|||
|
|
import os
|
|||
|
|
import json
|
|||
|
|
import re
|
|||
|
|
|
|||
|
|
print("替换简历修改版数据...")
|
|||
|
|
|
|||
|
|
# 读取修改版简历文件夹
|
|||
|
|
resumes_dir = '/Users/apple/Documents/cursor/教务系统/frontend_大健康/网页未导入数据/大健康产业/大健康修改版简历/'
|
|||
|
|
modified_resumes = {}
|
|||
|
|
|
|||
|
|
# 岗位名称映射(文件名 -> 实际岗位名)
|
|||
|
|
position_mapping = {
|
|||
|
|
"体检医生": "体检医生",
|
|||
|
|
"健康顾问": "健康顾问",
|
|||
|
|
"康复治疗师": "康复治疗师",
|
|||
|
|
"微整形医生": "微整形医生",
|
|||
|
|
"心理咨询师": "心理咨询师",
|
|||
|
|
"营养师助理": "营养师助理",
|
|||
|
|
"运动康复师": "运动康复师",
|
|||
|
|
"皮肤美容医生": "皮肤美容医生",
|
|||
|
|
"健康管理师助理": "健康管理师助理",
|
|||
|
|
"老年健康照护师": "老年健康照护师"
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 读取所有修改版简历文件
|
|||
|
|
for filename in os.listdir(resumes_dir):
|
|||
|
|
if filename.endswith('.md'):
|
|||
|
|
position_key = filename.replace('.md', '')
|
|||
|
|
if position_key in position_mapping:
|
|||
|
|
file_path = os.path.join(resumes_dir, filename)
|
|||
|
|
with open(file_path, 'r', encoding='utf-8') as f:
|
|||
|
|
content = f.read()
|
|||
|
|
# 移除第一行的标题(如 "# 健康顾问")
|
|||
|
|
lines = content.split('\n')
|
|||
|
|
if lines[0].startswith('# '):
|
|||
|
|
content = '\n'.join(lines[1:]).strip()
|
|||
|
|
modified_resumes[position_mapping[position_key]] = content
|
|||
|
|
print(f"✓ 读取修改版简历: {position_mapping[position_key]}")
|
|||
|
|
|
|||
|
|
# 备份原文件
|
|||
|
|
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
|
|||
|
|
content = f.read()
|
|||
|
|
|
|||
|
|
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js.backup_before_modified_resumes', 'w', encoding='utf-8') as f:
|
|||
|
|
f.write(content)
|
|||
|
|
|
|||
|
|
# 读取现有的mock数据
|
|||
|
|
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/health_mock_data_full.json', 'r', encoding='utf-8') as f:
|
|||
|
|
mock_data = json.load(f)
|
|||
|
|
|
|||
|
|
# 更新resumeTemplates中的modified字段
|
|||
|
|
updated_count = 0
|
|||
|
|
for group_name, positions in mock_data['resumeTemplates'].items():
|
|||
|
|
for position in positions:
|
|||
|
|
position_name = position['position']
|
|||
|
|
if position_name in modified_resumes:
|
|||
|
|
# 更新modified字段
|
|||
|
|
position['content']['modified'] = modified_resumes[position_name]
|
|||
|
|
updated_count += 1
|
|||
|
|
print(f"✓ 更新 {position_name} 的修改版简历")
|
|||
|
|
|
|||
|
|
print(f"\n共更新了 {updated_count} 个岗位的修改版简历")
|
|||
|
|
|
|||
|
|
# 将更新后的数据转换为JavaScript格式
|
|||
|
|
industries_js = json.dumps(mock_data['industries'], ensure_ascii=False, indent=2)
|
|||
|
|
resumeTemplates_js = json.dumps(mock_data['resumeTemplates'], ensure_ascii=False, indent=2)
|
|||
|
|
|
|||
|
|
# 创建新的Mock文件内容
|
|||
|
|
new_content = f"""// 简历与面试题Mock数据
|
|||
|
|
|
|||
|
|
// 岗位群列表
|
|||
|
|
const industries = {industries_js};
|
|||
|
|
|
|||
|
|
// 简历模板数据
|
|||
|
|
const resumeTemplates = {resumeTemplates_js};
|
|||
|
|
|
|||
|
|
// 我的简历数据
|
|||
|
|
const myResume = {{
|
|||
|
|
personalInfo: {{
|
|||
|
|
name: "张三",
|
|||
|
|
phone: "138****8888",
|
|||
|
|
email: "zhangsan@example.com",
|
|||
|
|
age: 25,
|
|||
|
|
education: "苏州信息职业技术学院 2020.9-2023.6",
|
|||
|
|
experience: "2年",
|
|||
|
|
location: "北京"
|
|||
|
|
}},
|
|||
|
|
workExperience: [
|
|||
|
|
{{
|
|||
|
|
company: "某健康管理公司",
|
|||
|
|
position: "健康管理师",
|
|||
|
|
duration: "2022.03-2024.01",
|
|||
|
|
description: "负责健康评估和健康管理方案制定工作"
|
|||
|
|
}}
|
|||
|
|
],
|
|||
|
|
skills: ["健康评估", "健康管理", "数据分析", "客户服务"],
|
|||
|
|
projects: [
|
|||
|
|
{{
|
|||
|
|
name: "企业员工健康管理项目",
|
|||
|
|
role: "健康管理师",
|
|||
|
|
duration: "2023.05-2023.12",
|
|||
|
|
description: "负责企业员工的健康评估和管理方案制定"
|
|||
|
|
}}
|
|||
|
|
]
|
|||
|
|
}};
|
|||
|
|
|
|||
|
|
// 获取页面mock数据的函数
|
|||
|
|
export function getMockPageData() {{
|
|||
|
|
return resumeInterviewMockData;
|
|||
|
|
}}
|
|||
|
|
|
|||
|
|
// 导出合并的数据
|
|||
|
|
export const resumeInterviewMockData = {{
|
|||
|
|
industries,
|
|||
|
|
resumeTemplates,
|
|||
|
|
myResume
|
|||
|
|
}};
|
|||
|
|
"""
|
|||
|
|
|
|||
|
|
# 写入新内容
|
|||
|
|
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
|
|||
|
|
f.write(new_content)
|
|||
|
|
|
|||
|
|
# 同时更新JSON文件以保持一致
|
|||
|
|
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/health_mock_data_full.json', 'w', encoding='utf-8') as f:
|
|||
|
|
json.dump(mock_data, f, ensure_ascii=False, indent=2)
|
|||
|
|
|
|||
|
|
print("\n✓ 简历修改版数据替换完成!")
|
|||
|
|
print(" - 原文件已备份为 resumeInterviewMock.js.backup_before_modified_resumes")
|
|||
|
|
print(" - 同步更新了 health_mock_data_full.json")
|