Skip to content

Commit d9744c3

Browse files
authored
合并main更改 (#31)
* Update CNAME * feat: 添加公告弹窗功能,支持动态显示公告内容
1 parent 73a24b6 commit d9744c3

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed

announcement.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"show": true,
3+
"content": "<b>ExamAware2-Desktop</b> 今年不会继续更新,如有离线使用需要请本机部署ExamSchedule使用。</br>感谢各位对ExamAware项目的支持。</br>若您在使用本项目时遇到所谓的“付费”,请务必不要相信,ExamAware项目从未要求用户付费。</br>如果您已经付费,遇到问题时优先寻找付费提供方解决。</br>如果您有任何疑问,请在GitHub上联系我们。</br>再次感谢您的支持!"
4+
}

index.html

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,61 @@
195195
text-align: center;
196196
}
197197

198+
/* 公告弹窗样式 */
199+
#announcement-modal {
200+
display: none;
201+
position: fixed;
202+
z-index: 9999;
203+
left: 0;
204+
top: 0;
205+
width: 100vw;
206+
height: 100vh;
207+
background: rgba(18, 18, 18, 0.75);
208+
justify-content: center;
209+
align-items: center;
210+
}
211+
212+
#announcement-modal > div {
213+
background: #232a34;
214+
color: #e3f2fd;
215+
border-radius: 16px;
216+
max-width: 90vw;
217+
min-width: 320px;
218+
box-shadow: 0 4px 24px rgba(25, 118, 210, 0.18);
219+
padding: 32px 24px 16px 24px;
220+
position: relative;
221+
display: flex;
222+
flex-direction: column;
223+
align-items: center;
224+
}
225+
226+
#announcement-modal h2 {
227+
font-size: 22px;
228+
font-weight: 500;
229+
margin-bottom: 12px;
230+
color: #90caf9;
231+
}
232+
233+
#announcement-modal p {
234+
font-size: 16px;
235+
margin-bottom: 24px;
236+
text-align: center;
237+
}
238+
239+
#announcement-close {
240+
background: #1976d2;
241+
color: #fff;
242+
border: none;
243+
border-radius: 8px;
244+
padding: 8px 24px;
245+
font-size: 15px;
246+
cursor: pointer;
247+
transition: background 0.2s;
248+
}
249+
250+
#announcement-close:hover {
251+
background: #155a8a;
252+
198253
@keyframes floatY {
199254
0% {
200255
transform: translateY(0);
@@ -260,10 +315,18 @@
260315

261316
<div class="copyright">&copy; 2024-2025 ExamAware开发团队 版权所有</div>
262317

318+
<!-- 公告弹窗 -->
319+
<div id="announcement-modal" style="display:none; position:fixed; z-index:9999; left:0; top:0; width:100vw; height:100vh; background:rgba(18,18,18,0.75); justify-content:center; align-items:center;">
320+
<div style="background:#232a34; color:#e3f2fd; border-radius:16px; max-width:90vw; min-width:320px; box-shadow:0 4px 24px rgba(25,118,210,0.18); padding:32px 24px 16px 24px; position:relative; display:flex; flex-direction:column; align-items:center;">
321+
<span style="font-size:22px; font-weight:500; margin-bottom:12px; color:#90caf9;">公告</span>
322+
<div id="announcement-content" style="font-size:16px; margin-bottom:24px; text-align:center;"></div>
323+
<button id="announcement-close" style="background:#1976d2; color:#fff; border:none; border-radius:8px; padding:8px 24px; font-size:15px; cursor:pointer; transition:background 0.2s;">关闭</button>
324+
</div>
263325
<div class="poweredby-chuqiyun" style="width:100%;display:flex;justify-content:center;align-items:center;position:absolute;bottom:48px;left:0;z-index:10;">
264326
<a href="https://chuqiyun.com">
265327
<img src="https://chuqiyun.com/static/images/poweredby.svg" alt="Powered by 楚奇云">
266328
</a>
329+
267330
</div>
268331

269332
<script>
@@ -275,7 +338,25 @@
275338
}
276339
}
277340
}
278-
window.onload = checkAprilFools;
341+
window.onload = function() {
342+
checkAprilFools();
343+
// 公告弹窗逻辑
344+
fetch('./announcement.json')
345+
.then(res => {
346+
if (!res.ok) throw new Error('No announcement');
347+
return res.json();
348+
})
349+
.then(data => {
350+
if (data && data.show && data.content) {
351+
document.getElementById('announcement-content').innerHTML = data.content;
352+
document.getElementById('announcement-modal').style.display = 'flex';
353+
}
354+
})
355+
.catch(() => {});
356+
document.getElementById('announcement-close').onclick = function() {
357+
document.getElementById('announcement-modal').style.display = 'none';
358+
};
359+
};
279360
</script>
280361
</body>
281362

0 commit comments

Comments
 (0)