Commit 99d9b89faed90d4448522b0502741013744168a4
1 parent
16aae6bd
1. 首次加载时立即弹窗,之后按照restTime轮询
Showing
1 changed file
with
7 additions
and
4 deletions
src/mes/common/siderInfoComponent/index.js
| ... | ... | @@ -618,14 +618,17 @@ const DeviceTargetInfoComponent = () => { |
| 618 | 618 | |
| 619 | 619 | const settingId = useRef(`settingId_${commonUtils.createSid()}`); |
| 620 | 620 | const timer = useRef(null); |
| 621 | + const isFirstLoad = useRef(true); | |
| 621 | 622 | |
| 622 | 623 | useEffect( |
| 623 | 624 | () => { |
| 624 | 625 | if (bPopup && iPopDuration) { |
| 625 | - const restTime = Math.max( | |
| 626 | - iPopDuration * 60 * 1000 - dProduceHour * 1000, | |
| 627 | - 0 | |
| 628 | - ); | |
| 626 | + // 首次加载时立即弹窗,之后按照restTime轮询 | |
| 627 | + const restTime = isFirstLoad.current | |
| 628 | + ? 0 | |
| 629 | + : Math.max(iPopDuration * 60 * 1000 - dProduceHour * 1000, 0); | |
| 630 | + isFirstLoad.current = false; | |
| 631 | + | |
| 629 | 632 | clearTimeout(timer.current); |
| 630 | 633 | timer.current = null; |
| 631 | 634 | timer.current = setTimeout(() => { | ... | ... |