From 99d9b89faed90d4448522b0502741013744168a4 Mon Sep 17 00:00:00 2001 From: pengm <674192343@qq.com> Date: Thu, 18 Jun 2026 13:20:47 +0800 Subject: [PATCH] 1. 首次加载时立即弹窗,之后按照restTime轮询 --- src/mes/common/siderInfoComponent/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mes/common/siderInfoComponent/index.js b/src/mes/common/siderInfoComponent/index.js index c524046..5d5845d 100644 --- a/src/mes/common/siderInfoComponent/index.js +++ b/src/mes/common/siderInfoComponent/index.js @@ -618,14 +618,17 @@ const DeviceTargetInfoComponent = () => { const settingId = useRef(`settingId_${commonUtils.createSid()}`); const timer = useRef(null); + const isFirstLoad = useRef(true); useEffect( () => { if (bPopup && iPopDuration) { - const restTime = Math.max( - iPopDuration * 60 * 1000 - dProduceHour * 1000, - 0 - ); + // 首次加载时立即弹窗,之后按照restTime轮询 + const restTime = isFirstLoad.current + ? 0 + : Math.max(iPopDuration * 60 * 1000 - dProduceHour * 1000, 0); + isFirstLoad.current = false; + clearTimeout(timer.current); timer.current = null; timer.current = setTimeout(() => { -- libgit2 0.22.2