164 lines
5.9 KiB
Python
164 lines
5.9 KiB
Python
|
|
#!/usr/bin/env python3
|
|||
|
|
# -*- coding: utf-8 -*-
|
|||
|
|
|
|||
|
|
import json
|
|||
|
|
import re
|
|||
|
|
|
|||
|
|
def complete_sutuo_update():
|
|||
|
|
"""
|
|||
|
|
完整更新苏拓的个人档案信息,包括基本信息、排名、学习数据等
|
|||
|
|
"""
|
|||
|
|
|
|||
|
|
# 读取能源个人档案数据
|
|||
|
|
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_complete_sutuo", 'w', encoding='utf-8') as f:
|
|||
|
|
f.write(content)
|
|||
|
|
|
|||
|
|
# 能源头像
|
|||
|
|
sutuo_avatar = "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/02393125baa474d558c484c0677664b1.jpg"
|
|||
|
|
|
|||
|
|
# 完整的个人信息更新
|
|||
|
|
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'avatar: "https://ddcz-1315997005\.cos\.ap-nanjing\.myqcloud\.com/static/avatar/douyin/152361c6c68a193660cdbdf9074c2cf3\.jpg"', f'avatar: "{sutuo_avatar}"'),
|
|||
|
|
(r'school: "苏州健雄职业技术学院"', f'school: "{sutuo_data["学校名称"]}"'),
|
|||
|
|
(r'major: "模具设计与制造"', f'major: "{sutuo_data["专业名称"]}"'),
|
|||
|
|
(r'className: "智能制造班"', 'className: "能源班"'),
|
|||
|
|
(r'grade: "2023级"', 'grade: "2023级"'),
|
|||
|
|
(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'gpa: 4\.6', 'gpa: 4.5'),
|
|||
|
|
(r'classRank: 2', f'classRank: {sutuo_data["班级排名"]}'),
|
|||
|
|
|
|||
|
|
# 排名信息
|
|||
|
|
(r'rank: 2', f'rank: {sutuo_data["班级排名"]}'),
|
|||
|
|
(r'score: 95', f'score: {sutuo_data["学分"]}'),
|
|||
|
|
(r'totalStudents: 45', 'totalStudents: 10'),
|
|||
|
|
(r'averageScore: 78\.5', 'averageScore: 94.5'),
|
|||
|
|
]
|
|||
|
|
|
|||
|
|
# 应用基本信息更新
|
|||
|
|
updated_content = content
|
|||
|
|
for pattern, replacement in updates:
|
|||
|
|
old_content = updated_content
|
|||
|
|
updated_content = re.sub(pattern, replacement, updated_content)
|
|||
|
|
if old_content != updated_content:
|
|||
|
|
print(f"✓ 更新: {pattern} -> {replacement}")
|
|||
|
|
|
|||
|
|
# 更新能源产业相关的学习数据
|
|||
|
|
# 已完成模块
|
|||
|
|
updated_content = re.sub(
|
|||
|
|
r'"基础理论",\s*"设计软件应用",\s*"创意思维训练",\s*"项目管理基础",',
|
|||
|
|
'"能源基础理论", "智能制造基础", "新能源材料概论", "自动化控制原理",',
|
|||
|
|
updated_content
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
# 进行中模块
|
|||
|
|
updated_content = re.sub(
|
|||
|
|
r'"展会策划实务",\s*"文旅产业研究",\s*"数字创意设计",\s*"品牌营销策略",',
|
|||
|
|
'"储能系统设计", "光伏发电技术", "智能电网运维", "新能源材料制备",',
|
|||
|
|
updated_content
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
# 即将开始模块
|
|||
|
|
updated_content = re.sub(
|
|||
|
|
r'"实习实训",\s*"毕业设计",',
|
|||
|
|
'"能源企业实训", "新能源项目设计",',
|
|||
|
|
updated_content
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
# 更新技能标签
|
|||
|
|
skills_pattern = r'skills: \[\s*"[^"]*",[\s\S]*?\],'
|
|||
|
|
new_skills = '''skills: [
|
|||
|
|
"Python编程",
|
|||
|
|
"PLC控制系统",
|
|||
|
|
"AutoCAD制图",
|
|||
|
|
"储能技术",
|
|||
|
|
"光伏系统设计",
|
|||
|
|
"电气自动化",
|
|||
|
|
"新能源材料",
|
|||
|
|
"数据分析",
|
|||
|
|
],'''
|
|||
|
|
updated_content = re.sub(skills_pattern, new_skills, updated_content)
|
|||
|
|
|
|||
|
|
# 更新证书
|
|||
|
|
certificates_pattern = r'certificates: \[\s*\{[\s\S]*?\},\s*\{[\s\S]*?\},\s*\],'
|
|||
|
|
new_certificates = '''certificates: [
|
|||
|
|
{
|
|||
|
|
name: "电气工程师助理",
|
|||
|
|
issueDate: "2024-12-15",
|
|||
|
|
issuer: "中国电力企业联合会",
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: "新能源技术应用",
|
|||
|
|
issueDate: "2024-11-20",
|
|||
|
|
issuer: "国家能源局",
|
|||
|
|
},
|
|||
|
|
],'''
|
|||
|
|
updated_content = re.sub(certificates_pattern, new_certificates, updated_content)
|
|||
|
|
|
|||
|
|
# 更新项目
|
|||
|
|
projects_pattern = r'projects: \[\s*\{[\s\S]*?\},\s*\{[\s\S]*?\},\s*\],'
|
|||
|
|
new_projects = '''projects: [
|
|||
|
|
{
|
|||
|
|
name: "校园光伏发电系统设计",
|
|||
|
|
role: "主设计师",
|
|||
|
|
period: "2024.10 - 2024.12",
|
|||
|
|
status: "已完成",
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: "储能电站运维监控系统",
|
|||
|
|
role: "技术开发",
|
|||
|
|
period: "2024.11 - 至今",
|
|||
|
|
status: "进行中",
|
|||
|
|
},
|
|||
|
|
],'''
|
|||
|
|
updated_content = re.sub(projects_pattern, new_projects, updated_content)
|
|||
|
|
|
|||
|
|
print(f"✓ 更新学习相关数据")
|
|||
|
|
|
|||
|
|
# 写入更新后的内容
|
|||
|
|
with open("src/data/mockData.js", 'w', encoding='utf-8') as f:
|
|||
|
|
f.write(updated_content)
|
|||
|
|
|
|||
|
|
print(f"\n✅ 完整更新苏拓个人档案信息完成")
|
|||
|
|
print(f"📋 更新内容:")
|
|||
|
|
print(f" - 姓名: {sutuo_data['学员名称']}")
|
|||
|
|
print(f" - 学号: {sutuo_data['学号']}")
|
|||
|
|
print(f" - 学校: {sutuo_data['学校名称']}")
|
|||
|
|
print(f" - 专业: {sutuo_data['专业名称']}")
|
|||
|
|
print(f" - 垂直方向: {sutuo_data['垂直方向']}")
|
|||
|
|
print(f" - MBTI: {sutuo_data['MBTI']}")
|
|||
|
|
print(f" - 学分: {sutuo_data['学分']}")
|
|||
|
|
print(f" - 班级排名: {sutuo_data['班级排名']}")
|
|||
|
|
print(f" - 班级信息: 能源班(10人)")
|
|||
|
|
print(f" - 学习内容: 能源产业相关课程、技能、证书、项目")
|
|||
|
|
|
|||
|
|
if __name__ == "__main__":
|
|||
|
|
complete_sutuo_update()
|