Files
ALL-teach_sys/frontend_大健康/update_health_ranking.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

83 lines
3.5 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
# 读取大健康个人档案数据
with open('网页未导入数据/大健康产业/大健康个人档案.json', 'r', encoding='utf-8') as f:
health_profiles = json.load(f)
# 读取头像列表
with open('网页未导入数据/头像列表.json', 'r', encoding='utf-8') as f:
avatar_list = json.load(f)
# 头像映射(根据学生名称)
avatar_map = {
"于语涵": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/f1dcfee97ade582e97c666ebae40563f.jpg",
"陈沐谦": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/d96aef8e47c87f01ac15e6ca51643e38.jpg",
"魏思涵": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/9c8e2aa5e1f0aad6c3e528f088c9e1f0.jpg",
"沈思宁": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/c825e86e5c2e03f43c38ee1f37f9e925.jpg",
"鲁嘉树": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/2b1e3f5beebf23bb0b949c38e2ea85e1.jpg",
"奚沐辰": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/67c67c0c8a1b4f95cf03ffa5fe12e0f1.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/d1ac60e4c1bb21e0f93a479e8c19e5f0.jpg",
"张予安": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/c3e7c3c0f1d3e4c9bde1f1e8e9c4f9e0.jpg",
"马哲宇": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/e9f1c4e8e9c4f9e0f1e8e9c4c3e7c3c0.jpg"
}
# 构建班级排名数据
rankings = []
for profile in health_profiles:
name = profile['学员名称'].rstrip('') # 去除特殊字符
rankings.append({
"rank": int(profile['班级排名']),
"studentId": profile['学号'],
"studentName": name,
"name": name,
"avatar": avatar_map.get(name, avatar_list[int(profile['班级排名']) - 1] if int(profile['班级排名']) <= len(avatar_list) else ""),
"score": int(profile['学分']),
"credits": int(profile['学分']),
"school": profile['学校名称'],
"major": profile['专业名称'],
"isMe": name == "何泽" # 何泽是当前用户
})
# 按排名排序
rankings.sort(key=lambda x: x['rank'])
# 构建完整的ranking对象
ranking_data = {
"myRank": {
"rank": 7, # 何泽排名第7
"score": 94,
"totalStudents": 10,
"trend": "stable",
"change": 0
},
"classInfo": {
"className": "大健康班",
"totalStudents": 10,
"averageScore": 94.9 # (98+98+96+96+95+95+94+93+93+90)/10
},
"rankings": rankings
}
# 读取mockData.js文件
with open('src/data/mockData.js', 'r', encoding='utf-8') as f:
content = f.read()
# 查找并替换ranking部分在profileOverview中
import re
# 找到profileOverview的ranking部分
pattern = r'(mockData\.profileOverview = \{[\s\S]*?ranking: )\{[\s\S]*?\n \},\n( // |\s+\w+:)'
replacement = r'\1' + json.dumps(ranking_data, ensure_ascii=False, indent=6).replace('\n', '\n ') + ',\n\\2'
content = re.sub(pattern, replacement, content)
# 写回文件
with open('src/data/mockData.js', 'w', encoding='utf-8') as f:
f.write(content)
print("✅ 成功更新班级排名数据为大健康产业数据")
print(f"✅ 共更新 {len(rankings)} 个学生的排名信息")