更新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

@@ -0,0 +1,191 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import re
from datetime import datetime
# 读取智能制造岗位简历数据
print("正在读取智能制造岗位简历.json...")
with open('网页未导入数据/智能制造产业/智能制造岗位简历.json', 'r', encoding='utf-8') as f:
smart_mfg_data = json.load(f)
# 读取当前mock文件
print("正在读取当前mock文件...")
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
mock_content = f.read()
# 备份原文件
backup_time = datetime.now().strftime('%Y%m%d_%H%M%S')
backup_file = f'src/mocks/resumeInterviewMock.js.backup_complete_{backup_time}'
with open(backup_file, 'w', encoding='utf-8') as f:
f.write(mock_content)
print(f"已创建备份文件: {backup_file}")
# 解析智能制造岗位简历数据,构建完整的面试题映射
interview_data_map = {}
for item in smart_mfg_data:
job_group = item.get('简历岗位群', '')
interview_content = item.get('面试题内容', '')
if job_group and interview_content:
# 解析面试题内容
questions_data = []
lines = interview_content.split('\n')
current_section = None
current_section_questions = []
section_id = 1
for line in lines:
line = line.strip()
if not line:
continue
# 大标题(如 # 一、xxx
if line.startswith('# '):
# 保存上一个section
if current_section and current_section_questions:
questions_data.append({
'id': f'group_q{section_id}',
'title': current_section,
'questions': current_section_questions
})
section_id += 1
current_section = line[2:].strip()
current_section_questions = []
# 问题编号(如 1. xxx 或 1、xxx
elif re.match(r'^(\d+)[\.、]\s+', line):
# 提取问题
question_match = re.match(r'^(\d+)[\.、]\s+(.+)', line)
if question_match:
question_text = question_match.group(2).strip()
# 查找后续的答案
answer_lines = []
line_index = lines.index(line) + 1
while line_index < len(lines):
next_line = lines[line_index].strip()
# 如果遇到下一个问题或章节,停止
if next_line.startswith('#') or re.match(r'^(\d+)[\.、]\s+', next_line):
break
# 如果是答案标记
if next_line.startswith('示例答案') or next_line.startswith('答案'):
# 提取答案内容
if '' in next_line or ':' in next_line:
answer_text = re.sub(r'^(示例答案|答案)[:]?\s*', '', next_line)
answer_lines.append(answer_text)
line_index += 1
# 继续读取多行答案
while line_index < len(lines):
next_line = lines[line_index].strip()
if not next_line or next_line.startswith('#') or re.match(r'^(\d+)[\.、]\s+', next_line):
break
answer_lines.append(next_line)
line_index += 1
break
elif next_line:
# 如果没有明确的答案标记,下一行非空内容可能就是答案
answer_lines.append(next_line)
line_index += 1
break
else:
line_index += 1
answer = ' '.join(answer_lines).strip()
current_section_questions.append({
'question': question_text,
'answer': answer
})
# 保存最后一个section
if current_section and current_section_questions:
questions_data.append({
'id': f'group_q{section_id}',
'title': current_section,
'questions': current_section_questions
})
interview_data_map[job_group] = questions_data
print(f"\n共解析 {len(interview_data_map)} 个岗位群的面试题数据")
# 更新mock文件中的面试题
def update_industry_questions(match):
full_match = match.group(0)
industry_name = match.group(1)
# 查找对应的面试题数据
if industry_name not in interview_data_map:
print(f" - {industry_name}: 保持原样(未找到对应数据)")
return full_match
questions_data = interview_data_map[industry_name]
# 构建新的questions数组
new_questions = []
for section_data in questions_data:
sub_questions = []
for idx, q in enumerate(section_data['questions']):
# 转义特殊字符
question_text = q['question'].replace('\\', '\\\\').replace('"', '\\"')
answer_text = q['answer'].replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n')
sub_questions.append(f'''{{
"id": "q{section_data['id'][7:]}_{idx+1}",
"question": "{question_text}",
"answer": "{answer_text}"
}}''')
section_title = section_data['title'].replace('\\', '\\\\').replace('"', '\\"')
new_questions.append(f'''{{
"id": "{section_data['id']}",
"question": "# {section_title}",
"subQuestions": [
{','.join(sub_questions)}
]
}}''')
# 替换questions部分
questions_str = ',\n '.join(new_questions)
# 构建完整的替换内容
result = match.group(0).split('"questions": [')[0]
result += '"questions": [\n '
result += questions_str
result += '\n ]'
# 统计题目数量
total_questions = sum(len(section['questions']) for section in questions_data)
print(f" - {industry_name}: 更新为 {len(questions_data)} 个章节,{total_questions} 道题")
return result
# 执行更新
print("\n正在更新面试题数据...")
pattern = r'"name":\s*"([^"]+)"[^}]*?"questions":\s*\[.*?\]\s*(?=\})'
new_content = re.sub(pattern, update_industry_questions, mock_content, flags=re.DOTALL)
# 保存更新后的文件
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.write(new_content)
print("\n✅ 面试题数据更新完成!")
# 验证语法
import subprocess
result = subprocess.run(['node', '-c', 'src/mocks/resumeInterviewMock.js'],
capture_output=True, text=True)
if result.returncode == 0:
print("✅ 语法检查通过!")
else:
print("❌ 语法错误:")
print(result.stderr)