Files
ALL-teach_sys/frontend_化工/test_interview_questions.html

127 lines
4.2 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>化工岗位面试题验证</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}
h1 {
color: #333;
text-align: center;
}
.job-group {
background: white;
border-radius: 8px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.job-group h2 {
color: #2c5aa0;
margin-bottom: 15px;
border-bottom: 2px solid #2c5aa0;
padding-bottom: 10px;
}
.question-item {
background: #f9f9f9;
padding: 15px;
margin-bottom: 15px;
border-left: 4px solid #4CAF50;
border-radius: 4px;
}
.question {
font-weight: bold;
color: #333;
margin-bottom: 10px;
}
.answer {
color: #666;
line-height: 1.6;
}
.stats {
background: #e3f2fd;
padding: 15px;
border-radius: 8px;
margin-bottom: 20px;
text-align: center;
}
.success {
color: #4CAF50;
font-weight: bold;
}
</style>
</head>
<body>
<h1>化工产业岗位面试题数据验证</h1>
<div id="stats" class="stats"></div>
<div id="content"></div>
<script type="module">
// 导入resumeInterviewMock数据
fetch('src/mocks/resumeInterviewMock.js')
.then(response => response.text())
.then(text => {
// 提取getPageData函数返回的数据
const match = text.match(/return\s+({[\s\S]*?})\s*}\s*export/);
if (match) {
// 使用eval来解析JavaScript对象注意仅用于测试
const dataStr = match[1];
const data = eval('(' + dataStr + ')');
displayData(data);
}
});
function displayData(data) {
const contentDiv = document.getElementById('content');
const statsDiv = document.getElementById('stats');
let totalGroups = 0;
let totalQuestions = 0;
let html = '';
// 遍历所有产业
data.industries.forEach(industry => {
if (industry.name === '化工产业') {
// 统计岗位群和面试题
industry.questions.forEach(questionGroup => {
totalGroups++;
const subQuestions = questionGroup.subQuestions || [];
totalQuestions += subQuestions.length;
html += `<div class="job-group">`;
html += `<h2>${questionGroup.question}</h2>`;
if (subQuestions.length > 0) {
subQuestions.forEach((q, index) => {
html += `<div class="question-item">`;
html += `<div class="question">问题${index + 1}: ${q.question}</div>`;
html += `<div class="answer">解答: ${q.answer}</div>`;
html += `</div>`;
});
} else {
html += `<p style="color: red;">⚠️ 该岗位群暂无面试题数据</p>`;
}
html += `</div>`;
});
}
});
// 显示统计信息
statsDiv.innerHTML = `
<h2 class="success">✅ 数据更新成功!</h2>
<p>共更新了 <strong>${totalGroups}</strong> 个岗位群</p>
<p>共包含 <strong>${totalQuestions}</strong> 道面试题</p>
`;
contentDiv.innerHTML = html;
}
</script>
</body>
</html>