Skip to content

Commit 822ff5d

Browse files
authored
Merge pull request #11 from MKStoler4096/master
修复#6:实时刷新考试状态和顶部状态栏 不知道能不能用,先合并再说()
2 parents d263bb9 + 13b1434 commit 822ff5d

File tree

6 files changed

+91
-39
lines changed

6 files changed

+91
-39
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
os: [ windows-latest ]
15-
node-version: [ 20.x ]
14+
os: [windows-latest]
15+
node-version: [20.x]
1616

1717
steps:
1818
- name: Checkout

.github/workflows/publish.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818
uses: actions/[email protected]
1919
if: github.event.release.prerelease == false || matrix.os == 'windows-latest'
2020

21-
2221
- name: Set up Node.js
2322
uses: actions/setup-node@v4
2423
if: github.event.release.prerelease == false || matrix.os == 'windows-latest'
@@ -29,7 +28,6 @@ jobs:
2928
run: yarn install
3029
if: github.event.release.prerelease == false || matrix.os == 'windows-latest'
3130

32-
3331
- name: Build and package for Windows
3432
if: github.event.release.prerelease == false && matrix.os == 'windows-latest'
3533
run: yarn build:win

README.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[![Beta](https://img.shields.io/github/v/release/hello8693DSZ/dsz-exam-showboard?include_prereleases&style=social-square&label=测试版)](https://github.com/hello8693DSZ/dsz-exam-showboard/releases/)
88

99
## 软件介绍
10+
1011
- 您可以查看下方的详细介绍
1112
- 使用Vue + TypeScript + JavaScript制作,使用Node.js+Electron完善系统级功能并打包。
1213
- 欢迎给作者点个右上角的Star或者给作者宣传一波
@@ -15,53 +16,64 @@
1516
## 功能
1617

1718
### 展示考试信息
18-
- [X] 展示考试名称
19-
- [X] 展示当前时间
20-
- [X] 展示当前考试科目名称
21-
- [X] 展示考试开始,结束时间
22-
- [X] 展示考试状态
23-
19+
20+
- [x] 展示考试名称
21+
- [x] 展示当前时间
22+
- [x] 展示当前考试科目名称
23+
- [x] 展示考试开始,结束时间
24+
- [x] 展示考试状态
25+
2426
### 其他功能
25-
- [X] 考试结束十五分钟前预警
27+
28+
- [x] 考试结束十五分钟前预警
2629
- [ ] 集控管理(正在开发中)
2730

2831
## 软件截图
2932

3033
### 主界面截图
34+
3135
![main](image/README/main.png)
3236

3337
### 考试界面截图
38+
3439
![view](image/README/view.png)
3540

3641
## 开始使用
42+
3743
### 下载
44+
3845
对于普通用户,可以在以下渠道下载到本软件
3946

4047
下载 [Realeases](https://github.com/hello8693DSZ/dsz-exam-showboard/releases) | [Actions](https://github.com/hello8693DSZ/dsz-exam-showboard/actions)
4148

4249
### 准备配置文件
50+
4351
#### 新建格式为`json`的配置文件,模板如下
52+
4453
```json
4554
{
46-
"examName": "",
47-
"message": "",
48-
"examInfos": [
49-
{
50-
"name": "",
51-
"start": "XXXX-XX-XXTXX:XX:XX",
52-
"end": "XXXX-XX-XXTXX:XX:XX"
53-
}
54-
]
55+
"examName": "",
56+
"message": "",
57+
"examInfos": [
58+
{
59+
"name": "",
60+
"start": "XXXX-XX-XXTXX:XX:XX",
61+
"end": "XXXX-XX-XXTXX:XX:XX"
62+
}
63+
]
5564
}
5665
```
5766

5867
### 运行
68+
5969
下载完成后,将软件双击运行,等待进度条走完,双击运行桌面上的名为ExamShowboard的快捷方式
6070

6171
### 导入配置
62-
进入主界面后,点击打开配置按钮,选择您已配置好的配置文件,下次进入时可点击直接进入看板按钮进入考试看板,继续使用上次加载的配置文件。
72+
73+
进入主界面后,点击打开配置按钮,选择您已配置好的配置文件,下次进入时可点击直接进入看板按钮进入考试看板,继续使用上次加载的配置文件。
6374

6475
## 开发
76+
6577
要在本地编译应用您需要安装以下负载和工具
6678

6779
- [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)
@@ -108,4 +120,3 @@ $ yarn build:linux
108120
[![Star 历史](https://starchart.cc/hello8693DSZ/dsz-exam-showboard.svg?variant=adaptive)](https://starchart.cc/hello8693DSZ/dsz-exam-showboard)
109121

110122
<div align="center">
111-
Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
<template>
22
<v-system-bar class="position-fixed">
33
<v-icon icon="mdi-window-close" @click="ipcHandleExit"></v-icon>
4-
<span class="ms-2">{{
5-
new Date().toLocaleTimeString('en-US', {
6-
hour: 'numeric',
7-
minute: 'numeric',
8-
hour12: false
9-
})
10-
}}</span>
4+
<span class="ms-2">{{ currentTime }}</span>
115
</v-system-bar>
126
<v-app-bar :elevation="2" class="position-fixed">
137
<v-app-bar-title>{{ profileStore.appHeader }}</v-app-bar-title>
@@ -21,12 +15,32 @@
2115
</template>
2216

2317
<script setup>
18+
import { ref, onMounted, onUnmounted } from 'vue';
2419
import { useRouter } from 'vue-router';
2520
import { useProfileStore } from '../stores/app';
2621
2722
const profileStore = useProfileStore();
23+
const router = useRouter();
24+
const currentTime = ref(
25+
new Date().toLocaleTimeString('en-US', {
26+
hour: 'numeric',
27+
minute: 'numeric',
28+
hour12: false
29+
})
30+
);
2831
29-
const ipcHandleExit = () => window.electron.ipcRenderer.send('prog:exit');
32+
const updateTime = () => {
33+
currentTime.value = new Date().toLocaleTimeString('en-US', {
34+
hour: 'numeric',
35+
minute: 'numeric',
36+
hour12: false
37+
});
38+
};
3039
31-
const router = useRouter();
40+
onMounted(() => {
41+
const interval = setInterval(updateTime, 1000);
42+
onUnmounted(() => clearInterval(interval));
43+
});
44+
45+
const ipcHandleExit = () => window.electron.ipcRenderer.send('prog:exit');
3246
</script>

src/renderer/src/components/ExamList.vue

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
</template>
4747

4848
<script setup lang="ts">
49-
import { reacive, computed } from 'vue';
49+
import { reactive, computed, onMounted, onUnmounted } from 'vue';
5050
5151
const props = defineProps({
5252
exam: {
@@ -55,9 +55,13 @@ const props = defineProps({
5555
}
5656
});
5757
58+
const state = reactive({
59+
exams: props.exam
60+
});
61+
5862
// Computed properties and methods
5963
const sortedExams = computed(() => {
60-
return props.exam.sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime());
64+
return state.exams.sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime());
6165
});
6266
6367
const headers = [
@@ -87,10 +91,28 @@ function getStatusText(item: any): string {
8791
const startTime = new Date(item.start);
8892
const endTime = new Date(item.end);
8993
90-
if (now < startTime) return '未开始';
91-
else if (now >= startTime && now <= endTime) return '进行中';
92-
else return '已结束';
94+
if (now < startTime) {
95+
return '未开始';
96+
} else if (now >= startTime && now <= endTime) {
97+
return '进行中';
98+
} else {
99+
return '已结束';
100+
}
93101
}
102+
103+
// Update exams every minute
104+
onMounted(() => {
105+
const interval = setInterval(() => {
106+
state.exams = state.exams.map((exam) => ({
107+
...exam,
108+
status: getStatusText(exam)
109+
}));
110+
}, 1000); // 1000 ms = 1 second
111+
112+
onUnmounted(() => {
113+
clearInterval(interval);
114+
});
115+
});
94116
</script>
95117

96118
<style scoped>

src/renderer/src/pages/infoPage.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<v-container class="main-area">
33
<v-row>
44
<v-col cols="12">
5-
<h1>{{ globalStore.examName }}</h1>
5+
<h1 class="large-title">{{ globalStore.examName }}</h1>
6+
<h2 class="medium-title">{{ globalStore.message }}</h2>
67
</v-col>
78
</v-row>
89

@@ -35,13 +36,19 @@ const currentExam = computed(() => {
3536
return current;
3637
}
3738
});
38-
39-
//
4039
</script>
4140

4241
<style scoped>
4342
.main-area {
4443
padding-left: 20px;
4544
padding-right: 20px;
4645
}
46+
47+
.large-title {
48+
font-size: 3em; /* 放大h1文字 */
49+
}
50+
51+
.medium-title {
52+
font-size: 1em; /* 略小一点的h2文字 */
53+
}
4754
</style>

0 commit comments

Comments
 (0)