Files
ALL-teach_sys/frontend_智能开发/updateProjectLibraryWithDetails.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

151 lines
4.3 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');
// 读取智能开发项目案例数据
const projectData = JSON.parse(
fs.readFileSync('./网页未导入数据/智能开发产业/智能开发项目案例.json', 'utf-8')
);
console.log(`找到 ${projectData.length} 个智能开发项目案例`);
// 转换为项目库页面需要的格式
const projects = projectData.map((item, index) => {
// 解析对应岗位
const positions = item['适用岗位']
? item['适用岗位'].split(',').map(p => p.trim())
: [];
// 确定单元名称(优先使用垂直能力课,其次复合能力课)
const unit = item['对应单元名称(垂直能力课)'] || item['对应单元名称(复合能力课)'] || '';
// 确定项目类别和方向
const direction = item['所属垂直方向'] || '智能开发';
return {
id: index + 1,
name: item['案例名称'],
description: direction,
positions: positions,
unit: unit,
direction: direction,
category: direction, // 直接使用垂直方向作为类别
// 保留项目详情内容,用于弹窗显示
projectDetail: item['项目案例内容'] || ''
};
});
// 生成完整的projectLibraryMock.js文件内容
const mockFileContent = `// 项目库Mock数据
export const getMockProjectsList = (params = {}) => {
const { search = "", page = 1, pageSize = 10 } = params;
// 完整项目列表数据
const projects = ${JSON.stringify(projects, null, 4)};
// 搜索过滤
const filteredProjects = projects.filter(project => {
if (!search) return true;
const searchLower = search.toLowerCase();
return (
project.name.toLowerCase().includes(searchLower) ||
project.description.toLowerCase().includes(searchLower) ||
project.positions.some(pos => pos.toLowerCase().includes(searchLower)) ||
project.unit.toLowerCase().includes(searchLower) ||
project.category.toLowerCase().includes(searchLower)
);
});
// 分页
const start = (page - 1) * pageSize;
const end = start + pageSize;
const paginatedProjects = filteredProjects.slice(start, end);
return {
code: 0,
msg: "success",
data: {
list: paginatedProjects,
total: filteredProjects.length,
page,
pageSize,
hasMore: end < filteredProjects.length
}
};
};
export const getMockProjectDetail = (id) => {
const projects = ${JSON.stringify(projects, null, 4)};
const project = projects.find(p => p.id === parseInt(id));
if (!project) {
return {
code: 404,
msg: "项目不存在",
data: null
};
}
// 构建详情数据结构
const detailData = {
success: true,
code: 0,
msg: "success",
data: {
id: project.id,
title: project.name,
category: project.category,
description: project.description,
overview: "项目概述内容",
// 如果有projectDetail将其作为sections展示
sections: project.projectDetail ? [
{
title: "项目详情",
content: project.projectDetail
}
] : [],
// 适用岗位
applicablePositions: project.positions.map(pos => ({
position: pos,
level: "技术骨干岗" // 默认级别
})),
// 对应单元
correspondingUnits: [project.unit].filter(Boolean),
// 可以添加更多字段
process: "",
keyPoints: "",
attachments: []
}
};
return detailData;
};`;
// 写入projectLibraryMock.js
fs.writeFileSync('./src/mocks/projectLibraryMock.js', mockFileContent, 'utf-8');
console.log('✅ 项目库数据更新成功(包含详情)!');
console.log(`- 共更新 ${projects.length} 个项目`);
// 统计信息
const categoryCount = {};
projects.forEach(p => {
categoryCount[p.category] = (categoryCount[p.category] || 0) + 1;
});
console.log('\n项目类别统计');
Object.entries(categoryCount).forEach(([cat, count]) => {
console.log(` ${cat}: ${count}`);
});
console.log('\n前5个项目示例');
projects.slice(0, 5).forEach((p, i) => {
console.log(` ${i+1}. ${p.name}`);
console.log(` 单元: ${p.unit}`);
console.log(` 方向: ${p.direction}`);
console.log(` 岗位: ${p.positions.slice(0, 3).join(', ')}`);
console.log(` 详情长度: ${p.projectDetail ? p.projectDetail.length + '字符' : '无'}`);
});