|
|
|
@ -29,17 +29,19 @@ document.getElementById('excelFileInput').addEventListener('change', function (e
|
|
|
|
|
});
|
|
|
|
|
displayDiv.appendChild(rowDiv);
|
|
|
|
|
});
|
|
|
|
|
console.log("导入学生名单成功。");
|
|
|
|
|
};
|
|
|
|
|
reader.readAsArrayBuffer(file);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 点名按钮
|
|
|
|
|
document.getElementById('callButton').addEventListener('click', function () {
|
|
|
|
|
// 去除上一次的高亮的学生
|
|
|
|
|
console.log("点名按钮被点击。");
|
|
|
|
|
// 去除上一次的高亮
|
|
|
|
|
var displayDiv = document.getElementById('excelDataDisplay');
|
|
|
|
|
Array.from(displayDiv.children).forEach(child => child.style.backgroundColor = '');
|
|
|
|
|
|
|
|
|
|
// 过滤掉因上次回答问题得分超过2.5而跳过的学生
|
|
|
|
|
// 过滤掉因上次回答问题得分超过 2.5 而跳过的学生
|
|
|
|
|
let eligibleStudents = updatedData.filter(student => !skippedStudents.includes(student));
|
|
|
|
|
|
|
|
|
|
// 计算总积分
|
|
|
|
@ -63,6 +65,7 @@ document.getElementById('callButton').addEventListener('click', function () {
|
|
|
|
|
var studentName = studentInfo[1].textContent.trim();
|
|
|
|
|
var selectedStudentDiv = document.getElementById('selectedStudentInfo');
|
|
|
|
|
selectedStudentDiv.innerHTML = `<p>点到的学生学号:${studentId},姓名:${studentName}</p>`;
|
|
|
|
|
console.log(`随机选择了学生,学号:${studentId},姓名:${studentName}`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -96,11 +99,13 @@ document.getElementById('callButton').addEventListener('click', function () {
|
|
|
|
|
var studentName = studentInfo[1].textContent.trim();
|
|
|
|
|
var selectedStudentDiv = document.getElementById('selectedStudentInfo');
|
|
|
|
|
selectedStudentDiv.innerHTML = `<p>点到的学生学号:${studentId},姓名:${studentName}</p>`;
|
|
|
|
|
console.log(`通过概率选择点到了学生,学号:${studentId},姓名:${studentName}`);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 到达教室按钮
|
|
|
|
|
document.getElementById('arriveClassroom').addEventListener('click', function () {
|
|
|
|
|
console.log("到达教室按钮被点击。");
|
|
|
|
|
var displayDiv = document.getElementById('excelDataDisplay');
|
|
|
|
|
var rows = Array.from(displayDiv.children).slice(1);
|
|
|
|
|
if (rows.length > 0) {
|
|
|
|
@ -114,10 +119,12 @@ document.getElementById('arriveClassroom').addEventListener('click', function ()
|
|
|
|
|
if (student) {
|
|
|
|
|
let pointsKey = Object.keys(student).find(key => key.includes('积分'));
|
|
|
|
|
if (pointsKey) {
|
|
|
|
|
student[pointsKey] = parseFloat(student[pointsKey]) + 1;
|
|
|
|
|
let originalPoints = parseFloat(student[pointsKey]);
|
|
|
|
|
student[pointsKey] = originalPoints + 1;
|
|
|
|
|
// 更新显示
|
|
|
|
|
var rowSpans = selectedRow.querySelectorAll('span');
|
|
|
|
|
rowSpans[rowSpans.length - 1].textContent = student[pointsKey];
|
|
|
|
|
console.log(`学生${studentName}(学号:${studentId})到达教室,积分从${originalPoints}增加到${student[pointsKey]}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -126,6 +133,7 @@ document.getElementById('arriveClassroom').addEventListener('click', function ()
|
|
|
|
|
|
|
|
|
|
// 准确重复所提问的问题
|
|
|
|
|
document.getElementById('repeatedQuestionYes').addEventListener('click', function () {
|
|
|
|
|
console.log("准确重复问题按钮被点击。");
|
|
|
|
|
var displayDiv = document.getElementById('excelDataDisplay');
|
|
|
|
|
var rows = Array.from(displayDiv.children).slice(1);
|
|
|
|
|
if (rows.length > 0) {
|
|
|
|
@ -139,10 +147,12 @@ document.getElementById('repeatedQuestionYes').addEventListener('click', functio
|
|
|
|
|
if (student) {
|
|
|
|
|
let pointsKey = Object.keys(student).find(key => key.includes('积分'));
|
|
|
|
|
if (pointsKey) {
|
|
|
|
|
student[pointsKey] = parseFloat(student[pointsKey]) + 0.5;
|
|
|
|
|
let originalPoints = parseFloat(student[pointsKey]);
|
|
|
|
|
student[pointsKey] = originalPoints + 0.5;
|
|
|
|
|
// 更新显示
|
|
|
|
|
var rowSpans = selectedRow.querySelectorAll('span');
|
|
|
|
|
rowSpans[rowSpans.length - 1].textContent = student[pointsKey];
|
|
|
|
|
console.log(`学生${studentName}(学号:${studentId})准确重复问题,积分从${originalPoints}增加到${student[pointsKey]}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -151,6 +161,7 @@ document.getElementById('repeatedQuestionYes').addEventListener('click', functio
|
|
|
|
|
|
|
|
|
|
// 不能准确重复所提问的问题
|
|
|
|
|
document.getElementById('repeatedQuestionNo').addEventListener('click', function () {
|
|
|
|
|
console.log("不能准确重复问题按钮被点击。");
|
|
|
|
|
var displayDiv = document.getElementById('excelDataDisplay');
|
|
|
|
|
var rows = Array.from(displayDiv.children).slice(1);
|
|
|
|
|
if (rows.length > 0) {
|
|
|
|
@ -164,10 +175,12 @@ document.getElementById('repeatedQuestionNo').addEventListener('click', function
|
|
|
|
|
if (student) {
|
|
|
|
|
let pointsKey = Object.keys(student).find(key => key.includes('积分'));
|
|
|
|
|
if (pointsKey) {
|
|
|
|
|
student[pointsKey] = parseFloat(student[pointsKey]) - 1;
|
|
|
|
|
let originalPoints = parseFloat(student[pointsKey]);
|
|
|
|
|
student[pointsKey] = originalPoints - 1;
|
|
|
|
|
// 更新显示
|
|
|
|
|
var rowSpans = selectedRow.querySelectorAll('span');
|
|
|
|
|
rowSpans[rowSpans.length - 1].textContent = student[pointsKey];
|
|
|
|
|
console.log(`学生${studentName}(学号:${studentId})不能准确重复问题,积分从${originalPoints}减少到${student[pointsKey]}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -176,6 +189,7 @@ document.getElementById('repeatedQuestionNo').addEventListener('click', function
|
|
|
|
|
|
|
|
|
|
// 增加自定义分数
|
|
|
|
|
document.getElementById('addScoreButton').addEventListener('click', function () {
|
|
|
|
|
console.log("增加自定义分数按钮被点击。");
|
|
|
|
|
var inputScore = parseFloat(document.getElementById('addScoreInput').value);
|
|
|
|
|
if (inputScore >= 0.5 && inputScore <= 3 && !isNaN(inputScore)) {
|
|
|
|
|
var displayDiv = document.getElementById('excelDataDisplay');
|
|
|
|
@ -191,7 +205,8 @@ document.getElementById('addScoreButton').addEventListener('click', function ()
|
|
|
|
|
if (student) {
|
|
|
|
|
let pointsKey = Object.keys(student).find(key => key.includes('积分'));
|
|
|
|
|
if (pointsKey) {
|
|
|
|
|
student[pointsKey] = parseFloat(student[pointsKey]) + inputScore;
|
|
|
|
|
let originalPoints = parseFloat(student[pointsKey]);
|
|
|
|
|
student[pointsKey] = originalPoints + inputScore;
|
|
|
|
|
// 更新显示
|
|
|
|
|
var rowSpans = selectedRow.querySelectorAll('span');
|
|
|
|
|
rowSpans[rowSpans.length - 1].textContent = student[pointsKey];
|
|
|
|
@ -200,6 +215,7 @@ document.getElementById('addScoreButton').addEventListener('click', function ()
|
|
|
|
|
if (student[pointsKey] > 2.5) {
|
|
|
|
|
skippedStudents.push(student);
|
|
|
|
|
}
|
|
|
|
|
console.log(`学生${studentName}(学号:${studentId})增加自定义分数${inputScore},积分从${originalPoints}增加到${student[pointsKey]}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|