主要内容: - 包含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>
173 lines
5.3 KiB
JavaScript
173 lines
5.3 KiB
JavaScript
import fs from 'fs';
|
|
|
|
// 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;
|
|
}
|
|
|
|
// Helper function to parse markdown content
|
|
function parseMarkdownContent(content) {
|
|
if (!content) return { overview: '', process: '', keyPoints: '' };
|
|
|
|
const lines = content.split('\n');
|
|
let overview = '';
|
|
let process = '';
|
|
let keyPoints = '';
|
|
let currentSection = '';
|
|
|
|
lines.forEach(line => {
|
|
if (line.includes('项目概述')) {
|
|
currentSection = 'overview';
|
|
} else if (line.includes('项目整体流程') || line.includes('整体流程介绍')) {
|
|
currentSection = 'process';
|
|
} else if (line.includes('关键技术点')) {
|
|
currentSection = 'keyPoints';
|
|
} else if (currentSection) {
|
|
switch(currentSection) {
|
|
case 'overview':
|
|
overview += line + '\n';
|
|
break;
|
|
case 'process':
|
|
process += line + '\n';
|
|
break;
|
|
case 'keyPoints':
|
|
keyPoints += line + '\n';
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
|
|
return {
|
|
overview: overview.trim(),
|
|
process: process.trim(),
|
|
keyPoints: keyPoints.trim()
|
|
};
|
|
}
|
|
|
|
// Generate detailed project data with positions structure
|
|
const detailedProjects = transformedProjects.map((project, index) => {
|
|
const originalProject = financeProjects[index];
|
|
const parsedContent = parseMarkdownContent(originalProject['项目案例内容']);
|
|
|
|
// Transform positions to include level
|
|
const positionsWithLevel = project.positions.map(pos => {
|
|
// Determine level based on position name
|
|
let level = '普通岗';
|
|
if (pos.includes('经理') || pos.includes('总监') || pos.includes('主管')) {
|
|
level = '储备干部岗';
|
|
} else if (pos.includes('工程师') || pos.includes('专员') || pos.includes('顾问')) {
|
|
level = '技术骨干岗';
|
|
}
|
|
|
|
return {
|
|
level: level,
|
|
position: pos
|
|
};
|
|
});
|
|
|
|
return {
|
|
id: project.id,
|
|
name: project.name,
|
|
positions: positionsWithLevel,
|
|
unit: project.unit,
|
|
overview: parsedContent.overview || originalProject['项目案例内容'].substring(0, 300),
|
|
process: parsedContent.process || '',
|
|
keyPoints: parsedContent.keyPoints || ''
|
|
};
|
|
});
|
|
|
|
// Generate the complete mock file content with proper detail function
|
|
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) => {
|
|
// 直接根据ID返回对应项目的详情
|
|
const projects = ${JSON.stringify(detailedProjects, null, 4)};
|
|
|
|
const project = projects.find(p => p.id === parseInt(id));
|
|
|
|
if (!project) {
|
|
return {
|
|
success: false,
|
|
message: '项目不存在'
|
|
};
|
|
}
|
|
|
|
return {
|
|
success: true,
|
|
data: {
|
|
id: project.id,
|
|
title: project.name,
|
|
category: ${JSON.stringify(transformedProjects, null, 4)}.find(p => p.id === project.id)?.category || '',
|
|
applicablePositions: project.positions,
|
|
unit: project.unit,
|
|
overview: project.overview,
|
|
process: project.process,
|
|
keyPoints: project.keyPoints,
|
|
images: []
|
|
}
|
|
};
|
|
};
|
|
`;
|
|
|
|
// 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 fixed projectLibraryMock.js with correct data structure');
|
|
console.log('✅ Project details now return correct format with positions, overview, process, and keyPoints'); |