From 35a00e2acae0c9a0f87ca7e3766a8a8180a4c510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E4=BA=86=E4=B8=AA=E7=99=BD?= <543593352@qq.com> Date: Tue, 22 Oct 2024 16:04:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=89=B9=E9=98=85=EF=BC=9A?= =?UTF-8?q?=E6=9C=80=E5=B0=8F=E5=8C=96=E5=86=8D=E6=AC=A1=E6=89=93=E5=BC=80?= =?UTF-8?q?=E4=BC=9A=E5=88=B7=E6=96=B0=E7=9A=84=E9=80=BB=E8=BE=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/utils/tool.js | 2 +- .../src/views/classTask/teachClassTask.vue | 21 ++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/utils/tool.js b/src/renderer/src/utils/tool.js index 445cf22..1c800cd 100644 --- a/src/renderer/src/utils/tool.js +++ b/src/renderer/src/utils/tool.js @@ -340,7 +340,7 @@ const eventHandles = (type, win) => { // 监听窗口的激活事件 win.on('focus', async () => { toolState.isTaskWin=true - win&&win.reload(); //刷新该窗口 + // win&&win.reload(); //刷新该窗口 }); // 监听窗口关闭事件 win.on('closed', function () { diff --git a/src/renderer/src/views/classTask/teachClassTask.vue b/src/renderer/src/views/classTask/teachClassTask.vue index 7095339..9ba94ff 100644 --- a/src/renderer/src/views/classTask/teachClassTask.vue +++ b/src/renderer/src/views/classTask/teachClassTask.vue @@ -158,6 +158,7 @@ import quizStats from '@/views/classTask/container/quizStats.vue' import ClassOverview from '@/views/classTask/container/classOverview.vue' import {sessionStore} from '@/utils/store' + const { proxy } = getCurrentInstance() const emit = defineEmits(['cle-click']) const props = defineProps({ @@ -636,16 +637,29 @@ const closeDialog = () => { emit('cle-click') } +const reloadTimer = ref(0); // 开启定时查询,作业id是否刷新了,刷新了就重新获取 +const cutid = ref(0); // 当前初始化的作业id onMounted(() => { - const data = JSON.parse(localStorage.getItem('teachClassWorkItem')); // const data = sessionStore.get('teachClassWorkItem'); - // const data = localStorage.getItem('teachClassWorkItem'); - console.log(data,'????????????????????' ) if(data){ openDialog(data) } + // 开始定时查询 + cutid.value = data.id; + isReloadTimer(); }) +const isReloadTimer = () =>{ + clearInterval(reloadTimer.value) // 关闭定时器 + // 开启定时查询,作业id是否刷新了,刷新了就重新获取 + reloadTimer.value = setInterval(() => { + const data = JSON.parse(localStorage.getItem('teachClassWorkItem')); + if(cutid.value != data.id){ + cutid.value = data.id; + openDialog(data) + } + }, 1000) +} watch(classWorkAnalysis, (newVal, oldVal) => { if(newVal.view != 'quizStats'){ @@ -656,6 +670,7 @@ watch(classWorkAnalysis, (newVal, oldVal) => { onUnmounted(() => { clearInterval(classWorkActiveData.timerId) // 关闭定时器 逐题讲评的 + clearInterval(reloadTimer.value) // 关闭定时器 查询作业id是否刷新了 }) // defineExpose({