diff --git a/src/views/healthConsultation/HealthConsultationIndex.vue b/src/views/healthConsultation/HealthConsultationIndex.vue index 6ac89d3..1caee86 100644 --- a/src/views/healthConsultation/HealthConsultationIndex.vue +++ b/src/views/healthConsultation/HealthConsultationIndex.vue @@ -13,16 +13,16 @@
- +
- +
- - - - + + + +
@@ -60,6 +60,8 @@ const rightDate = ref(''); const initDate = ref(startTime); const timer = ref(null); + const interval = ref(); + const bKey = ref(0); const pageRef = ref(); const getTime = () => { @@ -79,6 +81,18 @@ updateRightDate(); }, 1000); }; + // 定时器,定时刷新接口 + const startInterval = () => { + if (interval.value) { + clearInterval(interval.value); + } + interval.value = setInterval( + () => { + bKey.value++; + }, + 5 * 60 * 1000 + ); + }; const updateRightDate = () => { rightDate.value = '累计运行时间:' + (dayjs().diff(dayjs(initDate.value), 'days') + 1) + ' 天'; @@ -88,6 +102,7 @@ getTime(); updateRightDate(); startTimer(); // 启动定时器 + startInterval(); // 启动定时器 document.title = '健康咨询平台'; }); @@ -103,6 +118,9 @@ if (timer.value) { clearInterval(timer.value); } + if (interval.value) { + clearInterval(interval.value); + } }); // 健康监测工具报警 diff --git a/src/views/healthConsultation/components/healthContentBottomItem1.vue b/src/views/healthConsultation/components/healthContentBottomItem1.vue index cc30fc1..66338f5 100644 --- a/src/views/healthConsultation/components/healthContentBottomItem1.vue +++ b/src/views/healthConsultation/components/healthContentBottomItem1.vue @@ -6,7 +6,7 @@