|
|
@@ -1,4 +1,4 @@
|
|
|
-import { View, Text, Image, ScrollView, PageContainer } from "@tarojs/components";
|
|
|
+import { View, Text, Image, ScrollView, PageContainer, Swiper, SwiperItem, Switch } from "@tarojs/components";
|
|
|
import Tabbar from "@/components/navigation/TabBar";
|
|
|
import IndexItem from '@/features/trackTimeDuration/components/IndexItem';
|
|
|
import Rings from "@/features/trackTimeDuration/components/Rings";
|
|
|
@@ -18,6 +18,7 @@ import { getBgRing, getCommon, getDot, getSchedule } from "@/features/trackTimeD
|
|
|
import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
|
|
|
import IndexConsole from "@/features/trackTimeDuration/components/IndexConsole";
|
|
|
import Modal from '@/components/layout/Modal'
|
|
|
+import { rpxToPx } from "@/utils/tools";
|
|
|
|
|
|
export default function Page() {
|
|
|
const dispatch = useDispatch();
|
|
|
@@ -39,6 +40,8 @@ export default function Page() {
|
|
|
const [isModal1, setIsModal1] = useState(false)
|
|
|
const [debugInfo, setDebugInfo] = useState(null)
|
|
|
|
|
|
+ const [isMulti, setIsMulti] = useState(false)
|
|
|
+
|
|
|
|
|
|
const [multiData, setMultiData] = useState([
|
|
|
{
|
|
|
@@ -194,7 +197,7 @@ export default function Page() {
|
|
|
</View>
|
|
|
}
|
|
|
|
|
|
- global.indexPageRefresh = ()=>{
|
|
|
+ global.indexPageRefresh = () => {
|
|
|
getCheckData()
|
|
|
}
|
|
|
|
|
|
@@ -204,15 +207,15 @@ export default function Page() {
|
|
|
setDebugInfo(debugNode)
|
|
|
setShowModal(isShow)
|
|
|
setModalDetail(detail)
|
|
|
- }
|
|
|
-
|
|
|
- global.showIndexModal2 = (isShow: boolean, detail: any) => {
|
|
|
+ }
|
|
|
+
|
|
|
+ global.showIndexModal2 = (isShow: boolean, detail: any) => {
|
|
|
setDebugInfo(null)
|
|
|
global.showModal = isShow
|
|
|
setIsModal1(false)
|
|
|
setShowModal2(isShow)
|
|
|
setModalDetail2(detail)
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
function modalContent() {
|
|
|
if (showModal || showModal2) {
|
|
|
@@ -279,52 +282,96 @@ export default function Page() {
|
|
|
<IndexItem type='SLEEP' data={(homeData as any).sleep} time={timestamp} />
|
|
|
<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'}
|
|
|
+ >
|
|
|
+ <SwiperItem className='swiperItem'>
|
|
|
+ <IndexConsole record={(homeData as any).fast_sleep} />
|
|
|
+
|
|
|
+ </SwiperItem>
|
|
|
|
|
|
- <IndexConsole record={(homeData as any).fast_sleep} />
|
|
|
+ {
|
|
|
+ (homeData as any).fast_sleep.current_record.status == 'WAIT_FOR_START' &&
|
|
|
+ <SwiperItem className='swiperItem'>
|
|
|
+ <View>
|
|
|
+ {
|
|
|
+ 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>
|
|
|
+ {
|
|
|
+ selIndex == 2 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
|
|
|
+ }
|
|
|
+ </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>
|
|
|
+ }
|
|
|
|
|
|
- <View>
|
|
|
- <Text>Single Sel</Text>
|
|
|
+ </Swiper>
|
|
|
|
|
|
- <View className={selIndex == 0 ? "single_check_sel" : "single_check_nor"} onClick={() => setSelIndex(0)}>
|
|
|
- <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)}>
|
|
|
- <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)}>
|
|
|
- <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>
|
|
|
- </View>
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ {/*
|
|
|
<View style={{ marginTop: 50 }}>
|
|
|
<Text>Multi Sel</Text>
|
|
|
{
|
|
|
rings()
|
|
|
}
|
|
|
- {
|
|
|
- multiData.map((item) => {
|
|
|
- return <View className={item.checked ? "single_check_sel" : "single_check_nor"} onClick={() => {
|
|
|
- item.checked = !item.checked
|
|
|
- setMultiData(JSON.parse(JSON.stringify(multiData)))
|
|
|
- }}>
|
|
|
- <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 style={{ height: 100 }} />
|
|
|
{
|