|
@@ -13,7 +13,7 @@ import { useRouter } from "@tarojs/taro";
|
|
|
import Card from "../components/card";
|
|
import Card from "../components/card";
|
|
|
import { MainColorType } from "@/context/themes/color";
|
|
import { MainColorType } from "@/context/themes/color";
|
|
|
import Taro from "@tarojs/taro";
|
|
import Taro from "@tarojs/taro";
|
|
|
-import { clockTimes, fastWithSleep } from "@/services/health";
|
|
|
|
|
|
|
+import { clockTimes, delRecord, fastWithSleep } from "@/services/health";
|
|
|
import NewDurationPicker, { DurationPickerType } from "../base/new_durationpicker";
|
|
import NewDurationPicker, { DurationPickerType } from "../base/new_durationpicker";
|
|
|
import showAlert from "@/components/basic/Alert";
|
|
import showAlert from "@/components/basic/Alert";
|
|
|
import NewDatePicker, { NewDatePickerType } from "../base/new_date_picker";
|
|
import NewDatePicker, { NewDatePickerType } from "../base/new_date_picker";
|
|
@@ -22,6 +22,9 @@ import { TimeFormatter } from "@/utils/time_format";
|
|
|
import StatusIndicator, { StatusType } from "../base/status_indicator";
|
|
import StatusIndicator, { StatusType } from "../base/status_indicator";
|
|
|
import { t } from "i18next";
|
|
import { t } from "i18next";
|
|
|
import FollowInfo from "@/_moment/components/follow_info";
|
|
import FollowInfo from "@/_moment/components/follow_info";
|
|
|
|
|
+import showActionSheet from "@/components/basic/ActionSheet";
|
|
|
|
|
+import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
|
|
+import LongCard from "@/_moment/components/long_card";
|
|
|
|
|
|
|
|
let useRoute;
|
|
let useRoute;
|
|
|
let useNavigation;
|
|
let useNavigation;
|
|
@@ -56,6 +59,7 @@ export default function LogTime() {
|
|
|
const type = router.params.type
|
|
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 long = useSelector((state: any) => state.long);
|
|
|
const [showGoal, setShowGoal] = useState(router.params.longfast)
|
|
const [showGoal, setShowGoal] = useState(router.params.longfast)
|
|
|
const tapIndex = router.params.index ?? 0
|
|
const tapIndex = router.params.index ?? 0
|
|
|
const [longDuration, setLongDuration] = useState(24)
|
|
const [longDuration, setLongDuration] = useState(24)
|
|
@@ -615,10 +619,6 @@ export default function LogTime() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- console.log(requestId)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
if (posting) return
|
|
if (posting) return
|
|
|
setPosting(true)
|
|
setPosting(true)
|
|
|
const url = onlyCheck ? '?only_check=true' : ''
|
|
const url = onlyCheck ? '?only_check=true' : ''
|
|
@@ -627,6 +627,8 @@ export default function LogTime() {
|
|
|
setRequestId(new Date().getTime())
|
|
setRequestId(new Date().getTime())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ Taro.eventCenter.trigger('refreshMoments', '')
|
|
|
|
|
+
|
|
|
if ((res as any).result) {
|
|
if ((res as any).result) {
|
|
|
setErrors([])
|
|
setErrors([])
|
|
|
setConflicts([])
|
|
setConflicts([])
|
|
@@ -806,17 +808,45 @@ export default function LogTime() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function cancelAlert(){
|
|
|
|
|
|
|
+ function moreOption(isNew: boolean) {
|
|
|
|
|
+ const { window,join_id } = router.params
|
|
|
|
|
+ showActionSheet({
|
|
|
|
|
+ title: '更多选项',
|
|
|
|
|
+ itemList: isNew ? ['开始新的打卡'] : [window == 'FAST' ? '添加断食结束' : '添加起床'],
|
|
|
|
|
+ success: (res) => {
|
|
|
|
|
+ if (res == 0) {
|
|
|
|
|
+ if (isNew) {
|
|
|
|
|
+ cancelAlert()
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ //jumpPage(`/_health/pages/log_time?type=home&index=${health.mode == 'FAST' ? 3 : 2}&single=${sceniaro.status == 'OG' ? 1 : 0}&is_start=0&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
|
|
|
|
|
+ jumpPage(`./log_time?hide_more=1&join_id=${join_id}&type=home&index=${window == 'FAST' ? 3 : 2}&single=0&is_start=0&window=${window}&op_page=${window == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function cancelAlert() {
|
|
|
showAlert({
|
|
showAlert({
|
|
|
- title:'放弃旧的,开始新的?',
|
|
|
|
|
- content:'',
|
|
|
|
|
- showCancel:true,
|
|
|
|
|
- cancelText:'取消',
|
|
|
|
|
- confirmText:'继续',
|
|
|
|
|
- cancel:()=>{
|
|
|
|
|
|
|
+ title: '放弃旧的,开始新的?',
|
|
|
|
|
+ content: '',
|
|
|
|
|
+ showCancel: true,
|
|
|
|
|
+ cancelText: '取消',
|
|
|
|
|
+ confirmText: '继续',
|
|
|
|
|
+ cancel: () => {
|
|
|
console.log('cancel')
|
|
console.log('cancel')
|
|
|
},
|
|
},
|
|
|
- confirm:()=>{
|
|
|
|
|
|
|
+ confirm: () => {
|
|
|
|
|
+ const { window,join_id } = router.params
|
|
|
|
|
+
|
|
|
|
|
+ delRecord({ ids: [getScenario(health.windows, window).window_id] }).then(res => {
|
|
|
|
|
+ Taro.eventCenter.trigger('refreshMoments', '')
|
|
|
|
|
+ global.refreshWindow()
|
|
|
|
|
+ Taro.redirectTo({
|
|
|
|
|
+ url:`./log_time?hide_more=1&join_id=${join_id}&index=${window == 'FAST' ? 0 : 1}&single=1&is_start=1&window=${window}&op_page=${window == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
console.log('confirm')
|
|
console.log('confirm')
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -1160,24 +1190,44 @@ export default function LogTime() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function joinContent() {
|
|
function joinContent() {
|
|
|
- if (router.params.join_id) {
|
|
|
|
|
|
|
+ if (router.params.join_id && !router.params.hide_more) {
|
|
|
const { index, window, is_start, single, join_status } = router.params
|
|
const { index, window, is_start, single, join_status } = router.params
|
|
|
- if (window == 'FAST') {
|
|
|
|
|
- // if (index )
|
|
|
|
|
- if (join_status == 'OG' && getScenario(health.windows, 'FAST').status == 'OG') {
|
|
|
|
|
- return <View onClick={cancelAlert} className="h26" style={{ color: MainColorType.link }}>更多选项</View>
|
|
|
|
|
- }
|
|
|
|
|
- else if (join_status == 'DONE' && getScenario(health.windows, 'FAST').status == 'WFS') {
|
|
|
|
|
- return <View className="h26" style={{ color: MainColorType.link }}>更多选项</View>
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- if (join_status == 'OG' && getScenario(health.windows, 'SLEEP').status == 'OG') {
|
|
|
|
|
- return <View onClick={cancelAlert} className="h26" style={{ color: MainColorType.link }}>更多选项</View>
|
|
|
|
|
- } else if (join_status == 'DONE' && getScenario(health.windows, 'SLEEP').status == 'WFS') {
|
|
|
|
|
- return <View className="h26" style={{ color: MainColorType.link }}>更多选项</View>
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ var status = getScenario(health.windows, window).status
|
|
|
|
|
+ return <View style={{ width: rpxToPx(400), height: rpxToPx(72), marginBottom: rpxToPx(24) }}>
|
|
|
|
|
+ <NewButton type={NewButtonType.link}
|
|
|
|
|
+ width={rpxToPx(400)}
|
|
|
|
|
+ height={rpxToPx(72)}
|
|
|
|
|
+ title="更多选项"
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ moreOption(status == 'OG')
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
|
|
+ </View>
|
|
|
|
|
+ // return <View onClick={() => {
|
|
|
|
|
+ // moreOption(status == 'OG')
|
|
|
|
|
+ // }} className="h26" style={{ color: MainColorType.link }}>更多选项</View>
|
|
|
|
|
+ // debugger
|
|
|
|
|
+ // if (window == 'FAST') {
|
|
|
|
|
+
|
|
|
|
|
+ // // if (index )
|
|
|
|
|
+ // if (join_status == 'OG' && getScenario(health.windows, window).status == 'OG') {
|
|
|
|
|
+ // return <View onClick={()=>{
|
|
|
|
|
+ // moreOption(true)
|
|
|
|
|
+ // }} className="h26" style={{ color: MainColorType.link }}>更多选项</View>
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else if (join_status == 'DONE' && getScenario(health.windows, 'FAST').status == 'WFS') {
|
|
|
|
|
+ // return <View onClick={()=>{
|
|
|
|
|
+ // moreOption(false)
|
|
|
|
|
+ // }} className="h26" style={{ color: MainColorType.link }}>更多选项</View>
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else {
|
|
|
|
|
+ // if (join_status == 'OG' && getScenario(health.windows, 'SLEEP').status == 'OG') {
|
|
|
|
|
+ // return <View onClick={cancelAlert} className="h26" style={{ color: MainColorType.link }}>更多选项</View>
|
|
|
|
|
+ // } else if (join_status == 'DONE' && getScenario(health.windows, 'SLEEP').status == 'WFS') {
|
|
|
|
|
+ // return <View className="h26" style={{ color: MainColorType.link }}>更多选项</View>
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
return <View />
|
|
return <View />
|
|
|
}
|
|
}
|
|
@@ -1240,7 +1290,7 @@ export default function LogTime() {
|
|
|
}}>{expectText()}</View>
|
|
}}>{expectText()}</View>
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
|
- router.params.join_id && <FollowInfo />
|
|
|
|
|
|
|
+ router.params.join_id && <FollowInfo user={long.follow}/>//<LongCard join={long.join} link={{}} hideJoin={true}/>//<FollowInfo />
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|