|
|
@@ -24,6 +24,7 @@ import OnBoard from "@/_health/components/onboard";
|
|
|
import NewButton, { NewButtonType } from "@/_health/base/new_button";
|
|
|
import showAlert from "@/components/basic/Alert";
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
+import Cell from "@/_health/base/cell";
|
|
|
|
|
|
let useNavigation;
|
|
|
let min = 0
|
|
|
@@ -191,8 +192,6 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
height={rpxToPx(72)}
|
|
|
bold={true}
|
|
|
onClick={() => record(item)} />
|
|
|
- // return <View className="timeline_operate" style={{ color: themeColor, backgroundColor: '#fff', borderColor: themeColor, borderWidth: 1, borderStyle: 'solid' }}
|
|
|
- // onClick={() => record(item)}>{operateTitle(item)}</View>
|
|
|
}
|
|
|
return <NewButton
|
|
|
color={themeColor}
|
|
|
@@ -205,14 +204,33 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
}
|
|
|
|
|
|
if (item.action && item.action == 'NA') {
|
|
|
- if (health.mode == 'FAST' || health.mode == 'SLEEP') {
|
|
|
+ // if (health.mode == 'FAST' || health.mode == 'SLEEP') {
|
|
|
+ if (item.moment && item.moment.media && item.moment.media.length > 0) {
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
return <IconArrow width={rpxToPx(34)} color={MainColorType.g03} />
|
|
|
}
|
|
|
+
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
return <View />
|
|
|
}
|
|
|
|
|
|
+ function canTap(item) {
|
|
|
+ if (health.mode == 'DAY' || health.mode == 'NIGHT') {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!user.isLogin) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!item.event_id) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
function tapTimeline(item, inex) {
|
|
|
if (health.mode == 'DAY' || health.mode == 'NIGHT') {
|
|
|
return;
|
|
|
@@ -260,63 +278,61 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
|
|
|
function timelineItem(item: any, index: number, count: number) {
|
|
|
var hasDescription = item.moment && item.moment.description
|
|
|
- return <View key={index}
|
|
|
- className="timeline_item"
|
|
|
- // hoverClass='cell_hover' hoverStayTime={50}
|
|
|
- onClick={() => tapTimeline(item, index)}>
|
|
|
- <View className="timeline_left">
|
|
|
- {/* space */}
|
|
|
- <View style={{
|
|
|
-
|
|
|
- height: hasDescription ? rpxToPx(28) : rpxToPx(36), flexShrink: 0
|
|
|
- }} />
|
|
|
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
|
|
|
+ return <Cell onClick={() => tapTimeline(item, index)} disable={!canTap(item)}>
|
|
|
+ <View key={index}
|
|
|
+ className="timeline_item"
|
|
|
+ style={{ backgroundColor: 'transparent' }}>
|
|
|
+ <View className="timeline_left">
|
|
|
<View style={{
|
|
|
- flexShrink: 0,
|
|
|
- width: rpxToPx(26),
|
|
|
- height: rpxToPx(26),
|
|
|
- borderRadius: rpxToPx(13),
|
|
|
- marginRight: rpxToPx(8),
|
|
|
- display: 'flex',
|
|
|
- alignItems: 'center',
|
|
|
- justifyContent: 'center',
|
|
|
- backgroundColor: getIconColor(index)
|
|
|
- }}>
|
|
|
- {
|
|
|
- processIcon(index)
|
|
|
- }
|
|
|
- {/* <Image style={{ width: rpxToPx(20), height: rpxToPx(20) }} src={finish ? require('@assets/_health/checked.png') : require('@assets/_health/ring.png')} /> */}
|
|
|
+
|
|
|
+ height: hasDescription ? rpxToPx(28) : rpxToPx(36), flexShrink: 0
|
|
|
+ }} />
|
|
|
+ <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
|
|
|
+ <View style={{
|
|
|
+ flexShrink: 0,
|
|
|
+ width: rpxToPx(26),
|
|
|
+ height: rpxToPx(26),
|
|
|
+ borderRadius: rpxToPx(13),
|
|
|
+ marginRight: rpxToPx(8),
|
|
|
+ display: 'flex',
|
|
|
+ alignItems: 'center',
|
|
|
+ justifyContent: 'center',
|
|
|
+ backgroundColor: getIconColor(index)
|
|
|
+ }}>
|
|
|
+ {
|
|
|
+ processIcon(index)
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ <Text className="timeline_time" style={{ color: MainColorType.g01 }}>{itemTitle(item)}</Text>
|
|
|
</View>
|
|
|
- <Text className="timeline_time">{itemTitle(item)}</Text>
|
|
|
- </View>
|
|
|
|
|
|
|
|
|
- <Text className="timeline_title"
|
|
|
- onClick={() => edit(item)}>{(item.moment && item.moment.title) ? item.moment.title : item.title}</Text>
|
|
|
+ <Text className="timeline_title"
|
|
|
+ onClick={() => edit(item)}>{(item.moment && item.moment.title) ? item.moment.title : item.title}</Text>
|
|
|
|
|
|
- {
|
|
|
- hasDescription && <Text className="timeline_desc">{item.moment.description}</Text>
|
|
|
- }
|
|
|
- {/* space */}
|
|
|
- <View style={{
|
|
|
- height: hasDescription ? rpxToPx(28) : rpxToPx(54), flexShrink: 0,
|
|
|
+ {
|
|
|
+ hasDescription && <Text className="timeline_desc" style={{ color: MainColorType.g02 }}>{item.moment.description}</Text>
|
|
|
+ }
|
|
|
+ {/* space */}
|
|
|
+ <View style={{
|
|
|
+ height: hasDescription ? rpxToPx(28) : rpxToPx(54), flexShrink: 0,
|
|
|
|
|
|
- }} />
|
|
|
+ }} />
|
|
|
|
|
|
- </View>
|
|
|
- <View style={{ flex: 1 }} />
|
|
|
+ </View>
|
|
|
|
|
|
- {
|
|
|
- item.moment && item.moment.media && item.moment.media.length > 0 && <Image
|
|
|
- src={item.moment.media[0].url}
|
|
|
- mode="aspectFill"
|
|
|
- className="console_item_img" />
|
|
|
- }
|
|
|
- {
|
|
|
- itemValue(item)
|
|
|
- }
|
|
|
- <View className="seperate_line" style={{ left: count - 1 == index ? -rpxToPx(52) : rpxToPx(52) }} />
|
|
|
- </View>
|
|
|
+ {
|
|
|
+ item.moment && item.moment.media && item.moment.media.length > 0 && <Image
|
|
|
+ src={item.moment.media[0].url}
|
|
|
+ mode="aspectFill"
|
|
|
+ className="console_item_img" />
|
|
|
+ }
|
|
|
+ {
|
|
|
+ itemValue(item)
|
|
|
+ }
|
|
|
+ <View className="border_footer_line" style={{ left: count - 1 == index ? -rpxToPx(52) : rpxToPx(52) }} />
|
|
|
+ </View>
|
|
|
+ </Cell>
|
|
|
}
|
|
|
|
|
|
function timeContent() {
|
|
|
@@ -620,36 +636,36 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
if (active.onboard == false) {
|
|
|
var seconds = new Date().getSeconds()
|
|
|
|
|
|
- return <Swiper autoplay>
|
|
|
- {
|
|
|
- list.map((item, index) => {
|
|
|
- return <SwiperItem key={index}>
|
|
|
- <OnBoard title={item.title}
|
|
|
- desc={item.time_label}
|
|
|
- btnTitle="Action"
|
|
|
- onClick={() => {
|
|
|
- if (!user.isLogin) {
|
|
|
- jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
|
|
|
- return
|
|
|
- }
|
|
|
- jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(item))
|
|
|
- }}
|
|
|
- />
|
|
|
- </SwiperItem>
|
|
|
- })
|
|
|
- }
|
|
|
- </Swiper>
|
|
|
- // return <OnBoard title={list[0].title}
|
|
|
- // desc="Subtitle"
|
|
|
- // btnTitle="Action"
|
|
|
- // onClick={() => {
|
|
|
- // if (!user.isLogin) {
|
|
|
- // jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
|
|
|
- // return
|
|
|
- // }
|
|
|
- // jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(list.length > 0 ? list[0] : '{}'))
|
|
|
- // }}
|
|
|
- // />
|
|
|
+ // return <Swiper autoplay>
|
|
|
+ // {
|
|
|
+ // list.map((item, index) => {
|
|
|
+ // return <SwiperItem key={index}>
|
|
|
+ // <OnBoard title={item.title}
|
|
|
+ // desc={item.time_label}
|
|
|
+ // btnTitle="Action"
|
|
|
+ // onClick={() => {
|
|
|
+ // if (!user.isLogin) {
|
|
|
+ // jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(item))
|
|
|
+ // }}
|
|
|
+ // />
|
|
|
+ // </SwiperItem>
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // </Swiper>
|
|
|
+ return <OnBoard title={list[0].title}
|
|
|
+ desc={list[0].time_label}
|
|
|
+ btnTitle="Action"
|
|
|
+ onClick={() => {
|
|
|
+ if (!user.isLogin) {
|
|
|
+ jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(list.length > 0 ? list[0] : '{}'))
|
|
|
+ }}
|
|
|
+ />
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
@@ -732,7 +748,6 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
return
|
|
|
}
|
|
|
var scenario = getScenario(health.windows, health.mode)
|
|
|
- debugger
|
|
|
Taro.chooseLocation({
|
|
|
latitude: scenario.extra.choose_location ? parseFloat(scenario.extra.lat + '') : undefined,
|
|
|
longitude: scenario.extra.choose_location ? parseFloat(scenario.extra.lng + '') : undefined,
|
|
|
@@ -831,7 +846,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
{/* <View className="main_summary_status" style={{ color: getThemeColor(health.mode) }}>{windowStatus()}</View> */}
|
|
|
<View className="main_summary_time bold" style={{
|
|
|
marginTop: rpxToPx(14),
|
|
|
- color: getWindowStatus(health.windows, health.mode) == WindowStatusType.upcoming ? '#B2B2B2' : '#000'
|
|
|
+ color: getWindowStatus(health.windows, health.mode) == WindowStatusType.upcoming ? '#000' : '#000'
|
|
|
}} >{getCountownTime(health.windows, health.mode)}
|
|
|
<View className={timePointClass()}
|
|
|
style={{ backgroundColor: getWindowStatus(health.windows, health.mode) == WindowStatusType.upcoming ? '#B2B2B2' : getThemeColor(health.mode) }} />
|
|
|
@@ -876,24 +891,26 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
{
|
|
|
health.mode == 'ACTIVE' && <View>
|
|
|
<View className="main_column_space" />
|
|
|
- <View className="console_active" onClick={() => {
|
|
|
+ <Cell onClick={() => {
|
|
|
if (!user.isLogin) {
|
|
|
jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
|
|
|
return
|
|
|
}
|
|
|
jumpPage('/_health/pages/move')
|
|
|
}}>
|
|
|
- <Image className="active_icon" src={require('@assets/_health/walk.png')} />
|
|
|
- <Text className="active_text">Move More</Text>
|
|
|
- <IconArrow width={rpxToPx(34)} color={MainColorType.g03} />
|
|
|
- </View>
|
|
|
-
|
|
|
+ <View className="console_active" style={{ backgroundColor: 'transparent' }}>
|
|
|
+ <Image className="active_icon" src={require('@assets/_health/walk.png')} />
|
|
|
+ <Text className="active_text">Move More</Text>
|
|
|
+ <IconArrow width={rpxToPx(34)} color={MainColorType.g03} />
|
|
|
+ </View>
|
|
|
+ </Cell>
|
|
|
</View>
|
|
|
+
|
|
|
}
|
|
|
{
|
|
|
(health.mode == 'FAST' || health.mode == 'SLEEP') && <View >
|
|
|
<View className="main_column_space" />
|
|
|
- <View className="console_active" onClick={() => {
|
|
|
+ <Cell onClick={() => {
|
|
|
if (!user.isLogin) {
|
|
|
jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
|
|
|
return
|
|
|
@@ -916,51 +933,54 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
}
|
|
|
jumpPage('/_health/pages/fast_sleep')
|
|
|
}}>
|
|
|
- <Image className="active_icon" src={require('@assets/_health/fast.png')} />
|
|
|
- <Text className="h34">Fast with sleep</Text>
|
|
|
- <View style={{ flex: 1 }} />
|
|
|
- {
|
|
|
- fastWithSleepStatus()
|
|
|
- }
|
|
|
- {
|
|
|
- health.fast_with_sleep.status == 'OG2_MISALIGNED' && <View style={{
|
|
|
- backgroundColor: MainColorType.error,
|
|
|
- width: rpxToPx(12),
|
|
|
- height: rpxToPx(12),
|
|
|
- borderRadius: rpxToPx(6),
|
|
|
- marginLeft: rpxToPx(12),
|
|
|
- marginRight: rpxToPx(12)
|
|
|
- }} />
|
|
|
- }
|
|
|
- <View style={{ width: rpxToPx(12) }} />
|
|
|
- <IconArrow width={rpxToPx(34)} color={MainColorType.g03} />
|
|
|
- {
|
|
|
- health.mode == 'FAST' && <View className="border_footer_line" style={{ left: rpxToPx(100) }} />
|
|
|
- }
|
|
|
- </View>
|
|
|
+ <View className="console_active" style={{ backgroundColor: 'transparent' }}>
|
|
|
+ <Image className="active_icon" src={require('@assets/_health/fast.png')} />
|
|
|
+ <Text className="h34">Fast with sleep</Text>
|
|
|
+ <View style={{ flex: 1 }} />
|
|
|
+ {
|
|
|
+ fastWithSleepStatus()
|
|
|
+ }
|
|
|
+ {
|
|
|
+ health.fast_with_sleep.status == 'OG2_MISALIGNED' && <View style={{
|
|
|
+ backgroundColor: MainColorType.error,
|
|
|
+ width: rpxToPx(12),
|
|
|
+ height: rpxToPx(12),
|
|
|
+ borderRadius: rpxToPx(6),
|
|
|
+ marginLeft: rpxToPx(12),
|
|
|
+ marginRight: rpxToPx(12)
|
|
|
+ }} />
|
|
|
+ }
|
|
|
+ <View style={{ width: rpxToPx(12) }} />
|
|
|
+ <IconArrow width={rpxToPx(34)} color={MainColorType.g03} />
|
|
|
+ {
|
|
|
+ health.mode == 'FAST' && <View className="border_footer_line" style={{ left: rpxToPx(100) }} />
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </Cell>
|
|
|
|
|
|
</View>
|
|
|
}
|
|
|
{
|
|
|
- health.mode == 'FAST' && <View>
|
|
|
- <View className="console_active" onClick={() => {
|
|
|
- if (!user.isLogin) {
|
|
|
- jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
|
|
|
- return
|
|
|
- }
|
|
|
- jumpPage('/_health/pages/long_fast')
|
|
|
- }}>
|
|
|
- <Image className="active_icon" src={require('@assets/_health/fast.png')} />
|
|
|
- <Text className="h34">Long fast</Text>
|
|
|
- <View style={{ flex: 1 }} />
|
|
|
- {
|
|
|
- longFastStatus()
|
|
|
- }
|
|
|
- <View style={{ width: rpxToPx(12) }} />
|
|
|
- <IconArrow width={rpxToPx(34)} color={MainColorType.g03} />
|
|
|
- </View>
|
|
|
+ health.mode == 'FAST' && <Cell onClick={() => {
|
|
|
+ if (!user.isLogin) {
|
|
|
+ jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ jumpPage('/_health/pages/long_fast')
|
|
|
+ }}><View>
|
|
|
+ <View className="console_active" style={{ backgroundColor: 'transparent' }}>
|
|
|
+ <Image className="active_icon" src={require('@assets/_health/fast.png')} />
|
|
|
+ <Text className="h34">Long fast</Text>
|
|
|
+ <View style={{ flex: 1 }} />
|
|
|
+ {
|
|
|
+ longFastStatus()
|
|
|
+ }
|
|
|
+ <View style={{ width: rpxToPx(12) }} />
|
|
|
+ <IconArrow width={rpxToPx(34)} color={MainColorType.g03} />
|
|
|
+ </View>
|
|
|
|
|
|
- </View>
|
|
|
+ </View>
|
|
|
+ </Cell>
|
|
|
}
|
|
|
<View className="circle" />
|
|
|
{
|
|
|
@@ -975,5 +995,5 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
setDurationPicker(false)
|
|
|
}} time={getScenario(health.windows, health.mode).target.duration} />
|
|
|
}
|
|
|
- </View>
|
|
|
+ </View >
|
|
|
}
|