|
@@ -41,6 +41,8 @@ export default function LogTime() {
|
|
|
const isSingle = router.params.single == '1'
|
|
const isSingle = router.params.single == '1'
|
|
|
const isFast = router.params.window == 'FAST'
|
|
const isFast = router.params.window == 'FAST'
|
|
|
const isStart = router.params.is_start == '1'
|
|
const isStart = router.params.is_start == '1'
|
|
|
|
|
+ const isFastWithSleep = router.params.is_fast_with_sleep == '1'
|
|
|
|
|
+ const type = router.params.type
|
|
|
const [data, setData] = useState<any>(null)
|
|
const [data, setData] = useState<any>(null)
|
|
|
const health = useSelector((state: any) => state.health);
|
|
const health = useSelector((state: any) => state.health);
|
|
|
const [showGoal, setShowGoal] = useState(false)
|
|
const [showGoal, setShowGoal] = useState(false)
|
|
@@ -101,6 +103,18 @@ export default function LogTime() {
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
for (var i = 0; i <= tapIndex; i++) {
|
|
for (var i = 0; i <= tapIndex; i++) {
|
|
|
|
|
+ // if (type == 'home'){
|
|
|
|
|
+ // if (tapIndex == 2){
|
|
|
|
|
+ // if (i == 0 || i==3){
|
|
|
|
|
+ // continue;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else if (tapIndex ==3){
|
|
|
|
|
+ // if (i==1||i==2){
|
|
|
|
|
+ // continue;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
var timeline: any;
|
|
var timeline: any;
|
|
|
if (i == 0 || i == 3) {
|
|
if (i == 0 || i == 3) {
|
|
|
timeline = i == 0 ? fast.timeline[0] : fast.timeline[1]
|
|
timeline = i == 0 ? fast.timeline[0] : fast.timeline[1]
|
|
@@ -215,16 +229,28 @@ export default function LogTime() {
|
|
|
list.push(params)
|
|
list.push(params)
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- const { status } = data
|
|
|
|
|
- for (var i = 0; i <= tapIndex; i++) {
|
|
|
|
|
- if ((status == 'OG1' || status == 'OG2' || status == 'OG3') && i == 0) {
|
|
|
|
|
- }
|
|
|
|
|
- else if ((status == 'OG2' || status == 'OG3' || status == 'OG2_NO1') && i == 1) {
|
|
|
|
|
- }
|
|
|
|
|
- else if (status == 'OG3' && i == 2) {
|
|
|
|
|
|
|
+ if (type == 'home') {
|
|
|
|
|
+ if (parseInt(tapIndex + '') == 2) {
|
|
|
|
|
+ var obj = array[1]
|
|
|
|
|
+ var timestamp = getTimestamp(obj)
|
|
|
|
|
+ list.push({
|
|
|
|
|
+ schedule_id: obj.schedule_id,
|
|
|
|
|
+ extra: obj.extra,
|
|
|
|
|
+ date: dayjs(timestamp).format('YYYYMMDD'),
|
|
|
|
|
+ timestamp: timestamp,
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ var obj2 = array[2]
|
|
|
|
|
+ var timestamp2 = getTimestamp(obj2)
|
|
|
|
|
+ list.push({
|
|
|
|
|
+ schedule_id: obj2.schedule_id,
|
|
|
|
|
+ extra: obj2.extra,
|
|
|
|
|
+ date: dayjs(timestamp2).format('YYYYMMDD'),
|
|
|
|
|
+ timestamp: timestamp2,
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
- else {
|
|
|
|
|
- var obj = array[i]
|
|
|
|
|
|
|
+ if (parseInt(tapIndex + '') == 3) {
|
|
|
|
|
+ var obj = array[0]
|
|
|
var timestamp = getTimestamp(obj)
|
|
var timestamp = getTimestamp(obj)
|
|
|
list.push({
|
|
list.push({
|
|
|
schedule_id: obj.schedule_id,
|
|
schedule_id: obj.schedule_id,
|
|
@@ -232,6 +258,38 @@ export default function LogTime() {
|
|
|
date: dayjs(timestamp).format('YYYYMMDD'),
|
|
date: dayjs(timestamp).format('YYYYMMDD'),
|
|
|
timestamp: timestamp,
|
|
timestamp: timestamp,
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ var obj2 = array[3]
|
|
|
|
|
+ var timestamp2 = getTimestamp(obj2)
|
|
|
|
|
+ list.push({
|
|
|
|
|
+ schedule_id: obj2.schedule_id,
|
|
|
|
|
+ extra: obj2.extra,
|
|
|
|
|
+ date: dayjs(timestamp2).format('YYYYMMDD'),
|
|
|
|
|
+ timestamp: timestamp2,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ const { status } = data
|
|
|
|
|
+ for (var i = 0; i <= tapIndex; i++) {
|
|
|
|
|
+ if ((status == 'OG1' || status == 'OG2' || status == 'OG3') && i == 0) {
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ((status == 'OG2' || status == 'OG3' || status == 'OG2_NO1') && i == 1) {
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (status == 'OG3' && i == 2) {
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ var obj = array[i]
|
|
|
|
|
+ var timestamp = getTimestamp(obj)
|
|
|
|
|
+ list.push({
|
|
|
|
|
+ schedule_id: obj.schedule_id,
|
|
|
|
|
+ extra: obj.extra,
|
|
|
|
|
+ date: dayjs(timestamp).format('YYYYMMDD'),
|
|
|
|
|
+ timestamp: timestamp,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -241,7 +299,7 @@ export default function LogTime() {
|
|
|
if (fast.real) {
|
|
if (fast.real) {
|
|
|
var t = fast.real.start_timestamp
|
|
var t = fast.real.start_timestamp
|
|
|
var schedule_id = fast.timeline[1].schedule_id
|
|
var schedule_id = fast.timeline[1].schedule_id
|
|
|
- if (list[list.length-1].schedule_id==schedule_id && list[list.length-1].timestamp-t>24*3600*1000){
|
|
|
|
|
|
|
+ if (list[list.length - 1].schedule_id == schedule_id && list[list.length - 1].timestamp - t > 24 * 3600 * 1000) {
|
|
|
showAlert({
|
|
showAlert({
|
|
|
title: 'Saving as Long Fast',
|
|
title: 'Saving as Long Fast',
|
|
|
content: 'Fasting that lasts more than 24 hours will be saved as Long Fast. ',
|
|
content: 'Fasting that lasts more than 24 hours will be saved as Long Fast. ',
|
|
@@ -263,14 +321,18 @@ export default function LogTime() {
|
|
|
|
|
|
|
|
function commit(list) {
|
|
function commit(list) {
|
|
|
clockTimes({
|
|
clockTimes({
|
|
|
- check_items: list
|
|
|
|
|
|
|
+ check_items: list,
|
|
|
|
|
+ op_page: isFastWithSleep ? 'FAST_WITH_SLEEP' : null
|
|
|
}).then(res => {
|
|
}).then(res => {
|
|
|
global.refreshWindow()
|
|
global.refreshWindow()
|
|
|
if (global.refreshFastSleep)
|
|
if (global.refreshFastSleep)
|
|
|
global.refreshFastSleep()
|
|
global.refreshFastSleep()
|
|
|
- Taro.navigateBack({
|
|
|
|
|
- delta: 1
|
|
|
|
|
|
|
+ Taro.redirectTo({
|
|
|
|
|
+ url: './post_result?data='+JSON.stringify(res)
|
|
|
})
|
|
})
|
|
|
|
|
+ // Taro.navigateBack({
|
|
|
|
|
+ // delta: 1
|
|
|
|
|
+ // })
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -419,6 +481,29 @@ export default function LogTime() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function multiContent() {
|
|
function multiContent() {
|
|
|
|
|
+ if (type == 'home') {
|
|
|
|
|
+ switch (parseInt(tapIndex + '')) {
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ return <View style={{ position: 'relative' }}>
|
|
|
|
|
+ {
|
|
|
|
|
+ logItem(1, false, true, false)
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ logItem(2, false, false, false)
|
|
|
|
|
+ }
|
|
|
|
|
+ </View>
|
|
|
|
|
+ case 3:
|
|
|
|
|
+ return <View style={{ position: 'relative' }}>
|
|
|
|
|
+ {
|
|
|
|
|
+ logItem(0, true, true, false)
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ logItem(3, true, false, false)
|
|
|
|
|
+ }
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
const { status } = data
|
|
const { status } = data
|
|
|
switch (parseInt(tapIndex + '')) {
|
|
switch (parseInt(tapIndex + '')) {
|
|
|
case 1:
|
|
case 1:
|