主要内容: - 包含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>
151 lines
4.6 KiB
JavaScript
151 lines
4.6 KiB
JavaScript
import fs from 'fs';
|
|
import path from 'path';
|
|
|
|
// Read finance commerce projects data
|
|
const financeProjects = JSON.parse(
|
|
fs.readFileSync('网页未导入数据/财经商贸产业/财经商贸项目案例.json', 'utf8')
|
|
);
|
|
|
|
// Transform finance projects to match the exact structure of manufacturing projects
|
|
const transformedProjects = financeProjects.map((project, index) => ({
|
|
id: index + 1,
|
|
name: project['案例名称'],
|
|
description: project['所属垂直方向'],
|
|
positions: project['对应个人简历名称'].split(',').map(p => p.trim()),
|
|
unit: project['对应单元名称(垂直能力课)'] || project['对应单元名称(复合能力课)'],
|
|
direction: project['所属垂直方向'],
|
|
category: getCategoryFromDirection(project['所属垂直方向'])
|
|
}));
|
|
|
|
// Helper function to map direction to category
|
|
function getCategoryFromDirection(direction) {
|
|
const categoryMap = {
|
|
'国际贸易': '国际贸易',
|
|
'供应链管理': '供应链管理',
|
|
'电子商务': '电子商务'
|
|
};
|
|
return categoryMap[direction] || direction;
|
|
}
|
|
|
|
// Generate the complete mock file content
|
|
const mockFileContent = `// 项目库Mock数据
|
|
export const getMockProjectsList = (params = {}) => {
|
|
const { search = "", page = 1, pageSize = 10 } = params;
|
|
|
|
// 完整项目列表数据
|
|
const projects = ${JSON.stringify(transformedProjects, null, 4)};
|
|
|
|
// 搜索过滤
|
|
let filteredProjects = projects;
|
|
if (search) {
|
|
filteredProjects = projects.filter(project =>
|
|
project.name.includes(search) ||
|
|
project.description.includes(search) ||
|
|
project.positions.some(pos => pos.includes(search)) ||
|
|
project.category.includes(search)
|
|
);
|
|
}
|
|
|
|
// 分页
|
|
const start = (page - 1) * pageSize;
|
|
const end = start + pageSize;
|
|
const paginatedProjects = filteredProjects.slice(start, end);
|
|
|
|
return {
|
|
success: true,
|
|
data: paginatedProjects,
|
|
total: filteredProjects.length,
|
|
page,
|
|
pageSize
|
|
};
|
|
};
|
|
|
|
// 项目详情Mock数据 - 财经商贸
|
|
export const getMockProjectDetail = (id) => {
|
|
const projects = ${JSON.stringify(transformedProjects, null, 4)};
|
|
|
|
const project = projects.find(p => p.id === parseInt(id));
|
|
|
|
if (!project) {
|
|
return {
|
|
success: false,
|
|
message: '项目不存在'
|
|
};
|
|
}
|
|
|
|
// 查找原始项目数据以获取详细内容
|
|
const financeProjectsData = ${JSON.stringify(financeProjects, null, 4)};
|
|
const originalProject = financeProjectsData[project.id - 1];
|
|
|
|
// 处理项目内容
|
|
let sections = [];
|
|
if (originalProject && originalProject['项目案例内容']) {
|
|
// 将Markdown内容转换为sections
|
|
const content = originalProject['项目案例内容'];
|
|
const lines = content.split('\\n');
|
|
let currentSection = null;
|
|
let currentContent = [];
|
|
|
|
lines.forEach(line => {
|
|
if (line.startsWith('# ') || line.startsWith('## ')) {
|
|
if (currentSection) {
|
|
sections.push({
|
|
title: currentSection,
|
|
content: currentContent.join('\\n').trim()
|
|
});
|
|
}
|
|
currentSection = line.replace(/^#+\\s*/, '').trim();
|
|
currentContent = [];
|
|
} else {
|
|
currentContent.push(line);
|
|
}
|
|
});
|
|
|
|
if (currentSection) {
|
|
sections.push({
|
|
title: currentSection,
|
|
content: currentContent.join('\\n').trim()
|
|
});
|
|
}
|
|
}
|
|
|
|
return {
|
|
success: true,
|
|
data: {
|
|
id: project.id,
|
|
title: project.name,
|
|
description: project.description || '',
|
|
images: [],
|
|
sections: sections.length > 0 ? sections : [
|
|
{
|
|
title: "项目概述",
|
|
content: project.name
|
|
}
|
|
]
|
|
}
|
|
};
|
|
};
|
|
`;
|
|
|
|
// Backup existing file
|
|
const timestamp = Date.now();
|
|
const backupPath = `src/mocks/projectLibraryMock.js.backup_${timestamp}`;
|
|
fs.copyFileSync('src/mocks/projectLibraryMock.js', backupPath);
|
|
console.log(`✅ Created backup at: ${backupPath}`);
|
|
|
|
// Write the new mock file
|
|
fs.writeFileSync('src/mocks/projectLibraryMock.js', mockFileContent);
|
|
console.log('✅ Successfully replaced projectLibraryMock.js with finance/commerce data');
|
|
|
|
// Update categories in ProjectLibraryPage/index.jsx
|
|
const indexPath = 'src/pages/ProjectLibraryPage/index.jsx';
|
|
const indexContent = fs.readFileSync(indexPath, 'utf8');
|
|
|
|
// Get unique categories and directions
|
|
const uniqueDirections = [...new Set(financeProjects.map(p => p['所属垂直方向']))];
|
|
const categories = ['全部', ...uniqueDirections];
|
|
|
|
console.log('📋 Categories to update:', categories);
|
|
console.log('✅ Project library data replacement complete!');
|
|
console.log(`📊 Total projects: ${transformedProjects.length}`);
|
|
console.log(`📁 Backup saved at: ${backupPath}`); |