Initial commit: 教务系统在线平台
- 包含4个产业方向的前端项目:智能开发、智能制造、大健康、财经商贸 - 已清理node_modules、.yoyo等大文件,项目大小从2.6GB优化至631MB - 配置完善的.gitignore文件 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
164
frontend_大健康/update_full_questions.py
Normal file
164
frontend_大健康/update_full_questions.py
Normal file
@@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
print("更新完整的面试题内容...")
|
||||
|
||||
# 读取大健康岗位简历数据
|
||||
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/网页未导入数据/大健康产业/大健康岗位简历.json', 'r', encoding='utf-8') as f:
|
||||
health_data = json.load(f)
|
||||
|
||||
# 读取当前的Mock数据
|
||||
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_full_questions', 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
# 读取health_mock_data.json以获取当前结构
|
||||
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/health_mock_data.json', 'r', encoding='utf-8') as f:
|
||||
mock_data = json.load(f)
|
||||
|
||||
# 按岗位群分组,提取完整面试题
|
||||
position_groups = {}
|
||||
for item in health_data:
|
||||
group_name = item['简历岗位群']
|
||||
if group_name not in position_groups:
|
||||
position_groups[group_name] = {
|
||||
'positions': [],
|
||||
'questions_content': item.get('面试题内容', '')
|
||||
}
|
||||
|
||||
# 岗位群ID映射
|
||||
group_id_map = {
|
||||
'健康管理': 'health_management',
|
||||
'健康检查': 'health_check',
|
||||
'康复治疗': 'rehabilitation',
|
||||
'慢性病管理': 'chronic_disease',
|
||||
'轻医美': 'medical_beauty',
|
||||
'社群运营': 'community_operation',
|
||||
'心理健康': 'mental_health',
|
||||
'药品供应链管理': 'pharma_supply',
|
||||
'药品生产': 'pharma_production',
|
||||
'药品质量检测': 'pharma_quality',
|
||||
'药物研发': 'pharma_research'
|
||||
}
|
||||
|
||||
# 解析面试题内容的函数
|
||||
def parse_questions(content, group_id):
|
||||
if not content:
|
||||
return []
|
||||
|
||||
questions = []
|
||||
|
||||
# 提取大类问题(一、二、三等)
|
||||
sections = re.findall(r'#\s*([一二三四五六七八九十]+、[^\n]+)\n(.*?)(?=#\s*[一二三四五六七八九十]+、|$)', content, re.DOTALL)
|
||||
|
||||
for section_idx, (section_title, section_content) in enumerate(sections, 1):
|
||||
# 提取每个小问题和答案
|
||||
q_pattern = r'(\d+\.\s*[^\n]+)\n\s*示例答案[::]\s*\n(.*?)(?=\d+\.|#|$)'
|
||||
sub_questions_match = re.findall(q_pattern, section_content, re.DOTALL)
|
||||
|
||||
if sub_questions_match:
|
||||
subQuestions = []
|
||||
for q_idx, (question_text, answer_text) in enumerate(sub_questions_match, 1):
|
||||
# 清理问题和答案文本
|
||||
question_clean = question_text.strip()
|
||||
answer_clean = answer_text.strip()
|
||||
|
||||
subQuestions.append({
|
||||
'id': f'q{q_idx}',
|
||||
'question': question_clean,
|
||||
'answer': answer_clean
|
||||
})
|
||||
|
||||
if subQuestions:
|
||||
questions.append({
|
||||
'id': f"{group_id}_q{section_idx}",
|
||||
'question': section_title.strip(),
|
||||
'subQuestions': subQuestions # 包含所有问题,不限制数量
|
||||
})
|
||||
|
||||
return questions
|
||||
|
||||
# 更新industries中的questions
|
||||
for industry in mock_data['industries']:
|
||||
group_name = industry['name']
|
||||
if group_name in position_groups:
|
||||
questions_content = position_groups[group_name]['questions_content']
|
||||
full_questions = parse_questions(questions_content, industry['id'])
|
||||
|
||||
if full_questions:
|
||||
industry['questions'] = full_questions
|
||||
print(f"✓ {group_name}: 更新了 {len(full_questions)} 个大类,共 {sum(len(q['subQuestions']) for q in full_questions)} 个问题")
|
||||
|
||||
# 将更新后的数据转换为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(" - 已包含完整的面试题内容")
|
||||
print(" - 原文件已备份为 resumeInterviewMock.js.backup_before_full_questions")
|
||||
Reference in New Issue
Block a user