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:
204
frontend_财经商贸/regenerateProjectLibrary.mjs
Normal file
204
frontend_财经商贸/regenerateProjectLibrary.mjs
Normal file
@@ -0,0 +1,204 @@
|
||||
import fs from 'fs';
|
||||
|
||||
// 读取财经商贸项目案例数据
|
||||
const caseData = JSON.parse(fs.readFileSync('网页未导入数据/财经商贸产业/财经商贸项目案例.json', 'utf8'));
|
||||
|
||||
// 读取岗位等级数据
|
||||
const jobLevelData = JSON.parse(fs.readFileSync('网页未导入数据/财经商贸产业/财经商贸岗位简历.json', 'utf8'));
|
||||
|
||||
// 创建岗位等级映射
|
||||
const levelMapping = {};
|
||||
jobLevelData.forEach(job => {
|
||||
levelMapping[job['岗位名称']] = job['岗位等级标签'];
|
||||
});
|
||||
|
||||
// 构建项目列表
|
||||
const projects = caseData.slice(0, 20).map((item, index) => {
|
||||
// 根据所属垂直方向确定category
|
||||
let category = '国际贸易'; // 默认
|
||||
if (item['所属垂直方向'] === '国际贸易') {
|
||||
category = '国际贸易';
|
||||
} else if (item['所属垂直方向'] === '供应链管理') {
|
||||
category = '供应链管理';
|
||||
} else if (item['所属垂直方向'] === '电子商务') {
|
||||
category = '电子商务';
|
||||
} else if (item['所属垂直方向'] === '金融服务') {
|
||||
category = '金融服务';
|
||||
} else if (item['所属垂直方向'] === '企业管理基础') {
|
||||
category = '供应链管理';
|
||||
}
|
||||
|
||||
// 获取岗位列表
|
||||
const positions = item['对应个人简历名称'] ? item['对应个人简历名称'].split(',').map(p => p.trim()) : [];
|
||||
|
||||
return {
|
||||
id: index + 1,
|
||||
name: item['案例名称'],
|
||||
description: item['所属垂直方向'] || category,
|
||||
positions: positions,
|
||||
unit: item['对应单元名称(垂直能力课)'] || item['对应单元名称(复合能力课)'] || '',
|
||||
direction: item['所属垂直方向'] || category,
|
||||
category: category
|
||||
};
|
||||
});
|
||||
|
||||
// 构建项目详情
|
||||
const projectDetails = {};
|
||||
caseData.slice(0, 20).forEach((item, index) => {
|
||||
const id = index + 1;
|
||||
|
||||
// 获取岗位列表并分配等级
|
||||
const positions = item['对应个人简历名称'] ? item['对应个人简历名称'].split(',').map(pos => {
|
||||
const position = pos.trim();
|
||||
// 从映射表获取等级,如果没有则根据规则分配
|
||||
let level = levelMapping[position] || '普通岗';
|
||||
// 将"基础岗"改为"普通岗"
|
||||
if (level === '基础岗') {
|
||||
level = '普通岗';
|
||||
}
|
||||
return { level, position };
|
||||
}) : [];
|
||||
|
||||
// 提取项目概述
|
||||
let overview = '';
|
||||
if (item['项目案例内容']) {
|
||||
const overviewMatch = item['项目案例内容'].match(/项目概述[\s\S]*?(?=\n#|$)/);
|
||||
if (overviewMatch) {
|
||||
overview = overviewMatch[0]
|
||||
.replace(/^#\s*/, '')
|
||||
.replace(/项目概述\s*/, '')
|
||||
.replace(/\n/g, ' ')
|
||||
.trim();
|
||||
}
|
||||
}
|
||||
|
||||
// 提取项目流程
|
||||
let process = '';
|
||||
if (item['项目案例内容']) {
|
||||
const processMatch = item['项目案例内容'].match(/项目整体流程介绍([\s\S]*?)(?=#\s*三、|$)/);
|
||||
if (processMatch) {
|
||||
process = processMatch[1].trim();
|
||||
}
|
||||
}
|
||||
|
||||
// 提取关键技术点
|
||||
let keyPoints = '';
|
||||
if (item['项目案例内容']) {
|
||||
const keyPointsMatch = item['项目案例内容'].match(/项目案例关键技术点([\s\S]*?)$/);
|
||||
if (keyPointsMatch) {
|
||||
keyPoints = keyPointsMatch[1].trim();
|
||||
}
|
||||
}
|
||||
|
||||
// 对岗位按等级排序:普通岗 -> 技术骨干岗 -> 储备干部岗
|
||||
const sortedPositions = [...positions].sort((a, b) => {
|
||||
const levelOrder = {
|
||||
'普通岗': 0,
|
||||
'技术骨干岗': 1,
|
||||
'储备干部岗': 2
|
||||
};
|
||||
const aOrder = levelOrder[a.level] !== undefined ? levelOrder[a.level] : 999;
|
||||
const bOrder = levelOrder[b.level] !== undefined ? levelOrder[b.level] : 999;
|
||||
return aOrder - bOrder;
|
||||
});
|
||||
|
||||
projectDetails[id] = {
|
||||
id: id,
|
||||
title: item['案例名称'],
|
||||
overview: overview || '项目概述内容',
|
||||
applicablePositions: sortedPositions,
|
||||
units: [item['对应单元名称(垂直能力课)'] || item['对应单元名称(复合能力课)'] || ''].filter(u => u),
|
||||
process: process,
|
||||
keyPoints: keyPoints,
|
||||
attachments: [
|
||||
{ name: `${item['案例名称']}.docx`, size: '1.2MB', type: 'doc' },
|
||||
{ name: '项目执行手册.pdf', size: '1.8MB', type: 'pdf' }
|
||||
]
|
||||
};
|
||||
});
|
||||
|
||||
// 生成完整的Mock文件内容
|
||||
const mockContent = `// 项目库Mock数据
|
||||
export const getMockProjectsList = (params = {}) => {
|
||||
const { search = "", page = 1, pageSize = 10 } = params;
|
||||
|
||||
// 完整项目列表数据 - 财经商贸
|
||||
const projects = ${JSON.stringify(projects, null, 2)};
|
||||
|
||||
// 搜索过滤
|
||||
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 projectDetails = ${JSON.stringify(projectDetails, null, 2)};
|
||||
|
||||
const detail = projectDetails[id];
|
||||
|
||||
if (!detail) {
|
||||
return {
|
||||
success: false,
|
||||
message: '项目不存在'
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: detail
|
||||
};
|
||||
};`;
|
||||
|
||||
// 写入文件
|
||||
fs.writeFileSync('src/mocks/projectLibraryMock.js', mockContent, 'utf8');
|
||||
|
||||
console.log('项目库数据已完全重新生成!');
|
||||
console.log(`共生成了 ${projects.length} 个项目`);
|
||||
|
||||
// 显示分类统计
|
||||
const categoryStats = {};
|
||||
projects.forEach(p => {
|
||||
categoryStats[p.category] = (categoryStats[p.category] || 0) + 1;
|
||||
});
|
||||
console.log('\n分类统计:');
|
||||
Object.entries(categoryStats).forEach(([cat, count]) => {
|
||||
console.log(` ${cat}: ${count} 个项目`);
|
||||
});
|
||||
|
||||
// 显示岗位等级统计
|
||||
let levelStats = {
|
||||
'普通岗': 0,
|
||||
'技术骨干岗': 0,
|
||||
'储备干部岗': 0
|
||||
};
|
||||
Object.values(projectDetails).forEach(detail => {
|
||||
detail.applicablePositions.forEach(pos => {
|
||||
if (levelStats[pos.level] !== undefined) {
|
||||
levelStats[pos.level]++;
|
||||
}
|
||||
});
|
||||
});
|
||||
console.log('\n岗位等级统计:');
|
||||
Object.entries(levelStats).forEach(([level, count]) => {
|
||||
console.log(` ${level}: ${count} 个岗位`);
|
||||
});
|
||||
Reference in New Issue
Block a user