更新12个教务系统并优化项目大小
主要更新: - 更新所有12个产业的教务系统数据和功能 - 删除所有 node_modules 文件夹(节省3.7GB) - 删除所有 .yoyo 缓存文件夹(节省1.2GB) - 删除所有 dist 构建文件(节省55MB) 项目优化: - 项目大小从 8.1GB 减少到 3.2GB(节省60%空间) - 保留完整的源代码和配置文件 - .gitignore 已配置,防止再次提交大文件 启动脚本: - start-industry.sh/bat/ps1 脚本会自动检测并安装依赖 - 首次启动时自动运行 npm install - 支持单个或批量启动产业系统 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
127
frontend_视觉设计/update_all_questions.py
Normal file
127
frontend_视觉设计/update_all_questions.py
Normal file
@@ -0,0 +1,127 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
def load_visual_design_data():
|
||||
"""加载视觉设计岗位简历数据"""
|
||||
with open('网页未导入数据/视觉设计产业/视觉设计岗位简历.json', 'r', encoding='utf-8') as f:
|
||||
return json.load(f)
|
||||
|
||||
def extract_questions_from_content(content):
|
||||
"""从面试题内容中提取问题和答案"""
|
||||
questions = []
|
||||
|
||||
# 提取所有问题
|
||||
pattern = r'(\d+)\.\s*问题[::]?\s*(.*?)(?:\n\s*)?(?:参考回答[::]?)(.*?)(?=\d+\.\s*问题|$)'
|
||||
matches = re.findall(pattern, content, re.DOTALL)
|
||||
|
||||
for match in matches[:5]: # 限制为前5个问题
|
||||
q_num = match[0]
|
||||
question_text = match[1].strip()
|
||||
answer_text = match[2].strip()
|
||||
|
||||
questions.append({
|
||||
"id": f"q{q_num}",
|
||||
"question": question_text,
|
||||
"answer": answer_text
|
||||
})
|
||||
|
||||
return questions
|
||||
|
||||
def update_mock_file():
|
||||
"""更新mock文件中的面试题数据"""
|
||||
|
||||
# 加载视觉设计数据
|
||||
visual_data = load_visual_design_data()
|
||||
|
||||
# 读取现有mock文件
|
||||
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
|
||||
mock_content = f.read()
|
||||
|
||||
# 创建完整的岗位群到岗位名称的映射
|
||||
industry_map = {
|
||||
"摄影/摄像": ["摄影师", "摄影师助理", "摄影助理", "影视摄像"],
|
||||
"平面设计": ["平面设计师", "广告设计助理", "平面设计专员"],
|
||||
"品牌设计": ["品牌视觉内容策划", "品牌创意文案", "品牌设计师"],
|
||||
"三维设计": ["三维动画师", "三维建模师", "CG总监助理"],
|
||||
"后期特效": ["特效师", "合成师", "后期制作专员"],
|
||||
"剪辑": ["剪辑师", "剪辑助理", "视频剪辑师"],
|
||||
"调色": ["调色师", "调色助理"],
|
||||
"音频处理": ["音频编辑", "录音师", "音效师"],
|
||||
"直播": ["直播运营专员", "直播策划", "直播导演"],
|
||||
"新媒体运营": ["新媒体运营专员", "内容运营", "短视频运营"],
|
||||
"影视节目策划": ["影视策划", "节目策划", "创意策划"],
|
||||
"室内设计": ["室内设计师", "室内设计助理", "效果图设计师"]
|
||||
}
|
||||
|
||||
updated_count = 0
|
||||
not_found_positions = []
|
||||
|
||||
# 为每个岗位群更新面试题
|
||||
for industry_name, position_names in industry_map.items():
|
||||
# 查找该岗位群的第一个岗位的面试题
|
||||
questions = []
|
||||
used_position = None
|
||||
for position_name in position_names:
|
||||
for item in visual_data:
|
||||
if item.get('岗位名称') == position_name and item.get('面试题内容'):
|
||||
questions = extract_questions_from_content(item.get('面试题内容', ''))
|
||||
used_position = position_name
|
||||
break
|
||||
if questions:
|
||||
break
|
||||
|
||||
if not questions:
|
||||
not_found_positions.append(industry_name)
|
||||
continue
|
||||
|
||||
# 查找并替换该岗位群的questions
|
||||
pattern = rf'("name":\s*"{re.escape(industry_name)}".*?"questions":\s*\[)(.*?)(\]\s*\}})'
|
||||
|
||||
def replace_func(match):
|
||||
prefix = match.group(1)
|
||||
suffix = match.group(3)
|
||||
|
||||
# 构建新的questions数组
|
||||
questions_str = "\n"
|
||||
for i, q in enumerate(questions):
|
||||
if i > 0:
|
||||
questions_str += ",\n"
|
||||
|
||||
# 转义特殊字符
|
||||
question_escaped = q['question'].replace('\\', '\\\\').replace('"', '\\"')
|
||||
answer_escaped = q['answer'].replace('\\', '\\\\').replace('"', '\\"')
|
||||
|
||||
questions_str += f''' {{
|
||||
"id": "{q['id']}",
|
||||
"question": "{question_escaped}",
|
||||
"answer": "{answer_escaped}"
|
||||
}}'''
|
||||
|
||||
questions_str += "\n "
|
||||
|
||||
return prefix + questions_str + suffix
|
||||
|
||||
# 执行替换
|
||||
new_content = re.sub(pattern, replace_func, mock_content, count=1, flags=re.DOTALL)
|
||||
|
||||
if new_content != mock_content:
|
||||
mock_content = new_content
|
||||
updated_count += 1
|
||||
print(f"✓ 已更新岗位群:{industry_name} (使用岗位:{used_position},共{len(questions)}个面试题)")
|
||||
|
||||
# 写回文件
|
||||
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
|
||||
f.write(mock_content)
|
||||
|
||||
print(f"\n✅ Mock文件更新完成!共更新{updated_count}个岗位群。")
|
||||
|
||||
if not_found_positions:
|
||||
print(f"\n⚠️ 以下岗位群未找到对应的面试题数据:")
|
||||
for name in not_found_positions:
|
||||
print(f" - {name}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
update_mock_file()
|
||||
Reference in New Issue
Block a user