Merge pull request #1 from MKStoler4096/dev

开发合并
This commit is contained in:
MKStoler 2024-10-09 10:00:18 +08:00 committed by GitHub
commit c73ab46e01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 47 additions and 37 deletions

View File

@ -25,5 +25,6 @@
"command": "extension.execute",
"priority": 4
}
]
],
"Codegeex.RepoIndex": true
}

View File

@ -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
#### 安装

View File

@ -1,7 +1,7 @@
{
"name": "dsz-exam-showboard",
"version": "0.1.0",
"description": "An Electron application with Vue",
"name": "examshowboard",
"version": "1.1.0",
"description": "电子考试展示板",
"main": "./out/main/index.js",
"author": "Hello8693 <hello8693@hello8693.xyz>",
"homepage": "https://dsz.hello8693.xyz/",

View File

@ -1,46 +1,22 @@
<template>
<v-system-bar class="position-fixed">
<v-icon icon="mdi-window-close" @click="ipcHandleExit"></v-icon>
<span class="ms-2">{{ currentTime }}</span>
</v-system-bar>
<v-app-bar :elevation="2" class="position-fixed">
<v-app-bar-title>{{ profileStore.appHeader }}</v-app-bar-title>
<template #append>
<div class="ga-4">
<v-btn @click="router.push('/mainWindow')">回到主页</v-btn>
<v-icon icon="mdi-window-close" @click="ipcHandleExit"></v-icon>
</div>
</template>
</v-app-bar>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import { useRouter } from 'vue-router';
import { useProfileStore } from '../stores/app';
const profileStore = useProfileStore();
const router = useRouter();
const currentTime = ref(
new Date().toLocaleTimeString('en-US', {
hour: 'numeric',
minute: 'numeric',
hour12: false
})
);
const updateTime = () => {
currentTime.value = new Date().toLocaleTimeString('en-US', {
hour: 'numeric',
minute: 'numeric',
hour12: false
});
};
onMounted(() => {
const interval = setInterval(updateTime, 1000);
onUnmounted(() => clearInterval(interval));
});
const ipcHandleExit = () => window.electron.ipcRenderer.send('prog:exit');
</script>

View File

@ -21,19 +21,45 @@
</template>
<script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { useProfileStore } from '@renderer/stores/app';
import { getCurrentTimeSlot, getNextExamTimeSlot } from '@renderer/utils/subjectUtils';
const globalStore = useProfileStore();
const currentExam = ref(null);
let timeout = null;
getCurrentTimeSlot(globalStore.examInfos);
const currentExam = computed(() => {
const updateCurrentExam = () => {
const current = getCurrentTimeSlot(globalStore.examInfos);
if (current == null) {
return getNextExamTimeSlot(globalStore.examInfos);
} else {
return current;
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();
scheduleNextUpdate();
});
onUnmounted(() => {
if (timeout) {
clearTimeout(timeout);
}
});
</script>