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:
151
frontend_智能开发/updateProjectLibraryWithDetails.cjs
Normal file
151
frontend_智能开发/updateProjectLibraryWithDetails.cjs
Normal file
@@ -0,0 +1,151 @@
|
||||
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 + '字符' : '无'}`);
|
||||
});
|
||||
Reference in New Issue
Block a user