Files
ALL-teach_sys/frontend_能源/safe_update_sutuo_profile.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

68 lines
2.5 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import re
def safe_update_sutuo_profile():
"""
安全地更新苏拓的个人档案信息
"""
# 读取能源个人档案数据
with open("网页未导入数据/能源产业/能源个人档案.json", 'r', encoding='utf-8') as f:
energy_profiles = json.load(f)
# 查找苏拓的数据
sutuo_data = None
for profile in energy_profiles:
if profile["学员名称"] == "苏拓":
sutuo_data = profile
break
if not sutuo_data:
print("❌ 未找到苏拓的数据")
return
print(f"✓ 找到苏拓的数据: {sutuo_data}")
# 读取mockData.js文件
with open("src/data/mockData.js", 'r', encoding='utf-8') as f:
content = f.read()
# 创建备份
with open("src/data/mockData.js.backup_safe_update", 'w', encoding='utf-8') as f:
f.write(content)
# 安全更新 - 只替换profileOverview中的基本信息
updates = [
(r'name: "王强"', f'name: "{sutuo_data["学员名称"]}"'),
(r'realName: "王强"', f'realName: "{sutuo_data["学员名称"]}"'),
(r'studentId: "2325010211"', f'studentId: "{sutuo_data["学号"]}"'),
(r'studentNo: "2325010211"', f'studentNo: "{sutuo_data["学号"]}"'),
(r'school: "苏州健雄职业技术学院"', f'school: "{sutuo_data["学校名称"]}"'),
(r'major: "模具设计与制造"', f'major: "{sutuo_data["专业名称"]}"'),
(r'className: "智能制造班"', 'className: "能源班"'),
(r'stageName: "自动化设备智能调试"', f'stageName: "{sutuo_data["垂直方向"]}"'),
(r'mbti: "ESTJ"', f'mbti: "{sutuo_data["MBTI"]}"'),
(r'mbtiType: "ESTJ"', f'mbtiType: "{sutuo_data["MBTI"]}"'),
(r'credits: 95', f'credits: {sutuo_data["学分"]}'),
(r'classRank: 2', f'classRank: {sutuo_data["班级排名"]}'),
]
# 应用更新
updated_content = content
for pattern, replacement in updates:
old_content = updated_content
updated_content = re.sub(pattern, replacement, updated_content, count=1)
if old_content != updated_content:
print(f"✓ 更新: {pattern} -> {replacement}")
# 写入更新后的内容
with open("src/data/mockData.js", 'w', encoding='utf-8') as f:
f.write(updated_content)
print(f"\n✅ 安全更新苏拓个人档案信息完成")
if __name__ == "__main__":
safe_update_sutuo_profile()