|
@@ -56,7 +56,7 @@ if (process.env.TARO_ENV == 'rn') {
|
|
|
|
|
|
|
|
export default function IndexPage() {
|
|
export default function IndexPage() {
|
|
|
const dispatch = useDispatch();
|
|
const dispatch = useDispatch();
|
|
|
- const { t,i18n } = useTranslation()
|
|
|
|
|
|
|
+ const { t, i18n } = useTranslation()
|
|
|
const [checkData, setCheckData] = useState(null)
|
|
const [checkData, setCheckData] = useState(null)
|
|
|
const user = useSelector((state: any) => state.user);
|
|
const user = useSelector((state: any) => state.user);
|
|
|
const time = useSelector((state: any) => state.time);
|
|
const time = useSelector((state: any) => state.time);
|
|
@@ -95,10 +95,10 @@ export default function IndexPage() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- if (process.env.TARO_ENV=='rn'){
|
|
|
|
|
|
|
+ if (process.env.TARO_ENV == 'rn') {
|
|
|
AppState.addEventListener('change', handleAppStateChange);
|
|
AppState.addEventListener('change', handleAppStateChange);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
global.consoleType = 'idle'
|
|
global.consoleType = 'idle'
|
|
|
dispatch(staticResources() as any);
|
|
dispatch(staticResources() as any);
|
|
|
// dispatch(gobalConfigs() as any);
|
|
// dispatch(gobalConfigs() as any);
|
|
@@ -119,10 +119,10 @@ export default function IndexPage() {
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const currentLanguage = i18n.language;
|
|
const currentLanguage = i18n.language;
|
|
|
global.language = currentLanguage
|
|
global.language = currentLanguage
|
|
|
- console.log('current language',currentLanguage)
|
|
|
|
|
|
|
+ console.log('current language', currentLanguage)
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
const handleAppStateChange = (nextAppState) => {
|
|
const handleAppStateChange = (nextAppState) => {
|
|
@@ -319,6 +319,51 @@ export default function IndexPage() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function getCheckData() {
|
|
function getCheckData() {
|
|
|
|
|
+ var res = global.selectData
|
|
|
|
|
+ setErrorPage(false)
|
|
|
|
|
+ dispatch(updateScenario((res as any).current_record))
|
|
|
|
|
+ dispatch(setConfigs((res as any).time_input_schema));
|
|
|
|
|
+ dispatch(setScenario((res as any).scenario));
|
|
|
|
|
+
|
|
|
|
|
+ if ((res as any).theme_color) {
|
|
|
|
|
+ global.fastColor = (res as any).theme_color.fast
|
|
|
|
|
+ global.sleepColor = (res as any).theme_color.sleep
|
|
|
|
|
+ }
|
|
|
|
|
+ machine.context.checkData = res as any;
|
|
|
|
|
+
|
|
|
|
|
+ global.scenario = (res as any).current_record.scenario;
|
|
|
|
|
+ const currentState = trackTimeService.getSnapshot();
|
|
|
|
|
+ let json = {};
|
|
|
|
|
+ var key = (res as any).current_record.scenario
|
|
|
|
|
+ var status = (res as any).current_record.status
|
|
|
|
|
+ json[key] = status
|
|
|
|
|
+ currentState.value = json;
|
|
|
|
|
+ machine.context.currentStatus = `${key}.${status}`;//'mixed.ON_GOING2'
|
|
|
|
|
+ setCheckData(res as any)
|
|
|
|
|
+
|
|
|
|
|
+ setLoaded(true)
|
|
|
|
|
+
|
|
|
|
|
+ if ((res as any).current_record.status != 'ONGOING1') {
|
|
|
|
|
+ setSwiperIndex(0)
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ if (global.consoleType == 'going') {
|
|
|
|
|
+ setShowSingleFastEnd(true)
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ setShowSingleFastEnd(false)
|
|
|
|
|
+ setSwiperIndex(1)
|
|
|
|
|
+ setAutoPlay(true)
|
|
|
|
|
+ global.consoleType = 'end'
|
|
|
|
|
+ dispatch(changeConsoleStatus({ status: ConsoleType.end }))
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ global.consoleType = 'idle'
|
|
|
|
|
+ }, 2000)
|
|
|
|
|
+ }, 500)
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return
|
|
|
getClocks().then(res => {
|
|
getClocks().then(res => {
|
|
|
debugger
|
|
debugger
|
|
|
setErrorPage(false)
|
|
setErrorPage(false)
|
|
@@ -520,7 +565,7 @@ export default function IndexPage() {
|
|
|
onBeforeLeave={() => {
|
|
onBeforeLeave={() => {
|
|
|
Taro.showTabBar();
|
|
Taro.showTabBar();
|
|
|
}}
|
|
}}
|
|
|
- onClick={()=>{alert('b')}}
|
|
|
|
|
|
|
+ onClick={() => { alert('b') }}
|
|
|
onClickOverlay={() => { alert('a') }}
|
|
onClickOverlay={() => { alert('a') }}
|
|
|
onAfterLeave={() => { setShowModal(false); setShowModal2(false) }}
|
|
onAfterLeave={() => { setShowModal(false); setShowModal2(false) }}
|
|
|
show={showModal || showModal2} round={true} overlay={true} position='bottom'
|
|
show={showModal || showModal2} round={true} overlay={true} position='bottom'
|
|
@@ -581,7 +626,7 @@ export default function IndexPage() {
|
|
|
user.isLogin && checkData && (checkData as any).latest_record &&
|
|
user.isLogin && checkData && (checkData as any).latest_record &&
|
|
|
<RecordFastSleep type='latest' data={(checkData as any).latest_record} delSuccess={getCheckData} />
|
|
<RecordFastSleep type='latest' data={(checkData as any).latest_record} delSuccess={getCheckData} />
|
|
|
}
|
|
}
|
|
|
- <View style={{ height: process.env.TARO_ENV=='rn'?0:100 }} />
|
|
|
|
|
|
|
+ <View style={{ height: process.env.TARO_ENV == 'rn' ? 0 : 100 }} />
|
|
|
</View>
|
|
</View>
|
|
|
|
|
|
|
|
{
|
|
{
|