From 189b0467e1d7d19840a7ad7a83581a0c1cdcc9c2 Mon Sep 17 00:00:00 2001 From: MKStoler Date: Tue, 8 Oct 2024 18:24:52 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(pre):=20=E9=80=92=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/pages/infoPage.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/pages/infoPage.vue b/src/renderer/src/pages/infoPage.vue index df7ef07..7ab2592 100644 --- a/src/renderer/src/pages/infoPage.vue +++ b/src/renderer/src/pages/infoPage.vue @@ -21,20 +21,22 @@ From 662884f671a75574b6cceadcc93a1f0213357182 Mon Sep 17 00:00:00 2001 From: MKStoler Date: Wed, 9 Oct 2024 06:31:43 +0800 Subject: [PATCH 2/3] =?UTF-8?q?chore:=201.0.0.1=E9=A2=84=E5=8F=91=E8=A1=8C?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 ++++++++- package.json | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0a29a69..77e71fb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DSZ考试展板·改(指不定期对原项目修修补补) +# 考试展板(原DSZ考试展板) ![view](image/README/view.png) @@ -74,6 +74,8 @@ ## 开发 +### 环境要求 + 要在本地编译应用您需要安装以下负载和工具 - [VSCode](https://code.visualstudio.com/) + [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) @@ -82,6 +84,11 @@ 必须使用Yarn包管理。Node版本要求为20。 +### 开发进度 + +- 在`main`分支上保留原作者`0.1.0`版本 +- 正在`dev`分支上开发`1.1-Malkuth`版本 + ### Project Setup #### 安装 diff --git a/package.json b/package.json index 8ba044f..29522fb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "dsz-exam-showboard", - "version": "0.1.0", - "description": "An Electron application with Vue", + "name": "examshowboard", + "version": "1.0.0.1", + "description": "考试展板", "main": "./out/main/index.js", "author": "Hello8693 ", "homepage": "https://dsz.hello8693.xyz/", From c7f62b8a84735fe1f080a309037f63c2016cdd52 Mon Sep 17 00:00:00 2001 From: MKStoler Date: Wed, 9 Oct 2024 09:55:03 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E8=80=83=E5=AE=8C=E5=90=8E1?= =?UTF-8?q?=E5=88=86=E9=92=9F=E5=90=8E=E5=88=B7=E6=96=B0=E7=A7=91=E7=9B=AE?= =?UTF-8?q?=20fix:=20=E5=90=88=E5=B9=B6=E5=B7=A5=E5=85=B7=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 ++- README.md | 4 ++-- package.json | 4 ++-- src/renderer/src/components/AppTopBar.vue | 26 +-------------------- src/renderer/src/pages/infoPage.vue | 28 +++++++++++++++++++++-- 5 files changed, 33 insertions(+), 32 deletions(-) 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); + } });