Files
online_sys/frontend_智能开发/restoreToManufacturing.cjs
KQL a7242f0c69 Initial commit: 教务系统在线平台
- 包含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>
2025-12-12 18:16:55 +08:00

328 lines
11 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const fs = require('fs');
// 1. 恢复项目库页面标题和分类
const pagePath = './src/pages/ProjectLibraryPage/index.jsx';
let pageContent = fs.readFileSync(pagePath, 'utf-8');
// 恢复标题
pageContent = pageContent.replace(
/<p className="project-library-title">智能开发班级项目库<\/p>/,
'<p className="project-library-title">智能制造班级项目库</p>'
);
// 恢复分类标签
pageContent = pageContent.replace(
/const categories = \["全部", "AI智能应用开发", "网络安全", "AI大前端", "AIOps智能运维"\];/,
'const categories = ["全部", "新能源制造", "汽车制造", "精密加工", "智能装配", "质量检测"];'
);
fs.writeFileSync(pagePath, pageContent, 'utf-8');
console.log('✅ 页面标题和分类已恢复为智能制造');
// 2. 恢复projectLibraryMock.js中的数据
const mockPath = './src/mocks/projectLibraryMock.js';
let mockContent = fs.readFileSync(mockPath, 'utf-8');
// 智能制造项目数据
const manufacturingProjects = `[
{
id: 1,
name: "新能源汽车电池PACK产线",
direction: "新能源制造",
description: "建设完整的动力电池PACK自动化生产线",
positions: ["新能源系统集成工程师", "电池测试工程师", "产线调试工程师"],
difficulty: "高级",
tags: ["新能源", "自动化", "MES系统"],
progress: 85,
deadline: "2024-03-15"
},
{
id: 2,
name: "汽车焊装生产线集成",
direction: "汽车制造",
description: "实现白车身焊装自动化生产线的系统集成",
positions: ["智能制造系统架构师", "焊接工艺工程师", "机器人调试工程师"],
difficulty: "高级",
tags: ["焊装", "机器人", "系统集成"],
progress: 72,
deadline: "2024-04-20"
},
{
id: 3,
name: "航空零件五轴加工中心",
direction: "精密加工",
description: "高精度航空结构件的五轴联动数控加工",
positions: ["CNC高级编程工程师", "精密加工工艺师", "质量检测工程师"],
difficulty: "高级",
tags: ["五轴加工", "航空制造", "精密测量"],
progress: 68,
deadline: "2024-03-30"
},
{
id: 4,
name: "3C产品自动装配线",
direction: "智能装配",
description: "消费电子产品柔性自动化装配系统",
positions: ["自动化产线工程师", "视觉检测工程师", "MES开发工程师"],
difficulty: "中级",
tags: ["3C制造", "柔性产线", "智能装配"],
progress: 90,
deadline: "2024-02-28"
},
{
id: 5,
name: "锂电池智能制造工厂",
direction: "新能源制造",
description: "建设数字化锂电池智能制造示范工厂",
positions: ["智能工厂规划师", "数字化工程师", "设备集成工程师"],
difficulty: "高级",
tags: ["数字工厂", "锂电池", "智能制造"],
progress: 45,
deadline: "2024-05-10"
},
{
id: 6,
name: "精密模具智能加工",
direction: "精密加工",
description: "注塑模具的智能化设计与精密加工",
positions: ["模具设计工程师", "CAM编程工程师", "EDM加工技师"],
difficulty: "中级",
tags: ["模具制造", "精密加工", "CAD/CAM"],
progress: 78,
deadline: "2024-03-25"
},
{
id: 7,
name: "工业视觉质检系统",
direction: "质量检测",
description: "基于深度学习的产品缺陷视觉检测系统",
positions: ["机器视觉工程师", "算法工程师", "质量工程师"],
difficulty: "高级",
tags: ["机器视觉", "深度学习", "质量控制"],
progress: 82,
deadline: "2024-04-05"
},
{
id: 8,
name: "智能仓储物流系统",
direction: "智能装配",
description: "AGV+立体仓库的智能仓储解决方案",
positions: ["物流系统工程师", "AGV调试工程师", "WMS开发工程师"],
difficulty: "中级",
tags: ["智能物流", "AGV", "立体仓库"],
progress: 65,
deadline: "2024-04-15"
},
{
id: 9,
name: "新能源电机智造产线",
direction: "新能源制造",
description: "电动汽车驱动电机自动化生产线建设",
positions: ["电机工艺工程师", "产线集成工程师", "测试开发工程师"],
difficulty: "高级",
tags: ["电机制造", "新能源", "自动化"],
progress: 55,
deadline: "2024-05-20"
},
{
id: 10,
name: "汽车总装MES系统",
direction: "汽车制造",
description: "汽车总装车间制造执行系统开发与实施",
positions: ["MES实施顾问", "系统架构师", "数据分析师"],
difficulty: "高级",
tags: ["MES", "总装", "数字化"],
progress: 70,
deadline: "2024-04-10"
}
]`;
// 查找getMockProjectsList函数中的projects数组并替换
const projectsListPattern = /export const getMockProjectsList[\s\S]*?const projects = \[[\s\S]*?\];/;
const projectsListMatch = mockContent.match(projectsListPattern);
if (projectsListMatch) {
const newProjectsList = `export const getMockProjectsList = (params = {}) => {
const { page = 1, pageSize = 10, search = '' } = params;
// 智能制造项目数据
const projects = ${manufacturingProjects};`;
mockContent = mockContent.replace(projectsListMatch[0], newProjectsList);
}
// 查找并修复getMockProjectDetail函数
const detailFunctionStart = mockContent.indexOf('export const getMockProjectDetail = (id) => {');
if (detailFunctionStart !== -1) {
// 找到函数结束位置
let braceCount = 0;
let functionEnd = -1;
for (let i = detailFunctionStart; i < mockContent.length; i++) {
if (mockContent[i] === '{') braceCount++;
if (mockContent[i] === '}') {
braceCount--;
if (braceCount === 0) {
functionEnd = i + 1;
break;
}
}
}
// 构建新的getMockProjectDetail函数
const newDetailFunction = `export const getMockProjectDetail = (id) => {
// 使用智能制造项目数据
const projects = ${manufacturingProjects};
const project = projects.find(p => p.id === parseInt(id));
if (!project) {
return {
success: false,
code: 404,
message: "项目不存在",
data: null
};
}
return {
success: true,
code: 0,
message: "success",
data: {
id: project.id,
title: project.name,
category: project.direction,
description: project.description,
difficulty: project.difficulty,
tags: project.tags,
positions: project.positions,
progress: project.progress,
deadline: project.deadline,
sections: [
{
title: "项目背景",
content: \`该项目是\${project.direction}领域的重要项目,旨在通过智能制造技术提升生产效率和产品质量。项目涉及\${project.tags.join('、')}等关键技术。\`
},
{
title: "技术方案",
content: "采用先进的智能制造技术,包括工业互联网、人工智能、大数据分析等,构建智能化生产系统。"
},
{
title: "预期成果",
content: "项目完成后将显著提升生产效率,降低制造成本,提高产品质量稳定性。"
}
],
attachments: []
}
};
}`;
mockContent = mockContent.substring(0, detailFunctionStart) +
newDetailFunction +
mockContent.substring(functionEnd);
}
fs.writeFileSync(mockPath, mockContent, 'utf-8');
console.log('✅ 项目库Mock数据已恢复为智能制造');
// 3. 恢复projectUnitsMapping.js
const mappingPath = './src/data/projectUnitsMapping.js';
const manufacturingMapping = `// 项目案例对应单元映射数据 - 智能制造
// 基于智能制造产业项目
export const projectUnitsMapping = {
"新能源汽车电池PACK产线": {
compoundUnits: ["新能源电池制造"],
verticalUnits: ["电池系统集成", "产线调试与优化"]
},
"汽车焊装生产线集成": {
compoundUnits: ["汽车智能制造"],
verticalUnits: ["焊接工艺", "机器人编程", "系统集成"]
},
"航空零件五轴加工中心": {
compoundUnits: ["精密制造技术"],
verticalUnits: ["五轴编程", "精密测量", "工艺优化"]
},
"3C产品自动装配线": {
compoundUnits: ["智能装配系统"],
verticalUnits: ["柔性制造", "视觉检测", "MES集成"]
},
"锂电池智能制造工厂": {
compoundUnits: ["数字化工厂"],
verticalUnits: ["智能工厂规划", "设备互联", "数据分析"]
},
"精密模具智能加工": {
compoundUnits: ["模具制造技术"],
verticalUnits: ["CAD/CAM", "EDM加工", "精密制造"]
},
"工业视觉质检系统": {
compoundUnits: ["智能检测技术"],
verticalUnits: ["机器视觉", "深度学习", "缺陷检测"]
},
"智能仓储物流系统": {
compoundUnits: ["智能物流系统"],
verticalUnits: ["AGV调度", "立体仓库", "WMS开发"]
},
"新能源电机智造产线": {
compoundUnits: ["电机智能制造"],
verticalUnits: ["电机工艺", "自动化集成", "性能测试"]
},
"汽车总装MES系统": {
compoundUnits: ["制造执行系统"],
verticalUnits: ["MES实施", "数据采集", "生产调度"]
}
};
// 获取项目的复合能力课程
export const getCompoundUnits = (projectTitle) => {
if (!projectTitle) return [];
// 直接匹配
if (projectUnitsMapping[projectTitle]) {
return projectUnitsMapping[projectTitle].compoundUnits || [];
}
// 尝试去除后缀后匹配(如"详情"
const cleanTitle = projectTitle.replace(/详情$/, '');
if (projectUnitsMapping[cleanTitle]) {
return projectUnitsMapping[cleanTitle].compoundUnits || [];
}
return [];
};
// 获取项目的垂直能力课程
export const getVerticalUnits = (projectTitle) => {
if (!projectTitle) return [];
// 直接匹配
if (projectUnitsMapping[projectTitle]) {
return projectUnitsMapping[projectTitle].verticalUnits || [];
}
// 尝试去除后缀后匹配(如"详情"
const cleanTitle = projectTitle.replace(/详情$/, '');
if (projectUnitsMapping[cleanTitle]) {
return projectUnitsMapping[cleanTitle].verticalUnits || [];
}
return [];
};
// 获取项目的所有对应单元
export const getProjectUnits = (projectTitle) => {
const mapping = projectUnitsMapping[projectTitle];
if (!mapping) return [];
return [...mapping.compoundUnits, ...mapping.verticalUnits];
};`;
fs.writeFileSync(mappingPath, manufacturingMapping, 'utf-8');
console.log('✅ 单元映射数据已恢复为智能制造');
console.log('\n✅ 所有项目库相关数据已恢复为智能制造产业!');
console.log('- 页面标题: 智能制造班级项目库');
console.log('- 分类标签: 新能源制造、汽车制造、精密加工、智能装配、质量检测');
console.log('- 项目数据: 10个智能制造项目');
console.log('- 单元映射: 智能制造相关单元');