主要内容: - 包含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>
81 lines
2.8 KiB
Python
81 lines
2.8 KiB
Python
import json
|
||
|
||
# 读取更新后的项目数据(包含正确的岗位等级)
|
||
with open('food_projects_with_levels.json', 'r', encoding='utf-8') as f:
|
||
updated_data = json.load(f)
|
||
|
||
# 生成JavaScript格式的项目详情
|
||
js_details = "const projectDetails = {\n"
|
||
for project_id, detail in updated_data['projects_details'].items():
|
||
# 处理岗位数据,确保格式正确
|
||
positions_str = json.dumps(detail['positions'], ensure_ascii=False, indent=4)
|
||
positions_str = positions_str.replace('\n', '\n ')
|
||
|
||
js_details += f""" {project_id}: {{
|
||
id: {project_id},
|
||
name: "{detail['name']}",
|
||
positions: {positions_str},
|
||
unit: "{detail.get('unit', '')}",
|
||
overview: `{detail.get('overview', '本项目暂无详细概述')}`,
|
||
process: `{detail.get('process', '本项目暂无流程介绍')}`,
|
||
keyPoints: `{detail.get('keyPoints', '本项目暂无关键技术点')}`
|
||
}},
|
||
"""
|
||
|
||
js_details = js_details.rstrip(',\n') + "\n};"
|
||
|
||
# 读取原始mock文件
|
||
with open('src/mocks/projectLibraryMock.js', 'r', encoding='utf-8') as f:
|
||
original_content = f.read()
|
||
|
||
# 找到projectDetails的开始和结束位置
|
||
details_start = original_content.find('const projectDetails = {')
|
||
if details_start == -1:
|
||
print("错误:未找到projectDetails定义")
|
||
exit(1)
|
||
|
||
# 找到projectDetails的结束位置
|
||
# 需要正确匹配大括号
|
||
brace_count = 0
|
||
i = details_start + len('const projectDetails = {') - 1
|
||
found_start = False
|
||
while i < len(original_content):
|
||
if original_content[i] == '{':
|
||
if not found_start:
|
||
found_start = True
|
||
brace_count += 1
|
||
elif original_content[i] == '}':
|
||
brace_count -= 1
|
||
if brace_count == 0:
|
||
details_end = i + 1
|
||
# 找到分号
|
||
while details_end < len(original_content) and original_content[details_end] != ';':
|
||
details_end += 1
|
||
details_end += 1
|
||
break
|
||
i += 1
|
||
|
||
# 替换projectDetails部分
|
||
new_content = original_content[:details_start] + js_details + original_content[details_end:]
|
||
|
||
# 备份原文件
|
||
import datetime
|
||
backup_name = f"src/mocks/projectLibraryMock.js.backup_{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}_levels"
|
||
with open(backup_name, 'w', encoding='utf-8') as f:
|
||
f.write(original_content)
|
||
print(f"已备份原文件到: {backup_name}")
|
||
|
||
# 写入新内容
|
||
with open('src/mocks/projectLibraryMock.js', 'w', encoding='utf-8') as f:
|
||
f.write(new_content)
|
||
|
||
print("已更新 projectLibraryMock.js 中的项目详情数据,包含正确的岗位等级")
|
||
|
||
# 验证更新
|
||
print("\n验证更新后的数据:")
|
||
for i in range(1, 4):
|
||
detail = updated_data['projects_details'].get(str(i))
|
||
if detail:
|
||
print(f"\n项目{i}: {detail['name']}")
|
||
for pos in detail['positions'][:2]:
|
||
print(f" - {pos['position']}: {pos['level']}") |