更新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:
KQL
2025-10-17 14:36:25 +08:00
parent 60921dbfb9
commit 38350dca36
792 changed files with 470498 additions and 11589 deletions

View File

@@ -1,182 +1,160 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import os
import re
from datetime import datetime
# 读取视觉设计岗位简历.json文件
json_file = '网页未导入数据/视觉设计产业/视觉设计岗位简历.json'
mock_file = 'src/mocks/resumeInterviewMock.js'
def load_visual_design_data():
"""加载视觉设计岗位简历数据"""
with open('网页未导入数据/视觉设计产业/视觉设计岗位简历.json', 'r', encoding='utf-8') as f:
return json.load(f)
print("正在读取完整的面试题数据...")
with open(json_file, 'r', encoding='utf-8') as f:
positions_data = json.load(f)
def extract_questions_simple(content):
"""从面试题内容中提取问题和答案(简单格式)"""
questions = []
# 解析所有岗位的面试
all_questions = {}
for position in positions_data:
position_name = position.get("岗位名称", "")
interview_content = position.get("面试题内容", "")
if position_name and interview_content:
questions = []
lines = interview_content.split('\n')
current_section = "专业能力类" # 默认分类
# 提取所有问
pattern = r'(\d+)\.\s*问题[:]?\s*(.*?)(?:\n\s*)?(?:参考回答[:]?)(.*?)(?=\d+\.\s*问题|$)'
matches = re.findall(pattern, content, re.DOTALL)
for line in lines:
line = line.strip()
# 识别大分类
if line.startswith('# '):
section_text = line[2:].strip()
if '专业' in section_text or '能力' in section_text:
current_section = "专业能力类"
elif '行为' in section_text or '经历' in section_text:
current_section = "行为经历类"
elif '情景' in section_text or '应变' in section_text:
current_section = "情景应变类"
else:
current_section = section_text
for i, match in enumerate(matches[:5], 1): # 限制为前5个问题
q_num = match[0]
question_text = match[1].strip()
answer_text = match[2].strip()
# 识别问题
elif line and line[0].isdigit() and '. 问题' in line:
parts = line.split('问题:', 1)
if len(parts) > 1:
question_text = parts[1].strip()
else:
parts = line.split('问题:', 1)
if len(parts) > 1:
question_text = parts[1].strip()
else:
continue
questions.append({
"id": f"q{i}",
"question": question_text,
"answer": answer_text
})
questions.append({
"question": question_text,
"section": current_section
})
return questions
all_questions[position_name] = questions
if questions:
print(f"解析 {position_name}{len(questions)} 个问题")
def read_mock_file():
"""读取并解析mock文件"""
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
content = f.read()
return content
# 创建备份
backup_file = f"{mock_file}.backup_direct_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
with open(mock_file, 'r', encoding='utf-8') as f:
original_content = f.read()
with open(backup_file, 'w', encoding='utf-8') as f:
f.write(original_content)
print(f"\n已创建备份:{backup_file}")
def update_industry_questions(mock_content, industry_name, questions):
"""更新指定岗位群的面试题"""
# 定义产业和岗位的映射
industry_map = {
"UI设计": "UI设计师",
"包装设计": "包装设计师",
"插画设计": "插画师",
"灯光": "影视灯光",
"动画设计": "动画师",
"后期特效": "特效设计师",
"剪辑": "剪辑师",
"品牌设计": "品牌视觉内容策划",
"平面设计": "平面设计师",
"三维设计": "3D建模师",
"摄影/摄像": "摄影师",
"室内设计": "室内设计师",
"调色": "调色师",
"新媒体运营": "新媒体运营专员",
"音频处理": "音效设计师",
"影视节目策划": "导演",
"直播": "直播助理"
}
# 构建questions数组的JSON字符串
questions_str = json.dumps(questions, ensure_ascii=False, indent=6)
# 更新面试题
print("\n开始更新面试题...")
content = original_content
update_count = 0
for industry_name, position_name in industry_map.items():
if position_name not in all_questions:
print(f"✗ 未找到 {position_name} 的面试题数据")
continue
questions = all_questions[position_name]
if not questions:
continue
# 按分类组织问题
sections = {}
for q in questions:
section = q['section']
if section not in sections:
sections[section] = []
sections[section].append(q['question'])
# 构建新的questions数组
new_questions = []
group_id = 1
for section_name, section_questions in sections.items():
if section_questions:
group = {
"id": f"group_q{group_id}",
"question": f"# {section_name}",
"subQuestions": []
}
for idx, q_text in enumerate(section_questions, 1):
group["subQuestions"].append({
"id": f"q{group_id}_{idx}",
"question": q_text,
"answer": "请根据您的实际经验和项目情况,结合专业知识进行回答。"
})
new_questions.append(group)
group_id += 1
# 生成JSON字符串
questions_json = json.dumps(new_questions, ensure_ascii=False, indent=6)
# 调整缩进每行前面加4个空格
lines = questions_str.split('\n')
adjusted_lines = []
for line in lines:
if line.strip():
adjusted_lines.append(' ' + line)
else:
adjusted_lines.append(line)
questions_str = '\n'.join(adjusted_lines)
# 查找并替换
# 搜索产业名称
search_str = f'"name": "{industry_name}"'
if search_str in content:
# 找到产业位置
start_idx = content.find(search_str)
# 模式找到industry name然后找到其questions数组
pattern = rf'("name":\s*"{re.escape(industry_name)}".*?"questions":\s*\[)[^]]*?(\])'
# 找到对应的questions字段
questions_start = content.find('"questions":', start_idx)
if questions_start > 0 and questions_start < start_idx + 2000: # 确保在同一产业内
# 找到questions数组的开始 [
array_start = content.find('[', questions_start)
if array_start > 0:
# 找到对应的结束 ]
bracket_count = 1
idx = array_start + 1
while idx < len(content) and bracket_count > 0:
if content[idx] == '[':
bracket_count += 1
elif content[idx] == ']':
bracket_count -= 1
idx += 1
def replace_func(match):
prefix = match.group(1)
suffix = match.group(2)
return prefix + '\n' + questions_str.strip() + '\n ' + suffix
if bracket_count == 0:
# 替换questions内容
content = content[:array_start] + questions_json + content[idx-1:]
update_count += 1
print(f"✓ 已更新 {industry_name} ({len(questions)} 个问题)")
new_content = re.sub(pattern, replace_func, mock_content, count=1, flags=re.DOTALL)
# 写回文件
if update_count > 0:
print(f"\n正在写入文件...")
with open(mock_file, 'w', encoding='utf-8') as f:
f.write(content)
return new_content != mock_content, new_content
def main():
"""主函数"""
print("=== 直接更新面试题数据 ===\n")
# 创建备份
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
backup_name = f'src/mocks/resumeInterviewMock.js.backup_{timestamp}_direct'
mock_content = read_mock_file()
with open(backup_name, 'w', encoding='utf-8') as f:
f.write(mock_content)
print(f"✓ 已创建备份: {backup_name}\n")
# 加载视觉设计数据
visual_data = load_visual_design_data()
# 岗位群映射
industry_map = {
"UI设计": ["UI设计师"],
"包装设计": ["包装设计师", "包装设计师助理"],
"插画设计": ["插画师"],
"灯光": ["影视灯光", "摄影美术指导助理"],
"动画设计": ["动画师"],
"平面设计": ["平面设计师"],
"品牌设计": ["品牌视觉内容策划"],
"三维设计": ["CG总监助理", "3D建模师"],
"后期特效": ["特效设计师", "特效合成师"],
"剪辑": ["剪辑师", "剪辑助理"],
"调色": ["调色师"],
"音频处理": ["录音师", "音效设计师"],
"直播": ["直播专员", "直播助理"],
"新媒体运营": ["新媒体运营专员"],
"影视节目策划": ["文案策划"],
"室内设计": ["室内设计师"],
"摄影/摄像": ["摄影师", "影视摄像"]
}
updated_count = 0
for industry_name, position_names in industry_map.items():
# 查找面试题内容
questions = None
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_simple(item.get('面试题内容', ''))
used_position = position_name
break
if questions:
break
if not questions:
print(f"⚠️ 未找到面试题:{industry_name}")
continue
# 更新mock文件
success, mock_content = update_industry_questions(mock_content, industry_name, questions)
if success:
updated_count += 1
print(f"✓ 已更新岗位群:{industry_name} (使用岗位:{used_position},共{len(questions)}个问题)")
else:
print(f"✗ 未能更新岗位群:{industry_name}")
# 保存文件
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.write(mock_content)
print(f"\n✅ 更新完成!共更新{updated_count}个岗位群")
# 验证语法
print("验证文件语法...")
result = os.popen(f'node -c {mock_file} 2>&1').read()
if result:
print(f"❌ 语法错误:{result}")
# 恢复备份
with open(backup_file, 'r', encoding='utf-8') as f:
content = f.read()
with open(mock_file, 'w', encoding='utf-8') as f:
f.write(content)
print("已恢复备份")
else:
print("✓ 语法验证通过")
print(f"\n成功更新 {update_count} 个产业的面试题!")
else:
print("\n未更新任何产业")
import subprocess
try:
result = subprocess.run(['node', '-c', 'src/mocks/resumeInterviewMock.js'],
capture_output=True, text=True)
if result.returncode == 0:
print("✅ 文件语法验证通过")
else:
print(f"❌ 文件语法验证失败:\n{result.stderr}")
print(f"\n恢复备份: {backup_name}")
with open(backup_name, 'r', encoding='utf-8') as f:
backup_content = f.read()
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.write(backup_content)
print("已恢复备份")
except Exception as e:
print(f"⚠️ 无法验证语法: {str(e)}")
if __name__ == '__main__':
main()