mirror of
https://github.com/ExamAware/ExamSchedule.git
synced 2025-04-29 19:16:33 +00:00

* refactor: 史诗级重构拆分多年狮山代码 * style: 添加设置模态框淡出动画,优化关闭和保存设置的用户体验 * style: 添加错误提示系统,优化用户体验,处理设置和全屏操作中的异常 * feat: 添加主题切换功能,支持亮/暗色模式,优化用户界面 * chore: 测试配置 * feat: 更新亮色主题背景和透明度 * style: 滑块居右 * feat: 初步实现 全是Bug * feat: 添加提醒队列功能,支持音频预加载和配置导出 * feat: 优化文件输入和按钮样式,提升用户交互体验 * feat: 添加时间广播功能,优化错误提示系统,移除不必要的设置选项 * feat: 移除不再使用的音频文件,更新课程结束时间,优化音频文件加载和选择功能
54 lines
1.8 KiB
JavaScript
54 lines
1.8 KiB
JavaScript
function updateDisplay() {
|
|
try {
|
|
var now = new Date(),
|
|
timeDisplay = document.getElementById('timeDisplay'),
|
|
statusLabel = document.getElementById('statusLabel'),
|
|
timeDesc = document.getElementById('timeDescription');
|
|
if (currentCourse) {
|
|
var endTime = parseTime(currentCourse.end),
|
|
remain = endTime - now;
|
|
statusLabel.textContent = currentCourse.name + ' 进行中';
|
|
timeDisplay.textContent = formatTime(remain);
|
|
timeDesc.textContent = '剩余时间';
|
|
} else {
|
|
statusLabel.textContent = '休息中';
|
|
var nextCourse = getNextCourse();
|
|
if (nextCourse) {
|
|
var startTime = parseTime(nextCourse.start),
|
|
remain = startTime - now;
|
|
timeDisplay.textContent = formatTime(remain);
|
|
timeDesc.textContent = '距离 ' + nextCourse.name;
|
|
} else {
|
|
timeDisplay.textContent = '00:00';
|
|
timeDesc.textContent = '今日课程已结束';
|
|
}
|
|
}
|
|
updateScheduleTable();
|
|
} catch (e) {
|
|
errorSystem.show('界面更新失败: ' + e.message, 'error');
|
|
}
|
|
}
|
|
|
|
function formatTime(ms) {
|
|
try {
|
|
if (ms < 0) return '00:00';
|
|
var totalSeconds = Math.floor(ms / 1000),
|
|
minutes = Math.floor(totalSeconds / 60),
|
|
seconds = totalSeconds % 60;
|
|
return (minutes < 10 ? '0' : '') + minutes + ':' + (seconds < 10 ? '0' : '') + seconds;
|
|
} catch (e) {
|
|
return '--:--';
|
|
}
|
|
}
|
|
|
|
function formatDateTime(dateTimeStr) {
|
|
var date = new Date(dateTimeStr);
|
|
return date.toLocaleString('zh-CN', {
|
|
month: '2-digit',
|
|
day: '2-digit',
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
second: '2-digit'
|
|
});
|
|
}
|