Leon 1 년 전
부모
커밋
5d4de1e53c

+ 3 - 2
src/_record/components/ring_progress.weapp.tsx

@@ -25,6 +25,7 @@ export default function RingProgress(props: {
     shareBg?: any;
     shareCover?: any;
     isCompleted?: boolean;
+    checkImgUrl?:string;
 }) {
     const canvasId = props.canvasId ?? new Date().getTime() + ''
     const info = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync()
@@ -209,7 +210,7 @@ export default function RingProgress(props: {
             }
             if (goal) {
                 ctx.font = `bold ${rpxToPx(30)}px sans-serif`
-                ctx.fillStyle = MainColorType.orange
+                ctx.fillStyle = color??MainColorType.orange
                 ctx.textAlign = 'center'
                 ctx.textBaseline = 'top';
                 ctx.fillText(goal, rpxToPx(450), rpxToPx(416));
@@ -237,7 +238,7 @@ export default function RingProgress(props: {
 
                 if (!checkImg) {
                     const img1 = _canvas.createImage(); // 创建图像对象
-                    img1.src = global.checkImg
+                    img1.src = props.checkImgUrl??global.checkImg
                     img1.onload = () => {
                         console.log('begin draw img')
                         ctx.beginPath();

+ 150 - 13
src/pages/clock/ClockIndex.tsx

@@ -6,7 +6,7 @@ import { IconClose, IconNext } from "@/components/basic/Icons";
 import { rpxToPx } from "@/utils/tools";
 import { useDispatch, useSelector } from "react-redux";
 import { useEffect, useRef, useState } from "react";
-import { homeInfo } from "@/services/health";
+import { homeInfo, windows } from "@/services/health";
 import dayjs from "dayjs";
 import 'dayjs/locale/zh-cn';
 import 'dayjs/locale/en';
@@ -27,6 +27,7 @@ import RecordLog from "./components/record_log";
 import PickerCard from "@/_record/components/picker_card";
 import LogPublish from "./components/log_publish";
 import RecordTimeResult from "./components/record_time_result";
+import { setFastWithSleep, setWindows } from "@/store/health";
 
 var timer
 let useNavigation, LinearGradient;
@@ -55,6 +56,7 @@ export default function ClockIndex() {
     const [selScenario, setSelScenario] = useState('')
     const [selTag, setSelTag] = useState<any>(null)
     const [scenarios, setScenarios] = useState<any>([])
+    const [tabs, setTabs] = useState<any>([])
     const dispatch = useDispatch();
     const { t } = useTranslation()
     global.dispatch = dispatch;
@@ -96,19 +98,89 @@ export default function ClockIndex() {
     }, [showDatePicker, showDurationPicker, showEndDatePicker])
 
     function getHomeData() {
+        getWindows()
         homeInfo().then(res => {
             setLoaded(true)
             setHome(res)
             setCount(1)
-            setScenarios((res as any).scenarios ?? [])
+
             dispatch(setEvents((res as any).events))
             dispatch(setActions((res as any).actions))
+            if ((res as any).scenarios) {
+                setScenarios((res as any).scenarios)
+                var active_scenario = (res as any).active_scenario
+                setTabs((res as any).scenarios.map(((item, index) => {
+                    if (item.scenario == active_scenario) {
+                        setCurrent(index)
+                    }
+                    return item.title
+                })))
+            }
             setShowRetry(false)
         }).catch(e => {
             setShowRetry(true)
         })
     }
 
+    function getWindows() {
+        windows().then(res => {
+            // setLoaded(true)
+            // setShowRetry(false)
+            // if (!(res as any).windows.night_day.night.target) {
+            //     var date = new Date()
+            //     var hour = date.getHours()
+            //     if (hour >= 6 && hour < 18) {
+            //         var date1 = new Date()
+            //         date1.setHours(6)
+            //         date1.setMinutes(0)
+            //         date1.setSeconds(0)
+
+            //         var date2 = new Date()
+            //         date2.setHours(18)
+            //         date2.setMinutes(0)
+            //         date2.setSeconds(0);
+
+            //         (res as any).windows.night_day.day.target = {
+            //             start_timestamp: date1.getTime(),
+            //             end_timestamp: date2.getTime(),
+            //             duration: 12 * 60 * 60 * 1000
+            //         };
+
+            //         (res as any).windows.night_day.night.target = {
+            //             start_timestamp: date2.getTime(),
+            //             end_timestamp: date2.getTime() + 12 * 60 * 60 * 1000,
+            //             duration: 12 * 60 * 60 * 1000
+            //         }
+            //     }
+            //     else {
+            //         var date1 = new Date()
+            //         date1.setHours(18)
+            //         date1.setMinutes(0)
+            //         date1.setSeconds(0);
+
+            //         (res as any).windows.night_day.day.target = {
+            //             start_timestamp: date1.getTime(),
+            //             end_timestamp: date1.getTime() + 12 * 60 * 60 * 1000,
+            //             duration: 12 * 60 * 60 * 1000
+            //         };
+
+            //         (res as any).windows.night_day.night.target = {
+            //             start_timestamp: date1.getTime() + 12 * 60 * 60 * 1000,
+            //             end_timestamp: date1.getTime() + 12 * 60 * 60 * 1000 + 12 * 60 * 60 * 1000,
+            //             duration: 12 * 60 * 60 * 1000
+            //         }
+            //     }
+            // }
+            dispatch(setFastWithSleep((res as any).fast_with_sleep))
+            dispatch(setWindows((res as any).windows))
+            // dispatch(setLongFast((res as any).long_fast))
+            // dispatch(setRefreshs((res as any).refresh_timestamps))
+            // dispatch(setFinishSetup((res as any).finish_setup))
+
+        }).catch(e => {
+        })
+    }
+
     useEffect(() => {
         getInfo()
         Taro.eventCenter.on('refreshClockIndex', getHomeData)
@@ -231,12 +303,19 @@ export default function ClockIndex() {
     }
 
 
+    const array = global.language == 'en' ? ['Eat', 'Workout', 'Fast', 'Sleep'] : ['饮食', '运动', '断食', '睡眠']
+    if (!loaded && showRetry) return <View style={{ position: 'relative' }}>
+        <View style={{ height: navigationBarHeight }} />
+        <IndexTab items={array} current={current} onChanged={(index) => {
+            setCurrent(index)
+        }} />
+        <NoData refresh={
+            () => {
+                getHomeData()
+            }
+        } />
 
-    if (!loaded && showRetry) return <NoData refresh={
-        () => {
-            getHomeData()
-        }
-    } />
+    </View>
 
     function bgView() {
         if (process.env.TARO_ENV == 'weapp') {
@@ -277,13 +356,71 @@ export default function ClockIndex() {
             bgView()
         }
         <View style={{ height: navigationBarHeight }} />
-        <IndexTab items={['Fast', 'Sleep', 'Eat', 'Move']} current={current} onChanged={(index)=>{
+        <IndexTab items={tabs} current={current} onChanged={(index) => {
             setCurrent(index)
-        }}/>
-        <Swiper style={{ height: swiperHeight(), width: rpxToPx(750) }} current={current} onChange={e=>{
+        }} />
+        <Swiper style={{ height: swiperHeight(), width: rpxToPx(750) }} current={current} onChange={e => {
             setCurrent(e.detail.current)
         }}>
-            <SwiperItem>
+            {
+                scenarios.map((item, index) => {
+                    return <SwiperItem key={index}>
+                        {
+                            item.scenario == 'FAST' && <RecordTime scenario="FAST"
+                                event={item.event}
+                                theme_color={item.theme_color}
+                                contentHeight={swiperHeight()}
+                                showPicker={showPicker}
+                                hidePicker={hidePicker}
+                                complete={info => {
+                                    setTimeResult(info)
+                                    setSelScenario('FAST')
+                                    setShowTimeResult(true)
+                                }}
+                                count={count} />
+                        }
+                        {
+                            item.scenario == 'SLEEP' && <RecordTime scenario="SLEEP"
+                                event={item.event}
+                                theme_color={item.theme_color}
+                                contentHeight={swiperHeight()}
+                                showPicker={showPicker} hidePicker={hidePicker}
+                                complete={info => {
+                                    setTimeResult(info)
+                                    setSelScenario('SLEEP')
+                                    setShowTimeResult(true)
+                                }}
+                                count={count} />
+                        }
+                        {
+                            item.scenario == 'MEAL' && <RecordLog scenario="MEAL"
+                                tags={item.tags}
+                                contentHeight={swiperHeight()}
+                                showPublish={(scenario, tag, tags, addTag) => {
+                                    setAddTag(addTag)
+                                    setShowLogPublish(true)
+                                    setSelScenario(scenario)
+                                    setSelTag(tag)
+                                    setTags(tags)
+                                }} />
+                        }
+                        {
+                            item.scenario == 'ACTIVITY' && <RecordLog
+                                tags={item.tags}
+                                scenario="ACTIVITY"
+                                contentHeight={swiperHeight()}
+                                showPublish={(scenario, tag, tags, addTag) => {
+                                    setAddTag(addTag)
+                                    setShowLogPublish(true)
+                                    setSelScenario(scenario)
+                                    setSelTag(tag)
+                                    setTags(tags)
+                                }} />
+                        }
+                    </SwiperItem>
+                })
+            }
+            {/* <SwiperItem>
                 <RecordTime scenario="FAST"
                     contentHeight={swiperHeight()}
                     showPicker={showPicker}
@@ -323,7 +460,7 @@ export default function ClockIndex() {
                     setSelTag(tag)
                     setTags(tags)
                 }} />
-            </SwiperItem>
+            </SwiperItem> */}
         </Swiper>
         {
             showChoose && <ChooseActions
@@ -409,7 +546,7 @@ export default function ClockIndex() {
                     scenario={selScenario}
                     info={timeResult}
                     goEat={() => {
-                        setCurrent(2)
+                        setCurrent(0)
                         setShowTimeResult(false)
                     }}
                 />

+ 2 - 1
src/pages/clock/components/index_tab.tsx

@@ -10,7 +10,8 @@ export default function IndexTab(props: { items: any, current: number,onChanged:
     useEffect(()=>{
         setSelIndex(props.current)
     },[props.current])
-    return <View className="index_tabbar">
+    
+    return <View className="index_tabbar" style={{alignItems:'center',justifyContent:'center'}}>
         {
             props.items.map((item, index) => {
                 return <NewButton type={NewButtonType.custom} key={index} onClick={()=>{

+ 32 - 5
src/pages/clock/components/log_tags.tsx

@@ -1,24 +1,31 @@
-import { View,Image } from "@tarojs/components";
+import { View, Image } from "@tarojs/components";
 import './log_tags.scss'
 import NewButton, { NewButtonType } from "@/_health/base/new_button";
 import { MainColorType } from "@/context/themes/color";
-import { IconAdd } from "@/components/basic/Icons";
+import { IconAdd, IconArrow } from "@/components/basic/Icons";
 import { rpxToPx } from "@/utils/tools";
 import { BASE_IMG_URL } from "@/services/http/api";
 import { useTranslation } from "react-i18next";
+import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
+import { useSelector } from "react-redux";
 
 export default function LogTags(props: { tags: any, scenario: any, showPublish: any }) {
-    const {t} = useTranslation()
+    const user = useSelector((state: any) => state.user);
+    const { t } = useTranslation()
     return <View className="tag_operate_bg">
         {
             props.tags.map((item, index) => {
                 return <NewButton key={index} type={NewButtonType.custom}
                     onClick={() => {
+                        if (!user.isLogin) {
+                            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
+                            return
+                        }
                         // setChooseTitle(item.title)
                         // setPostCount(item.log_count + 1)
                         // setStep(2)
                         // setSelTag(item)
-                        props.showPublish(props.scenario, item,false)
+                        props.showPublish(props.scenario, item, false)
                     }}>
                     <View key={index} className="tag_operate_item h34"
                         style={{ backgroundColor: MainColorType.white_25 }}
@@ -34,7 +41,11 @@ export default function LogTags(props: { tags: any, scenario: any, showPublish:
         <View className="tag_operate_item h34"
             style={{ backgroundColor: MainColorType.white_25, marginBottom: rpxToPx(100) }}
             onClick={() => {
-                props.showPublish(props.scenario, {},true)
+                if (!user.isLogin) {
+                    jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
+                    return
+                }
+                props.showPublish(props.scenario, {}, true)
                 // setTitle('')
                 // setChooseTitle('')
                 // setPostCount(1)
@@ -42,5 +53,21 @@ export default function LogTags(props: { tags: any, scenario: any, showPublish:
             }}><View className="tag_first_letter h36">
                 <Image src={BASE_IMG_URL + 'edit.svg'} style={{ width: rpxToPx(36), height: rpxToPx(36) }} />
             </View>{t('health.custom')}</View>
+        {
+            props.scenario == 'ACTIVITY' && <View className="tag_operate_item h34"
+                style={{ backgroundColor: MainColorType.white_25, marginBottom: rpxToPx(100), marginTop: -rpxToPx(74) }}
+                onClick={() => {
+                    if (!user.isLogin) {
+                        jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
+                        return
+                    }
+                    jumpPage('/_health/pages/move')
+                }}><View className="tag_first_letter h36">
+                    <Image src={BASE_IMG_URL + 'walk.svg'} style={{ width: rpxToPx(36), height: rpxToPx(36) }} />
+                </View>{global.language == 'en' ? 'Move' : '步数'}
+                <View style={{ flex: 1 }} />
+                <IconArrow color={MainColorType.g02} width={rpxToPx(36)} />
+            </View>
+        }
     </View>
 }

+ 48 - 26
src/pages/clock/components/record_log.tsx

@@ -44,7 +44,8 @@ export default function RecordLog(props: {
     contentHeight: number, imgs?: any, only_text?: any, quick?: any, join_id?: any,
     id?: any,
     edit?: any,
-    check_in?: any
+    check_in?: any,
+    tags: any,
 
 }) {
     const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
@@ -166,29 +167,30 @@ export default function RecordLog(props: {
     }, [step])
 
     function getTags() {
-        userTags({ scenario: scenario }).then(res => {
-            if (chooseTitle == '' && !props.edit) {
-                var current = dayjs().format('HH:mm');
-                var isFind = false;
-                (res as any).tags.map(item => {
-                    if (item.time_from && item.time_to) {
-                        if (isInTimeRange(current, item.time_from, item.time_to)) {
-                            isFind = true;
-                            setTitle(item.title)
-                            setChooseTitle(item.title)
-                            setPostCount(item.log_count + 1)
-                        }
-                    }
-                })
-                if (!isFind) {
-                    setTitle((res as any).tags[0].title)
-                    setChooseTitle((res as any).tags[0].title)
-                    setPostCount((res as any).tags[0].log_count + 1)
-                }
-            }
+        setTags(props.tags)
+        // userTags({ scenario: scenario }).then(res => {
+        //     if (chooseTitle == '' && !props.edit) {
+        //         var current = dayjs().format('HH:mm');
+        //         var isFind = false;
+        //         (res as any).tags.map(item => {
+        //             if (item.time_from && item.time_to) {
+        //                 if (isInTimeRange(current, item.time_from, item.time_to)) {
+        //                     isFind = true;
+        //                     setTitle(item.title)
+        //                     setChooseTitle(item.title)
+        //                     setPostCount(item.log_count + 1)
+        //                 }
+        //             }
+        //         })
+        //         if (!isFind) {
+        //             setTitle((res as any).tags[0].title)
+        //             setChooseTitle((res as any).tags[0].title)
+        //             setPostCount((res as any).tags[0].log_count + 1)
+        //         }
+        //     }
 
-            setTags((res as any).tags)
-        })
+        //     setTags((res as any).tags)
+        // })
     }
 
     function isInTimeRange(currentTime, startTime, endTime) {
@@ -571,8 +573,8 @@ export default function RecordLog(props: {
         <View style={{ position: 'relative', overflow: showChoose ? 'hidden' : 'visible' }}>
             {
                 step == 0 && <LogTags tags={tags} scenario={scenario} showPublish={
-                    (scenario,item,addTag) => {
-                        props.showPublish(scenario,item,tags,addTag)
+                    (scenario, item, addTag) => {
+                        props.showPublish(scenario, item, tags, addTag)
                     }
                 } />
             }
@@ -595,6 +597,10 @@ export default function RecordLog(props: {
                             <View className="form_cancel">
                                 <NewButton btnStyle={{ flex: 1 }} type={NewButtonType.img}
                                     onClick={() => {
+                                        if (!user.isLogin) {
+                                            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
+                                            return
+                                        }
                                         setStep(0)
                                     }}
                                 >
@@ -605,7 +611,11 @@ export default function RecordLog(props: {
                                 <NewButton btnStyle={{ flex: 1 }} type={NewButtonType.img}
                                     onClick={() => {
                                         if (title.length == 0) return
-                                        props.showPublish(props.scenario, { title: title },tags,false)
+                                        if (!user.isLogin) {
+                                            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
+                                            return
+                                        }
+                                        props.showPublish(props.scenario, { title: title }, tags, false)
                                         setStep(0)
                                         // setChooseTitle(title)
                                         // setPostCount(1)
@@ -629,6 +639,10 @@ export default function RecordLog(props: {
                         <View style={{ display: 'flex', flexDirection: 'row' }} >
                             <NewButton type={NewButtonType.custom}
                                 onClick={() => {
+                                    if (!user.isLogin) {
+                                        jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
+                                        return
+                                    }
                                     setStep(0)
                                     setFocus(false)
                                 }}>
@@ -665,6 +679,10 @@ export default function RecordLog(props: {
                                             })
                                         }} />
                                         <View className="cover_del" onClick={() => {
+                                            if (!user.isLogin) {
+                                                jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
+                                                return
+                                            }
                                             showAlert({
                                                 title: t('health.del_title'),
                                                 content: '',
@@ -699,6 +717,10 @@ export default function RecordLog(props: {
 
 
                     <View className="time_view" onClick={() => {
+                        if (!user.isLogin) {
+                            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
+                            return
+                        }
                         setShowTimePicker(true)
                     }}>
 

+ 24 - 0
src/pages/clock/components/record_time.scss

@@ -272,4 +272,28 @@
     width: 698px;
     height: 108px;
     border-radius: 28px;
+}
+
+.time_record_card{
+    width: 692px;
+    height: 156px;
+    border-radius: 42px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    margin-top: 26px;
+    background-color: rgba($color: #ffffff, $alpha: 0.25);
+    font-size: 34px;
+    position: relative;
+}
+
+.timer_record_card_arrow{
+    position: absolute;
+    width: 36px;
+    height: 36px;
+    top: 60px;
+    right:50px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
 }

+ 112 - 45
src/pages/clock/components/record_time.tsx

@@ -1,4 +1,4 @@
-import { View, Image, PickerView, PickerViewColumn, Text } from "@tarojs/components";
+import { View, Image, PickerView, PickerViewColumn, Text, ScrollView } from "@tarojs/components";
 import './record_time.scss'
 import Taro, { useRouter, useShareAppMessage } from "@tarojs/taro";
 import { rpxToPx } from "@/utils/tools";
@@ -22,6 +22,8 @@ import FollowInfo from "@/_moment/components/follow_info";
 import MomentDetailShare from "@/pages/moment/moment_detail_share";
 import RingProgress from "@/_record/components/ring_progress.weapp";
 import PickerCard from "@/_record/components/picker_card";
+import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
+import { BASE_IMG_URL } from "@/services/http/api";
 
 
 let timer
@@ -33,7 +35,17 @@ if (process.env.TARO_ENV == 'rn') {
     LinearGradient = require('react-native-linear-gradient').default
 }
 
-export default function RecordTime(props: { scenario: string, join_id?: string, contentHeight: number, showPicker: any, hidePicker: any, count: number, complete: any }) {
+export default function RecordTime(props: {
+    scenario: string,
+    join_id?: string,
+    contentHeight: number,
+    showPicker: any,
+    hidePicker: any,
+    count: number,
+    theme_color: string,
+    complete: any,
+    event: any,
+}) {
     const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
     const navigationBarHeight = systemInfo.statusBarHeight + 44;
     const screenHeight = systemInfo.screenHeight
@@ -136,37 +148,41 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
         }
     }, [status, showDatePicker, showEndDatePicker, showDurationPicker])
 
-
     useEffect(() => {
-        const { events } = record
-        events.map((item) => {
-            if (item.scenario == scenario) {
-                setInfo(item)
-                setStatus(item.status)
-                setLoaded(true)
-            }
-        })
         downloadFile()
-        // timer = setInterval(() => {
-        //     if (picker1Ref.current || picker2Ref.current || picker3Ref.current) return
-        //     if (statusRef.current == 'DONE') return
-        //     setCount(count => count + 1)
-        // }, 1000)
-        // return () => {
-        //     clearInterval(timer)
-        // }
     }, [])
 
+
+    useEffect(() => {
+
+        setInfo(props.event)
+        setStatus(props.event.status)
+        setLoaded(true)
+    }, [props.event])
+
     useEffect(() => {
         setCount(props.count)
     }, [props.count])
 
     function downloadFile() {
         Taro.downloadFile({
-            url: 'https://background-pictures.oss-cn-beijing.aliyuncs.com/inapp/checkmark.png',
+            url: BASE_IMG_URL+'cp_check_f.png',
+            success: (res) => {
+                if (res.statusCode === 200) {
+                    global.checkFastImg = res.tempFilePath
+
+                } else {
+                }
+            },
+            fail: (err) => {
+            }
+        });
+
+        Taro.downloadFile({
+            url: BASE_IMG_URL+'cp_check_s.png',
             success: (res) => {
                 if (res.statusCode === 200) {
-                    global.checkImg = res.tempFilePath
+                    global.checkSleepImg = res.tempFilePath
 
                 } else {
                 }
@@ -219,7 +235,10 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
     function start() {
         // var date = TimeFormatter.stringToDate(selDate, time)
         // date.setMilliseconds(new Date(enterTimestmap).getMilliseconds())
-
+        if (!user.isLogin) {
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
+            return
+        }
 
         var params: any = {
             scenario: scenario, //ACTIVITY
@@ -300,7 +319,10 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
         if (posting) return
         setPosting(true)
         addEvents(params).then(res => {
-            props.complete((res as any).data)
+            var dt = (res as any).data
+            dt.theme_color = props.theme_color
+            props.complete(dt)
+
             // setShowHighlight(true)
             // setTimeout(() => {
             //     setShowHighlight(false)
@@ -308,8 +330,8 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
             // setTimeout(() => {
             //     setShowResult(true)
             // }, 2000)
-            // Taro.eventCenter.trigger('refreshClockIndex')
-            // Taro.eventCenter.trigger('refreshMoments', '')
+            Taro.eventCenter.trigger('refreshClockIndex')
+            Taro.eventCenter.trigger('refreshMoments', '')
             // setInfo((res as any).data)
             // setStatus((res as any).data.status)
             // setShareUrl('')
@@ -380,7 +402,7 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
             return {
                 value: '',
                 footer: '',
-                color: MainColorType.orange,
+                color: props.theme_color ?? MainColorType.orange,
                 result: TimeFormatter.formateDurationBySeconds(info.time.end_timestamp / 1000 - info.time.start_timestamp / 1000),
             }
         }
@@ -391,7 +413,7 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
             return {
                 target: str,
                 goal: t('health.adjust_goal'),
-                color: MainColorType.orange
+                color: props.theme_color ?? MainColorType.orange
             }
         }
         var percent = 100 * (new Date().getTime() - info.time.start_timestamp) / info.time.duration
@@ -451,7 +473,7 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
                     </View>
 
                 </View>
-                <View className="share_card2" style={{ background: MainColorType.orange, marginTop: rpxToPx(26) + navigationBarHeight }}>
+                <View className="share_card2" style={{ background: props.theme_color ?? MainColorType.orange, marginTop: rpxToPx(26) + navigationBarHeight }}>
                     {/* {
                         shareUrl.length > 0 ? <Image src={shareUrl} style={{ width: rpxToPx(900), height: rpxToPx(720) }} /> :
                             <View style={{ width: rpxToPx(900), height: rpxToPx(720), backgroundColor: MainColorType.g02 }} />
@@ -465,13 +487,13 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
                             width: rpxToPx(88)
                         }}
                         real={{
-                            color: MainColorType.orange,
+                            color: props.theme_color ?? MainColorType.orange,
                             width: rpxToPx(16),
                             start: getStartArc(info.time.start_timestamp),
                             duration: getDurationArc(info.time.start_timestamp, info.time.end_timestamp)
                         }}
                         extra={ringExtra()}
-                        shareBg={[MainColorType.orange]}
+                        shareBg={[props.theme_color ?? MainColorType.orange]}
                         isCompleted
                         shareCover={
                             url => {
@@ -484,6 +506,10 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
                             {
                                 showResult ? <View style={{ display: 'flex', flex: 1, flexDirection: 'row' }}>
                                     <NewButton type={NewButtonType.custom} onClick={() => {
+                                        if (!user.isLogin) {
+                                            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
+                                            return
+                                        }
                                         setShowDatePicker(true)
                                     }}>
                                         <View className="operate_item" >
@@ -493,6 +519,10 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
                                         </View>
                                     </NewButton>
                                     <NewButton type={NewButtonType.custom} onClick={() => {
+                                        if (!user.isLogin) {
+                                            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
+                                            return
+                                        }
                                         tapEndPicker()
                                     }}>
                                         <View className="operate_item" >
@@ -610,6 +640,10 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
             <View style={{ height: rpxToPx(26) }} />
             <View className="progress_card">
                 <View onClick={() => {
+                    if (!user.isLogin) {
+                        jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
+                        return
+                    }
                     tapClock()
                     // setShowDurationPicker(true)
                 }}>
@@ -628,7 +662,7 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
                             duration: status == 'WFS' ? getDurationArc(new Date().getTime(), new Date().getTime() + info.time.duration) : getDurationArc(info.time.start_timestamp, info.time.start_timestamp + info.time.duration)
                         }}
                         real={status == 'WFS' ? null : {
-                            color: MainColorType.orange,
+                            color: props.theme_color ?? MainColorType.orange,
                             width: rpxToPx(88),
                             start: getStartArc(info.time.start_timestamp),
                             duration: getDurationArc(info.time.start_timestamp, new Date().getTime())
@@ -646,7 +680,7 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
                                 <View className={showHighlight ? 'card_highlight start_card_show' : ''} />
                                 <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: props.theme_color ?? MainColorType.orange }}>{scenario == 'FAST' ? t('health.adjust_start') : t('health.adjust_bedtime')}</View>
                             </View>
                         </NewButton>
                         <NewButton type={NewButtonType.custom} onClick={() => {
@@ -655,7 +689,7 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
                             <View className="operate_item_index">
                                 <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 className="h30 bold" style={{ color: props.theme_color ?? MainColorType.orange }}>{t('health.adjust_goal')}</View>
                             </View>
                         </NewButton>
                     </View>
@@ -666,7 +700,7 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
                         title={scenario == 'FAST' ? record.actions.FAST_START : record.actions.SLEEP_BEDTIME}
                         width={rpxToPx(490)}
                         height={rpxToPx(108)}
-                        color={MainColorType.orange}
+                        color={props.theme_color ?? MainColorType.orange}
                         onClick={start}
                     />
                 }
@@ -677,7 +711,7 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
                         title={scenario == 'FAST' ? record.actions.FAST_END : record.actions.SLEEP_WAKE_UP}
                         width={rpxToPx(490)}
                         height={rpxToPx(108)}
-                        color={MainColorType.orange}
+                        color={props.theme_color ?? MainColorType.orange}
                         onClick={end}
                     />
                         {/* <NewButton
@@ -781,7 +815,7 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
                                     duration: status == 'WFS' ? getDurationArc(new Date().getTime(), new Date().getTime() + info.time.duration) : getDurationArc(info.time.start_timestamp, info.time.start_timestamp + info.time.duration)
                                 }}
                                 real={status == 'WFS' ? null : {
-                                    color: MainColorType.orange,
+                                    color: props.theme_color ?? MainColorType.orange,
                                     width: rpxToPx(88),
                                     start: getStartArc(info.time.start_timestamp),
                                     duration: getDurationArc(info.time.start_timestamp, new Date().getTime())
@@ -851,14 +885,47 @@ export default function RecordTime(props: { scenario: string, join_id?: string,
             }
         </View>
     }
-    return <View style={{ width: rpxToPx(750), height: 1000, display: 'flex', flexShrink: 0, alignItems: 'center', flexDirection: 'column' }}>
-        {
-            status == 'DONE' ? doneComponent() : render()
-        }
+    return <ScrollView style={{ position: 'relative', zIndex: 1000, height: props.contentHeight }} scrollY>
+        <View style={{ width: rpxToPx(750), display: 'flex', flexShrink: 0, alignItems: 'center', flexDirection: 'column' }}>
+            {
+                status == 'DONE' ? doneComponent() : render()
+            }
+            {
+                scenario == 'FAST' && <NewButton type={NewButtonType.custom} onClick={() => {
+                    if (!user.isLogin) {
+                        jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
+                        return
+                    }
+                    jumpPage('/_health/pages/fast_sleep')
+                }}>
+                    <View className="time_record_card">
+                        {global.language == 'en' ? 'Fast & Sleep' : '断食与睡眠'}
+                        <View className="timer_record_card_arrow">
+                            <IconArrow width={rpxToPx(34)} color={MainColorType.black_25} />
+                        </View>
+                    </View>
+                </NewButton>
+            }
+            <NewButton type={NewButtonType.custom} onClick={() => {
+                if (!user.isLogin) {
+                    jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
+                    return
+                }
+                jumpPage('/pages/metric/Metric')
+            }}>
+                <View className="time_record_card">
+                    {global.language == 'en' ? 'Metrics' : '指标'}
+                    <View className="timer_record_card_arrow">
+                        <IconArrow width={rpxToPx(34)} color={MainColorType.black_25} />
+                    </View>
+                </View>
+            </NewButton>
 
-        <MomentDetailShare
-            user={user}
-            canvas_id={"time_record" + scenario}
-            btnColor={MainColorType.orange} />
-    </View>
+            <MomentDetailShare
+                user={user}
+                canvas_id={"time_record" + scenario}
+                btnColor={props.theme_color ?? MainColorType.orange} />
+            <View style={{ height: 100 }} />
+        </View>
+    </ScrollView>
 }

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

@@ -72,7 +72,7 @@
     margin-top: -40px;
 }
 
-.operate_item {
+.operate_item_result {
     display: flex;
     flex-direction: column;
     align-items: center;

+ 7 - 6
src/pages/clock/components/record_time_result.tsx

@@ -73,7 +73,7 @@ export default function RecordTimeResult(props: { onClose: any, scenario: string
         return {
             value: '',
             footer: '',
-            color: MainColorType.orange,
+            color: info.theme_color ?? MainColorType.orange,
             result: TimeFormatter.formateDurationBySeconds(info.time.end_timestamp / 1000 - info.time.start_timestamp / 1000),
         }
 
@@ -108,7 +108,7 @@ export default function RecordTimeResult(props: { onClose: any, scenario: string
             </View>
 
         </View>
-        <View className="share_card3" style={{ background: MainColorType.orange, marginTop: rpxToPx(26) + navigationBarHeight }}>
+        <View className="share_card3" style={{ background: info.theme_color ?? MainColorType.orange, marginTop: rpxToPx(26) + navigationBarHeight }}>
             {/* {
                             shareUrl.length > 0 ? <Image src={shareUrl} style={{ width: rpxToPx(900), height: rpxToPx(720) }} /> :
                                 <View style={{ width: rpxToPx(900), height: rpxToPx(720), backgroundColor: MainColorType.g02 }} />
@@ -122,13 +122,14 @@ export default function RecordTimeResult(props: { onClose: any, scenario: string
                     width: rpxToPx(88)
                 }}
                 real={{
-                    color: MainColorType.orange,
+                    color: info.theme_color ?? MainColorType.orange,
                     width: rpxToPx(16),
                     start: getStartArc(info.time.start_timestamp),
                     duration: getDurationArc(info.time.start_timestamp, info.time.end_timestamp)
                 }}
                 extra={ringExtra()}
-                shareBg={[MainColorType.orange]}
+                shareBg={[info.theme_color ?? MainColorType.orange]}
+                checkImgUrl={scenario == 'FAST' ? global.checkFastImg : global.checkSleepImg}
                 isCompleted
                 shareCover={
                     url => {
@@ -149,7 +150,7 @@ export default function RecordTimeResult(props: { onClose: any, scenario: string
                                     })
                                 })
                             }}>
-                                <View className="operate_item" >
+                                <View className="operate_item_result" >
                                     <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">{scenario == 'FAST' ? t('health.adjust_start') : t('health.adjust_bedtime')}</View>
@@ -164,7 +165,7 @@ export default function RecordTimeResult(props: { onClose: any, scenario: string
                                     })
                                 })
                             }}>
-                                <View className="operate_item" >
+                                <View className="operate_item_result" >
                                     <View className={showHighlight ? 'card_highlight end_card_show' : ''} />
                                     <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>