Files
ALL-teach_sys/frontend_土木水利/update_avatars.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

61 lines
2.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

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
import re
def update_avatars_in_files():
"""更换前三名和葛荣景的头像"""
# 定义新的头像映射
new_avatars = {
"宋雨": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/e17fceace7fef683b80fb096d857ec96.jpg", # 第1名 - 换新头像
"邓航": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/8cdf6b86bda8dd650eee8bf4e68db21b.jpg", # 第2名 - 换新头像
"吕明轩": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/b073d530f57f24bd0964d7aa1d0b33f5.jpg", # 第3名 - 换新头像
"葛荣景": "https://ddcz-1315997005.cos.ap-nanjing.myqcloud.com/static/avatar/douyin/457cfa8e557879e14d54f13dc226a11e.jpg" # 第4名葛荣景 - 换新头像
}
# 1. 更新 mockData.js 中的 profileOverview 数据
print("1. 更新 mockData.js 中的头像...")
with open('src/data/mockData.js', 'r', encoding='utf-8') as f:
content = f.read()
# 更新葛荣景的个人信息头像studentInfo部分
pattern = r'("name": "葛荣景",\s+"realName": "葛荣景",\s+"studentId": "2325060773",\s+"studentNo": "2325060773",\s+"avatar": ")[^"]+(")'
content = re.sub(pattern, r'\1' + new_avatars["葛荣景"] + r'\2', content)
# 更新排名列表中的头像
for name, avatar_url in new_avatars.items():
# 更新排名数据中的头像
pattern = f'("studentName": "{name}",\s+"name": "{name}",\s+"avatar": ")[^"]+(")'
content = re.sub(pattern, r'\1' + avatar_url + r'\2', content)
with open('src/data/mockData.js', 'w', encoding='utf-8') as f:
f.write(content)
print("✅ mockData.js 更新完成")
# 2. 更新 ClassRankModal 组件中的头像映射
print("\n2. 更新 ClassRankModal 组件中的头像映射...")
with open('src/components/ClassRankModal/index.jsx', 'r', encoding='utf-8') as f:
content = f.read()
# 更新 switch case 中的头像URL
for name, avatar_url in new_avatars.items():
pattern = f'case "{name}":\s+avatarUrl = "[^"]+";'
replacement = f'case "{name}":\n avatarUrl = "{avatar_url}";'
content = re.sub(pattern, replacement, content)
with open('src/components/ClassRankModal/index.jsx', 'w', encoding='utf-8') as f:
f.write(content)
print("✅ ClassRankModal 组件更新完成")
print("\n📋 已更换的头像:")
for name, url in new_avatars.items():
print(f" - {name}: 已更换为新头像")
print("\n✨ 所有头像更新完成!")
if __name__ == "__main__":
update_avatars_in_files()