mirror of
https://hub.gitmirror.com/https://github.com/ExamAware/ExamShowboard-Legacy.git
synced 2025-04-29 03:36:34 +00:00
fix(pre): 递交
This commit is contained in:
parent
2ee240ccaf
commit
189b0467e1
@ -21,20 +21,22 @@
|
||||
</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);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
updateCurrentExam();
|
||||
const interval = setInterval(updateCurrentExam, 20000); // 每20秒刷新一次
|
||||
onUnmounted(() => clearInterval(interval));
|
||||
});
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user