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>
This commit is contained in:
88
frontend_智能开发/updateUnitsMapping.cjs
Normal file
88
frontend_智能开发/updateUnitsMapping.cjs
Normal file
@@ -0,0 +1,88 @@
|
||||
const fs = require('fs');
|
||||
|
||||
// 读取智能开发项目案例数据
|
||||
const smartDevProjects = JSON.parse(
|
||||
fs.readFileSync('网页未导入数据/智能开发产业/智能开发项目案例.json', 'utf-8')
|
||||
);
|
||||
|
||||
// 构建新的映射数据
|
||||
let mappingContent = `// 项目案例对应单元映射数据
|
||||
// 基于智能开发产业项目案例
|
||||
|
||||
export const projectUnitsMapping = {
|
||||
`;
|
||||
|
||||
smartDevProjects.forEach((project, index) => {
|
||||
const projectName = project['项目名称'];
|
||||
|
||||
// 获取复合能力课和垂直能力课
|
||||
const compoundUnits = project['对应单元']?.['复合能力课'] || [];
|
||||
const verticalUnits = project['对应单元']?.['垂直能力课'] || [];
|
||||
|
||||
mappingContent += ` "${projectName}": {
|
||||
"compoundUnits": [
|
||||
${compoundUnits.map(unit => ` "${unit}"`).join(',\n')}
|
||||
],
|
||||
"verticalUnits": [
|
||||
${verticalUnits.map(unit => ` "${unit}"`).join(',\n')}
|
||||
]
|
||||
}`;
|
||||
|
||||
if (index < smartDevProjects.length - 1) {
|
||||
mappingContent += ',\n';
|
||||
}
|
||||
});
|
||||
|
||||
mappingContent += `
|
||||
};
|
||||
|
||||
// 获取项目的复合能力课程
|
||||
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 compoundUnits = getCompoundUnits(projectTitle);
|
||||
const verticalUnits = getVerticalUnits(projectTitle);
|
||||
return [...compoundUnits, ...verticalUnits];
|
||||
};
|
||||
`;
|
||||
|
||||
// 写入文件
|
||||
fs.writeFileSync('src/data/projectUnitsMapping.js', mappingContent);
|
||||
|
||||
console.log('✅ projectUnitsMapping.js 已更新为智能开发项目数据!');
|
||||
console.log(`- 包含 ${smartDevProjects.length} 个项目的单元映射`);
|
||||
console.log('- 保留了原有的函数结构');
|
||||
Reference in New Issue
Block a user