leon 1 рік тому
батько
коміт
f83cf30018

+ 40 - 37
src/_health/pages/recents.tsx

@@ -8,54 +8,57 @@ import NewButton, { NewButtonType } from "../base/new_button";
 import { getThemeColor } from "@/features/health/hooks/health_hooks";
 import { MainColorType } from "@/context/themes/color";
 import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
-import { useRef, useState } from "react";
+import { useEffect, useRef, useState } from "react";
 import MainHistory from "@/features/health/MainHistory";
+import Taro from "@tarojs/taro";
+import { checkSummaries } from "@/services/health";
 
 export default function Recents() {
     const [mode, setMode] = useState('EAT')
     const { t } = useTranslation()
     const historyRef = useRef()
+    const [list, setList] = useState<any>([])
+
+    useEffect(() => {
+        getData()
+    }, [])
+
+    function getData() {
+        checkSummaries().then(res => {
+            setList((res as any).windows)
+            setMode((res as any).windows[0].window)
+        })
+    }
+
+    if (list.length == 0) {
+        return <View />
+    }
+
+
     function detail() {
         return <View style={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>
             <NewHeader type={NewHeaderType.left} title={t('health.check_ins')} />
             <ScrollView style={{ width: rpxToPx(750), flexDirection: 'row', display: 'flex', height: rpxToPx(72) }} scrollX enableFlex showScrollbar={false}>
-                <View style={{ width: rpxToPx(40), flexShrink: 0 }} />
-                <NewButton type={NewButtonType.img} onClick={() => setMode('EAT')}>
-                    <View className="streak_toolbar_btn"
-                        style={{ backgroundColor: mode == 'EAT' ? getThemeColor('EAT') + '1A' : 'transparent' }}
-                    >
-                        <Text className={mode == 'EAT' ? 'bold h30' : 'h30'}
-                            style={{ color: mode == 'EAT' ? getThemeColor('EAT') : MainColorType.g01, marginRight: 5 }}>{t('health.eat')}</Text>
-                    </View>
-                </NewButton>
-
-                <NewButton type={NewButtonType.img} onClick={() => setMode('ACTIVE')}>
-                    <View className="streak_toolbar_btn"
-                        style={{ backgroundColor: mode == 'ACTIVE' ? getThemeColor('ACTIVE') + '1A' : 'transparent' }}
-                    >
-                        <Text className={mode == 'ACTIVE' ? 'bold h30' : 'h30'}
-                            style={{ color: mode == 'ACTIVE' ? getThemeColor('ACTIVE') : MainColorType.g01, marginRight: 5 }}>{t('health.active')}</Text>
-                    </View>
-                </NewButton>
-                <NewButton type={NewButtonType.img} onClick={() => setMode('FAST')}>
-                    <View className="streak_toolbar_btn"
-                        style={{ backgroundColor: mode == 'FAST' ? getThemeColor('FAST') + '1A' : 'transparent' }}
-                    >
-                        <Text className={mode == 'FAST' ? 'bold h30' : 'h30'}
-                            style={{ color: mode == 'FAST' ? getThemeColor('FAST') : MainColorType.g01, marginRight: 5 }}>{t('health.fast')}</Text>
-                    </View>
-                </NewButton>
-                <NewButton type={NewButtonType.img} onClick={() => setMode('SLEEP')}>
-                    <View className="streak_toolbar_btn"
-                        style={{ backgroundColor: mode == 'SLEEP' ? getThemeColor('SLEEP') + '1A' : 'transparent' }}
-                    >
-                        <Text className={mode == 'SLEEP' ? 'bold h30' : 'h30'}
-                            style={{ color: mode == 'SLEEP' ? getThemeColor('SLEEP') : MainColorType.g01, marginRight: 5 }}>{t('health.sleep')}</Text>
-                    </View>
-                </NewButton>
-                <View style={{ width: rpxToPx(40), flexShrink: 0 }} />
+                <View style={{display:'flex',flexDirection:'row',flexShrink:0}}>
+                    <View style={{ width: rpxToPx(40), flexShrink: 0 }} />
+                    {
+                        list.map((item, index) => {
+                            return <NewButton key={index} type={NewButtonType.img} onClick={() => setMode(item.window)}>
+                                <View className="streak_toolbar_btn"
+                                    style={{ backgroundColor: mode == item.window ? getThemeColor(item.window) + '1A' : 'transparent' }}
+                                >
+                                    <Text className={mode == item.window ? 'bold h30' : 'h30'}
+                                        style={{ color: mode == item.window ? getThemeColor(item.window) : MainColorType.g01, marginRight: 5 }}>{item.title}</Text>
+                                    <Text className={mode == item.window ? 'bold h20' : 'h20'}
+                                        style={{ color: mode == item.window ? getThemeColor(item.window) : MainColorType.g01 }}>{item.log_count}</Text>
+                                </View>
+                            </NewButton>
+                        })
+                    }
+                    <View style={{ width: rpxToPx(40), flexShrink: 0 }} />
+                </View>
             </ScrollView>
-            <View style={{height:rpxToPx(36),flexShrink:0}}/>
+            <View style={{ height: rpxToPx(36), flexShrink: 0 }} />
             <MainHistory ref={historyRef} type={mode} updateDate={(e) => {
                 // setShowDate(e.show)
                 // setDate(e.date)

+ 4 - 2
src/_health/pages/timeline_detail.tsx

@@ -353,7 +353,10 @@ export default function TimelineDetail() {
             setShowPop(true)
         }
 
+        Taro.eventCenter.on('refresh_timeline',getDatas)
+
         return () => {
+            Taro.eventCenter.off('refresh_timeline')
         }
     }, [])
 
@@ -627,7 +630,7 @@ export default function TimelineDetail() {
         var id = list[0].id
         // global.edit_timeline = detail
         // jumpPage(`./add_moment?edit=1&event_id=${event_id}&id=${id}`)
-        jumpPage(`/_record/pages/log_record?edit=1&event_id=${detail.id}&scenario=${detail.scenario}`)
+        jumpPage(`/_record/pages/log_record?edit=1&id=${detail.id}&scenario=${detail.scenario}`)
     }
 
     function del() {
@@ -843,7 +846,6 @@ export default function TimelineDetail() {
     }
 
     function goHome() {
-        // jumpPage('/_moment/pages/message')
         if (!user.isLogin) {
             jumpPage('/_account/pages/ChooseAuth')
             return

+ 185 - 0
src/_moment/components/long_card copy.tsx

@@ -0,0 +1,185 @@
+import { MainColorType } from "@/context/themes/color";
+import { View, Text, Image, ScrollView } from "@tarojs/components";
+import './long_card.scss'
+import { rpxToPx } from "@/utils/tools";
+import ShareBtn from "@/components/basic/ShareBtn";
+import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
+import { useDispatch, useSelector } from "react-redux";
+import { getScenario } from "@/features/health/hooks/health_hooks";
+import { setFollow, setJoinData, setJoinTitle } from "@/store/long";
+import Taro from "@tarojs/taro";
+import { useTranslation } from "react-i18next";
+
+export default function LongCard(props: { join?: any, user?: any, hideJoin?: boolean, share?: any, title?: string, isFeedItem?: boolean }) {
+    const { status, key, from, window } = props.join
+    const health = useSelector((state: any) => state.health);
+    const user = useSelector((state: any) => state.user);
+    const long = useSelector((state: any) => state.long);
+    const dispatch = useDispatch()
+    const {t} = useTranslation()
+    let type = 0
+    function join(e) {
+        if (process.env.TARO_ENV == 'weapp') {
+            e.stopPropagation()
+        }
+        if (props.user) {
+            dispatch(setFollow(props.user))
+        }
+        if (props.title) {
+            dispatch(setJoinTitle(props.title))
+        }
+        dispatch(setJoinData(props.join))
+        if (!user.isLogin) {
+            jumpPage('/_account/pages/ChooseAuth')
+            return
+        }
+
+        if (window == 'ACTIVE' || window == 'EAT') {
+            jumpPage(`/_record/pages/log_record?scenario=${window=='EAT'?'MEAL':'ACTIVITY'}&join_id=${key}`)
+            // jumpPage(`/_health/pages/add_moment?join_id=${key}&is_temp=${true}&window=${window}&title=${props.title ?? long.title}`)
+        }
+        else {
+            if (window == 'FAST') {
+                // if (getScenario(health.windows, 'FAST').status == 'WFS') {
+                //     //jumpPage(`/_health/pages/log_time?index=${health.mode == 'FAST' ? 0 : 1}&single=1&is_start=1&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
+                //     jumpPage(`/_health/pages/log_time?join_id=${key}&index=0&single=1&is_start=1&window=${window}`)
+                // }
+                // 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(`/_health/pages/log_time?join_id=${key}&index=3&single=1&is_start=0&window=${window}`)
+                // }
+                jumpPage(`/_record/pages/time_record?scenario=${window}&join_id=${key}`)
+            }
+            else if (window=='SLEEP'){
+                jumpPage(`/_record/pages/time_record?scenario=${window}&join_id=${key}`)
+                // if (getScenario(health.windows, 'SLEEP').status == 'WFS') {
+                //     //jumpPage(`/_health/pages/log_time?index=${health.mode == 'FAST' ? 0 : 1}&single=1&is_start=1&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
+                //     jumpPage(`/_health/pages/log_time?join_id=${key}&index=1&single=1&is_start=1&window=${window}`)
+                // }
+                // 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(`/_health/pages/log_time?join_id=${key}&index=2&single=1&is_start=0&window=${window}`)
+                // }
+            }
+
+        }
+
+
+    }
+
+    function goDetail() {
+        if (!user.isLogin) {
+            jumpPage('/_account/pages/ChooseAuth')
+            return
+        }
+        if (props.user) {
+            dispatch(setFollow(props.user))
+        }
+        if (props.title) {
+            dispatch(setJoinTitle(props.title))
+        }
+        dispatch(setJoinData(props.join))
+        jumpPage(`/_moment/pages/long_detail?join_id=${key}&window=${window}&status=${status}`)
+    }
+
+    function share() {
+        // global.join_id = key
+        if (props.share) {
+            props.share()
+        }
+        // if (props.isFeedItem){
+        //     Taro.eventCenter.trigger('moment_share',{
+
+        //     })
+        // }
+    }
+
+    function users() {
+        return <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
+            {
+                props.join.users.map((item, index) => {
+                    if (index > 4) return
+                    return <Image className="long_avatar" mode="aspectFill" style={{
+                        zIndex: 10 - index,
+                        marginLeft: index == 0 ? 0 : -rpxToPx(20)
+                    }} src={item.avatar} key={index} />
+                })
+            }
+            {/* <View className="long_avatar"></View> */}
+            <View className="h26" style={{ marginLeft: rpxToPx(6) }}>{props.join.users.length > 5 ? `+${props.join.users.length - 5} more ` : ''}</View>
+        </View>
+    }
+
+    if (from)
+        return <View onClick={goDetail} className="long_card_bg" style={{
+            flexDirection: 'column',
+            paddingTop: rpxToPx(18),
+            paddingBottom: rpxToPx(18)
+        }}>
+            <View className="h20 g02" style={{ marginBottom: rpxToPx(6) }}>{t('health.join2')}</View>
+            <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
+                <View className="h26" style={{ marginRight: rpxToPx(8) }}>{from.nickname}</View>
+                {
+                    users()
+                }
+                <View style={{ flex: 1 }} />
+                {
+                    status == 'JOIN' && <View className="h26 bold" style={{ color: MainColorType.link,padding:5,marginRight:-5 }} onClick={join}>{t('health.join')}</View>
+                }
+                {
+                    status == 'SHARE' && <ShareBtn onClick={share} hideShare={props.isFeedItem}>
+                        <Image src={require('@assets/_health/wechat.png')} style={{ width: rpxToPx(44), height: rpxToPx(44) }} />
+                        {/* <View className="h26 bold" style={{ color: MainColorType.success }} >邀请好友加入</View> */}
+                    </ShareBtn>
+                }
+
+            </View>
+        </View>
+    if (status == 'JOIN')
+        return <View onClick={goDetail} className="long_card_bg long_card_begin">
+            {
+                (props.join && props.join.user_count == 0) && <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
+                    <Image className="long_avatar" mode="aspectFill" style={{
+                        marginRight: rpxToPx(6)
+                    }} src={props.join.user.avatar} />
+                    <View className="h26 g02">{t('health.call_me_join',{name:props.join.user.nickname})}</View>
+                </View>
+            }
+
+            {
+                props.join && props.join.user_count > 0 && users()
+            }
+            <View className="h26 bold" style={{ color: MainColorType.link,padding:15,marginRight:-15 }} onClick={join}>{t('health.join')}</View>
+        </View>
+
+    if (status == 'SHARE') {
+        if (!props.join || props.join.user_count == 0) {
+            return <View onClick={goDetail} className="long_card_bg long_card_begin" style={{ alignItems: 'center',paddingLeft:rpxToPx(14) }}>
+                <ShareBtn onClick={share} hideShare={props.isFeedItem}>
+                    <View style={{
+                        display: 'flex', flexDirection: 'row',
+                        alignItems: 'center', justifyContent: 'center'
+                    }}>
+                        <View style={{ width: rpxToPx(80),marginRight:rpxToPx(10), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
+                            <Image src={require('@assets/_health/wechat.png')} style={{ width: rpxToPx(44), height: rpxToPx(44) }} />
+                        </View>
+
+                        <View className="h26 bold" style={{ color: MainColorType.success }} >{t('health.call_friends_join')}</View>
+                    </View>
+
+                </ShareBtn>
+            </View>
+        }
+        return <View onClick={goDetail} className="long_card_bg long_card_begin">
+            {
+                props.join && props.join.user_count > 0 && users()
+            }
+            <ShareBtn onClick={share} hideShare={props.isFeedItem}>
+                <Image src={require('@assets/_health/wechat.png')} style={{ width: rpxToPx(44), height: rpxToPx(44) }} />
+                {/* <View className="h26 bold" style={{ color: MainColorType.success }} >邀请好友加入</View> */}
+            </ShareBtn>
+        </View>
+    }
+
+    return <View />
+}

+ 11 - 59
src/_moment/components/long_card.tsx

@@ -9,6 +9,7 @@ import { getScenario } from "@/features/health/hooks/health_hooks";
 import { setFollow, setJoinData, setJoinTitle } from "@/store/long";
 import Taro from "@tarojs/taro";
 import { useTranslation } from "react-i18next";
+import { IconArrow } from "@/components/basic/Icons";
 
 export default function LongCard(props: { join?: any, user?: any, hideJoin?: boolean, share?: any, title?: string, isFeedItem?: boolean }) {
     const { status, key, from, window } = props.join
@@ -16,7 +17,7 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: boo
     const user = useSelector((state: any) => state.user);
     const long = useSelector((state: any) => state.long);
     const dispatch = useDispatch()
-    const {t} = useTranslation()
+    const { t } = useTranslation()
     let type = 0
     function join(e) {
         if (process.env.TARO_ENV == 'weapp') {
@@ -35,7 +36,7 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: boo
         }
 
         if (window == 'ACTIVE' || window == 'EAT') {
-            jumpPage(`/_record/pages/log_record?scenario=${window=='EAT'?'MEAL':'ACTIVITY'}&join_id=${key}`)
+            jumpPage(`/_record/pages/log_record?scenario=${window == 'EAT' ? 'MEAL' : 'ACTIVITY'}&join_id=${key}`)
             // jumpPage(`/_health/pages/add_moment?join_id=${key}&is_temp=${true}&window=${window}&title=${props.title ?? long.title}`)
         }
         else {
@@ -50,7 +51,7 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: boo
                 // }
                 jumpPage(`/_record/pages/time_record?scenario=${window}&join_id=${key}`)
             }
-            else if (window=='SLEEP'){
+            else if (window == 'SLEEP') {
                 jumpPage(`/_record/pages/time_record?scenario=${window}&join_id=${key}`)
                 // if (getScenario(health.windows, 'SLEEP').status == 'WFS') {
                 //     //jumpPage(`/_health/pages/log_time?index=${health.mode == 'FAST' ? 0 : 1}&single=1&is_start=1&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
@@ -98,7 +99,7 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: boo
         return <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
             {
                 props.join.users.map((item, index) => {
-                    if (index > 4) return
+                    // if (index > 4) return
                     return <Image className="long_avatar" mode="aspectFill" style={{
                         zIndex: 10 - index,
                         marginLeft: index == 0 ? 0 : -rpxToPx(20)
@@ -106,79 +107,30 @@ export default function LongCard(props: { join?: any, user?: any, hideJoin?: boo
                 })
             }
             {/* <View className="long_avatar"></View> */}
-            <View className="h26" style={{ marginLeft: rpxToPx(6) }}>{props.join.users.length > 5 ? `+${props.join.users.length - 5} more ` : ''}</View>
+            {/* <View className="h26" style={{ marginLeft: rpxToPx(6) }}>{props.join.users.length > 5 ? `+${props.join.users.length - 5} more ` : ''}</View> */}
         </View>
     }
 
-    if (from)
-        return <View onClick={goDetail} className="long_card_bg" style={{
-            flexDirection: 'column',
-            paddingTop: rpxToPx(18),
-            paddingBottom: rpxToPx(18)
-        }}>
-            <View className="h20 g02" style={{ marginBottom: rpxToPx(6) }}>{t('health.join2')}</View>
-            <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
-                <View className="h26" style={{ marginRight: rpxToPx(8) }}>{from.nickname}</View>
-                {
-                    users()
-                }
-                <View style={{ flex: 1 }} />
-                {
-                    status == 'JOIN' && <View className="h26 bold" style={{ color: MainColorType.link,padding:5,marginRight:-5 }} onClick={join}>{t('health.join')}</View>
-                }
-                {
-                    status == 'SHARE' && <ShareBtn onClick={share} hideShare={props.isFeedItem}>
-                        <Image src={require('@assets/_health/wechat.png')} style={{ width: rpxToPx(44), height: rpxToPx(44) }} />
-                        {/* <View className="h26 bold" style={{ color: MainColorType.success }} >邀请好友加入</View> */}
-                    </ShareBtn>
-                }
-
-            </View>
-        </View>
     if (status == 'JOIN')
-        return <View onClick={goDetail} className="long_card_bg long_card_begin">
+        return <View onClick={goDetail} style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(24) }}>
             {
                 (props.join && props.join.user_count == 0) && <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
                     <Image className="long_avatar" mode="aspectFill" style={{
                         marginRight: rpxToPx(6)
                     }} src={props.join.user.avatar} />
-                    <View className="h26 g02">{t('health.call_me_join',{name:props.join.user.nickname})}</View>
+
                 </View>
             }
 
             {
                 props.join && props.join.user_count > 0 && users()
             }
-            <View className="h26 bold" style={{ color: MainColorType.link,padding:15,marginRight:-15 }} onClick={join}>{t('health.join')}</View>
+            <View className="h24">在跟卡</View>
+            <IconArrow width={rpxToPx(24)} color={MainColorType.g02}/>
         </View>
 
     if (status == 'SHARE') {
-        if (!props.join || props.join.user_count == 0) {
-            return <View onClick={goDetail} className="long_card_bg long_card_begin" style={{ alignItems: 'center',paddingLeft:rpxToPx(14) }}>
-                <ShareBtn onClick={share} hideShare={props.isFeedItem}>
-                    <View style={{
-                        display: 'flex', flexDirection: 'row',
-                        alignItems: 'center', justifyContent: 'center'
-                    }}>
-                        <View style={{ width: rpxToPx(80),marginRight:rpxToPx(10), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
-                            <Image src={require('@assets/_health/wechat.png')} style={{ width: rpxToPx(44), height: rpxToPx(44) }} />
-                        </View>
-
-                        <View className="h26 bold" style={{ color: MainColorType.success }} >{t('health.call_friends_join')}</View>
-                    </View>
-
-                </ShareBtn>
-            </View>
-        }
-        return <View onClick={goDetail} className="long_card_bg long_card_begin">
-            {
-                props.join && props.join.user_count > 0 && users()
-            }
-            <ShareBtn onClick={share} hideShare={props.isFeedItem}>
-                <Image src={require('@assets/_health/wechat.png')} style={{ width: rpxToPx(44), height: rpxToPx(44) }} />
-                {/* <View className="h26 bold" style={{ color: MainColorType.success }} >邀请好友加入</View> */}
-            </ShareBtn>
-        </View>
+        return <View />
     }
 
     return <View />

+ 25 - 7
src/_record/components/picker_card.tsx

@@ -8,10 +8,13 @@ import NewDurationPicker, { DurationPickerType } from "@/_health/base/new_durati
 import { useState } from "react";
 import NewDateTimePicker from "@/_health/base/new_date_time_picker";
 import dayjs from "dayjs";
+import { useTranslation } from "react-i18next";
+import Taro from "@tarojs/taro";
 
 export default function PickerCard(props: { onClose: any, onConfirm: any, title: string, type: string, value: any, error?: string, onChange?: any }) {
     const [value, setValue] = useState(props.value)
     const [pickerError, setPickerError] = useState('')
+    const { t } = useTranslation()
     return <View className="picker_card_bg_1">
         <View className="picker_card">
             <View className="picker_card_close" onClick={props.onClose}>
@@ -43,12 +46,12 @@ export default function PickerCard(props: { onClose: any, onConfirm: any, title:
                             if (props.onChange) {
                                 props.onChange()
                             }
-                            if (dt.getTime() > new Date().getTime()) {
-                                setPickerError('不能大于当前时间')
-                            }
-                            else {
-                                setPickerError('')
-                            }
+                            // if (dt.getTime() > new Date().getTime()) {
+                            //     setPickerError(t('health.future_time_limit'))
+                            // }
+                            // else {
+                            //     setPickerError('')
+                            // }
                         }} />
                 }
             </View>
@@ -58,8 +61,23 @@ export default function PickerCard(props: { onClose: any, onConfirm: any, title:
                 width={rpxToPx(578)}
                 height={rpxToPx(96)}
                 color={MainColorType.orange}
-                title={global.language=='en'?'Done':'确定'}
+                title={t('health.done')}
                 onClick={() => {
+                    if (props.type == 'datetime') {
+                        if (value > new Date().getTime()) {
+                            // setPickerError(t('health.future_time_limit'))
+                            Taro.showToast({
+                                title: t('health.future_time_limit'),
+                                icon: 'none'
+                            })
+                            setValue(new Date().getTime())
+                            vibrate()
+                            return
+                        }
+                        else {
+                            setPickerError('')
+                        }
+                    }
                     if (pickerError.length > 0) {
                         vibrate()
                         return

+ 54 - 46
src/_record/pages/log_record.tsx

@@ -124,9 +124,20 @@ export default function LogRecord() {
             quickSave()
         }
 
-        if (router.params.edit){
-            eventDetail(router.params.event_id).then(res=>{
-                
+        if (router.params.edit) {
+            eventDetail(router.params.id).then(res => {
+                setTitle((res as any).title)
+                setChooseTitle((res as any).title)
+                if ((res as any).moment) {
+                    setDesc((res as any).moment.description)
+                    if ((res as any).moment.media && (res as any).moment.media.length > 0) {
+                        setPics((res as any).moment.media)
+                    }
+                }
+                if ((res as any).time) {
+                    setSelDate(dayjs((res as any).time.start_timestamp).format('YYYY-MM-DD'))
+                    setTime(dayjs((res as any).time.start_timestamp).format('HH:mm'))
+                }
             })
         }
     }, [])
@@ -141,7 +152,7 @@ export default function LogRecord() {
 
     function getTags() {
         userTags({ scenario: scenario }).then(res => {
-            if (chooseTitle == '') {
+            if (chooseTitle == '' && !router.params.edit) {
                 var current = dayjs().format('HH:mm');
                 var isFind = false;
                 (res as any).tags.map(item => {
@@ -224,7 +235,6 @@ export default function LogRecord() {
 
     function addImage(isCamera) {
         var source: any = isCamera ? ['camera'] : ['album']
-        console.log(source)
         Taro.chooseMedia({
             count: 9 - pics.length,
             sizeType: ['compressed'],
@@ -243,7 +253,6 @@ export default function LogRecord() {
     }
 
     async function chooseSuccess(res, isAlbum) {
-        console.log('选择图片', res)
         // const filePaths = res.map(file => file.path
         //     // process.env.TARO_ENV === 'rn' || isFilePath ? file.path : file.tempFilePath
         // )
@@ -390,7 +399,6 @@ export default function LogRecord() {
             set_time: global.set_time ? global.set_time : new Date().getTime(),
             confirm_time: new Date().getTime()
         }
-        // console.log('打卡提交数据', params)
         if (posting) return
         setPosting(true)
         // Taro.showLoading({
@@ -436,25 +444,29 @@ export default function LogRecord() {
     }
 
     function edit() {
-        // var date = new Date(selDate + 'T' + time + ':' + dayjs(enterTimestmap).format('ss'))
         var date = TimeFormatter.stringToDate(selDate, time)
+        date.setMilliseconds(new Date(enterTimestmap).getMilliseconds())
+
+
         var params: any = {
-            schedule_id: schedule_id,
-            title: title,
-            description: desc,
+            id: router.params.id,
+            scenario: scenario, //ACTIVITY
+            type: 'POINT',
+            sub_type: scenario,
+            title: chooseTitle,
+
             time: {
                 start_timestamp: date.getTime()
             }
         }
 
+        if (router.params.join_id) {
+            params.join_key = router.params.join_id
+        }
 
-        // if (imgUrl.length > 0) {
-        //     params.media = [{
-        //         url: imgUrl,
-        //         type: imgUrl.indexOf('mp4') != -1 ? 'video' : 'image',
-        //         source: 'album'
-        //     }]
-        // }
+        var moment: any = {
+            description: desc,
+        }
         if (pics.length > 0) {
             var picList: any = []
             pics.map((item) => {
@@ -467,40 +479,37 @@ export default function LogRecord() {
                     format: item.format
                 })
             })
-            params.media = picList
+            moment.media = picList
         }
         else {
-            params.media = []
-        }
-        if (event_id && event_id != 'undefined') {
-            params.event_id = event_id
-        }
-
-        if (is_temp) {
-            params.event = window == 'EAT' ? 'EAT_CUSTOM' : 'ACTIVE_CUSTOM'
+            moment.media = []
         }
-
-
-
+        params.moment = moment
         params.extra = {
             set_time: global.set_time ? global.set_time : new Date().getTime(),
             confirm_time: new Date().getTime()
         }
-
         if (posting) return
         setPosting(true)
-        updateMoment(params, router.params.id).then(res => {
-            Taro.eventCenter.trigger('refreshMoments', '')
+        // Taro.showLoading({
+        //     title: t('health.uploading')
+        // })
+        addEvents(params).then(res => {
+            setShowResult(true)
+            setResult(res)
             setPosting(false)
-            if (process.env.TARO_ENV == 'weapp') {
-                Taro.navigateBack();
+            Taro.eventCenter.trigger('refresh_timeline',(res as any).feed_item)
+            if (global.refreshHistory){
+                global.refreshHistory()
             }
-
-            // global.refreshWindow()
-            // global.refreshHistory()
-            // global.refreshMoment()
+            Taro.navigateBack()
+            // Taro.hideLoading()
+            // Taro.reLaunch({
+            //     url: '/pages/moment/moment'
+            // })
         }).catch(e => {
             setPosting(false)
+            // Taro.hideLoading()
         })
     }
 
@@ -563,7 +572,6 @@ export default function LogRecord() {
                             Taro.navigateBack()
                             return
                         }
-                        debugger
                         if (chooseTitle.length > 0 && step == 0) {
                             setStep(2)
                             return
@@ -573,8 +581,8 @@ export default function LogRecord() {
                                 title: t('health.back_no_save'),
                                 content: '',
                                 showCancel: true,
-                                cancelText: '取消',
-                                confirmText: '退出',
+                                cancelText: t('health.cancel'),
+                                confirmText: t('health.exit'),
                                 confirm: () => {
                                     Taro.navigateBack()
                                 }
@@ -661,7 +669,6 @@ export default function LogRecord() {
                             <NewButton btnStyle={{ flex: 1 }} type={NewButtonType.img}
                                 onClick={() => {
                                     if (title.length == 0) return
-                                    console.log(title)
                                     setChooseTitle(title)
                                     setPostCount(1)
                                     setStep(2)
@@ -793,14 +800,15 @@ export default function LogRecord() {
                     color={MainColorType.orange}
                     width={rpxToPx(646)}
                     height={rpxToPx(108)}
-                    title={t('health.log_moment')}
+                    title={t('health.share_to_moment')}
                     onClick={save}
                 />
             </View>
         }
         {
             showTimePicker && <PickerCard onClose={() => { setShowTimePicker(false) }}
-                value={new Date().getTime()}
+                value={new Date(selDate + 'T' + time + ':00').getTime()}
+                title={global.language == 'en' ? 'Choose Time' : "选择时间"}
                 type="datetime"
                 onConfirm={(e) => {
                     setSelDate(dayjs(e).format('YYYY-MM-DD'))
@@ -810,7 +818,7 @@ export default function LogRecord() {
             />
         }
         {
-            showResult && <View className="share_bg">
+            showResult && false && <View className="share_bg">
                 <View className="navi_bar" style={{ height: navigationBarHeight }}>
                     <View style={{
                         position: 'absolute',

+ 8 - 0
src/_record/pages/time_record.scss

@@ -157,7 +157,15 @@
 
 .momentBtnAni{
     opacity: 0;
+    width: 646px;
+    height: 96px;
+    border-radius: 48px;
+    background-color: #fff;
+    color: #000;
     animation: showAni 0.1s 0.3s linear forwards;
+    display: flex;
+    align-items: center;
+    justify-content: center;
 }
 
 @keyframes showAni{

+ 31 - 29
src/_record/pages/time_record.tsx

@@ -58,7 +58,7 @@ export default function TimeRecord() {
 
     const [postError, setPostError] = useState('')
 
-    const [pickerTitle,setPickerTitle] = useState('')
+    const [pickerTitle, setPickerTitle] = useState('')
 
     const { t } = useTranslation()
 
@@ -111,14 +111,14 @@ export default function TimeRecord() {
             setPostError('')
         }
 
-        if (showDatePicker){
-            setPickerTitle(scenario=='FAST'?t('health.adjust_fast_start_time'):t('health.adjust_bed_time'))
+        if (showDatePicker) {
+            setPickerTitle(scenario == 'FAST' ? t('health.adjust_fast_start_time') : t('health.adjust_bed_time'))
         }
-        else if (showEndDatePicker){
-            setPickerTitle(scenario=='FAST'?t('health.adjust_fast_end_time'):t('health.adjust_wake_up'))
+        else if (showEndDatePicker) {
+            setPickerTitle(scenario == 'FAST' ? t('health.adjust_fast_end_time') : t('health.adjust_wake_up'))
         }
-        else if (showDurationPicker){
-            setPickerTitle(scenario=='FAST'?t('health.adjust_fast_goal'):t('health.adjust_sleep_goal'))
+        else if (showDurationPicker) {
+            setPickerTitle(scenario == 'FAST' ? t('health.adjust_fast_goal') : t('health.adjust_sleep_goal'))
         }
     }, [status, showDatePicker, showEndDatePicker, showDurationPicker])
 
@@ -350,7 +350,7 @@ export default function TimeRecord() {
         percent = parseInt(percent + '')
         return {
             progress: TimeFormatter.countdown(info.time.start_timestamp),
-            footer: `ELAPSED ${percent}%`,
+            footer: t('health.elapsed', { percent: percent + '%' }),//`ELAPSED ${percent}%`,
             color: MainColorType.g02
         }
     }
@@ -439,29 +439,29 @@ export default function TimeRecord() {
                                         setShowDatePicker(true)
                                     }}>
                                         <View className="operate_item" >
-                                            <View className="g02 h24 white_50">{scenario=='FAST'?t('health.started'):t('health.bedtime1')}</View>
+                                            <View className="g02 h24 white_50">{scenario == 'FAST' ? t('health.started') : t('health.bedtime1')}</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 }}>{scenario=='FAST'?t('health.adjust_start'):t('health.adjust_bedtime')}</View>
+                                            <View className="h30 bold white_50" style={{ color: MainColorType.white }}>{scenario == 'FAST' ? t('health.adjust_start') : t('health.adjust_bedtime')}</View>
                                         </View>
                                     </NewButton>
                                     <NewButton type={NewButtonType.custom} onClick={() => {
                                         setShowEndDatePicker(true)
                                     }}>
                                         <View className="operate_item" style={{ backgroundColor: showHighlight ? '#ffffff80' : 'transparent' }} >
-                                            <View className="g02 h24 white_50">{scenario=='FAST'?t('health.finished'):t('health.wokeup')}</View>
+                                            <View className="g02 h24 white_50">{scenario == 'FAST' ? t('health.finished') : t('health.wokeup')}</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 }}>{scenario=='FAST'?t('health.adjust_end'):t('health.adjust_wake_up')}</View>
+                                            <View className="h30 bold white_50" style={{ color: MainColorType.white }}>{scenario == 'FAST' ? t('health.adjust_end') : t('health.adjust_wake_up')}</View>
                                         </View>
                                     </NewButton>
                                 </View> :
-                                    <View className="white bold" style={{ fontSize: rpxToPx(72), display: 'flex', alignItems: 'center', justifyContent: 'center', flex: 1 }}>{t('health.fast_finished')}</View>
+                                    <View className="white bold" style={{ fontSize: rpxToPx(72), display: 'flex', alignItems: 'center', justifyContent: 'center', flex: 1 }}>{scenario == 'FAST' ?t('health.fast_finished'):t('health.sleep_finished')}</View>
                             }
 
 
                         </View>
                     }
                 </View>
-                {
+                {/* {
                     showResult && <View style={{ opacity: 0 }}><View className="shareBtnAni" >
                         <ShareBtn hideShare={true}>
                             <NewButton type={NewButtonType.custom}>
@@ -473,6 +473,19 @@ export default function TimeRecord() {
                         </ShareBtn>
                     </View>
                     </View>
+                } */}
+
+                {
+                    showResult && <NewButton type={NewButtonType.custom}
+                        onClick={() => {
+                            Taro.reLaunch({
+                                url: '/pages/moment/moment'
+                            })
+                        }}
+                    ><View
+
+                        className="bold h30 momentBtnAni" style={{ marginTop: rpxToPx(26) }}>{t('health.view_in_moments')}</View>
+                    </NewButton>
                 }
                 {
                     showResult && <NewButton type={NewButtonType.custom} onClick={() => {
@@ -491,23 +504,12 @@ export default function TimeRecord() {
                             alignItems: 'center',
                             justifyContent: 'center'
                         }}>
-                            What are you eating?
+                            {t('health.what_eating')}
                         </View>
                     </NewButton>
 
                 }
-                {
-                    showResult && <NewButton type={NewButtonType.custom}
-                        onClick={() => {
-                            Taro.reLaunch({
-                                url: '/pages/moment/moment'
-                            })
-                        }}
-                    ><View
 
-                        className="white_50 h30 momentBtnAni" style={{ marginTop: rpxToPx(26) }}>Go to moments</View>
-                    </NewButton>
-                }
 
 
             </View>
@@ -589,16 +591,16 @@ export default function TimeRecord() {
                             setShowDatePicker(true)
                         }}>
                             <View className="operate_item" style={{ backgroundColor: showHighlight ? '#ffffff80' : 'transparent' }}>
-                                <View className="black_50 h24">{scenario=='FAST'?t('health.started'):t('health.bedtime1')}</View>
+                                <View className="black_50 h24">{scenario == 'FAST' ? t('health.started') : t('health.bedtime1')}</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 }}>{scenario=='FAST'?t('health.adjust_start'):t('health.adjust_bedtime')}</View>
+                                <View className="h30 bold" style={{ color: MainColorType.orange }}>{scenario == 'FAST' ? t('health.adjust_start') : t('health.adjust_bedtime')}</View>
                             </View>
                         </NewButton>
                         <NewButton type={NewButtonType.custom} onClick={() => {
                             setShowDurationPicker(true)
                         }}>
                             <View className="operate_item">
-                                <View className="black_50 h24">{t('health.time_goal',{time:TimeFormatter.formateDurationBySeconds(info.time.duration / 1000)})}</View>
+                                <View className="black_50 h24">{t('health.time_goal', { time: TimeFormatter.formateDurationBySeconds(info.time.duration / 1000) })}</View>
                                 <View className="h44 bold" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>{TimeFormatter.abbrTimestampFormat(info.time.target_end_timestamp)}</View>
                                 <View className="h30 bold" style={{ color: MainColorType.orange }}>{t('health.adjust_goal')}</View>
                             </View>

+ 6 - 1
src/context/locales/en.js

@@ -1073,6 +1073,7 @@ export default {
         edit_name: 'Edit Names',
         edit_order: 'Edit Orders',
         back_no_save: 'Exit without Saving',
+        exit:'Exit',
 
         verion_tip: 'You are upgraded to the latest version',
         verion_done: 'Setup',
@@ -1289,6 +1290,10 @@ export default {
         adjust_fast_end_time:'Adjust Fasting End Time',
         adjust_sleep_goal:'Adjust Sleep Goal',
         adjust_bed_time:'Adjust Bedtime',
-        adjust_wake_up:'Adjust Wake Up'
+        adjust_wake_up:'Adjust Wake Up',
+        elapsed:'ELAPSED {{percent}}',
+        view_in_moments:'View in Moments',
+        what_eating:'What\'re you eating?',
+        share_to_moment:'Share to Moments',
     }
 }

+ 8 - 2
src/context/locales/zh.js

@@ -1076,6 +1076,7 @@ export default {
         edit_name: '编辑名称',
         edit_order: '编辑排序',
         back_no_save: '退出不保存',
+        exit:'退出',
 
         verion_tip: '您已升级到最新版本',
         verion_done: '完成设置',
@@ -1251,7 +1252,7 @@ export default {
         joins: '接龙历史',
         show_joins: '查看接龙历史',
         total_joins: '累计获得 {{total}} 次跟卡',
-        check_in: '打卡',
+        check_in: '今日打卡',
         home: '首页',
 
         add_photos: '添加图片',
@@ -1290,6 +1291,11 @@ export default {
         adjust_fast_end_time:'调整断食结束时间',
         adjust_sleep_goal:'调整睡眠目标',
         adjust_bed_time:'调整就寝时间',
-        adjust_wake_up:'调整起床时间'
+        adjust_wake_up:'调整起床时间',
+        elapsed:'时间已过 {{percent}}',
+
+        view_in_moments:'去搭子圈查看',
+        what_eating:'吃点什么?',
+        share_to_moment:'分享到搭子圈',
     }
 }

+ 15 - 7
src/features/health/MainHistory.tsx

@@ -77,11 +77,19 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
         }
     }, [user.isLogin])
 
-    useEffect(()=>{
-        return ()=>{
+    useEffect(() => {
+        return () => {
             myScrollTop = 0
         }
-    },[])
+    }, [])
+
+    // useEffect(() => {
+    //     Taro.eventCenter.on('refresh_timeline', refresh)
+
+    //     return () => {
+    //         Taro.eventCenter.off('refresh_timeline')
+    //     }
+    // }, [])
 
     global.refreshHistory = () => {
         refresh()
@@ -143,7 +151,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
     }, [health.mode])
 
     function measureItemLayouts() {
-        
+
         list.forEach((item, index) => {
             query.select(`#history-${index}`).boundingClientRect()
         });
@@ -293,7 +301,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
                                             title: moment.title,
                                             description: moment.description,
                                             url: moment.media[0].url,
-                                            urls:moment.media,
+                                            urls: moment.media,
                                             event_id: event.id
                                         }
                                     ]
@@ -363,7 +371,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
         setLoading(true)
         records(params).then(res => {
             var array = (res as any).data
-            
+
 
             array.map(item => {
                 var temps: any = []
@@ -425,7 +433,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
                                             title: moment.title,
                                             description: moment.description,
                                             url: moment.media[0].url,
-                                            urls:moment.media,
+                                            urls: moment.media,
                                             event_id: event.id
                                         }
                                     ]

+ 1 - 1
src/pages/clock/components/choose_actions.scss

@@ -5,7 +5,7 @@
     top: 0;
     width: 100vw;
     height: 100vh;
-    background-color: rgba($color: #000, $alpha: 0.9);
+    background-color: rgba($color: #000, $alpha: 0.95);
     display: flex;
     flex-direction: column;
     align-items: center;

+ 28 - 22
src/pages/clock/components/choose_actions.tsx

@@ -8,11 +8,12 @@ import { BASE_IMG_URL, baseUrl } from '@/services/http/api'
 import { useTranslation } from 'react-i18next'
 import { jumpPage } from '@/features/trackTimeDuration/hooks/Common'
 import { MainColorType } from '@/context/themes/color'
-import { useEffect } from 'node_modules/@types/react'
+import { useEffect, useState } from 'react'
 
 export default function ChooseActions(props: { close: any, quick: any, chooseText: any, chooseImg: any }) {
     const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
     const navigationBarHeight = systemInfo.statusBarHeight + 44;
+    const [hideContent, setHideContent] = useState(false)
     const { t } = useTranslation()
 
     function camera() {
@@ -28,6 +29,7 @@ export default function ChooseActions(props: { close: any, quick: any, chooseTex
             count: 9,
             type: 'image',
             success: async function (res) {
+                setHideContent(true)
                 const results = await Promise.all(res.tempFiles.map(getImageInfo));
                 chooseSuccess(results, true)
             },
@@ -57,6 +59,7 @@ export default function ChooseActions(props: { close: any, quick: any, chooseTex
             mediaType: ['image'],
             sourceType: source,
             success: async function (res) {
+                setHideContent(true)
                 const results = await Promise.all(res.tempFiles.map(getImageInfo));
 
 
@@ -186,28 +189,31 @@ export default function ChooseActions(props: { close: any, quick: any, chooseTex
                 </View>
             </View>
         </View>
-        <NewButton type={NewButtonType.img} onClick={album}>
-            <View className='action_btn h30 bold cardShowAni'>{t('health.add_photos')}
-                <Image className='action_btn_img' src={BASE_IMG_URL + 'image.svg'} />
-            </View>
-        </NewButton>
-        <NewButton type={NewButtonType.img} onClick={text}>
-            <View className='action_btn h30 bold cardShowAni'>{t('health.add_text')}
-                <Image className='action_btn_img' src={BASE_IMG_URL + 'text.svg'} />
-            </View>
-        </NewButton>
-        <NewButton type={NewButtonType.img} onClick={camera}>
-            <View className='action_btn h30 bold cardShowAni'>{t('health.camera2')}
-                <Image className='action_btn_img' src={BASE_IMG_URL + 'camera.svg'} />
-            </View>
-        </NewButton>
+        <View style={{ opacity: hideContent ? 0 : 1 }}>
+            <NewButton type={NewButtonType.img} onClick={album}>
+                <View className='action_btn h30 bold cardShowAni'>{t('health.add_photos')}
+                    <Image className='action_btn_img' src={BASE_IMG_URL + 'image.svg'} />
+                </View>
+            </NewButton>
+            <NewButton type={NewButtonType.img} onClick={text}>
+                <View className='action_btn h30 bold cardShowAni'>{t('health.add_text')}
+                    <Image className='action_btn_img' src={BASE_IMG_URL + 'text.svg'} />
+                </View>
+            </NewButton>
+            <NewButton type={NewButtonType.img} onClick={camera}>
+                <View className='action_btn h30 bold cardShowAni'>{t('health.camera2')}
+                    <Image className='action_btn_img' src={BASE_IMG_URL + 'camera.svg'} />
+                </View>
+            </NewButton>
+
+            <NewButton type={NewButtonType.img} onClick={chat}>
+                <View className='action_btn h30 bold cardShowAni'>{t('health.import_chat')}
+                    <Image className='action_btn_img' src={BASE_IMG_URL + 'wechat.svg'} />
+                </View>
+            </NewButton>
+            <View style={{ height: rpxToPx(120) }} />
+        </View>
 
-        <NewButton type={NewButtonType.img} onClick={chat}>
-            <View className='action_btn h30 bold cardShowAni'>{t('health.import_chat')}
-                <Image className='action_btn_img' src={BASE_IMG_URL + 'wechat.svg'} />
-            </View>
-        </NewButton>
-        <View style={{height:rpxToPx(120)}}/>
 
         {/* <View className='cardShowAni' style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', height: rpxToPx(64), marginTop: rpxToPx(26) }}>
             <View className='or_line'/>

+ 75 - 2
src/pages/moment/moment_item.tsx

@@ -15,6 +15,12 @@ import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import { IconActive, IconShare } from "@/components/basic/Icons";
 import Taro from "@tarojs/taro";
 import LongCard from "@/_moment/components/long_card";
+import NewButton, { NewButtonType } from "@/_health/base/new_button";
+import { useSelector } from "react-redux";
+import showActionSheet from "@/components/basic/ActionSheet";
+import { useTranslation } from "react-i18next";
+import showAlert from "@/components/basic/Alert";
+import { delEvents } from "@/services/health";
 
 dayjs.extend(relativeTime);
 dayjs.extend(isToday);
@@ -23,9 +29,11 @@ dayjs.extend(isYesterday);
 
 
 
-export default function MomentItem(props: { data: any }) {
+export default function MomentItem(props: { data: any, del?: any }) {
     const scale = '?x-oss-process=image/format,jpg/resize,w_400'
+    const my = useSelector((state: any) => state.user);
     const { link, moment, user, join } = props.data
+    const { t } = useTranslation()
 
     const formatImages = (list) => {
         return list.map(obj => obj.url);
@@ -82,6 +90,53 @@ export default function MomentItem(props: { data: any }) {
 
     }
 
+    function tapMore() {
+        var list: any = [];
+        if (link.window != 'ACTIVE' && link.window != 'EAT') {
+            list = [t('health.delete')]
+        }
+        else {
+            list = [t('health.edit'), t('health.delete')]
+        }
+        showActionSheet({
+            // showActionSheetWithOptions: showActionSheetWithOptions,
+            title: t('health.more_actions'),
+            itemList: list,
+            success: (res) => {
+                if (res >= 0) {
+                    if (list[res] == t('health.delete')) {
+                        // dispatch(setFirstEatId(''))
+                        // dispatch(setFirstActiveId(''))
+                        del()
+                    }
+                    else if (list[res] == t('health.edit')) {
+                        edit()
+                    }
+                }
+            }
+        })
+    }
+
+    function edit() {
+        jumpPage(`/_record/pages/log_record?edit=1&id=${link.event_id}&scenario=${link.scenario}`)
+    }
+
+    function del() {
+        showAlert({
+            title: t('health.del_title'),
+            content: '',
+            cancelText: t('health.del_cancel'),
+            confirmText: t('health.del_confirm'),
+            showCancel: true,
+            confirm: () => {
+                delEvents(link.event_id).then(res => {
+                    if (props.del)
+                        props.del()
+                })
+            }
+        })
+    }
+
     const kSpace = rpxToPx(12)
     const hasMedia = moment.media.length > 0
     const hasLink = link && (link.ring || link.move)
@@ -141,14 +196,32 @@ export default function MomentItem(props: { data: any }) {
             }
 
             <View style={{ padding: kSpace }} />
-            <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', height: rpxToPx(44) }}>
+            <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', height: rpxToPx(44) }}>
                 <View className="h26 g02">{dayjs(moment.timestamp).fromNow()}</View>
+                <View style={{ flex: 1 }} />
                 {/* {
                     link && link.scenario != 'MOVE' && <View className="item_share_bg" onClick={tapShare}>
                         <IconShare color={MainColorType.g02} width={20} />
                         <Button className="item_share" openType="share" onClick={() => { global.momentShareData = props.data; }}></Button>
                     </View>
                 } */}
+                {/* if (!detail.share_user || user.id == detail.share_user.id) {
+                            return <NewButton
+                    type={NewButtonType.more}
+                    onClick={tapMore}
+                />
+                        } */}
+                <NewButton type={NewButtonType.custom} onClick={tapShare}>
+                    <IconShare color={MainColorType.g02} width={20} />
+                </NewButton>
+                {my.isLogin && my.id == user.id && <View style={{width:rpxToPx(16)}}/>}
+                {
+                    my.isLogin && my.id == user.id && <NewButton
+                        type={NewButtonType.more}
+                        onClick={tapMore}
+                    />
+                }
+
 
             </View>
         </View>

+ 21 - 1
src/pages/moment/moment_main.tsx

@@ -104,11 +104,15 @@ export default function MomentMain() {
         Taro.eventCenter.on('unfollowUser', listenUnfollowUser)
         Taro.eventCenter.on('refreshMoments', refreshMoments)
         Taro.eventCenter.on('moment_share', momentShare)
+
+        Taro.eventCenter.on('refresh_timeline', refreshItem)
+        //Taro.eventCenter.trigger('refresh_timeline',(res as any).feed_item)
         return () => {
             Taro.eventCenter.off('followUser')
             Taro.eventCenter.off('unfollowUser')
             Taro.eventCenter.off('refreshMoments')
             Taro.eventCenter.off('moment_share')
+            Taro.eventCenter.off('refresh_timeline')
             clearInterval(timer)
         }
 
@@ -129,6 +133,16 @@ export default function MomentMain() {
         myFriends()
     }
 
+    function refreshItem(e){
+        var list = JSON.parse(JSON.stringify(moments))
+        list.map((item)=>{
+            if (item.id == e.id){
+                return e
+            }
+        })
+        setMoments(list)
+    }
+
     function momentShare(e) {
         setShareInfo(e)
         setShowShareGuide(true)
@@ -502,7 +516,13 @@ export default function MomentMain() {
 
                             }
                             return <View key={index} id={`history2-${index}`}>
-                                <MomentItem data={item} />
+                                <MomentItem data={item} del={
+                                    ()=>{
+                                        var list = JSON.parse(JSON.stringify(moments))
+                                        list.splice(index,1)
+                                        setMoments(list)
+                                    }
+                                }/>
                             </View>
                         })
                     }

+ 14 - 1
src/services/health.tsx

@@ -1,5 +1,5 @@
 import { reject } from "lodash";
-import { API_ACTIVE_MOVES, API_ACTIVE_MOVES_CURRENT, API_ACTIVE_MOVES_SCHEDULES, API_HEALTH_ARCHIVED, API_HEALTH_CLOCK, API_HEALTH_EVENTS, API_HEALTH_FAST_SLEEP, API_HEALTH_LABELS_EVENT, API_HEALTH_LABELS_TIME, API_HEALTH_MOMENT, API_HEALTH_RECORD, API_HEALTH_SCHEDULES, API_HEALTH_STREAKS, API_HEALTH_WINDOWS, API_HEALTH_FAST, API_ME_ALBUMS, API_ME_ALBUMS_STAT, API_ME_JOURNALS, API_HEALTH_SCHEDULES_ORDERS, API_LASTEST_JOURNAL, API_USER_HOME, API_USER_TAGS, API_USER_EVENTS, API_CHECK_SUMMARY } from "./http/api";
+import { API_ACTIVE_MOVES, API_ACTIVE_MOVES_CURRENT, API_ACTIVE_MOVES_SCHEDULES, API_HEALTH_ARCHIVED, API_HEALTH_CLOCK, API_HEALTH_EVENTS, API_HEALTH_FAST_SLEEP, API_HEALTH_LABELS_EVENT, API_HEALTH_LABELS_TIME, API_HEALTH_MOMENT, API_HEALTH_RECORD, API_HEALTH_SCHEDULES, API_HEALTH_STREAKS, API_HEALTH_WINDOWS, API_HEALTH_FAST, API_ME_ALBUMS, API_ME_ALBUMS_STAT, API_ME_JOURNALS, API_HEALTH_SCHEDULES_ORDERS, API_LASTEST_JOURNAL, API_USER_HOME, API_USER_TAGS, API_USER_EVENTS, API_CHECK_SUMMARY, API_CHECK_SUMMARIES } from "./http/api";
 import { request } from "./http/request";
 
 export const getLabelsEvent = (params) => {
@@ -511,6 +511,19 @@ export const checkSummary = (params) => {
     })
 }
 
+export const checkSummaries = () => {
+    return new Promise((resolve, reject) => {
+        request({
+            url: API_CHECK_SUMMARIES, method: 'GET', data: { }
+        }).then(res => {
+            resolve(res);
+            // dispatch(loginSuccess(res));
+        }).catch(e => {
+            reject(e)
+        })
+    })
+}
+
 export const eventDetail = (id) =>{
     return new Promise((resolve, reject) => {
         request({

+ 2 - 1
src/services/http/api.js

@@ -139,4 +139,5 @@ export const API_JOIN_HISTORY = `${baseUrl}/api/join/histories` //完整接龙
 export const API_USER_HOME = `${baseUrl}/api/user/home`
 export const API_USER_TAGS = `${baseUrl}/api/user/tags`
 export const API_USER_EVENTS = `${baseUrl}/api/user/events`
-export const API_CHECK_SUMMARY = `${baseUrl}/api/user/check-in-summary`
+export const API_CHECK_SUMMARY = `${baseUrl}/api/user/check-in-summary`
+export const API_CHECK_SUMMARIES = `${baseUrl}/api/user/check-in-summaries`