Files
online_sys/frontend_大健康/test_interview_data.js
KQL a7242f0c69 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>
2025-12-12 18:16:55 +08:00

95 lines
3.3 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env node
// 测试面试题数据是否正确加载
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// 读取mock数据文件
const mockFilePath = path.join(__dirname, 'src/mocks/resumeInterviewMock.js');
const mockContent = fs.readFileSync(mockFilePath, 'utf-8');
// 提取industries数据
const industriesMatch = mockContent.match(/const industries = (\[[\s\S]*?\]);/);
if (!industriesMatch) {
console.error('❌ 无法找到industries数据');
process.exit(1);
}
// 尝试解析数据将JavaScript对象转换为JSON
const industriesDataStr = industriesMatch[1];
// 简单替换JavaScript对象语法为JSON格式
const jsonStr = industriesDataStr
.replace(/(\w+):/g, '"$1":') // 给属性名加引号
.replace(/'/g, '"') // 单引号改双引号
.replace(/,(\s*[\]}])/g, '$1'); // 移除尾随逗号
try {
const industries = JSON.parse(jsonStr);
console.log('✅ 成功解析industries数据');
console.log(`📊 共找到 ${industries.length} 个产业群`);
let totalPositions = 0;
let positionsWithQuestions = 0;
let questionsFromHealthData = 0;
industries.forEach(industry => {
console.log(`\n🏢 产业: ${industry.name} (${industry.positions.length} 个岗位)`);
industry.positions.forEach(position => {
totalPositions++;
if (position.questions && position.questions.length > 0) {
positionsWithQuestions++;
// 检查问题内容是否包含大健康特定问题
const questionTexts = position.questions.flatMap(q =>
q.subQuestions ? q.subQuestions.map(sq => sq.question) : [q.question]
);
const hasHealthQuestions = questionTexts.some(q =>
q.includes('健康管理') ||
q.includes('康复') ||
q.includes('药品') ||
q.includes('医疗') ||
q.includes('生产流程') ||
q.includes('质量控制') ||
q.includes('GMP') ||
q.includes('患者')
);
if (hasHealthQuestions) {
questionsFromHealthData++;
console.log(`${position.title}: 包含大健康相关问题 (${position.questions.length} 组)`);
} else {
console.log(`${position.title}: 可能仍是原始问题`);
console.log(` 示例问题: ${questionTexts[0]?.substring(0, 50)}...`);
}
} else {
console.log(` ⚠️ ${position.title}: 无面试题`);
}
});
});
console.log('\n📈 统计总结:');
console.log(`总岗位数: ${totalPositions}`);
console.log(`有面试题的岗位: ${positionsWithQuestions}`);
console.log(`包含大健康相关问题的岗位: ${questionsFromHealthData}`);
console.log(`更新完成率: ${((questionsFromHealthData / totalPositions) * 100).toFixed(1)}%`);
if (questionsFromHealthData < totalPositions * 0.8) {
console.log('\n⚠ 警告: 大部分岗位可能仍在使用原始问题,需要检查数据更新是否成功');
} else {
console.log('\n🎉 成功: 大部分岗位已更新为大健康相关问题');
}
} catch (error) {
console.error('❌ JSON解析失败:', error.message);
console.log('尝试的JSON字符串前100字符:', jsonStr.substring(0, 100));
}