- 包含4个产业方向的前端项目:智能开发、智能制造、大健康、财经商贸 - 已清理node_modules、.yoyo等大文件,项目大小从2.6GB优化至631MB - 配置完善的.gitignore文件 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
140 lines
4.4 KiB
Python
140 lines
4.4 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)
|
|
|
|
# 生成项目详情数据
|
|
project_details = {}
|
|
|
|
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})
|
|
|
|
# 构建详情对象
|
|
detail = {
|
|
'id': project_id,
|
|
'title': item['案例名称'],
|
|
'overview': item.get('项目案例内容', '').split('\n')[2] if item.get('项目案例内容') else '暂无项目概述',
|
|
'applicablePositions': positions,
|
|
'units': [item.get('对应单元名称(垂直能力课)') or item.get('对应单元名称(复合能力课)')],
|
|
'process': '',
|
|
'keyPoints': '',
|
|
'attachments': [] # 智能制造项目没有附件
|
|
}
|
|
|
|
# 从项目案例内容中提取流程和关键技术点
|
|
content = item.get('项目案例内容', '')
|
|
if content:
|
|
# 提取流程部分
|
|
process_match = re.search(r'# 二、项目整体流程介绍(.*?)# 三、', content, re.DOTALL)
|
|
if process_match:
|
|
detail['process'] = process_match.group(1).strip()
|
|
|
|
# 提取关键技术点
|
|
keypoints_match = re.search(r'# 三、.*?关键技术点.*?\n(.*?)$', content, re.DOTALL)
|
|
if keypoints_match:
|
|
detail['keyPoints'] = keypoints_match.group(1).strip()
|
|
|
|
project_details[project_id] = detail
|
|
|
|
# 生成getMockProjectDetail函数代码
|
|
code = '''// 项目详情Mock数据
|
|
export const getMockProjectDetail = (id) => {
|
|
const projectDetails = {
|
|
'''
|
|
|
|
for pid, detail in list(project_details.items())[:5]: # 只生成前5个作为示例
|
|
code += f''' {pid}: {{
|
|
id: {pid},
|
|
title: '{detail["title"]}',
|
|
overview: `{detail["overview"]}`,
|
|
applicablePositions: {json.dumps(detail["applicablePositions"], ensure_ascii=False)},
|
|
units: {json.dumps(detail["units"], ensure_ascii=False)},
|
|
process: `{detail["process"]}`,
|
|
keyPoints: `{detail["keyPoints"]}`,
|
|
attachments: []
|
|
}},
|
|
'''
|
|
|
|
code += ''' };
|
|
|
|
const project = projectDetails[id];
|
|
if (project) {
|
|
return {
|
|
success: true,
|
|
data: project
|
|
};
|
|
}
|
|
|
|
// 如果没有找到特定的详情,返回通用格式
|
|
const projects = '''
|
|
|
|
# 添加项目列表引用
|
|
code += '''[
|
|
{
|
|
"id": 1,
|
|
"name": "锂电非标设备中物流线设计及装调项目",
|
|
"description": "智能制造非标自动化产线搭建",
|
|
"positions": [
|
|
"生产经理储备干部",
|
|
"自动化产线设计师",
|
|
"非标自动化工程师"
|
|
],
|
|
"unit": "新能源电池制造产线搭建",
|
|
"direction": "智能制造非标自动化产线搭建",
|
|
"category": "新能源制造"
|
|
}
|
|
];'''
|
|
|
|
code += '''
|
|
|
|
const simpleProject = projects.find(p => p.id === parseInt(id));
|
|
if (simpleProject) {
|
|
return {
|
|
success: true,
|
|
data: {
|
|
id: simpleProject.id,
|
|
title: simpleProject.name,
|
|
overview: simpleProject.description,
|
|
applicablePositions: simpleProject.positions.map(p => ({ level: '技术骨干岗', position: p })),
|
|
units: [simpleProject.unit],
|
|
process: '项目流程详情暂未录入',
|
|
keyPoints: '关键技术点暂未录入',
|
|
attachments: []
|
|
}
|
|
};
|
|
}
|
|
|
|
return {
|
|
success: false,
|
|
message: "项目不存在"
|
|
};
|
|
};'''
|
|
|
|
# 写入文件
|
|
with open('projectDetailUpdate.js', 'w', encoding='utf-8') as f:
|
|
f.write(code)
|
|
|
|
print("✅ 项目详情更新代码已生成到 projectDetailUpdate.js")
|
|
print(f"- 生成了 {len(project_details)} 个项目的详情数据")
|
|
print("- 请手动将代码替换到 src/mocks/projectLibraryMock.js 中的 getMockProjectDetail 函数") |