99 lines
3.3 KiB
Python
99 lines
3.3 KiB
Python
|
|
#!/usr/bin/env python3
|
|||
|
|
# -*- coding: utf-8 -*-
|
|||
|
|
|
|||
|
|
import json
|
|||
|
|
import re
|
|||
|
|
|
|||
|
|
print("删除面试题中的重复序号...")
|
|||
|
|
|
|||
|
|
# 备份当前文件
|
|||
|
|
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_remove_numbers', '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)
|
|||
|
|
|
|||
|
|
# 处理每个岗位群的面试题
|
|||
|
|
for industry in mock_data['industries']:
|
|||
|
|
if 'questions' in industry and industry['questions']:
|
|||
|
|
for question_card in industry['questions']:
|
|||
|
|
if 'subQuestions' in question_card:
|
|||
|
|
for sub_q in question_card['subQuestions']:
|
|||
|
|
# 删除问题开头的序号 "1. ", "2. " 等
|
|||
|
|
if 'question' in sub_q:
|
|||
|
|
# 使用正则表达式删除开头的数字和点
|
|||
|
|
sub_q['question'] = re.sub(r'^\d+\.\s*', '', sub_q['question'])
|
|||
|
|
|
|||
|
|
print(f"处理了 {len(mock_data['industries'])} 个岗位群的面试题")
|
|||
|
|
|
|||
|
|
# 将更新后的数据转换为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(" - 已删除所有题目前的序号(1. 2. 等)")
|
|||
|
|
print(" - 原文件已备份为 resumeInterviewMock.js.backup_before_remove_numbers")
|