|
|
@@ -27,7 +27,7 @@ import WeekCalendar from "@/features/trackTimeDuration/components/WeekCalendar";
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
import Layout from "@/components/layout/layout";
|
|
|
-import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
|
|
|
+import { ModalType, NaviBarTitleShowType, TemplateType } from "@/utils/types";
|
|
|
import TitleView from "@/features/trackTimeDuration/components/TitleView";
|
|
|
import ClockHeader from "@/features/trackTimeDuration/components/ClockHeader";
|
|
|
|
|
|
@@ -57,13 +57,17 @@ export default function Page() {
|
|
|
const [homeData, setHomeData] = useState(null)
|
|
|
|
|
|
const [selIndex, setSelIndex] = useState(0)
|
|
|
+
|
|
|
+
|
|
|
const [showModal, setShowModal] = useState(false)
|
|
|
const [modalDetail, setModalDetail] = useState<any>(null)
|
|
|
|
|
|
const [showModal2, setShowModal2] = useState(false)
|
|
|
const [modalDetail2, setModalDetail2] = useState<any>(null)
|
|
|
|
|
|
- const [isModal1, setIsModal1] = useState(false)
|
|
|
+ const [showModal3, setShowModal3] = useState(false)
|
|
|
+ const [modalDetail3, setModalDetail3] = useState<any>(null)
|
|
|
+
|
|
|
const [debugInfo, setDebugInfo] = useState(null)
|
|
|
|
|
|
const [isMulti, setIsMulti] = useState(false)
|
|
|
@@ -90,7 +94,7 @@ export default function Page() {
|
|
|
useEffect(() => {
|
|
|
global.showNightRing = false;
|
|
|
setInterval(() => {
|
|
|
- if (isPause){
|
|
|
+ if (isPause) {
|
|
|
return
|
|
|
}
|
|
|
setCount((prevCounter) => prevCounter + 1)
|
|
|
@@ -141,7 +145,7 @@ export default function Page() {
|
|
|
global.homeData = res
|
|
|
|
|
|
if (user.isLogin) {
|
|
|
- isPause = (res as any).fast_sleep.current_record.status=='WAIT_FOR_START'
|
|
|
+ isPause = (res as any).fast_sleep.current_record.status == 'WAIT_FOR_START'
|
|
|
dispatch(updateScenario((res as any).fast_sleep.current_record))
|
|
|
dispatch(setConfigs((res as any).time_input_schema));
|
|
|
dispatch(setScenario((res as any).fast_sleep.scenario));
|
|
|
@@ -264,7 +268,6 @@ export default function Page() {
|
|
|
|
|
|
global.showIndexModal = (isShow: boolean, detail: any, debugNode?: any) => {
|
|
|
global.showModal = isShow
|
|
|
- setIsModal1(true)
|
|
|
setDebugInfo(debugNode)
|
|
|
setShowModal(isShow)
|
|
|
setModalDetail(detail)
|
|
|
@@ -273,11 +276,17 @@ export default function Page() {
|
|
|
global.showIndexModal2 = (isShow: boolean, detail: any) => {
|
|
|
setDebugInfo(null)
|
|
|
global.showModal = isShow
|
|
|
- setIsModal1(false)
|
|
|
setShowModal2(isShow)
|
|
|
setModalDetail2(detail)
|
|
|
}
|
|
|
|
|
|
+ global.showIndexModal3 = (isShow: boolean, detail: any) => {
|
|
|
+ setDebugInfo(null)
|
|
|
+ global.showModal = isShow
|
|
|
+ setShowModal3(isShow)
|
|
|
+ setModalDetail3(detail)
|
|
|
+ }
|
|
|
+
|
|
|
global.changeTargetDuration = (duration: number, isFast: boolean) => {
|
|
|
var obj = JSON.parse(JSON.stringify(homeData))
|
|
|
var record = obj.fast_sleep.current_record
|
|
|
@@ -291,17 +300,25 @@ export default function Page() {
|
|
|
}
|
|
|
|
|
|
function modalContent() {
|
|
|
- if (showModal || showModal2) {
|
|
|
+ if (showModal || showModal2 || showModal3) {
|
|
|
if (process.env.TARO_ENV == 'weapp') {
|
|
|
+ if (showModal3) {
|
|
|
+ return <Modal children={modalDetail3}
|
|
|
+ modalType={ModalType.center}
|
|
|
+ dismiss={() => { setShowModal3(false); clearInterval(global.popTimer) }}
|
|
|
+ confirm={() => { }} />
|
|
|
+ }
|
|
|
return <Modal
|
|
|
testInfo={debugInfo}
|
|
|
dismiss={() => {
|
|
|
setDebugInfo(null)
|
|
|
- setShowModal(false); setShowModal2(false)
|
|
|
+ setShowModal(false);
|
|
|
+ setShowModal2(false);
|
|
|
+ setShowModal3(false);
|
|
|
}}
|
|
|
confirm={() => { }}>
|
|
|
{
|
|
|
- isModal1 ? modalDetail : modalDetail2
|
|
|
+ showModal ? modalDetail : showModal2 ? modalDetail2 : modalDetail3
|
|
|
}
|
|
|
</Modal>
|
|
|
}
|
|
|
@@ -321,10 +338,10 @@ export default function Page() {
|
|
|
onClick={() => { alert('b') }}
|
|
|
onClickOverlay={() => { alert('a') }}
|
|
|
onAfterLeave={() => { setShowModal(false); setShowModal2(false) }}
|
|
|
- show={showModal || showModal2} round={true} overlay={true} position='bottom'
|
|
|
+ show={showModal || showModal2 || showModal3} round={true} overlay={true} position='bottom'
|
|
|
>
|
|
|
{
|
|
|
- isModal1 ? modalDetail : modalDetail2
|
|
|
+ showModal ? modalDetail : showModal2 ? modalDetail2 : modalDetail3
|
|
|
}
|
|
|
</PageContainer>
|
|
|
}
|
|
|
@@ -366,97 +383,109 @@ export default function Page() {
|
|
|
|
|
|
<View className="index_container">
|
|
|
<Text className="count">{count}</Text>
|
|
|
- {/* <Text className="discovery">探索</Text> */}
|
|
|
- <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp} />
|
|
|
- <Swiper className='swiper1' indicatorColor='#333'
|
|
|
- indicatorActiveColor='#999'
|
|
|
- current={0}
|
|
|
- autoplay={false}
|
|
|
- duration={300}
|
|
|
- interval={300}
|
|
|
- indicator-offset={[0, -30]}
|
|
|
- indicator-height={30}
|
|
|
- indicatorDots={(homeData as any).fast_sleep.current_record.status == 'WAIT_FOR_START'}
|
|
|
- onChange={(e) => {
|
|
|
- var pageIndex = e.detail.current
|
|
|
- global.changeMixIndex(pageIndex)
|
|
|
- }}
|
|
|
- >
|
|
|
- <SwiperItem className='swiperItem'>
|
|
|
- <IndexConsole record={(homeData as any).fast_sleep} />
|
|
|
|
|
|
- </SwiperItem>
|
|
|
+ {
|
|
|
+ (homeData as any).fast_sleep.current_record.status != 'WAIT_FOR_START' ?
|
|
|
+ <View>
|
|
|
+ <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp} showStage={false} />
|
|
|
+ <IndexConsole record={(homeData as any).fast_sleep} />
|
|
|
+ </View> :
|
|
|
+
|
|
|
+ <Swiper className='swiper1' indicatorColor='#333'
|
|
|
+ indicatorActiveColor='#999'
|
|
|
+ current={0}
|
|
|
+ autoplay={false}
|
|
|
+ duration={300}
|
|
|
+ interval={300}
|
|
|
+
|
|
|
+ indicator-offset={[0, -30]}
|
|
|
+ indicator-height={30}
|
|
|
+ indicatorDots={(homeData as any).fast_sleep.current_record.status == 'WAIT_FOR_START'}
|
|
|
+ onChange={(e) => {
|
|
|
+ var pageIndex = e.detail.current
|
|
|
+ global.changeMixIndex(pageIndex)
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <SwiperItem className='swiperItem'>
|
|
|
+ <View>
|
|
|
+ <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp} showStage={false} />
|
|
|
+ <IndexConsole record={(homeData as any).fast_sleep} />
|
|
|
+ </View>
|
|
|
+
|
|
|
+ </SwiperItem>
|
|
|
|
|
|
- {
|
|
|
- (homeData as any).fast_sleep.current_record.status == 'WAIT_FOR_START' &&
|
|
|
- <SwiperItem className='swiperItem'>
|
|
|
- <View>
|
|
|
- {
|
|
|
- isMulti ? <View>
|
|
|
+ {
|
|
|
+ (homeData as any).fast_sleep.current_record.status == 'WAIT_FOR_START' &&
|
|
|
+ <SwiperItem className='swiperItem'>
|
|
|
+ <IndexItem type="FAST_SLEEP" data={(homeData as any).fast_sleep} time={timestamp + 2000} showStage={true} />
|
|
|
+ <View>
|
|
|
{
|
|
|
- multiData.map((item, index) => {
|
|
|
- return <View className={item.checked ? "single_check_sel" : "single_check_nor"} onClick={() => {
|
|
|
- item.checked = !item.checked
|
|
|
- global.updateMixItem([multiData[0].checked, multiData[1].checked, multiData[2].checked])
|
|
|
- setMultiData(JSON.parse(JSON.stringify(multiData)))
|
|
|
- setCount((prevCounter) => prevCounter + 1)
|
|
|
- }}>
|
|
|
- <Text className={item.checked ? "single_check_text_sel" : "single_check_text_nor"}>{item.title}</Text>
|
|
|
+ isMulti ? <View>
|
|
|
+ {
|
|
|
+ multiData.map((item, index) => {
|
|
|
+ return <View className={item.checked ? "single_check_sel" : "single_check_nor"} onClick={() => {
|
|
|
+ item.checked = !item.checked
|
|
|
+ global.updateMixItem([multiData[0].checked, multiData[1].checked, multiData[2].checked])
|
|
|
+ setMultiData(JSON.parse(JSON.stringify(multiData)))
|
|
|
+ setCount((prevCounter) => prevCounter + 1)
|
|
|
+ }}>
|
|
|
+ <Text className={item.checked ? "single_check_text_sel" : "single_check_text_nor"}>{item.title}</Text>
|
|
|
+ {
|
|
|
+ item.checked ? <Image src={require('@assets/images/check_black.png')} className="single_checked" /> :
|
|
|
+ <IconPlus color={ColorType.fast} />
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </View> : <View>
|
|
|
+
|
|
|
+ <View className={selIndex == 0 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(0); global.updateMixItem([true, false, false]); setCount((prevCounter) => prevCounter + 1) }}>
|
|
|
+ <Text className={selIndex == 0 ? "single_check_text_sel" : "single_check_text_nor"}>睡前断食</Text>
|
|
|
+ {
|
|
|
+ selIndex == 0 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ <View className={selIndex == 1 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(1); global.updateMixItem([false, true, false]); setCount((prevCounter) => prevCounter + 1) }}>
|
|
|
+ <Text className={selIndex == 1 ? "single_check_text_sel" : "single_check_text_nor"}>睡眠中断食</Text>
|
|
|
+ {
|
|
|
+ selIndex == 1 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ <View className={selIndex == 2 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(2); global.updateMixItem([false, false, true]); setCount((prevCounter) => prevCounter + 1) }}>
|
|
|
+ <Text className={selIndex == 2 ? "single_check_text_sel" : "single_check_text_nor"}>起床后断食</Text>
|
|
|
{
|
|
|
- item.checked ? <Image src={require('@assets/images/check_black.png')} className="single_checked" /> :
|
|
|
- <IconPlus color={ColorType.fast} />
|
|
|
+ selIndex == 2 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
|
|
|
}
|
|
|
</View>
|
|
|
- })
|
|
|
+ </View>
|
|
|
}
|
|
|
- </View> : <View>
|
|
|
-
|
|
|
- <View className={selIndex == 0 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(0); global.updateMixItem([true, false, false]); setCount((prevCounter) => prevCounter + 1) }}>
|
|
|
- <Text className={selIndex == 0 ? "single_check_text_sel" : "single_check_text_nor"}>睡前断食</Text>
|
|
|
- {
|
|
|
- selIndex == 0 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
|
|
|
- }
|
|
|
- </View>
|
|
|
- <View className={selIndex == 1 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(1); global.updateMixItem([false, true, false]); setCount((prevCounter) => prevCounter + 1) }}>
|
|
|
- <Text className={selIndex == 1 ? "single_check_text_sel" : "single_check_text_nor"}>睡眠中断食</Text>
|
|
|
- {
|
|
|
- selIndex == 1 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
|
|
|
- }
|
|
|
- </View>
|
|
|
- <View className={selIndex == 2 ? "single_check_sel" : "single_check_nor"} onClick={() => { setSelIndex(2); global.updateMixItem([false, false, true]); setCount((prevCounter) => prevCounter + 1) }}>
|
|
|
- <Text className={selIndex == 2 ? "single_check_text_sel" : "single_check_text_nor"}>起床后断食</Text>
|
|
|
- {
|
|
|
- selIndex == 2 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
|
|
|
- }
|
|
|
+ <View style={{ display: 'flex', alignItems: 'center', flexDirection: 'row', paddingRight: rpxToPx(46), width: rpxToPx(750), boxSizing: 'border-box' }}>
|
|
|
+ <View style={{ flex: 1 }} />
|
|
|
+ <Text style={{ marginRight: 10 }}>多选</Text>
|
|
|
+ <Switch color={ColorType.fast} onChange={(e) => {
|
|
|
+ setIsMulti(e.detail.value)
|
|
|
+ if (e.detail.value) {
|
|
|
+ global.updateMixItem([multiData[0].checked, multiData[1].checked, multiData[2].checked])
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ global.updateMixItem([selIndex == 0, selIndex == 1, selIndex == 2])
|
|
|
+ }
|
|
|
+ setCount((prevCounter) => prevCounter + 1)
|
|
|
+ }} />
|
|
|
</View>
|
|
|
</View>
|
|
|
- }
|
|
|
- <View style={{ display: 'flex', alignItems: 'center', flexDirection: 'row', paddingRight: rpxToPx(46), width: rpxToPx(750), boxSizing: 'border-box' }}>
|
|
|
- <View style={{ flex: 1 }} />
|
|
|
- <Text style={{ marginRight: 10 }}>多选</Text>
|
|
|
- <Switch color={ColorType.fast} onChange={(e) => {
|
|
|
- setIsMulti(e.detail.value)
|
|
|
- if (e.detail.value) {
|
|
|
- global.updateMixItem([multiData[0].checked, multiData[1].checked, multiData[2].checked])
|
|
|
- }
|
|
|
- else {
|
|
|
- global.updateMixItem([selIndex == 0, selIndex == 1, selIndex == 2])
|
|
|
- }
|
|
|
- setCount((prevCounter) => prevCounter + 1)
|
|
|
- }} />
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- </SwiperItem>
|
|
|
- }
|
|
|
+ </SwiperItem>
|
|
|
+ }
|
|
|
|
|
|
- </Swiper>
|
|
|
+ </Swiper>
|
|
|
+ }
|
|
|
{
|
|
|
user.isLogin && <DayLight />
|
|
|
}
|
|
|
{
|
|
|
user.isLogin && records.length > 0 && <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
|
{
|
|
|
- <Text className="discovery">最近</Text>
|
|
|
+ <Text className="discovery">{t('feature.track_time_duration.record_fast_sleep.header.latest_record')}</Text>
|
|
|
}
|
|
|
{
|
|
|
process.env.TARO_ENV == 'weapp' && <Text className="fast_sleep_more index_more" onClick={more}>{t('feature.track_time_duration.record_fast_sleep.header.btn_show_all')}</Text>
|
|
|
@@ -473,12 +502,12 @@ export default function Page() {
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
- {
|
|
|
+ {/* {
|
|
|
user.isLogin && <View>
|
|
|
<Text className="discovery">周统计</Text>
|
|
|
<WeekCalendar />
|
|
|
</View>
|
|
|
- }
|
|
|
+ } */}
|
|
|
|
|
|
<View style={{ height: 100 }} />
|
|
|
{
|