mirror of
https://github.com/ExamAware/ExamSchedule.git
synced 2025-04-29 11:06:32 +00:00

* docs: 更新README,添加考试看板和时间广播功能说明,优化界面截图 * docs: 在README中添加广播模式说明及相关截图 * refactor&fix&feat: 已知问题修复,加上暗色模式,还有拆分css * feat: 更新课程安排和提醒设置功能,支持导入导出配置 * feat: 添加考试信息展示,更新课程表加载逻辑,优化样式 * feat: 更新考试提醒设置,优化音频选择和配置加载逻辑 * feat: 优化提醒设置处理逻辑,支持临时生效配置导入
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
function setCookie(name, value, days) {
|
|
try {
|
|
const d = new Date();
|
|
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
const expires = "expires=" + d.toUTCString();
|
|
document.cookie = name + "=" + value + ";" + expires + ";path=/;SameSite=Strict";
|
|
} catch (e) {
|
|
console.error('设置 Cookie 失败:', e);
|
|
}
|
|
}
|
|
|
|
function getCookie(name) {
|
|
try {
|
|
const nameEQ = name + "=";
|
|
const cookies = document.cookie.split(';');
|
|
for (let cookie of cookies) {
|
|
cookie = cookie.trim();
|
|
if (cookie.indexOf(nameEQ) === 0) {
|
|
return cookie.substring(nameEQ.length);
|
|
}
|
|
}
|
|
} catch (e) {
|
|
console.error('读取 Cookie 失败:', e);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function formatTimeWithoutSeconds(time) {
|
|
return time.slice(0, -3);
|
|
}
|
|
|
|
const errorSystem = {
|
|
show: function(message) {
|
|
try {
|
|
const container = document.querySelector('.error-container');
|
|
const content = document.getElementById('errorMessage');
|
|
content.textContent = message;
|
|
container.style.display = 'flex';
|
|
setTimeout(this.hide, 5000);
|
|
} catch(e) {
|
|
console.error('错误提示系统异常:', e);
|
|
}
|
|
},
|
|
hide: function() {
|
|
const container = document.querySelector('.error-container');
|
|
if (container) container.style.display = 'none';
|
|
}
|
|
};
|