diff --git a/src/renderer/src/components/SubjectInfo.vue b/src/renderer/src/components/SubjectInfo.vue index 838e651..cf38c8d 100644 --- a/src/renderer/src/components/SubjectInfo.vue +++ b/src/renderer/src/components/SubjectInfo.vue @@ -1,23 +1,25 @@ @@ -45,10 +47,8 @@ const statusColor = computed(() => { const start = new Date(props.exam.start); const end = new Date(props.exam.end); - const fifteenMinutesBeforeStart = new Date(start.getTime() - 15 * 60 * 1000); - if (now.value < fifteenMinutesBeforeStart) return 'status-before'; - if (now.value >= fifteenMinutesBeforeStart && now.value < start) return 'status-soon'; + if (now.value < start) return 'status-before'; if (now.value >= start && now.value < end) return 'status-middle'; if (now.value >= end) return 'status-after'; }); @@ -58,10 +58,8 @@ const statusText = computed(() => { const start = new Date(props.exam.start); const end = new Date(props.exam.end); - const fifteenMinutesBeforeStart = new Date(start.getTime() - 15 * 60 * 1000); - if (now.value < fifteenMinutesBeforeStart) return '未开始'; - if (now.value >= fifteenMinutesBeforeStart && now.value < start) return '即将开始'; + if (now.value < start) return '未开始'; if (now.value >= start && now.value < end) return '进行中'; if (now.value >= end) return '已结束'; }); @@ -115,6 +113,9 @@ const countdown = computed(() => { return `${minutes}分${seconds}秒`; }); +// 动态颜色样式 +const remainingTimeColorClass = computed(() => (isWarning.value ? 'text--warning' : 'text--default')); + // Update the current time every second const updateNow = () => { now.value = new Date(); @@ -128,24 +129,33 @@ updateNow(); font-size: 2.5rem !important; } +.line-item { + margin-bottom: 16px; +} + +.text--default { + color: white !important; +} + .text--warning { - color: #ffc107 !important; /* Vuetify's default warning color */ + color: #ff0000 !important; } .text--info { - color: #17a2b8 !important; /* Info color */ + color: #ffff00 !important; +} + +.text--ended { + font-size: 2.5rem !important; + color: #666; } .status-before { color: orange; } -.status-soon { - color: #ff9800; /* 即将开始的颜色 */ -} - .status-middle { - color: #00ff00; + color: green; } .status-after { @@ -155,4 +165,8 @@ updateNow(); .subject-info-card { margin-top: 20px; } + +.text-center { + text-align: center; +}