diff --git a/src/renderer/src/components/SubjectInfo.vue b/src/renderer/src/components/SubjectInfo.vue
index cf38c8d..949ad1b 100644
--- a/src/renderer/src/components/SubjectInfo.vue
+++ b/src/renderer/src/components/SubjectInfo.vue
@@ -11,7 +11,6 @@
考试状态: {{ statusText }}
开考倒计时: {{ countdown }}
- 考试即将结束
考试剩余时间: {{ remainingTime }}
@@ -64,15 +63,6 @@ const statusText = computed(() => {
if (now.value >= end) return '已结束';
});
-const isWarning = computed(() => {
- if (!props.exam) return false;
-
- const end = new Date(props.exam.end);
- const fifteenMinutesBeforeEnd = new Date(end.getTime() - 15 * 60 * 1000);
-
- return now.value >= fifteenMinutesBeforeEnd && now.value < end;
-});
-
const showRemainingTime = computed(() => {
if (!props.exam) return false;
@@ -114,7 +104,14 @@ const countdown = computed(() => {
});
// 动态颜色样式
-const remainingTimeColorClass = computed(() => (isWarning.value ? 'text--warning' : 'text--default'));
+const remainingTimeColorClass = computed(() => {
+ if (!props.exam) return 'text--default';
+
+ const end = new Date(props.exam.end);
+ const fifteenMinutesBeforeEnd = new Date(end.getTime() - 15 * 60 * 1000);
+
+ return now.value >= fifteenMinutesBeforeEnd && now.value < end ? 'text--warning' : 'text--default';
+});
// Update the current time every second
const updateNow = () => {
@@ -169,4 +166,4 @@ updateNow();
.text-center {
text-align: center;
}
-
+
\ No newline at end of file