主要内容: - 包含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>
121 lines
3.7 KiB
Python
121 lines
3.7 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import json
|
|
import re
|
|
|
|
# 读取智能制造项目案例数据
|
|
with open('网页未导入数据/智能制造产业/智能制造项目案例.json', 'r', encoding='utf-8') as f:
|
|
raw_data = json.load(f)
|
|
|
|
# 读取现有的mock文件
|
|
with open('src/mocks/projectLibraryMock.js', 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# 生成简化的项目详情函数
|
|
new_function = '''// 项目详情Mock数据 - 智能制造
|
|
export const getMockProjectDetail = (id) => {
|
|
// 直接根据ID返回对应项目的详情
|
|
const projects = '''
|
|
|
|
# 添加项目数组
|
|
projects_data = []
|
|
for idx, item in enumerate(raw_data):
|
|
project_id = idx + 1
|
|
|
|
# 提取岗位信息
|
|
positions = []
|
|
if item.get('对应个人简历名称'):
|
|
pos_list = [p.strip() for p in item['对应个人简历名称'].split(',')]
|
|
for pos in pos_list:
|
|
if '助理' in pos or '技术员' in pos:
|
|
level = '普通岗'
|
|
elif '工程师' in pos or '主管' in pos:
|
|
level = '技术骨干岗'
|
|
elif '经理' in pos or '总监' in pos:
|
|
level = '储备干部岗'
|
|
else:
|
|
level = '普通岗'
|
|
positions.append({'level': level, 'position': pos})
|
|
|
|
# 提取项目内容的概述部分
|
|
content_text = item.get('项目案例内容', '')
|
|
overview = ''
|
|
if content_text:
|
|
# 尝试提取第一段概述
|
|
lines = content_text.split('\n')
|
|
for line in lines:
|
|
if line.strip() and not line.startswith('#'):
|
|
overview = line.strip()
|
|
break
|
|
|
|
# 提取流程和技术点
|
|
process = ''
|
|
keyPoints = ''
|
|
if content_text:
|
|
# 提取流程部分
|
|
process_match = re.search(r'# 二、.*?\n(.*?)(?=# 三、|$)', content_text, re.DOTALL)
|
|
if process_match:
|
|
process = process_match.group(1).strip()
|
|
|
|
# 提取关键技术点
|
|
keypoints_match = re.search(r'# 三、.*?\n(.*?)$', content_text, re.DOTALL)
|
|
if keypoints_match:
|
|
keyPoints = keypoints_match.group(1).strip()
|
|
|
|
project = {
|
|
'id': project_id,
|
|
'name': item['案例名称'],
|
|
'positions': positions,
|
|
'unit': item.get('对应单元名称(垂直能力课)') or item.get('对应单元名称(复合能力课)'),
|
|
'overview': overview,
|
|
'process': process,
|
|
'keyPoints': keyPoints
|
|
}
|
|
projects_data.append(project)
|
|
|
|
# 生成新的函数内容
|
|
new_function += json.dumps(projects_data, ensure_ascii=False, indent=2)
|
|
|
|
new_function += ''';
|
|
|
|
const project = projects.find(p => p.id === parseInt(id));
|
|
|
|
if (project) {
|
|
return {
|
|
success: true,
|
|
data: {
|
|
id: project.id,
|
|
title: project.name,
|
|
overview: project.overview || '暂无项目概述',
|
|
applicablePositions: project.positions || [],
|
|
units: [project.unit],
|
|
process: project.process || '项目流程详情暂未录入',
|
|
keyPoints: project.keyPoints || '关键技术点暂未录入',
|
|
// 不返回附件
|
|
attachments: []
|
|
}
|
|
};
|
|
}
|
|
|
|
return {
|
|
success: false,
|
|
message: "项目不存在"
|
|
};
|
|
};'''
|
|
|
|
# 找到并替换getMockProjectDetail函数
|
|
pattern = r'// 项目详情Mock数据.*?export const getMockProjectDetail = \(id\) => \{.*?\n\};'
|
|
match = re.search(pattern, content, re.DOTALL)
|
|
|
|
if match:
|
|
new_content = content[:match.start()] + new_function + content[match.end():]
|
|
|
|
# 写回文件
|
|
with open('src/mocks/projectLibraryMock.js', 'w', encoding='utf-8') as f:
|
|
f.write(new_content)
|
|
|
|
print("✅ 成功替换项目详情数据!")
|
|
print(f"- 更新了 {len(projects_data)} 个项目的详情")
|
|
else:
|
|
print("❌ 未找到getMockProjectDetail函数") |