主要内容: - 包含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>
76 lines
2.1 KiB
Python
76 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
|
||
import os
|
||
import json
|
||
|
||
def read_ehs_project():
|
||
"""
|
||
读取EHS项目的markdown文件内容
|
||
"""
|
||
# 项目文件夹路径
|
||
project_folder = "网页未导入数据/能源产业/学生完成的项目"
|
||
|
||
# 列出文件夹中的所有文件
|
||
if os.path.exists(project_folder):
|
||
files = os.listdir(project_folder)
|
||
print(f"找到的文件:{files}")
|
||
|
||
# 查找EHS相关的文件
|
||
for file in files:
|
||
if "EHS" in file and file.endswith(".md"):
|
||
file_path = os.path.join(project_folder, file)
|
||
print(f"\n读取文件:{file_path}")
|
||
|
||
with open(file_path, 'r', encoding='utf-8') as f:
|
||
content = f.read()
|
||
|
||
# 输出内容预览
|
||
print(f"\n文件内容(前500字符):")
|
||
print(content[:500])
|
||
print("\n" + "="*50)
|
||
|
||
# 生成JavaScript代码
|
||
generate_js_code(content, file.replace(".md", ""))
|
||
return content
|
||
else:
|
||
print(f"文件夹不存在:{project_folder}")
|
||
return None
|
||
|
||
def generate_js_code(content, title):
|
||
"""
|
||
生成JavaScript代码片段
|
||
"""
|
||
# 转义特殊字符
|
||
content_escaped = content.replace('\\', '\\\\').replace('`', '\\`').replace('${', '\\${')
|
||
|
||
js_code = f'''
|
||
// 可查看的项目数据更新
|
||
const clickableProject = {{
|
||
title: "{title}",
|
||
content: `{content_escaped}`
|
||
}};
|
||
|
||
// 使用示例:
|
||
// 在ProjectLibraryPage组件中,将handleCardClick函数中的内容替换为:
|
||
// if (projectTitle === "{title}") {{
|
||
// Modal.info({{
|
||
// title: projectTitle,
|
||
// content: (
|
||
// <div style={{{{ maxHeight: '60vh', overflowY: 'auto' }}}}>
|
||
// <ReactMarkdown>{{clickableProject.content}}</ReactMarkdown>
|
||
// </div>
|
||
// ),
|
||
// width: 800,
|
||
// }});
|
||
// }}
|
||
'''
|
||
|
||
# 保存到文件
|
||
with open("ehs_project_content.js", 'w', encoding='utf-8') as f:
|
||
f.write(js_code)
|
||
|
||
print(f"\nJavaScript代码已生成到:ehs_project_content.js")
|
||
|
||
if __name__ == "__main__":
|
||
read_ehs_project() |