Files
ALL-teach_sys/frontend_视觉设计/apply_full_answers.py
KQL cd2e307402 初始化12个产业教务系统项目
主要内容:
- 包含12个产业的完整教务系统前端代码
- 智能启动脚本 (start-industry.sh)
- 可视化产业导航页面 (index.html)
- 项目文档 (README.md)

优化内容:
- 删除所有node_modules和.yoyo文件夹,从7.5GB减少到2.7GB
- 添加.gitignore文件避免上传不必要的文件
- 自动依赖管理和智能启动系统

产业列表:
1. 文旅产业 (5150)
2. 智能制造 (5151)
3. 智能开发 (5152)
4. 财经商贸 (5153)
5. 视觉设计 (5154)
6. 交通物流 (5155)
7. 大健康 (5156)
8. 土木水利 (5157)
9. 食品产业 (5158)
10. 化工产业 (5159)
11. 能源产业 (5160)
12. 环保产业 (5161)

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 14:14:14 +08:00

118 lines
4.2 KiB
Python

#!/usr/bin/env python3
import json
import re
import os
from datetime import datetime
# 读取所有产业的完整面试题数据
print("正在读取完整面试题数据...")
with open('all_industries_with_answers.json', 'r', encoding='utf-8') as f:
all_updates = json.load(f)
# 读取UI设计的完整数据
with open('ui_questions_with_answers.json', 'r', encoding='utf-8') as f:
ui_questions = json.load(f)
# 读取当前的resumeInterviewMock.js
mock_file = 'src/mocks/resumeInterviewMock.js'
with open(mock_file, 'r', encoding='utf-8') as f:
content = f.read()
# 创建备份
backup_file = f"{mock_file}.backup_apply_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
with open(backup_file, 'w', encoding='utf-8') as f:
f.write(content)
print(f"已创建备份:{backup_file}")
# 首先更新UI设计的面试题
print("\n更新UI设计产业的面试题...")
# 查找UI设计产业的questions位置
ui_pattern = r'("name":\s*"UI设计"[^}]*?"questions":\s*)\[[^\]]*?\]'
match = re.search(ui_pattern, content, re.DOTALL)
if match:
# 替换为新的完整数据
ui_json_str = json.dumps(ui_questions, ensure_ascii=False, indent=4)
new_content = content[:match.start(1)] + match.group(1) + ui_json_str + content[match.end():]
# 写入文件
with open(mock_file, 'w', encoding='utf-8') as f:
f.write(new_content)
print("✓ UI设计产业面试题已更新为完整版本")
# 验证语法
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("\n继续更新其他产业...")
content = new_content # 使用更新后的内容
industry_map = {
"包装设计": "包装设计",
"插画设计": "插画设计",
"灯光": "灯光",
"动画设计": "动画设计",
"后期特效": "后期特效",
"剪辑": "剪辑",
"品牌设计": "品牌设计",
"平面设计": "平面设计",
"三维设计": "三维设计",
"摄影/摄像": "摄影/摄像",
"室内设计": "室内设计",
"调色": "调色",
"新媒体运营": "新媒体运营",
"音频处理": "音频处理",
"影视节目策划": "影视节目策划",
"直播": "直播"
}
update_count = 1 # UI设计已更新
for update_data in all_updates:
industry_name = update_data['industry']
if industry_name in industry_map:
mock_industry = industry_map[industry_name]
# 查找并替换
pattern = rf'("name":\s*"{re.escape(mock_industry)}"[^}}]*?"questions":\s*)\[[^\]]*?\]'
match = re.search(pattern, content, re.DOTALL)
if match:
# 生成JSON
questions_json = json.dumps(update_data['questions'], ensure_ascii=False, indent=4)
content = content[:match.start(1)] + match.group(1) + questions_json + content[match.end():]
update_count += 1
print(f"{industry_name} 已更新")
# 最终写入
with open(mock_file, 'w', encoding='utf-8') as f:
f.write(content)
# 最终验证
print(f"\n验证最终文件语法...")
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("✗ 未找到UI设计产业")