- 包含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>
236 lines
9.8 KiB
Python
236 lines
9.8 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
|
||
import json
|
||
import re
|
||
|
||
def parse_interview_questions(content):
|
||
"""解析面试题内容为结构化数据"""
|
||
questions = []
|
||
|
||
# 分割成不同的问题类别
|
||
sections = re.split(r'\n# ([一二三四五六七八九十]+、[^#\n]+)', content)
|
||
|
||
question_id = 1
|
||
for i in range(1, len(sections), 2):
|
||
if i >= len(sections):
|
||
break
|
||
|
||
section_title = sections[i].strip()
|
||
section_content = sections[i + 1] if i + 1 < len(sections) else ""
|
||
|
||
# 提取每个问题
|
||
question_blocks = re.split(r'\n\d+\.\s+', section_content)
|
||
|
||
for j, block in enumerate(question_blocks[1:], 1): # 跳过第一个空块
|
||
lines = block.strip().split('\n')
|
||
if not lines:
|
||
continue
|
||
|
||
question_text = lines[0].strip()
|
||
|
||
# 查找答案
|
||
answer_text = ""
|
||
for k, line in enumerate(lines):
|
||
if '示例答案' in line or '答案' in line:
|
||
# 获取答案内容
|
||
answer_lines = []
|
||
for answer_line in lines[k+1:]:
|
||
answer_line = answer_line.strip()
|
||
if answer_line and not answer_line.startswith('示例答案'):
|
||
if re.match(r'^\d+\.', answer_line):
|
||
break
|
||
answer_lines.append(answer_line)
|
||
answer_text = ' '.join(answer_lines)
|
||
break
|
||
|
||
if question_text and answer_text:
|
||
questions.append({
|
||
"id": f"q{question_id}",
|
||
"question": question_text,
|
||
"answer": answer_text
|
||
})
|
||
question_id += 1
|
||
|
||
return questions
|
||
|
||
def main():
|
||
# 读取大健康岗位简历数据
|
||
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:
|
||
mock_content = f.read()
|
||
|
||
# 收集所有岗位群的数据
|
||
all_industries = {}
|
||
for item in health_data:
|
||
industry = item.get('简历岗位群', '')
|
||
position_name = item.get('岗位名称', '')
|
||
avatar_url = item.get('简历头像url', '')
|
||
level_tag = item.get('岗位等级标签', '')
|
||
interview_content = item.get('面试题内容', '')
|
||
|
||
if industry:
|
||
if industry not in all_industries:
|
||
all_industries[industry] = {
|
||
'positions': [],
|
||
'questions': None
|
||
}
|
||
|
||
# 添加岗位信息
|
||
all_industries[industry]['positions'].append({
|
||
'name': position_name,
|
||
'avatar': avatar_url,
|
||
'level': level_tag
|
||
})
|
||
|
||
# 添加面试题(只添加一次)
|
||
if interview_content and not all_industries[industry]['questions']:
|
||
questions = parse_interview_questions(interview_content)
|
||
if questions:
|
||
# 将问题按类别分组
|
||
category_questions = {}
|
||
current_category = "综合面试题"
|
||
|
||
for q in questions:
|
||
# 检查是否是新的分类
|
||
if '岗位理解' in q['question']:
|
||
current_category = "岗位理解类问题"
|
||
elif '实践经验' in q['question'] or '案例' in q['question']:
|
||
current_category = "实践经验类问题"
|
||
elif '客户服务' in q['question'] or '客户' in q['question']:
|
||
current_category = "客户服务类问题"
|
||
elif '市场' in q['question'] or '趋势' in q['question']:
|
||
current_category = "市场与未来趋势类问题"
|
||
elif '技术' in q['question'] or '专业' in q['question']:
|
||
current_category = "专业技术类问题"
|
||
elif '团队' in q['question'] or '协作' in q['question']:
|
||
current_category = "团队协作类问题"
|
||
|
||
if current_category not in category_questions:
|
||
category_questions[current_category] = []
|
||
category_questions[current_category].append(q)
|
||
|
||
# 构建questions数组
|
||
questions_array = []
|
||
cat_id = 1
|
||
for category, cat_questions in category_questions.items():
|
||
questions_array.append({
|
||
"id": f"group_q{cat_id}",
|
||
"question": category,
|
||
"subQuestions": cat_questions
|
||
})
|
||
cat_id += 1
|
||
|
||
all_industries[industry]['questions'] = questions_array
|
||
|
||
# 需要添加的新岗位群(不在现有Mock中的)
|
||
new_industries = ['社群运营', '药品供应链管理', '药品生产', '药品质量检测', '药物研发']
|
||
|
||
# 生成新的岗位群数据
|
||
new_industry_blocks = []
|
||
industry_id = 7 # 从health_7开始
|
||
|
||
for industry_name in new_industries:
|
||
if industry_name in all_industries:
|
||
industry_data = all_industries[industry_name]
|
||
|
||
# 构建positions数组
|
||
positions_data = []
|
||
for idx, pos in enumerate(industry_data['positions'], 1):
|
||
level_mapping = {
|
||
'基础岗': '普通岗',
|
||
'技术骨干岗': '技术骨干岗',
|
||
'管理培训生岗': '管理培训生岗',
|
||
'管理岗': '管理岗'
|
||
}
|
||
|
||
position_obj = {
|
||
"id": f"health_{industry_id}_{idx}",
|
||
"title": pos['name'],
|
||
"level": level_mapping.get(pos['level'], '普通岗'),
|
||
"avatar": pos['avatar'],
|
||
"department": industry_name,
|
||
"type": "全职",
|
||
"experience": "1-3年",
|
||
"education": "大专",
|
||
"salary": "5-10K",
|
||
"location": "北京",
|
||
"updateTime": "2024-01-20",
|
||
"description": f"负责{pos['name']}相关工作",
|
||
"requirements": [
|
||
"具备相关专业知识和技能",
|
||
"有良好的沟通能力和团队合作精神",
|
||
"能够独立完成岗位职责",
|
||
"有相关实习或工作经验优先"
|
||
]
|
||
}
|
||
positions_data.append(position_obj)
|
||
|
||
# 构建industry对象
|
||
industry_obj = {
|
||
"id": f"health_{industry_id}",
|
||
"name": industry_name,
|
||
"positions": positions_data
|
||
}
|
||
|
||
# 添加questions(如果有的话)
|
||
if industry_data['questions']:
|
||
industry_obj["questions"] = industry_data['questions']
|
||
else:
|
||
# 使用默认的面试题结构
|
||
industry_obj["questions"] = [
|
||
{
|
||
"id": "group_q1",
|
||
"question": f"{industry_name}专业认知",
|
||
"subQuestions": [
|
||
{
|
||
"id": "q1",
|
||
"question": f"你如何理解{industry_name}的核心价值?",
|
||
"answer": f"{industry_name}的核心价值在于通过专业技能和知识,为企业和客户创造价值,推动行业发展。"
|
||
},
|
||
{
|
||
"id": "q2",
|
||
"question": f"{industry_name}中最重要的能力是什么?",
|
||
"answer": "专业技能、沟通能力、团队协作和持续学习能力都是非常重要的。"
|
||
},
|
||
{
|
||
"id": "q3",
|
||
"question": f"你为什么选择{industry_name}这个方向?",
|
||
"answer": "我对这个领域充满热情,相信能够在这里发挥我的专业优势,为行业发展做出贡献。"
|
||
}
|
||
]
|
||
}
|
||
]
|
||
|
||
new_industry_blocks.append(industry_obj)
|
||
industry_id += 1
|
||
|
||
# 将新的岗位群添加到Mock文件中
|
||
# 找到industries数组的结束位置
|
||
industries_end_pattern = r'(const industries = \[[^\]]*)\]'
|
||
|
||
# 生成新的岗位群JavaScript代码
|
||
new_blocks_js = ""
|
||
for block in new_industry_blocks:
|
||
new_blocks_js += ",\n " + json.dumps(block, ensure_ascii=False, indent=2).replace('\n', '\n ')
|
||
|
||
# 替换
|
||
replacement = rf'\1{new_blocks_js}\n]'
|
||
new_content = re.sub(industries_end_pattern, replacement, mock_content, flags=re.DOTALL)
|
||
|
||
# 写回文件
|
||
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
|
||
f.write(new_content)
|
||
|
||
print(f"成功添加了 {len(new_industry_blocks)} 个新岗位群:")
|
||
for block in new_industry_blocks:
|
||
print(f" - {block['name']} (ID: {block['id']}): {len(block['positions'])} 个岗位")
|
||
|
||
# 统计总数
|
||
print(f"\n现在总共有 11 个岗位群")
|
||
|
||
if __name__ == "__main__":
|
||
main() |