主要内容: - 包含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>
201 lines
6.5 KiB
JavaScript
201 lines
6.5 KiB
JavaScript
const fs = require('fs');
|
||
|
||
// 读取智能开发项目案例数据
|
||
const projectData = JSON.parse(
|
||
fs.readFileSync('./网页未导入数据/智能开发产业/智能开发项目案例.json', 'utf-8')
|
||
);
|
||
|
||
console.log(`找到 ${projectData.length} 个智能开发项目案例`);
|
||
|
||
// 1. 创建单元映射数据
|
||
const projectUnitsMapping = {};
|
||
projectData.forEach(item => {
|
||
const projectName = item['案例名称'];
|
||
projectUnitsMapping[projectName] = {
|
||
compoundUnits: item['对应单元名称(复合能力课)'] ? [item['对应单元名称(复合能力课)']] : [],
|
||
verticalUnits: item['对应单元名称(垂直能力课)'] ? [item['对应单元名称(垂直能力课)']] : []
|
||
};
|
||
});
|
||
|
||
// 生成projectUnitsMapping.js文件内容
|
||
const mappingFileContent = `// 项目案例对应单元映射数据 - 智能开发
|
||
// 基于 网页未导入数据/智能开发产业/智能开发项目案例.json
|
||
|
||
export const projectUnitsMapping = ${JSON.stringify(projectUnitsMapping, null, 2)};
|
||
|
||
// 获取项目的复合能力课程
|
||
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];
|
||
};`;
|
||
|
||
// 写入projectUnitsMapping.js
|
||
fs.writeFileSync('./src/data/projectUnitsMapping.js', mappingFileContent, 'utf-8');
|
||
|
||
// 2. 更新项目数据,添加适用岗位的等级信息
|
||
const projects = projectData.map((item, index) => {
|
||
// 解析适用岗位并添加等级
|
||
const positionsStr = item['适用岗位'] || '';
|
||
const positionsList = positionsStr ? positionsStr.split(',').map(p => p.trim()) : [];
|
||
|
||
// 为岗位分配等级(根据岗位名称判断)
|
||
const positions = positionsList.map(pos => {
|
||
let level = '技术骨干岗'; // 默认级别
|
||
|
||
// 根据岗位名称判断等级
|
||
if (pos.includes('助理') || pos.includes('实习') || pos.includes('初级')) {
|
||
level = '普通岗';
|
||
} else if (pos.includes('高级') || pos.includes('专家') || pos.includes('经理') || pos.includes('总监')) {
|
||
level = '储备干部岗';
|
||
}
|
||
|
||
return {
|
||
level: level,
|
||
position: pos
|
||
};
|
||
});
|
||
|
||
// 确定单元名称
|
||
const unit = item['对应单元名称(垂直能力课)'] || item['对应单元名称(复合能力课)'] || '';
|
||
|
||
// 提取项目详情内容的各个部分
|
||
const projectDetail = item['项目案例内容'] || '';
|
||
|
||
let overview = '';
|
||
let process = '';
|
||
let keyPoints = '';
|
||
|
||
if (projectDetail) {
|
||
// 尝试提取项目概述
|
||
const overviewMatch = projectDetail.match(/项目概述[\s\S]*?(?=\n#|$)/);
|
||
if (overviewMatch) {
|
||
overview = overviewMatch[0].replace(/^.*项目概述\s*/, '').replace(/^\n+/, '').trim();
|
||
// 只取前500个字符作为概述
|
||
if (overview.length > 500) {
|
||
overview = overview.substring(0, 497) + '...';
|
||
}
|
||
}
|
||
|
||
// 尝试提取项目流程
|
||
const processMatch = projectDetail.match(/项目整体流程介绍[\s\S]*?(?=\n#.*项目案例关键技术点|$)/);
|
||
if (processMatch) {
|
||
process = processMatch[0].replace(/^.*项目整体流程介绍\s*/, '').trim();
|
||
}
|
||
|
||
// 尝试提取关键技术点
|
||
const keyPointsMatch = projectDetail.match(/项目案例关键技术点[\s\S]*$/);
|
||
if (keyPointsMatch) {
|
||
keyPoints = keyPointsMatch[0].replace(/^.*项目案例关键技术点\s*/, '').trim();
|
||
}
|
||
}
|
||
|
||
// 返回与原有格式完全一致的数据结构
|
||
return {
|
||
id: index + 1,
|
||
name: item['案例名称'],
|
||
positions: positions,
|
||
unit: unit,
|
||
overview: overview || `${item['案例名称']}是一个${item['所属垂直方向'] || '智能开发'}方向的项目,旨在提升相关技术能力和实践经验。`,
|
||
process: process || '',
|
||
keyPoints: keyPoints || ''
|
||
};
|
||
});
|
||
|
||
// 3. 更新projectLibraryMock.js文件
|
||
const mockFilePath = './src/mocks/projectLibraryMock.js';
|
||
let mockFileContent = fs.readFileSync(mockFilePath, 'utf-8');
|
||
|
||
// 只需要确保getMockProjectDetail使用正确的数据
|
||
// 检查getMockProjectDetail函数是否返回正确的详情数据
|
||
const detailFunctionPattern = /export const getMockProjectDetail = \(id\) => \{[\s\S]*?\n\};/;
|
||
const detailFunctionMatch = mockFileContent.match(detailFunctionPattern);
|
||
|
||
if (detailFunctionMatch) {
|
||
// 构建新的getMockProjectDetail函数
|
||
const newDetailFunction = `export const getMockProjectDetail = (id) => {
|
||
// 直接根据ID返回对应项目的详情
|
||
const projects = ${JSON.stringify(projects, null, 2)};
|
||
|
||
const project = projects.find(p => p.id === parseInt(id));
|
||
|
||
if (!project) {
|
||
return {
|
||
code: 404,
|
||
msg: "项目不存在",
|
||
data: null
|
||
};
|
||
}
|
||
|
||
return {
|
||
code: 0,
|
||
msg: "success",
|
||
data: {
|
||
...project,
|
||
title: project.name,
|
||
applicablePositions: project.positions || [],
|
||
correspondingUnits: project.unit ? [project.unit] : []
|
||
}
|
||
};
|
||
};`;
|
||
|
||
// 替换函数
|
||
mockFileContent = mockFileContent.replace(detailFunctionMatch[0], newDetailFunction);
|
||
|
||
// 写入文件
|
||
fs.writeFileSync(mockFilePath, mockFileContent, 'utf-8');
|
||
|
||
console.log('✅ 项目详情数据更新成功!');
|
||
} else {
|
||
console.error('❌ 未找到getMockProjectDetail函数');
|
||
}
|
||
|
||
console.log('\n✅ 所有更新完成!');
|
||
console.log('- 单元映射数据已更新');
|
||
console.log('- 岗位等级已添加');
|
||
console.log('- 项目详情函数已更新');
|
||
|
||
// 输出统计
|
||
console.log('\n前3个项目示例:');
|
||
projects.slice(0, 3).forEach((p, i) => {
|
||
console.log(` ${i+1}. ${p.name}`);
|
||
console.log(` 单元: ${p.unit}`);
|
||
console.log(` 岗位: ${p.positions.map(pos => `${pos.position}(${pos.level})`).join(', ')}`);
|
||
}); |