fix(pre): 递交

This commit is contained in:
MKStoler 2024-10-08 18:24:52 +08:00
parent 2ee240ccaf
commit 189b0467e1

View File

@ -21,20 +21,22 @@
</template> </template>
<script setup> <script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { useProfileStore } from '@renderer/stores/app'; import { useProfileStore } from '@renderer/stores/app';
import { getCurrentTimeSlot, getNextExamTimeSlot } from '@renderer/utils/subjectUtils'; import { getCurrentTimeSlot, getNextExamTimeSlot } from '@renderer/utils/subjectUtils';
const globalStore = useProfileStore(); const globalStore = useProfileStore();
const currentExam = ref(null);
getCurrentTimeSlot(globalStore.examInfos); const updateCurrentExam = () => {
const currentExam = computed(() => {
const current = getCurrentTimeSlot(globalStore.examInfos); const current = getCurrentTimeSlot(globalStore.examInfos);
if (current == null) { currentExam.value = current ? current : getNextExamTimeSlot(globalStore.examInfos);
return getNextExamTimeSlot(globalStore.examInfos); };
} else {
return current; onMounted(() => {
} updateCurrentExam();
const interval = setInterval(updateCurrentExam, 20000); // 20
onUnmounted(() => clearInterval(interval));
}); });
</script> </script>