diff --git a/.vscode/settings.json b/.vscode/settings.json index fa35abe..b8d881b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,5 +25,6 @@ "command": "extension.execute", "priority": 4 } - ] + ], + "Codegeex.RepoIndex": true } diff --git a/README.md b/README.md index 77e71fb..de133e7 100644 --- a/README.md +++ b/README.md @@ -86,8 +86,8 @@ ### 开发进度 -- 在`main`分支上保留原作者`0.1.0`版本 -- 正在`dev`分支上开发`1.1-Malkuth`版本 +- 在`main`分支上保留原作者`0.1.0`版本; +- 正在`dev`分支上开发`1.1-Malkuth`版本。 ### Project Setup diff --git a/package.json b/package.json index 29522fb..a3b4b08 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "examshowboard", - "version": "1.0.0.1", - "description": "考试展板", + "version": "1.1.0", + "description": "电子考试展示板", "main": "./out/main/index.js", "author": "Hello8693 ", "homepage": "https://dsz.hello8693.xyz/", diff --git a/src/renderer/src/components/AppTopBar.vue b/src/renderer/src/components/AppTopBar.vue index e0a9d1b..71bdcd1 100644 --- a/src/renderer/src/components/AppTopBar.vue +++ b/src/renderer/src/components/AppTopBar.vue @@ -1,46 +1,22 @@ diff --git a/src/renderer/src/pages/infoPage.vue b/src/renderer/src/pages/infoPage.vue index 7ab2592..22637fe 100644 --- a/src/renderer/src/pages/infoPage.vue +++ b/src/renderer/src/pages/infoPage.vue @@ -27,16 +27,40 @@ import { getCurrentTimeSlot, getNextExamTimeSlot } from '@renderer/utils/subject const globalStore = useProfileStore(); const currentExam = ref(null); +let timeout = null; const updateCurrentExam = () => { const current = getCurrentTimeSlot(globalStore.examInfos); currentExam.value = current ? current : getNextExamTimeSlot(globalStore.examInfos); }; +const scheduleNextUpdate = () => { + if (timeout) { + clearTimeout(timeout); + } + + const nextExam = getNextExamTimeSlot(globalStore.examInfos); + if (nextExam) { + const nextEndTime = new Date(nextExam.end).getTime(); + const now = Date.now(); + const delay = nextEndTime - now + 60000; // 下一次考试结束时间 + 1分钟 + + timeout = setTimeout(() => { + updateCurrentExam(); + scheduleNextUpdate(); + }, delay); + } +}; + onMounted(() => { updateCurrentExam(); - const interval = setInterval(updateCurrentExam, 20000); // 每20秒刷新一次 - onUnmounted(() => clearInterval(interval)); + scheduleNextUpdate(); +}); + +onUnmounted(() => { + if (timeout) { + clearTimeout(timeout); + } });