mirror of
https://hub.gitmirror.com/https://github.com/ExamAware/ExamShowboard-Legacy.git
synced 2025-04-29 13:46:32 +00:00
feat:开考前15分钟和考试时显示倒计时
This commit is contained in:
parent
c6db4ce047
commit
f0a5fcc68a
@ -11,6 +11,7 @@
|
|||||||
考试状态: <span :class="statusColor">{{ statusText }}</span>
|
考试状态: <span :class="statusColor">{{ statusText }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="isWarning" class="text-h5 text--warning">考试即将结束</div>
|
<div v-if="isWarning" class="text-h5 text--warning">考试即将结束</div>
|
||||||
|
<div v-if="showRemainingTime" class="text-h5 text--info">剩余时间: {{ remainingTime }}</div>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
</v-card>
|
</v-card>
|
||||||
|
|
||||||
@ -69,6 +70,27 @@ const isWarning = computed(() => {
|
|||||||
return now.value >= fifteenMinutesBeforeEnd && now.value < end;
|
return now.value >= fifteenMinutesBeforeEnd && now.value < end;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const showRemainingTime = computed(() => {
|
||||||
|
if (!props.exam) return false;
|
||||||
|
|
||||||
|
const start = new Date(props.exam.start);
|
||||||
|
const end = new Date(props.exam.end);
|
||||||
|
const fifteenMinutesBeforeStart = new Date(start.getTime() - 15 * 60 * 1000);
|
||||||
|
|
||||||
|
return now.value >= fifteenMinutesBeforeStart && now.value < end;
|
||||||
|
});
|
||||||
|
|
||||||
|
const remainingTime = computed(() => {
|
||||||
|
if (!props.exam) return '';
|
||||||
|
|
||||||
|
const end = new Date(props.exam.end);
|
||||||
|
const timeDiff = end.getTime() - now.value.getTime();
|
||||||
|
const minutes = Math.floor(timeDiff / (1000 * 60));
|
||||||
|
const seconds = Math.floor((timeDiff % (1000 * 60)) / 1000);
|
||||||
|
|
||||||
|
return `${minutes}分${seconds}秒`;
|
||||||
|
});
|
||||||
|
|
||||||
// Update the current time every second
|
// Update the current time every second
|
||||||
const updateNow = () => {
|
const updateNow = () => {
|
||||||
now.value = new Date();
|
now.value = new Date();
|
||||||
@ -86,6 +108,10 @@ updateNow();
|
|||||||
color: #ffc107 !important; /* Vuetify's default warning color */
|
color: #ffc107 !important; /* Vuetify's default warning color */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text--info {
|
||||||
|
color: #17a2b8 !important; /* Info color */
|
||||||
|
}
|
||||||
|
|
||||||
.status-before {
|
.status-before {
|
||||||
color: orange;
|
color: orange;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<p>版本号: 1.1.0-Malkuth</p>
|
<p>版本号: 1.1.0-Malkuth</p>
|
||||||
<p>开发者:Hello8963 & Mkstoler4096</p>
|
<p>开发者:Hello8963 & Mkstoler4096</p>
|
||||||
<v-btn
|
<v-btn
|
||||||
href="https://github.com/Hello8963/exam-board"
|
href="https://github.com/MKStoler4096/dsz-exam-showboard-next"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
color="primary"
|
color="primary"
|
||||||
class="mt-4"
|
class="mt-4"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user