主要更新: - 更新所有12个产业的教务系统数据和功能 - 删除所有 node_modules 文件夹(节省3.7GB) - 删除所有 .yoyo 缓存文件夹(节省1.2GB) - 删除所有 dist 构建文件(节省55MB) 项目优化: - 项目大小从 8.1GB 减少到 3.2GB(节省60%空间) - 保留完整的源代码和配置文件 - .gitignore 已配置,防止再次提交大文件 启动脚本: - start-industry.sh/bat/ps1 脚本会自动检测并安装依赖 - 首次启动时自动运行 npm install - 支持单个或批量启动产业系统 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
138 lines
5.2 KiB
JavaScript
138 lines
5.2 KiB
JavaScript
#!/usr/bin/env node
|
||
|
||
const fs = require('fs');
|
||
const path = require('path');
|
||
|
||
console.log('开始替换线下面试模拟页面的评分数据...\n');
|
||
|
||
// 读取视觉设计产业的面试评分数据
|
||
const evaluationDataPath = path.join(__dirname, '网页未导入数据/面试评分及评价.json');
|
||
const evaluationData = JSON.parse(fs.readFileSync(evaluationDataPath, 'utf-8'));
|
||
|
||
// 筛选出视觉设计产业的数据
|
||
const visualDesignData = evaluationData.filter(item => item['产业'] === '视觉设计');
|
||
|
||
console.log(`找到视觉设计产业数据 ${visualDesignData.length} 条:`);
|
||
visualDesignData.forEach(item => {
|
||
console.log(`- ${item['面试流程名称']}`);
|
||
});
|
||
|
||
// 准备要替换的数据映射
|
||
const dataMapping = {};
|
||
|
||
visualDesignData.forEach(item => {
|
||
const stageName = item['面试流程名称'];
|
||
|
||
// 计算总分(专业能力权重60%,现场表现权重40%)
|
||
const professionalScores = [
|
||
parseInt(item['基础知识掌握水平']),
|
||
parseInt(item['产业链认知程度']),
|
||
parseInt(item['企业生产体系了解程度']),
|
||
parseInt(item['典型问题解决能力']),
|
||
parseInt(item['岗位职责理解程度']),
|
||
parseInt(item['项目经历丰富程度'])
|
||
];
|
||
|
||
const performanceScores = [
|
||
parseInt(item['语言表达与逻辑']),
|
||
parseInt(item['自信与情绪管理']),
|
||
parseInt(item['仪表与职场礼仪']),
|
||
parseInt(item['时间管理与条理性'])
|
||
];
|
||
|
||
const professionalAvg = professionalScores.reduce((a, b) => a + b, 0) / 6;
|
||
const performanceAvg = performanceScores.reduce((a, b) => a + b, 0) / 4;
|
||
|
||
const professionalScore = Math.round(professionalAvg * 10 * 0.6);
|
||
const performanceScore = Math.round(performanceAvg * 10 * 0.4);
|
||
const totalScore = professionalScore + performanceScore;
|
||
|
||
dataMapping[stageName] = {
|
||
totalScore: totalScore,
|
||
professionalScore: professionalScore,
|
||
performanceScore: performanceScore,
|
||
radarData: professionalScores,
|
||
radarData2: performanceScores,
|
||
evaluation: item['面试评价']
|
||
};
|
||
});
|
||
|
||
console.log('\n数据映射准备完成:');
|
||
Object.keys(dataMapping).forEach(key => {
|
||
const data = dataMapping[key];
|
||
console.log(`${key}: 总分=${data.totalScore}, 专业=${data.professionalScore}, 表现=${data.performanceScore}`);
|
||
});
|
||
|
||
// 备份原文件
|
||
const interviewRatingPath = path.join(__dirname, 'src/pages/InterviewSimulationPage/components/InterviewRating/index.jsx');
|
||
const backupPath = `${interviewRatingPath}.backup_${new Date().toISOString().replace(/[:.]/g, '-')}`;
|
||
fs.copyFileSync(interviewRatingPath, backupPath);
|
||
console.log(`\n✓ 已备份到: ${backupPath}`);
|
||
|
||
// 读取并替换文件内容
|
||
let content = fs.readFileSync(interviewRatingPath, 'utf-8');
|
||
|
||
// 替换第一次线下面试模拟数据
|
||
if (dataMapping['第一次线下面试模拟']) {
|
||
const data = dataMapping['第一次线下面试模拟'];
|
||
content = content.replace(
|
||
/} else if \(selectedItem === "第一次线下面试模拟"\) \{[\s\S]*?};/,
|
||
`} else if (selectedItem === "第一次线下面试模拟") {
|
||
return {
|
||
totalScore: ${data.totalScore},
|
||
professionalScore: ${data.professionalScore},
|
||
performanceScore: ${data.performanceScore},
|
||
radarData: [${data.radarData.join(', ')}],
|
||
radarData2: [${data.radarData2.join(', ')}],
|
||
title: "面试评价",
|
||
content: \`${data.evaluation}\`
|
||
};`
|
||
);
|
||
}
|
||
|
||
// 替换第二次线下面试模拟数据
|
||
if (dataMapping['第二次线下面试模拟']) {
|
||
const data = dataMapping['第二次线下面试模拟'];
|
||
content = content.replace(
|
||
/} else if \(selectedItem === "第二次线下面试模拟"\) \{[\s\S]*?};/,
|
||
`} else if (selectedItem === "第二次线下面试模拟") {
|
||
return {
|
||
totalScore: ${data.totalScore},
|
||
professionalScore: ${data.professionalScore},
|
||
performanceScore: ${data.performanceScore},
|
||
radarData: [${data.radarData.join(', ')}],
|
||
radarData2: [${data.radarData2.join(', ')}],
|
||
title: "面试评价",
|
||
content: \`${data.evaluation}\`
|
||
};`
|
||
);
|
||
}
|
||
|
||
// 替换第三次线下面试模拟数据
|
||
if (dataMapping['第三次线下面试模拟']) {
|
||
const data = dataMapping['第三次线下面试模拟'];
|
||
content = content.replace(
|
||
/} else if \(selectedItem === "第三次线下面试模拟"\) \{[\s\S]*?};/,
|
||
`} else if (selectedItem === "第三次线下面试模拟") {
|
||
return {
|
||
totalScore: ${data.totalScore},
|
||
professionalScore: ${data.professionalScore},
|
||
performanceScore: ${data.performanceScore},
|
||
radarData: [${data.radarData.join(', ')}],
|
||
radarData2: [${data.radarData2.join(', ')}],
|
||
title: "面试评价",
|
||
content: \`${data.evaluation}\`
|
||
};`
|
||
);
|
||
}
|
||
|
||
// 保存文件
|
||
fs.writeFileSync(interviewRatingPath, content);
|
||
|
||
console.log('\n✅ 数据替换完成!');
|
||
console.log('\n替换的数据包括:');
|
||
console.log('- 第一次线下面试模拟:专业能力评分、现场表现评分、雷达图数据、面试评价内容');
|
||
console.log('- 第二次线下面试模拟:专业能力评分、现场表现评分、雷达图数据、面试评价内容');
|
||
console.log('- 第三次线下面试模拟:专业能力评分、现场表现评分、雷达图数据、面试评价内容');
|
||
|
||
console.log('\n数据替换完成!'); |