|
@@ -78,7 +78,8 @@ export default function ClockIndex() {
|
|
|
const [showTimeResult, setShowTimeResult] = useState(false)
|
|
const [showTimeResult, setShowTimeResult] = useState(false)
|
|
|
const [timeResult, setTimeResult] = useState<any>(null)
|
|
const [timeResult, setTimeResult] = useState<any>(null)
|
|
|
|
|
|
|
|
- const [current, setCurrent] = useState(0)
|
|
|
|
|
|
|
+ const [current, setCurrent] = useState(-1)
|
|
|
|
|
+ const currentRef = useRef(current)
|
|
|
|
|
|
|
|
const [swiperHeight] = useState(screenHeight - navigationBarHeight - rpxToPx(108) - rpxToPx(112) - bottomSafeAreaHeight + 4)
|
|
const [swiperHeight] = useState(screenHeight - navigationBarHeight - rpxToPx(108) - rpxToPx(112) - bottomSafeAreaHeight + 4)
|
|
|
|
|
|
|
@@ -94,6 +95,10 @@ export default function ClockIndex() {
|
|
|
getHomeData()
|
|
getHomeData()
|
|
|
}, [user.isLogin])
|
|
}, [user.isLogin])
|
|
|
|
|
|
|
|
|
|
+ useEffect(()=>{
|
|
|
|
|
+ currentRef.current = current
|
|
|
|
|
+ },[current])
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
startPickerRef.current = showDatePicker
|
|
startPickerRef.current = showDatePicker
|
|
|
endPickerRef.current = showEndDatePicker
|
|
endPickerRef.current = showEndDatePicker
|
|
@@ -101,6 +106,7 @@ export default function ClockIndex() {
|
|
|
}, [showDatePicker, showDurationPicker, showEndDatePicker])
|
|
}, [showDatePicker, showDurationPicker, showEndDatePicker])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
|
|
+
|
|
|
downloadFile()
|
|
downloadFile()
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
@@ -146,7 +152,7 @@ export default function ClockIndex() {
|
|
|
setScenarios((res as any).scenarios)
|
|
setScenarios((res as any).scenarios)
|
|
|
var active_scenario = (res as any).active_scenario
|
|
var active_scenario = (res as any).active_scenario
|
|
|
setTabs((res as any).scenarios.map(((item, index) => {
|
|
setTabs((res as any).scenarios.map(((item, index) => {
|
|
|
- if (item.scenario == active_scenario) {
|
|
|
|
|
|
|
+ if (item.scenario == active_scenario && currentRef.current == -1) {
|
|
|
setCurrent(index)
|
|
setCurrent(index)
|
|
|
}
|
|
}
|
|
|
return item.title
|
|
return item.title
|
|
@@ -155,6 +161,7 @@ export default function ClockIndex() {
|
|
|
setShowRetry(false)
|
|
setShowRetry(false)
|
|
|
}).catch(e => {
|
|
}).catch(e => {
|
|
|
setShowRetry(true)
|
|
setShowRetry(true)
|
|
|
|
|
+ setCurrent(0)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|