|
|
@@ -219,11 +219,10 @@ export default function Component(props: {
|
|
|
editFoodJournal({
|
|
|
feel: feel
|
|
|
}, detail.id).then(res => {
|
|
|
- (res as any).showDate = props.data.showDate
|
|
|
-
|
|
|
- setDetail(res)
|
|
|
- setCount(count + 1)
|
|
|
if (isPreMeal) {
|
|
|
+ (res as any).showDate = props.data.showDate
|
|
|
+ setDetail(res)
|
|
|
+ setCount(count + 1)
|
|
|
props.refresh()
|
|
|
}
|
|
|
else {
|
|
|
@@ -293,6 +292,16 @@ export default function Component(props: {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ function abandon() {
|
|
|
+ editFoodJournal({
|
|
|
+ status: 'ABANDONED'
|
|
|
+ }, detail.id).then(res => {
|
|
|
+ props.forceRefresh()
|
|
|
+ }).catch(e => {
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
function showRefreshAlert() {
|
|
|
Taro.showModal({
|
|
|
title: t('feature.food.prompt'),
|
|
|
@@ -351,10 +360,31 @@ export default function Component(props: {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function more() {
|
|
|
+ Taro.showActionSheet({
|
|
|
+ itemList: ['重新开始']
|
|
|
+ }).then(res => {
|
|
|
+ if (res.tapIndex == 0) {
|
|
|
+ abandon()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
return <View>
|
|
|
{
|
|
|
- detail.mindful_mode == 'AWARE' && detail.feel.pre_meal && !detail.feel.post_meal && <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: rpxToPx(60) }}>
|
|
|
+ detail.mindful_mode == 'AWARE' && detail.status != 'ABANDONED' && detail.feel.pre_meal && !detail.feel.post_meal &&
|
|
|
+ <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: rpxToPx(60), position: 'relative' }}>
|
|
|
<Slider onChanged={(value) => { updateFeel(value, false) }} />
|
|
|
+ <Image src={require('@assets/images/more-vertical.png')} className="food_timeline_more" onClick={more} />
|
|
|
+ </View>
|
|
|
+ }
|
|
|
+ {
|
|
|
+ detail.mindful_mode == 'AWARE' && detail.feel.post_meal &&
|
|
|
+ <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', marginBottom: rpxToPx(60) }}>
|
|
|
+ <View style={{ width: rpxToPx(375) }} />
|
|
|
+ <View className="food_item_point" style={{ backgroundColor: ColorType.food }} />
|
|
|
+ <Text className="food_item_score" style={{ color: ColorType.food }}>{detail.feel.post_meal}
|
|
|
+ <Text style={{ fontSize: rpxToPx(24) }}>分饱</Text></Text>
|
|
|
</View>
|
|
|
}
|
|
|
<View className="food_timeline_item" onLongPress={showActionSheet}>
|
|
|
@@ -396,10 +426,20 @@ export default function Component(props: {
|
|
|
|
|
|
</View>
|
|
|
{
|
|
|
- detail.mindful_mode == 'AWARE' && !detail.feel.pre_meal && <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: rpxToPx(60) }}>
|
|
|
+ detail.mindful_mode == 'AWARE' && !detail.feel.pre_meal &&
|
|
|
+ <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: rpxToPx(60) }}>
|
|
|
<Slider onChanged={(value) => { updateFeel(value, true) }} />
|
|
|
</View>
|
|
|
}
|
|
|
+ {
|
|
|
+ detail.mindful_mode == 'AWARE' && detail.feel.pre_meal &&
|
|
|
+ <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', marginBottom: rpxToPx(60) }}>
|
|
|
+ <View style={{ width: rpxToPx(375) }} />
|
|
|
+ <View className="food_item_point" style={{ backgroundColor: ColorType.fast }} />
|
|
|
+ <Text className="food_item_score" style={{ color: ColorType.fast }}>{detail.feel.pre_meal}
|
|
|
+ <Text style={{ fontSize: rpxToPx(24) }}>分饿</Text></Text>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
{
|
|
|
showModal && <Modal dismiss={() => { setShowModal(false) }} confirm={() => { setShowModal(false) }}>
|
|
|
<View className='modal_content'>
|