|
@@ -30,6 +30,8 @@ import Layout from '@/components/layout/layout'
|
|
|
import { CheckBoxType, NaviBarTitleShowType, TemplateType } from '@/utils/types'
|
|
import { CheckBoxType, NaviBarTitleShowType, TemplateType } from '@/utils/types'
|
|
|
import { updateScenario } from '@/store/time'
|
|
import { updateScenario } from '@/store/time'
|
|
|
import { showModal } from '@/store/modal'
|
|
import { showModal } from '@/store/modal'
|
|
|
|
|
+import { ConsoleType, changeConsoleStatus } from '@/store/console'
|
|
|
|
|
+import TitleView from '@/features/trackTimeDuration/components/TitleView'
|
|
|
// import TabBar from '../../components/Tabbar';
|
|
// import TabBar from '../../components/Tabbar';
|
|
|
|
|
|
|
|
export default function IndexPage() {
|
|
export default function IndexPage() {
|
|
@@ -38,6 +40,7 @@ export default function IndexPage() {
|
|
|
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);
|
|
|
const common = useSelector((state: any) => state.common);
|
|
const common = useSelector((state: any) => state.common);
|
|
|
|
|
+ const consoleData = useSelector((state: any) => state.console);
|
|
|
const [counter, setCounter] = useState(0)
|
|
const [counter, setCounter] = useState(0)
|
|
|
const [timerId, setTimerId] = useState(null)
|
|
const [timerId, setTimerId] = useState(null)
|
|
|
const [needShowAddTip, setNeedShowAddTip] = useState(false)
|
|
const [needShowAddTip, setNeedShowAddTip] = useState(false)
|
|
@@ -51,9 +54,11 @@ export default function IndexPage() {
|
|
|
const [showModal2, setShowModal2] = useState(false)
|
|
const [showModal2, setShowModal2] = useState(false)
|
|
|
const [modalDetail2, setModalDetail2] = useState<any>({})
|
|
const [modalDetail2, setModalDetail2] = useState<any>({})
|
|
|
const [showSingleFastEnd, setShowSingleFastEnd] = useState(false)
|
|
const [showSingleFastEnd, setShowSingleFastEnd] = useState(false)
|
|
|
|
|
+ const [consoleStatus,setConsoleStatus] = useState(consoleData.status)
|
|
|
|
|
|
|
|
global.dispatch = dispatch;
|
|
global.dispatch = dispatch;
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
|
|
+ global.consoleType = 'idle'
|
|
|
dispatch(staticResources() as any);
|
|
dispatch(staticResources() as any);
|
|
|
// dispatch(gobalConfigs() as any);
|
|
// dispatch(gobalConfigs() as any);
|
|
|
trackTimeService.onTransition(state => {
|
|
trackTimeService.onTransition(state => {
|
|
@@ -72,6 +77,27 @@ export default function IndexPage() {
|
|
|
|
|
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ setConsoleStatus(consoleData.status)
|
|
|
|
|
+ switch (consoleData.status) {
|
|
|
|
|
+ // case ConsoleType.going:
|
|
|
|
|
+ // setShowSingleFastEnd(true)
|
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
|
+ // setShowSingleFastEnd(false)
|
|
|
|
|
+ // setSwiperIndex(1)
|
|
|
|
|
+ // setAutoPlay(true)
|
|
|
|
|
+ // dispatch(changeConsoleStatus({ status: ConsoleType.end }))
|
|
|
|
|
+ // }, 2000)
|
|
|
|
|
+ // break
|
|
|
|
|
+ case ConsoleType.end:
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ dispatch(changeConsoleStatus({ status: ConsoleType.idle }))
|
|
|
|
|
+ }, 2000)
|
|
|
|
|
+
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [consoleData.status])
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (user.isLogin) {
|
|
if (user.isLogin) {
|
|
|
//检查用户是否添加过小程序
|
|
//检查用户是否添加过小程序
|
|
@@ -176,6 +202,7 @@ export default function IndexPage() {
|
|
|
|
|
|
|
|
function getCheckData() {
|
|
function getCheckData() {
|
|
|
getClocks().then(res => {
|
|
getClocks().then(res => {
|
|
|
|
|
+ console.log(consoleStatus)
|
|
|
dispatch(updateScenario((res as any).current_record))
|
|
dispatch(updateScenario((res as any).current_record))
|
|
|
dispatch(setConfigs((res as any).time_input_schema));
|
|
dispatch(setConfigs((res as any).time_input_schema));
|
|
|
dispatch(setScenario((res as any).scenario));
|
|
dispatch(setScenario((res as any).scenario));
|
|
@@ -191,19 +218,41 @@ export default function IndexPage() {
|
|
|
machine.context.currentStatus = `${key}.${status}`;//'mixed.ON_GOING2'
|
|
machine.context.currentStatus = `${key}.${status}`;//'mixed.ON_GOING2'
|
|
|
setCheckData(res as any)
|
|
setCheckData(res as any)
|
|
|
|
|
|
|
|
- if ((res as any).current_record.status == 'ONGOING1') {
|
|
|
|
|
- setShowSingleFastEnd(true)
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- setShowSingleFastEnd(false)
|
|
|
|
|
- setSwiperIndex(1)
|
|
|
|
|
- setAutoPlay(true)
|
|
|
|
|
- }, 2000)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if ((res as any).current_record.status != 'ONGOING1') {
|
|
|
|
|
+ setSwiperIndex(0)
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- setSwiperIndex(0)
|
|
|
|
|
- setAutoPlay(false)
|
|
|
|
|
|
|
+ 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)
|
|
|
|
|
+ }, 2000)
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ console.log('bbb')
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ // if ((res as any).current_record.status == 'ONGOING1') {
|
|
|
|
|
+ // setShowSingleFastEnd(true)
|
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
|
+ // setShowSingleFastEnd(false)
|
|
|
|
|
+ // setSwiperIndex(1)
|
|
|
|
|
+ // setAutoPlay(true)
|
|
|
|
|
+ // }, 2000)
|
|
|
|
|
+
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else {
|
|
|
|
|
+ // setSwiperIndex(0)
|
|
|
|
|
+ // setAutoPlay(false)
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -251,21 +300,24 @@ export default function IndexPage() {
|
|
|
setModalDetail2(detail)
|
|
setModalDetail2(detail)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ function headerView(){
|
|
|
|
|
+ return <TitleView />
|
|
|
|
|
+ }
|
|
|
return (
|
|
return (
|
|
|
- <Layout type={TemplateType.flex} title='时钟' titleShowStyle={NaviBarTitleShowType.scrollToShow}>
|
|
|
|
|
|
|
+ <Layout type={TemplateType.customHeader} header={headerView()} title='时钟' titleShowStyle={NaviBarTitleShowType.scrollToShow}>
|
|
|
<View style={{ flex: 1, flexDirection: 'column', display: 'flex', backgroundColor: '#000', color: '#fff' }}>
|
|
<View style={{ flex: 1, flexDirection: 'column', display: 'flex', backgroundColor: '#000', color: '#fff' }}>
|
|
|
{
|
|
{
|
|
|
needShowAddTip && <Tooltip title="添加到我的小程序" closeTip={() => { setNeedShowAddTip(false) }} />
|
|
needShowAddTip && <Tooltip title="添加到我的小程序" closeTip={() => { setNeedShowAddTip(false) }} />
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- <TitleBar />
|
|
|
|
|
|
|
+ {/* <TitleBar /> */}
|
|
|
<Box>
|
|
<Box>
|
|
|
<View className='clock_bg'>
|
|
<View className='clock_bg'>
|
|
|
<Clocks />
|
|
<Clocks />
|
|
|
</View>
|
|
</View>
|
|
|
</Box>
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
+ <View className='console_bg'>
|
|
|
{
|
|
{
|
|
|
needSwiper() ? <Swiper className='swiper' indicatorColor='#333'
|
|
needSwiper() ? <Swiper className='swiper' indicatorColor='#333'
|
|
|
indicatorActiveColor='#999'
|
|
indicatorActiveColor='#999'
|
|
@@ -273,12 +325,13 @@ export default function IndexPage() {
|
|
|
autoplay={autoPlay}
|
|
autoplay={autoPlay}
|
|
|
duration={300}
|
|
duration={300}
|
|
|
interval={2000}
|
|
interval={2000}
|
|
|
|
|
+ indicatorDots={global.consoleType =='idle'}
|
|
|
onChange={(e) => {
|
|
onChange={(e) => {
|
|
|
setSwiperIndex(e.detail.current)
|
|
setSwiperIndex(e.detail.current)
|
|
|
if (e.detail.current == 0)
|
|
if (e.detail.current == 0)
|
|
|
setAutoPlay(false)
|
|
setAutoPlay(false)
|
|
|
}}
|
|
}}
|
|
|
- indicatorDots>
|
|
|
|
|
|
|
+ >
|
|
|
<SwiperItem className='swiperItem'>
|
|
<SwiperItem className='swiperItem'>
|
|
|
<Console />
|
|
<Console />
|
|
|
|
|
|
|
@@ -291,9 +344,10 @@ export default function IndexPage() {
|
|
|
<Console isNextStep={showSingleFastEnd} />
|
|
<Console isNextStep={showSingleFastEnd} />
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ </View>
|
|
|
|
|
|
|
|
{/* <Console /> */}
|
|
{/* <Console /> */}
|
|
|
- <More ref={global.moreRef} />
|
|
|
|
|
|
|
+ {/* <More ref={global.moreRef} /> */}
|
|
|
{
|
|
{
|
|
|
checkData && schedule()
|
|
checkData && schedule()
|
|
|
}
|
|
}
|