主要内容: - 包含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>
90 lines
4.0 KiB
Python
90 lines
4.0 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
|
||
import json
|
||
import re
|
||
|
||
def update_class_ranking_with_energy_data():
|
||
"""
|
||
使用能源个人档案.json中的数据更新班级排名信息
|
||
"""
|
||
|
||
# 读取能源个人档案数据
|
||
with open("网页未导入数据/能源产业/能源个人档案.json", 'r', encoding='utf-8') as f:
|
||
energy_profiles = json.load(f)
|
||
|
||
# 读取头像列表
|
||
avatar_mapping = {
|
||
"奚思瑶": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/199b35fbd6ed5e3ea6d6d064cf895a13.jpg",
|
||
"王承泽": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/152361c6c68a193660cdbdf9074c2cf3.jpg",
|
||
"赵纯": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/07a0a14c8c8d5476b2c8d54de12e6a06.jpg",
|
||
"陈知夏": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/13c5709a3993fdf353d147209f8145cb.jpg",
|
||
"苏拓": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/02393125baa474d558c484c0677664b1.jpg",
|
||
"王亦舒": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/152361c6c68a193660cdbdf9074c2cf3.jpg",
|
||
"戚瑶瑶": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/199b35fbd6ed5e3ea6d6d064cf895a13.jpg",
|
||
"吴珩": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/13c5709a3993fdf353d147209f8145cb.jpg",
|
||
"李月平": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/07a0a14c8c8d5476b2c8d54de12e6a06.jpg",
|
||
"章世龙": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/152361c6c68a193660cdbdf9074c2cf3.jpg",
|
||
}
|
||
|
||
# 构建排名数据数组
|
||
rankings_data = []
|
||
for profile in energy_profiles[:10]: # 只取前10名
|
||
name = profile["学员名称"]
|
||
is_me = name == "苏拓"
|
||
|
||
ranking_item = f''' {{
|
||
rank: {profile["班级排名"]},
|
||
studentId: "{profile["学号"]}",
|
||
studentName: "{name}",
|
||
name: "{name}",
|
||
avatar: "{avatar_mapping.get(name, "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/02393125baa474d558c484c0677664b1.jpg")}",
|
||
score: {profile["学分"]},
|
||
credits: {profile["学分"]},
|
||
school: "{profile["学校名称"]}",
|
||
major: "{profile["专业名称"]}",
|
||
isMe: {str(is_me).lower()},
|
||
}}'''
|
||
|
||
rankings_data.append(ranking_item)
|
||
|
||
rankings_array = ",\n".join(rankings_data)
|
||
|
||
print(f"✓ 生成了 {len(rankings_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_before_ranking_update", 'w', encoding='utf-8') as f:
|
||
f.write(content)
|
||
|
||
# 替换整个rankings数组
|
||
rankings_pattern = r'rankings: \[\s*\{[\s\S]*?\}\s*,[\s\S]*?\}\s*,[\s\S]*?\]\s*,'
|
||
|
||
new_rankings_section = f'''rankings: [
|
||
{rankings_array}
|
||
],'''
|
||
|
||
updated_content = re.sub(rankings_pattern, new_rankings_section, content)
|
||
|
||
# 更新班级信息
|
||
updated_content = re.sub(r'className: "智能制造班"', 'className: "能源班"', updated_content)
|
||
updated_content = re.sub(r'totalStudents: 45', 'totalStudents: 10', updated_content)
|
||
updated_content = re.sub(r'averageScore: 78\.5', 'averageScore: 94.5', updated_content)
|
||
|
||
# 写入更新后的内容
|
||
with open("src/data/mockData.js", 'w', encoding='utf-8') as f:
|
||
f.write(updated_content)
|
||
|
||
print(f"\n✅ 成功更新班级排名数据")
|
||
print(f"📋 更新内容:")
|
||
print(f" - 更新了前10名学生的排名信息")
|
||
print(f" - 苏拓排名第5位,学分95分")
|
||
print(f" - 班级名称改为'能源班'")
|
||
print(f" - 总学生数改为10人")
|
||
print(f" - 班级平均分改为94.5分")
|
||
|
||
if __name__ == "__main__":
|
||
update_class_ranking_with_energy_data() |