feat: 添加考试提醒功能,更新主题样式并优化配置

This commit is contained in:
MKStoler1024 2025-04-10 17:23:35 +00:00
parent 24c9a6a3e7
commit 27a7a760ad
12 changed files with 352 additions and 433 deletions

View File

@ -67,6 +67,7 @@ document.addEventListener("DOMContentLoaded", () => {
let currentExam = null;
let nextExam = null;
let lastExam = null;
let isnotificated = false;
data.examInfos.forEach(exam => {
const start = new Date(exam.start);
@ -79,6 +80,7 @@ document.addEventListener("DOMContentLoaded", () => {
}
if (now > end && (!lastExam || end > new Date(lastExam.end))) {
lastExam = exam;
isnotificated = false;
}
});
@ -97,6 +99,16 @@ document.addEventListener("DOMContentLoaded", () => {
remainingTimeElem.style.fontWeight = "bold";
statusElem.textContent = "状态: 即将结束";
statusElem.style.color = "red";
// 在剩余15分钟时显示提醒
if (isnotificated === false) {
const overlay = document.getElementById('reminder-overlay');
overlay.classList.add('show');
setTimeout(() => {
overlay.classList.remove('show');
}, 5000);
isnotificated = true;
}
} else {
remainingTimeElem.textContent = `剩余时间: ${remainingTimeText}`;
remainingTimeElem.style.color = "#93b4f7";

View File

@ -16,20 +16,17 @@ document.addEventListener("DOMContentLoaded", () => {
let offsetTime = getCookie("offsetTime") || 0;
let room = getCookie("room") || "";
let zoomLevel = getCookie("zoomLevel") || 1;
let theme = getCookie("theme") || "dark";
let currentTheme = getCookie("currentTheme") || "md3";
let theme = getCookie("theme") || "dark";
let themeConfig = [];
offsetTime = parseInt(offsetTime);
roomElem.textContent = room;
if (theme === "light") {
themeLink.href = "Styles/light.css";
themeToggle.checked = true;
} else {
themeLink.href = "Styles/dark.css";
themeToggle.checked = false;
}
// 初始化主题
const currentThemePath = `Styles/${currentTheme}/${theme}.css`;
themeLink.href = currentThemePath;
themeToggle.checked = theme === "light";
// 加载主题配置
fetch('Styles/profile.json')
@ -91,7 +88,7 @@ document.addEventListener("DOMContentLoaded", () => {
setCookie("currentTheme", currentTheme, 365);
roomElem.textContent = room;
document.body.style.zoom = zoomLevel;
themeLink.href = theme === "light" ? "Styles/light.css" : "Styles/dark.css";
updateThemeLink();
settingsModal.classList.add("fade-out");
setTimeout(() => {
settingsModal.style.display = "none";

View File

@ -456,3 +456,52 @@ input:checked + .slider:before {
color: #E6E1E5;
margin-bottom: 8px;
}
.reminder-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.95);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: all 0.5s ease;
backdrop-filter: blur(8px);
z-index: 9999;
}
.reminder-overlay.show {
opacity: 1;
visibility: visible;
}
.reminder-content {
text-align: center;
animation: fadeIn 0.5s ease;
}
.reminder-title {
font-size: 5rem;
color: #FF453A;
margin-bottom: 2rem;
}
.reminder-subtitle {
font-size: 3rem;
color: #FFD60A;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

View File

@ -456,3 +456,52 @@ input:checked + .slider:before {
color: #1C1B1F;
margin-bottom: 8px;
}
.reminder-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.95);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: all 0.5s ease;
backdrop-filter: blur(8px);
z-index: 9999;
}
.reminder-overlay.show {
opacity: 1;
visibility: visible;
}
.reminder-content {
text-align: center;
animation: fadeIn 0.5s ease;
}
.reminder-title {
font-size: 5rem;
color: #FF3B30;
margin-bottom: 2rem;
}
.reminder-subtitle {
font-size: 3rem;
color: #FF9500;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

View File

@ -1,406 +0,0 @@
body {
font-family: 'Roboto', 'HarmonyOS Sans SC', sans-serif;
margin: 0;
padding: 0;
background: #FFFBFE;
color: #1C1B1F;
overflow: auto;
}
body::-webkit-scrollbar {
display: none;
}
#fullscreen-btn, #settings-btn {
position: absolute;
top: 20px;
padding: 12px 24px;
font-size: 1rem;
cursor: pointer;
background-color: #E8DEF8;
color: #1C1B1F;
border: none;
border-radius: 20px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
transition: all 0.2s ease;
z-index: 1001;
}
#fullscreen-btn {
right: 20px;
}
#settings-btn {
right: 120px;
}
#settings-btn:hover, #fullscreen-btn:hover {
background-color: #D0BCFF;
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.container {
padding: 24px;
max-width: 1400px;
margin: auto;
background-color: #F7F2FA;
border-radius: 28px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
h1 {
font-size: 3.5rem;
font-weight: 400;
text-align: left;
margin-bottom: 16px;
color: #1C1B1F;
display: flex;
align-items: center;
justify-content: space-between;
}
#room {
font-size: 3.5rem;
font-weight: 400;
color: #1C1B1F;
margin-left: 20px;
}
#message {
font-size: 1.5rem;
color: #6750A4;
margin-bottom: 24px;
}
.content {
display: flex;
justify-content: space-between;
gap: 24px;
}
.left-column, .right-column {
display: flex;
flex-direction: column;
gap: 24px;
}
.left-column {
width: 45%;
}
.right-column {
width: 50%;
}
.clock-section, .info-section, .right-column {
background-color: #FFFFFF;
padding: 24px;
border-radius: 28px;
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
#current-time {
font-size: 8rem;
text-align: center;
color: #6750A4;
margin: 0;
font-weight: 400;
}
#current-subject, #exam-timing, #remaining-time, #status {
font-size: 3rem;
margin: 16px 0;
text-align: left;
color: #1C1B1F;
}
table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
margin-top: 24px;
background-color: #FFFFFF;
border-radius: 16px;
overflow: hidden;
}
th, td {
padding: 1px;
font-size: 1.8rem;
text-align: center;
border-bottom: 1px solid #E8DEF8;
}
th {
background-color: #E8DEF8;
color: #1C1B1F;
font-weight: 500;
}
tr:hover {
background-color: #F7F2FA;
}
.exam-status-tag {
padding: 6px 12px;
border-radius: 8px;
font-size: 1.2rem;
font-weight: 500;
}
.exam-status-进行中 {
background-color: #DDF4D7;
color: #365534;
}
.exam-status-即将开始 {
background-color: #FFF2D6;
color: #594300;
}
.exam-status-已结束 {
background-color: #FFDAD6;
color: #5C1130;
}
.exam-status-未开始 {
background-color: #E8DEF8;
color: #1C1B1F;
}
#settings-modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.3);
backdrop-filter: blur(8px);
}
#settings-modal-content {
background: #FFFFFF;
padding: 32px 48px 32px 32px;
margin: 32px auto;
border-radius: 28px;
width: 600px;
max-height: 60vh;
overflow-y: auto;
box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
#settings-modal-content::-webkit-scrollbar {
width: 8px;
}
#settings-modal-content::-webkit-scrollbar-track {
background: transparent;
margin: 4px;
}
#settings-modal-content::-webkit-scrollbar-thumb {
background: #E8DEF8;
border-radius: 8px;
border: 2px solid #FFFFFF;
}
#settings-modal-content::-webkit-scrollbar-thumb:hover {
background: #D0BCFF;
}
#settings-modal-content h3 {
margin: 0 0 24px;
color: #1C1B1F;
font-size: 24px;
font-weight: 400;
}
#settings-modal-content label {
display: flex;
align-items: center;
gap: 16px;
margin: 16px 0;
font-size: 16px;
color: #1C1B1F;
}
#settings-modal-content input[type="number"],
#settings-modal-content input[type="text"] {
font-size: 1.5rem;
padding: 12px 16px;
margin: 8px 0 24px;
width: 100%;
box-sizing: border-box;
border: 2px solid #E8DEF8;
border-radius: 12px;
background-color: #FFFFFF;
color: #1C1B1F;
transition: all 0.2s ease;
}
#settings-modal-content input:focus {
outline: none;
border-color: #6750A4;
background-color: #F7F2FA;
}
.button-group {
display: flex;
justify-content: flex-end;
gap: 16px;
margin-top: 32px;
}
#save-settings-btn, #close-settings-btn {
padding: 12px 24px;
border-radius: 20px;
font-size: 16px;
font-weight: 500;
border: none;
cursor: pointer;
transition: all 0.2s ease;
}
#save-settings-btn {
background-color: #6750A4;
color: #FFFFFF;
}
#close-settings-btn {
background-color: #E8DEF8;
color: #1C1B1F;
}
#save-settings-btn:hover, #close-settings-btn:hover {
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.error-container {
position: fixed;
bottom: 24px;
left: 50%;
transform: translateX(-50%);
background: #FFDAD6;
color: #5C1130;
padding: 16px 24px;
border-radius: 16px;
display: none;
z-index: 10001;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
animation: slideUp 0.3s ease;
}
.switch {
position: relative;
display: inline-block;
width: 52px;
height: 32px;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #E8DEF8;
transition: .3s;
border-radius: 16px;
}
.slider:before {
position: absolute;
content: "";
height: 24px;
width: 24px;
left: 4px;
bottom: 4px;
background-color: #FFFFFF;
transition: .3s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #6750A4;
}
input:checked + .slider:before {
transform: translateX(20px);
background-color: #FFFFFF;
}
.config-file-container {
margin: 24px 0;
padding: 24px;
border: 2px solid #E8DEF8;
border-radius: 20px;
background-color: #F7F2FA;
transition: all 0.2s ease;
}
.config-file-container:hover {
border-color: #6750A4;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.config-file-container input[type="file"] {
max-width: 100%;
width: auto;
box-sizing: border-box;
padding: 12px;
border: 2px dashed #E8DEF8;
border-radius: 16px;
background-color: #FFFFFF;
color: #1C1B1F;
cursor: pointer;
transition: all 0.2s ease;
}
.config-file-container input[type="file"]::-webkit-file-upload-button {
padding: 8px 16px;
margin-right: 12px;
background-color: #E8DEF8;
color: #1C1B1F;
border: none;
border-radius: 12px;
cursor: pointer;
transition: all 0.2s ease;
}
.config-file-container input[type="file"]::-webkit-file-upload-button:hover {
background-color: #D0BCFF;
}
.file-hint {
margin-top: 12px;
font-size: 14px;
color: #49454F;
line-height: 1.5;
}
.config-control-btn {
margin-top: 20px;
padding: 12px 28px;
background-color: #E8DEF8;
color: #1C1B1F;
border: none;
border-radius: 24px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
justify-content: center;
}
.config-control-btn:hover {
background-color: #D0BCFF;
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

View File

@ -456,3 +456,52 @@ input:checked + .slider:before {
color: #E6E1E5;
margin-bottom: 8px;
}
.reminder-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.95);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: all 0.5s ease;
backdrop-filter: blur(8px);
z-index: 9999;
}
.reminder-overlay.show {
opacity: 1;
visibility: visible;
}
.reminder-content {
text-align: center;
animation: fadeIn 0.5s ease;
}
.reminder-title {
font-size: 5rem;
color: #FF453A;
margin-bottom: 2rem;
}
.reminder-subtitle {
font-size: 3rem;
color: #FFD60A;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

View File

@ -456,3 +456,52 @@ input:checked + .slider:before {
color: #1C1B1F;
margin-bottom: 8px;
}
.reminder-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.95);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: all 0.5s ease;
backdrop-filter: blur(8px);
z-index: 9999;
}
.reminder-overlay.show {
opacity: 1;
visibility: visible;
}
.reminder-content {
text-align: center;
animation: fadeIn 0.5s ease;
}
.reminder-title {
font-size: 5rem;
color: #FF3B30;
margin-bottom: 2rem;
}
.reminder-subtitle {
font-size: 3rem;
color: #FF9500;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

View File

@ -515,3 +515,52 @@ input:checked + .slider:before {
.config-control-btn:hover {
background-color: #c9302c;
}
.reminder-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.95);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: all 0.5s ease;
backdrop-filter: blur(8px);
z-index: 9999;
}
.reminder-overlay.show {
opacity: 1;
visibility: visible;
}
.reminder-content {
text-align: center;
animation: fadeIn 0.5s ease;
}
.reminder-title {
font-size: 5rem;
color: #FF453A;
margin-bottom: 2rem;
}
.reminder-subtitle {
font-size: 3rem;
color: #FFD60A;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

View File

@ -520,3 +520,52 @@ input:checked + .slider:before {
.config-control-btn:hover {
background-color: #c9302c;
}
.reminder-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.95);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
visibility: hidden;
transition: all 0.5s ease;
backdrop-filter: blur(8px);
z-index: 9999;
}
.reminder-overlay.show {
opacity: 1;
visibility: visible;
}
.reminder-content {
text-align: center;
animation: fadeIn 0.5s ease;
}
.reminder-title {
font-size: 5rem;
color: #FF3B30;
margin-bottom: 2rem;
}
.reminder-subtitle {
font-size: 3rem;
color: #FF9500;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

16
exam/Styles/profile.json Normal file
View File

@ -0,0 +1,16 @@
{
"theme":[
{
"name": "ExamAware旧版",
"path": "ealg"
},
{
"name": "ExamSchedule旧版",
"path": "old"
},
{
"name": "Material Design 3",
"path": "md3"
}
]
}

View File

@ -5,43 +5,43 @@
"examInfos": [
{
"name": "语文",
"start": "2025-03-31T07:20:00",
"end": "2025-03-31T09:50:00"
"start": "2025-03-10T07:20:00",
"end": "2025-03-10T09:50:00"
},
{
"name": "物理",
"start": "2025-03-31T10:20:00",
"end": "2025-03-31T11:50:00"
"start": "2025-03-10T10:20:00",
"end": "2025-03-10T11:50:00"
},
{
"name": "英语",
"start": "2025-03-31T14:10:00",
"end": "2025-03-31T23:15:00"
"start": "2025-03-10T14:10:00",
"end": "2025-03-10T23:15:00"
},
{
"name": "历史",
"start": "2025-03-31T23:55:00",
"end": "2025-04-01T01:00:00"
"start": "2025-03-10T23:55:00",
"end": "2025-04-11T01:32:00"
},
{
"name": "数学",
"start": "2025-04-01T07:50:00",
"end": "2025-04-01T09:50:00"
"start": "2025-04-11T07:50:00",
"end": "2025-04-11T09:50:00"
},
{
"name": "化学",
"start": "2025-04-01T10:20:00",
"end": "2025-04-01T11:50:00"
"start": "2025-04-11T10:20:00",
"end": "2025-04-11T11:50:00"
},
{
"name": "生物/政治",
"start": "2025-04-01T14:10:00",
"end": "2025-04-01T15:40:00"
"start": "2025-04-11T14:10:00",
"end": "2025-04-11T15:40:00"
},
{
"name": "地理",
"start": "2025-04-01T16:10:00",
"end": "2025-04-01T17:40:00"
"start": "2025-04-11T16:10:00",
"end": "2025-04-11T17:40:00"
}
]
}

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Exam Schedule</title>
<link rel="stylesheet" href="Styles/dark.css" id="theme-link">
<link id="theme-link" rel="stylesheet" href="Styles/md3/dark.css">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet">
</head>
<body>
@ -49,6 +49,12 @@
</div>
</div>
</div>
<div id="reminder-overlay" class="reminder-overlay">
<div class="reminder-content">
<h1 class="reminder-title">距离考试结束还有 15 分钟</h1>
<h2 class="reminder-subtitle">注意掌握时间</h2>
</div>
</div>
<!-- Settings Modal -->
<div id="settings-modal">
<div id="settings-modal-content" class="settings-panel dark-theme">