|
@@ -9,7 +9,7 @@ import NewDateTimePicker from "@/_health/base/new_date_time_picker";
|
|
|
import dayjs from "dayjs";
|
|
import dayjs from "dayjs";
|
|
|
import RingProgress from "../components/ring_progress";
|
|
import RingProgress from "../components/ring_progress";
|
|
|
import NewDurationPicker, { DurationPickerType } from "@/_health/base/new_durationpicker";
|
|
import NewDurationPicker, { DurationPickerType } from "@/_health/base/new_durationpicker";
|
|
|
-import { IconArrow, IconClose } from "@/components/basic/Icons";
|
|
|
|
|
|
|
+import { IconArrow, IconClose, IconMore2 } from "@/components/basic/Icons";
|
|
|
import { useSelector } from "react-redux";
|
|
import { useSelector } from "react-redux";
|
|
|
import { TimeFormatter } from "@/utils/time_format";
|
|
import { TimeFormatter } from "@/utils/time_format";
|
|
|
import { addEvents, delWindowId } from "@/services/health";
|
|
import { addEvents, delWindowId } from "@/services/health";
|
|
@@ -44,6 +44,7 @@ export default function TimeRecord() {
|
|
|
const [showHighlight, setShowHighlight] = useState(false)
|
|
const [showHighlight, setShowHighlight] = useState(false)
|
|
|
const [showShare, setShowShare] = useState(false)
|
|
const [showShare, setShowShare] = useState(false)
|
|
|
const [shareUrl, setShareUrl] = useState('')
|
|
const [shareUrl, setShareUrl] = useState('')
|
|
|
|
|
+ const [showResult, setShowResult] = useState(false)
|
|
|
|
|
|
|
|
const statusRef = useRef(status)
|
|
const statusRef = useRef(status)
|
|
|
const picker1Ref = useRef(showDatePicker)
|
|
const picker1Ref = useRef(showDatePicker)
|
|
@@ -64,7 +65,7 @@ export default function TimeRecord() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const { scenario } = router.params
|
|
const { scenario } = router.params
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
if (process.env.TARO_ENV == 'weapp') {
|
|
if (process.env.TARO_ENV == 'weapp') {
|
|
|
|
|
|
|
@@ -218,7 +219,10 @@ export default function TimeRecord() {
|
|
|
setShowHighlight(true)
|
|
setShowHighlight(true)
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
setShowHighlight(false)
|
|
setShowHighlight(false)
|
|
|
- }, 3000)
|
|
|
|
|
|
|
+ }, 4000)
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ setShowResult(true)
|
|
|
|
|
+ }, 2000)
|
|
|
Taro.eventCenter.trigger('refreshClockIndex')
|
|
Taro.eventCenter.trigger('refreshClockIndex')
|
|
|
Taro.eventCenter.trigger('refreshMoments', '')
|
|
Taro.eventCenter.trigger('refreshMoments', '')
|
|
|
setInfo((res as any).data)
|
|
setInfo((res as any).data)
|
|
@@ -329,30 +333,6 @@ export default function TimeRecord() {
|
|
|
function doneComponent() {
|
|
function doneComponent() {
|
|
|
if (status == 'DONE') {
|
|
if (status == 'DONE') {
|
|
|
return <View className="share_bg" style={{ justifyContent: 'flex-start' }}>
|
|
return <View className="share_bg" style={{ justifyContent: 'flex-start' }}>
|
|
|
- {/* {
|
|
|
|
|
- shareUrl.length == 0 && <View className="share_canvas"><RingProgress
|
|
|
|
|
- radius={125} canvasId="helloworld_share2"
|
|
|
|
|
- //scale={0.75}
|
|
|
|
|
- count={count}
|
|
|
|
|
- bgRing={{
|
|
|
|
|
- color: 'rgba(255,255,255,1)',
|
|
|
|
|
- width: 35
|
|
|
|
|
- }}
|
|
|
|
|
- real={{
|
|
|
|
|
- color: MainColorType.orange,
|
|
|
|
|
- width: 5,
|
|
|
|
|
- start: getStartArc(info.time.start_timestamp),
|
|
|
|
|
- duration: getDurationArc(info.time.start_timestamp, info.time.end_timestamp)
|
|
|
|
|
- }}
|
|
|
|
|
- extra={ringExtra()}
|
|
|
|
|
- isCompleted
|
|
|
|
|
- shareCover={
|
|
|
|
|
- url => {
|
|
|
|
|
- setShareUrl(url)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- /></View>
|
|
|
|
|
- } */}
|
|
|
|
|
|
|
|
|
|
<View className="navi_bar" style={{ height: navigationBarHeight }}>
|
|
<View className="navi_bar" style={{ height: navigationBarHeight }}>
|
|
|
<View style={{
|
|
<View style={{
|
|
@@ -380,7 +360,7 @@ export default function TimeRecord() {
|
|
|
</View>
|
|
</View>
|
|
|
|
|
|
|
|
</View>
|
|
</View>
|
|
|
- <View className="share_card" style={{ background: MainColorType.orange, marginTop: rpxToPx(26) + navigationBarHeight }}>
|
|
|
|
|
|
|
+ <View className="share_card2" style={{ background: MainColorType.orange, marginTop: rpxToPx(26) + navigationBarHeight }}>
|
|
|
{/* {
|
|
{/* {
|
|
|
shareUrl.length > 0 ? <Image src={shareUrl} style={{ width: rpxToPx(900), height: rpxToPx(720) }} /> :
|
|
shareUrl.length > 0 ? <Image src={shareUrl} style={{ width: rpxToPx(900), height: rpxToPx(720) }} /> :
|
|
|
<View style={{ width: rpxToPx(900), height: rpxToPx(720), backgroundColor: MainColorType.g02 }} />
|
|
<View style={{ width: rpxToPx(900), height: rpxToPx(720), backgroundColor: MainColorType.g02 }} />
|
|
@@ -409,33 +389,73 @@ export default function TimeRecord() {
|
|
|
}
|
|
}
|
|
|
/>
|
|
/>
|
|
|
{
|
|
{
|
|
|
- <View className="operate_content" style={{ marginTop: rpxToPx(40) }}>
|
|
|
|
|
- <View className="operate_item" onClick={() => {
|
|
|
|
|
- setShowDatePicker(true)
|
|
|
|
|
- }}>
|
|
|
|
|
- <View className="g02 h24">STARTED</View>
|
|
|
|
|
- <View className="h44 bold" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>{TimeFormatter.dateTimeFormate(info.time.start_timestamp, true)}</View>
|
|
|
|
|
- <View className="h30 bold" style={{ color: MainColorType.white }}>Edit Start</View>
|
|
|
|
|
- </View>
|
|
|
|
|
- <View className="operate_item" style={{ backgroundColor: showHighlight ? '#ffffff80' : 'transparent' }} onClick={() => {
|
|
|
|
|
- setShowEndDatePicker(true)
|
|
|
|
|
- }}>
|
|
|
|
|
- <View className="g02 h24">FINISHED</View>
|
|
|
|
|
- <View className="h44 bold" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>{TimeFormatter.dateTimeFormate(info.time.end_timestamp, true)}</View>
|
|
|
|
|
- <View className="h30 bold" style={{ color: MainColorType.white }}>Edit Finish</View>
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+ <View className="share_operate_content">
|
|
|
|
|
+ {
|
|
|
|
|
+ showResult ? <View style={{ display: 'flex', flex: 1, flexDirection: 'row' }}>
|
|
|
|
|
+ <View className="operate_item" onClick={() => {
|
|
|
|
|
+ setShowDatePicker(true)
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <View className="g02 h24 white_50">STARTED</View>
|
|
|
|
|
+ <View className="h44 bold white" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>{TimeFormatter.dateTimeFormate(info.time.start_timestamp, true)}</View>
|
|
|
|
|
+ <View className="h30 bold white_50" style={{ color: MainColorType.white }}>Edit Start</View>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <View className="operate_item" style={{ backgroundColor: showHighlight ? '#ffffff80' : 'transparent' }} onClick={() => {
|
|
|
|
|
+ setShowEndDatePicker(true)
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <View className="g02 h24 white_50">FINISHED</View>
|
|
|
|
|
+ <View className="h44 bold white" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>{TimeFormatter.dateTimeFormate(info.time.end_timestamp, true)}</View>
|
|
|
|
|
+ <View className="h30 bold white_50" style={{ color: MainColorType.white }}>Edit Finish</View>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ </View> :
|
|
|
|
|
+ <View className="white bold" style={{ fontSize: rpxToPx(72), display: 'flex', alignItems: 'center', justifyContent: 'center', flex: 1 }}>You've made it!</View>
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
</View>
|
|
</View>
|
|
|
- <ShareBtn>
|
|
|
|
|
- <NewButton
|
|
|
|
|
- type={NewButtonType.fill}
|
|
|
|
|
- color={MainColorType.success}
|
|
|
|
|
- width={rpxToPx(698)}
|
|
|
|
|
- height={rpxToPx(108)}
|
|
|
|
|
- title="Send to friends"
|
|
|
|
|
- />
|
|
|
|
|
- </ShareBtn>
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ showResult && <ShareBtn>
|
|
|
|
|
+ <NewButton
|
|
|
|
|
+ type={NewButtonType.fill}
|
|
|
|
|
+ color={MainColorType.success}
|
|
|
|
|
+ width={rpxToPx(698)}
|
|
|
|
|
+ height={rpxToPx(108)}
|
|
|
|
|
+ title="Send to friends"
|
|
|
|
|
+ />
|
|
|
|
|
+ </ShareBtn>
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ showResult && <View
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ Taro.redirectTo({
|
|
|
|
|
+ url: `./log_record?scenario=${scenario == 'FAST' ? 'MEAL' : 'ACTIVITY'}`
|
|
|
|
|
+ })
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="h34 bold white_75" style={{
|
|
|
|
|
+ backgroundColor: MainColorType.black_05,
|
|
|
|
|
+ marginTop: rpxToPx(26),
|
|
|
|
|
+ width: rpxToPx(698),
|
|
|
|
|
+ height: rpxToPx(108),
|
|
|
|
|
+ borderRadius: rpxToPx(28),
|
|
|
|
|
+ display: 'flex',
|
|
|
|
|
+ alignItems: 'center',
|
|
|
|
|
+ justifyContent: 'center'
|
|
|
|
|
+ }}>
|
|
|
|
|
+ What are you eating?
|
|
|
|
|
+ </View>
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ showResult && <View
|
|
|
|
|
+ onClick={()=>{
|
|
|
|
|
+ Taro.reLaunch({
|
|
|
|
|
+ url:'/pages/moment/moment'
|
|
|
|
|
+ })
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="white_50 h30" style={{ marginTop: rpxToPx(26) }}>Go to moments</View>
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
@@ -505,14 +525,14 @@ export default function TimeRecord() {
|
|
|
setShowDatePicker(true)
|
|
setShowDatePicker(true)
|
|
|
}}>
|
|
}}>
|
|
|
<View className="g02 h24">STARTED</View>
|
|
<View className="g02 h24">STARTED</View>
|
|
|
- <View className="h44 bold" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>{TimeFormatter.dateTimeFormate(info.time.start_timestamp, true)}</View>
|
|
|
|
|
|
|
+ <View className="h44 bold" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>{TimeFormatter.abbrTimestampFormat(info.time.start_timestamp)}</View>
|
|
|
<View className="h30 bold" style={{ color: MainColorType.orange }}>Edit Start</View>
|
|
<View className="h30 bold" style={{ color: MainColorType.orange }}>Edit Start</View>
|
|
|
</View>
|
|
</View>
|
|
|
<View className="operate_item" onClick={() => {
|
|
<View className="operate_item" onClick={() => {
|
|
|
setShowDurationPicker(true)
|
|
setShowDurationPicker(true)
|
|
|
}}>
|
|
}}>
|
|
|
<View className="g02 h24">{TimeFormatter.formateDurationBySeconds(info.time.duration / 1000)} Goal</View>
|
|
<View className="g02 h24">{TimeFormatter.formateDurationBySeconds(info.time.duration / 1000)} Goal</View>
|
|
|
- <View className="h44 bold" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>{TimeFormatter.dateTimeFormate(info.time.target_end_timestamp, true)}</View>
|
|
|
|
|
|
|
+ <View className="h44 bold" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>{TimeFormatter.abbrTimestampFormat(info.time.target_end_timestamp, true)}</View>
|
|
|
<View className="h30 bold" style={{ color: MainColorType.orange }}>Edit Goal</View>
|
|
<View className="h30 bold" style={{ color: MainColorType.orange }}>Edit Goal</View>
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
@@ -537,10 +557,19 @@ export default function TimeRecord() {
|
|
|
color={MainColorType.orange}
|
|
color={MainColorType.orange}
|
|
|
onClick={end}
|
|
onClick={end}
|
|
|
/>
|
|
/>
|
|
|
- <NewButton
|
|
|
|
|
|
|
+ {/* <NewButton
|
|
|
type={NewButtonType.more}
|
|
type={NewButtonType.more}
|
|
|
onClick={more}
|
|
onClick={more}
|
|
|
- />
|
|
|
|
|
|
|
+ /> */}
|
|
|
|
|
+ <NewButton
|
|
|
|
|
+ type={NewButtonType.img}
|
|
|
|
|
+ onClick={more}
|
|
|
|
|
+ >
|
|
|
|
|
+ <View style={{ width: rpxToPx(72), height: rpxToPx(72), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
|
|
|
+ <IconMore2 width={rpxToPx(36)} color="#000" />
|
|
|
|
|
+ </View>
|
|
|
|
|
+
|
|
|
|
|
+ </NewButton>
|
|
|
{/* <View onClick={more}>More</View> */}
|
|
{/* <View onClick={more}>More</View> */}
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
@@ -572,7 +601,7 @@ export default function TimeRecord() {
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ {/* {
|
|
|
status == 'OG' && <View className="eat_card" style={{ height: rpxToPx(120) }} onClick={() => {
|
|
status == 'OG' && <View className="eat_card" style={{ height: rpxToPx(120) }} onClick={() => {
|
|
|
Taro.redirectTo({
|
|
Taro.redirectTo({
|
|
|
url: `./log_record?scenario=${scenario == 'FAST' ? 'MEAL' : 'ACTIVITY'}`
|
|
url: `./log_record?scenario=${scenario == 'FAST' ? 'MEAL' : 'ACTIVITY'}`
|
|
@@ -583,7 +612,7 @@ export default function TimeRecord() {
|
|
|
<IconArrow width={rpxToPx(34)} color={MainColorType.g02} />
|
|
<IconArrow width={rpxToPx(34)} color={MainColorType.g02} />
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
- }
|
|
|
|
|
|
|
+ } */}
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* {
|
|
{/* {
|