leon 1 年之前
父節點
當前提交
11a8df3e12

+ 1 - 1
config/env.ts

@@ -1,4 +1,4 @@
 
 export const APP_VERSION = '1.0.2'
 export const ANDROID_VERSION = '1.0.0'
-export const WX_VERSION = '1.5.0'
+export const WX_VERSION = '1.5.1'

+ 18 - 11
src/_health/pages/log_time.tsx

@@ -176,6 +176,7 @@ export default function LogTime() {
         const { fast, sleep, status } = res
 
         var list: any = []
+        debugger
         if (isSingle) {
             var timeline: any;
             var time = dayjs().format('HH:mm')
@@ -345,17 +346,21 @@ export default function LogTime() {
                 list[0].time = dayjs(fast.real.start_timestamp).format('HH:mm')
             }
 
-            if (sleep.real && sleep.real.start_timestamp) {
-                list[1].date = dayjs(sleep.real.start_timestamp).format('YYYY-MM-DD')
-                list[1].disable = true
-                list[1].time = dayjs(sleep.real.start_timestamp).format('HH:mm')
-            }
+            if (isFastWithSleep) {
+                if (sleep.real && sleep.real.start_timestamp) {
+                    list[1].date = dayjs(sleep.real.start_timestamp).format('YYYY-MM-DD')
+                    list[1].disable = true
+                    list[1].time = dayjs(sleep.real.start_timestamp).format('HH:mm')
+                }
 
-            if (list.length > 2 && sleep.real && sleep.real.end_timestamp) {
-                list[2].date = dayjs(sleep.real.end_timestamp).format('YYYY-MM-DD')
-                list[2].disable = true
-                list[2].time = dayjs(sleep.real.end_timestamp).format('HH:mm')
+                if (list.length > 2 && sleep.real && sleep.real.end_timestamp) {
+                    list[2].date = dayjs(sleep.real.end_timestamp).format('YYYY-MM-DD')
+                    list[2].disable = true
+                    list[2].time = dayjs(sleep.real.end_timestamp).format('HH:mm')
+                }
             }
+
+
         }
 
         if (status == 'OG2_NO1' && isFastWithSleep) {
@@ -851,8 +856,8 @@ export default function LogTime() {
         }
         else {
             var timeline = index == 1 ? sleep.timeline[0] : sleep.timeline[1]
-            if (isSingle){
-                timeline = sleep.timeline[0]
+            if (isSingle) {
+                timeline = iStart ? sleep.timeline[0] : sleep.timeline[1]
             }
             if (status == 'WFS') {
                 min = enterTime - 24 * 3600 * 1000
@@ -903,6 +908,7 @@ export default function LogTime() {
             }
         }
         else {
+            debugger
             schedule_time = iStart ? sleep.period.start_time : sleep.period.end_time
             schedule_id = iStart ? sleep.timeline[0].schedule_id : sleep.timeline[1].schedule_id
             if (!iStart && sleep.status == 'OG') {
@@ -937,6 +943,7 @@ export default function LogTime() {
                 }
                 return null
             }
+            debugger
             return timeline.target.timestamp
         }
         return <ChooseDateTime

+ 1 - 1
src/_health/pages/move_schedule.tsx

@@ -165,7 +165,7 @@ export default function MoveSchedule() {
                                 status={<StatusIndicator type={StatusType.normal}
                                     color={MainColorType.active}
                                     text={t('health.waking_hour') + (index + 1)} />}
-                                title={t('health.check_begin_at',{time:open+':50'})}
+                                title={t('health.check_begin_at2',{time:open+':50'})}
                                 description={`${parseInt(start) < new Date().getHours() ? '' : ''}${start}:00-${end}:00`}
                                 subDesc={<Text className="schedule_item_time">  {firstTime(index)}</Text>}
                                 right={<View style={{

+ 1 - 1
src/_health/pages/move_setting_reminder.tsx

@@ -50,7 +50,7 @@ export default function MoveSettingReminder() {
                                 status={<StatusIndicator type={StatusType.normal}
                                     color={MainColorType.active}
                                     text={t('health.waking_hour') + (index + 1)} />}
-                                title={t('health.check_begin_at',{time:item.reminder_time})}
+                                title={t('health.check_begin_at2',{time:item.reminder_time})}
                                 description={`${item.title}`}
                                 subDesc={<Text className="schedule_item_time"></Text>}
                                 right={<View style={{

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

@@ -1112,6 +1112,7 @@ export default {
         see_full_check: 'See Full Check-In Schedule',
 
         check_begin_at: 'Check-in begins {{time}}',
+        check_begin_at2: '{{time}} Check-in begins',
         check_reopen:'Check-In reopens {{time}}',
         kcal: ' kcal',
         km: ' km',

+ 1 - 0
src/context/locales/zh.js

@@ -1115,6 +1115,7 @@ export default {
         see_full_check: '查看完整打卡日程',
 
         check_begin_at: '打卡将于 {{time}} 开放',
+        check_begin_at2: '{{time}} 打卡开放',
         check_reopen:'打卡将于{{time}}重新开放',
         kcal: ' 千卡',
         km: ' 公里',

+ 58 - 8
src/features/health/MainSwiper.tsx

@@ -11,10 +11,21 @@ import { MainColorType } from "@/context/themes/color";
 import { rpxToPx } from "@/utils/tools";
 import dayjs from "dayjs";
 import { useTranslation } from "react-i18next";
+import { useRouter } from "@tarojs/taro";
 
 
 let scrollPage = 0;
 let maxScale = 0.75
+let useRoute;
+let useNavigation;
+let scenario = '';
+let AppState;
+if (process.env.TARO_ENV == 'rn') {
+    useRoute = require("@react-navigation/native").useRoute
+    useNavigation = require("@react-navigation/native").useNavigation
+    AppState = require("react-native").AppState
+}
+
 export default function MainSwiper(props: { count: number, pageChanged: Function, typeChanged: Function }) {
     const [current, setCurrent] = useState(1)
     const [type, setType] = useState(WindowType.day)
@@ -24,12 +35,51 @@ export default function MainSwiper(props: { count: number, pageChanged: Function
     const [scale1, setScale1] = useState(maxScale)
     const [scale2, setScale2] = useState(maxScale)
 
-    const {t} = useTranslation()
+    const { t } = useTranslation()
     const dispatch = useDispatch()
 
-    useEffect(()=>{
+    let router
+    let navigation;
+    if (useNavigation) {
+        navigation = useNavigation()
+    }
+
+    if (process.env.TARO_ENV == 'rn') {
+        router = useRoute()
+    }
+    else {
+        router = useRouter()
+    }
+
+
+    useEffect(() => {
+        // if (router.params && router.params.window) {
+        //     switch (router.params.window) {
+        //         case 'day':
+        //         case 'night':
+        //             console.log('a')
+        //             dispatch(setTab(0))
+        //             setCurrent(0)
+        //             break
+        //         case 'fast':
+        //         case 'eat':
+        //             console.log('b')
+        //             dispatch(setTab(1))
+        //             setCurrent(1)
+        //             break
+        //         case 'sleep':
+        //         case 'active':
+        //             console.log('c')
+        //             dispatch(setTab(2))
+        //             setCurrent(2)
+        //             break
+        //     }
+        // }
+        // else {
         dispatch(setTab(1))
-    },[])
+        // }
+
+    }, [])
 
     function pageChanged(e) {
         const page = e.detail.current
@@ -161,12 +211,12 @@ export default function MainSwiper(props: { count: number, pageChanged: Function
         scrollPage = current
     }
 
-    global.switchTap = ()=>{
+    global.switchTap = () => {
         switchMode()
     }
 
     function switchMode() {
-        console.log('swiper switch',health.mode)
+        console.log('swiper switch', health.mode)
         switch (health.mode) {
             case 'FAST':
                 dispatch(setMode('EAT'));
@@ -191,14 +241,14 @@ export default function MainSwiper(props: { count: number, pageChanged: Function
     }
 
     return <View style={{ flexDirection: 'column', display: 'flex', alignItems: 'center' }}>
-        <Text className="h50 bold" style={{marginTop:rpxToPx(24)}}>{t('health.today')}</Text>
+        <Text className="h50 bold" style={{ marginTop: rpxToPx(24) }}>{t('health.today')}</Text>
         <Text className="main_date g01" >{global.language == 'en' ? dayjs().format('dddd, MMM D') : dayjs().format('MMMD日 dddd')}</Text>
         <Swiper
             onTransition={onTransition}
             onAnimationFinish={onTransitionend}
             style={{ height: rpxToPx(218), width: rpxToPx(634) }} circular
-            previousMargin={rpxToPx(634/3)}
-            nextMargin={rpxToPx(634/3)}
+            previousMargin={rpxToPx(634 / 3)}
+            nextMargin={rpxToPx(634 / 3)}
             onChange={pageChanged}
             current={current}>
             <SwiperItem>