Files
ALL-teach_sys/frontend_智能开发/updateProjectsOnly.cjs
KQL cd2e307402 初始化12个产业教务系统项目
主要内容:
- 包含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>
2025-09-24 14:14:14 +08:00

113 lines
3.7 KiB
JavaScript

const fs = require('fs');
const path = require('path');
// 读取智能开发项目案例数据
const smartDevProjects = JSON.parse(
fs.readFileSync('网页未导入数据/智能开发产业/智能开发项目案例.json', 'utf-8')
);
// 读取当前的mock文件
const mockFilePath = path.join(__dirname, 'src/mocks/projectLibraryMock.js');
let mockFileContent = fs.readFileSync(mockFilePath, 'utf-8');
// 构建项目列表数据
const projectsList = smartDevProjects.map((project, index) => {
// 获取适用岗位
const positions = Array.isArray(project['适用岗位']) ? project['适用岗位'] : [];
// 获取岗位名称列表
const positionNames = positions.map(pos => `"${pos['岗位名称']}"`).join(', ');
// 获取所属垂直方向
const direction = project['所属垂直方向'] || '智能开发';
// 获取类别
const category = direction;
// 获取单元
const unit = project['对应单元'] ?
(project['对应单元']['垂直能力课'] && project['对应单元']['垂直能力课'][0]) || direction :
direction;
return ` {
id: ${index + 1},
name: "${project['项目名称']}",
description: "${direction}",
positions: [${positionNames}],
unit: "${unit}",
direction: "${direction}",
category: "${category}"
}`;
});
// 替换getMockProjectsList中的项目列表
const projectsListStr = projectsList.join(',\n');
mockFileContent = mockFileContent.replace(
/const projects = \[[\s\S]*?\];/,
`const projects = [\n${projectsListStr}\n ];`
);
// 构建项目详情数据
const projectDetails = {};
smartDevProjects.forEach((project, index) => {
const id = index + 1;
const positions = Array.isArray(project['适用岗位']) ? project['适用岗位'] : [];
// 构建适用岗位数组 - 保持原始格式
const applicablePositions = positions.map(pos => {
return `{ level: '${pos['岗位等级标签']}', position: '${pos['岗位名称']}' }`;
}).join(', ');
// 获取单元列表
const units = [];
if (project['对应单元']) {
if (project['对应单元']['复合能力课']) {
units.push(...project['对应单元']['复合能力课']);
}
if (project['对应单元']['垂直能力课']) {
units.push(...project['对应单元']['垂直能力课']);
}
}
const unitsStr = units.map(u => `'${u}'`).join(', ');
projectDetails[id] = {
id,
title: project['项目名称'] + '详情',
overview: project['项目概述'] || '',
applicablePositions,
units: unitsStr,
process: project['项目整体流程介绍'] || '',
keyPoints: project['项目案例关键技术点'] || '',
};
});
// 构建projectDetails对象字符串
let projectDetailsStr = ' const projectDetails = {\n';
for (const [id, detail] of Object.entries(projectDetails)) {
projectDetailsStr += ` ${id}: {
id: ${id},
title: '${detail.title}',
overview: '${detail.overview.replace(/'/g, "\\'")}',
applicablePositions: [${detail.applicablePositions}],
units: [${detail.units}],
process: '${detail.process.replace(/'/g, "\\'")}',
keyPoints: '${detail.keyPoints.replace(/'/g, "\\'")}',
attachments: [
{ name: '项目文档.docx', size: '1.2MB', type: 'doc' },
{ name: '项目执行手册.pdf', size: '1.8MB', type: 'pdf' }
]
},\n`;
}
// 移除最后的逗号
projectDetailsStr = projectDetailsStr.slice(0, -2) + '\n };\n';
// 替换getMockProjectDetail函数中的projectDetails
mockFileContent = mockFileContent.replace(
/const projectDetails = \{[\s\S]*?\n \};/,
projectDetailsStr.trim()
);
// 写入文件
fs.writeFileSync(mockFilePath, mockFileContent);
console.log('✅ 项目数据已更新,保持原始代码结构!');