主要内容: - 包含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>
89 lines
3.2 KiB
Python
89 lines
3.2 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import json
|
|
import re
|
|
|
|
def extract_energy_teachers():
|
|
"""从导师信息(通用).json文件中提取能源产业导师"""
|
|
with open('网页未导入数据/导师信息(通用).json', 'r', encoding='utf-8') as f:
|
|
data = json.load(f)
|
|
|
|
energy_teachers = {}
|
|
|
|
for teacher in data:
|
|
if teacher.get('就业管家') == '能源':
|
|
name = teacher['查询导师名称']
|
|
|
|
# 确定导师类型
|
|
teacher_type = "复合课导师" # 默认
|
|
if '公共课' in teacher.get('导师类型', ''):
|
|
teacher_type = "公共课导师"
|
|
elif 'AI' in teacher.get('导师类型', ''):
|
|
teacher_type = "AI课导师"
|
|
elif 'HR' in teacher.get('导师类型', '') or '企业' in teacher.get('导师类型', ''):
|
|
teacher_type = "企业资深HR"
|
|
|
|
# 获取导师特长或标签
|
|
specialties = teacher.get('导师特长', teacher.get('导师标签', []))
|
|
|
|
energy_teachers[name] = {
|
|
'name': name,
|
|
'introduction': teacher['导师介绍'],
|
|
'specialties': specialties,
|
|
'avatar': teacher.get('❌导师头像url链接', ''),
|
|
'type': teacher_type,
|
|
'verticalDirection': teacher.get('所属垂直方向', ''),
|
|
'courses': [] # 初始化为空,后续会通过日历数据更新
|
|
}
|
|
|
|
return energy_teachers
|
|
|
|
def update_mockdata_teachers():
|
|
"""更新mockData.js中的teacherData"""
|
|
|
|
# 提取能源产业导师
|
|
energy_teachers = extract_energy_teachers()
|
|
|
|
# 读取mockData.js
|
|
with open('src/data/mockData.js', 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# 构建新的teacherData对象字符串
|
|
teacher_data_str = "{\n"
|
|
for name, teacher in energy_teachers.items():
|
|
specialties_str = json.dumps(teacher['specialties'], ensure_ascii=False)
|
|
|
|
# 转义特殊字符
|
|
introduction = teacher['introduction'].replace('"', '\\"').replace('\n', '\\n')
|
|
|
|
teacher_data_str += f''' "{name}": {{
|
|
name: "{teacher['name']}",
|
|
introduction: "{introduction}",
|
|
specialties: {specialties_str},
|
|
avatar: "{teacher['avatar']}",
|
|
type: "{teacher['type']}",
|
|
verticalDirection: "{teacher['verticalDirection']}",
|
|
courses: []
|
|
}},\n'''
|
|
|
|
# 移除最后一个逗号
|
|
teacher_data_str = teacher_data_str.rstrip(',\n') + '\n }'
|
|
|
|
# 替换teacherData内容
|
|
# 找到teacherData的起始位置
|
|
pattern = r'teacherData:\s*updateTeacherCourses\(\{[\s\S]*?\},\s*allCalendarEvents\)'
|
|
|
|
replacement = f'teacherData: updateTeacherCourses({teacher_data_str}, allCalendarEvents)'
|
|
|
|
new_content = re.sub(pattern, replacement, content)
|
|
|
|
# 写回文件
|
|
with open('src/data/mockData.js', 'w', encoding='utf-8') as f:
|
|
f.write(new_content)
|
|
|
|
print(f"成功更新 {len(energy_teachers)} 位能源产业导师数据")
|
|
print("导师名单:", list(energy_teachers.keys()))
|
|
|
|
if __name__ == "__main__":
|
|
update_mockdata_teachers() |