Leon vor 2 Jahren
Ursprung
Commit
67b171a710

+ 1 - 7
ios/Podfile.lock

@@ -18,8 +18,6 @@ PODS:
     - ExpoModulesCore
   - EXConstants (14.0.2):
     - ExpoModulesCore
-  - EXErrorRecovery (4.0.1):
-    - ExpoModulesCore
   - EXFileSystem (15.1.1):
     - ExpoModulesCore
   - EXFont (11.0.1):
@@ -470,7 +468,6 @@ DEPENDENCIES:
   - EXBrightness (from `../node_modules/expo-brightness/ios`)
   - EXCamera (from `../node_modules/expo-camera/ios`)
   - EXConstants (from `../node_modules/expo-constants/ios`)
-  - EXErrorRecovery (from `../node_modules/expo-error-recovery/ios`)
   - EXFileSystem (from `../node_modules/expo-file-system/ios`)
   - EXFont (from `../node_modules/expo-font/ios`)
   - EXImageLoader (from `../node_modules/expo-image-loader/ios`)
@@ -592,8 +589,6 @@ EXTERNAL SOURCES:
     :path: "../node_modules/expo-camera/ios"
   EXConstants:
     :path: "../node_modules/expo-constants/ios"
-  EXErrorRecovery:
-    :path: "../node_modules/expo-error-recovery/ios"
   EXFileSystem:
     :path: "../node_modules/expo-file-system/ios"
   EXFont:
@@ -721,7 +716,6 @@ SPEC CHECKSUMS:
   EXBrightness: 1725afacfdaeb4724bb949c44384cff0ef0d7d18
   EXCamera: d7e91d5857faee493ca3cf8dafd42572db61849e
   EXConstants: 3c86653c422dd77e40d10cbbabb3025003977415
-  EXErrorRecovery: ae43433feb0608a64dc5b1c8363b3e7769a9ea24
   EXFileSystem: 60602b6eefa6873f97172c684b7537c9760b50d6
   EXFont: 319606bfe48c33b5b5063fb0994afdc496befe80
   EXImageLoader: 84b65e6bd9d3345d6fbb3ab936a546c54496a64d
@@ -799,4 +793,4 @@ SPEC CHECKSUMS:
 
 PODFILE CHECKSUM: c500841d0cd00b84fdb1d6b4c1b8833eab606c22
 
-COCOAPODS: 1.14.2
+COCOAPODS: 1.14.3

+ 9 - 6
src/components/basic/Buttons.tsx

@@ -31,11 +31,14 @@ export default function Buttons(props: {
     openType?: string,
     btnStyle?: any,
     showLoading?: boolean,
-    lightLoading?:boolean
+    lightLoading?: boolean
 }) {
 
     function onClick(e) {
-        e.stopPropagation()
+        if (process.env.TARO_ENV == 'weapp') {
+            e.stopPropagation()
+        }
+
         if (props.disabled) return
         props.onClick()
     }
@@ -51,7 +54,7 @@ export default function Buttons(props: {
             <Text
                 style={{
                     ...props.btnStyle,
-                    fontWeight: 500,
+                    fontWeight: 'bold',
                 }} className={props.className ? props.className : ''}>{props.title}</Text>
         </View>
     }
@@ -72,7 +75,7 @@ export default function Buttons(props: {
                     style={{
                         color: props.btnStyle.color,
                         fontSize: props.btnStyle.fontSize,
-                        fontWeight: 500,
+                        fontWeight: 'bold',
                         marginBottom: 2
                     }}>{props.title}</Text>
             </View>
@@ -86,7 +89,7 @@ export default function Buttons(props: {
         <View className={mainClass} style={{ ...props.btnStyle, opacity: props.lowLight ? 0.4 : 1 }} onClick={onClick}>
             {
                 props.showLoading && <View style={{ marginBottom: 2, marginRight: 5 }}>
-                    <AtActivityIndicator size={32}  color={props.lightLoading?'#999':'#000'} />
+                    <AtActivityIndicator size={32} color={props.lightLoading ? '#999' : '#000'} />
                 </View>
             }
             <Text
@@ -94,7 +97,7 @@ export default function Buttons(props: {
                 style={{
                     color: props.btnStyle.color,
                     fontSize: props.btnStyle.fontSize,
-                    fontWeight: 500,
+                    fontWeight: 'bold',
                     marginBottom: 2
                 }}>{props.title}</Text>
         </View>

+ 5 - 1
src/components/input/LimitPickers.scss

@@ -1,5 +1,5 @@
 @import '@/utils/common.scss';
-
+/* #ifdef weapp */
 .picker-mask {
     max-width: auto;
     // background: red;
@@ -18,7 +18,11 @@
     background-size: 750px 500px !important;
     height: 500px;
 }
+/* #endif */
+
+/* #ifdef rn */
 
+/* #endif */
 .point_bg1 {
     position: absolute;
     width: 150px;

+ 8 - 1
src/components/input/PickerViews.scss

@@ -1,3 +1,4 @@
+/* #ifdef weapp */
 .picker-mask {
     max-width: auto;
     // background: red;
@@ -17,4 +18,10 @@
     background-size: 750px 400px !important;
     height: 400px;
     color: #fff !important;
-}
+}
+
+/* #endif */
+
+/* #ifdef rn */
+
+/* #endif */

+ 7 - 0
src/components/input/SlidngScale.scss

@@ -128,6 +128,7 @@
     width: 750px;
 }
 
+/* #ifdef weapp */
 .shadow_left {
     pointer-events: none;
     position: absolute;
@@ -158,6 +159,12 @@
     background: linear-gradient(180deg, rgba(182, 225, 252, 0.1) 18%, rgba(28, 28, 28, 0) 100%);
 }
 
+/* #endif */
+
+/* #ifdef rn */
+
+/* #endif */
+
 .center_line {
     width: 24px;
     height: 30px;

+ 1 - 4
src/context/locales/index.ts

@@ -16,7 +16,7 @@ function getLanguageSetting() {
     }
   }
   else {
-    initLocale('zh')
+    initLocale('en')
   }
 }
 
@@ -43,7 +43,4 @@ function initLocale(strLocale: string) {
 }
 
 getLanguageSetting();
-
-
-
 export default i18n;

+ 0 - 1
src/features/common/PostBtn.tsx

@@ -59,7 +59,6 @@ export default function Component(props: {
                 onClick={click}
                 disabled={btnStatus != 'idle'}
                 showLoading={btnStatus == 'abnormal'}
-                // lowLight={btnStatus != 'idle'}
                 btnStyle={props.btnStyle}
                 lightLoading={props.lightLoading}
             />

+ 7 - 7
src/features/common/SpecBtns.tsx

@@ -28,7 +28,7 @@ export const StartFastBtn = (props: { onClick: Function, isLoading?: boolean })
                 // paddingRight: 40,
                 color: 'black',
                 fontSize: 20,
-                fontWeight: 500,
+                fontWeight: 'bold',
                 display: 'flex',
                 alignItems: 'center',
                 justifyContent: 'center',
@@ -51,7 +51,7 @@ export const StartSleepBtn = (props: { onClick: Function, lowLight?: boolean, is
                 // paddingLeft: 40,
                 // paddingRight: 40,
                 color: 'black',
-                fontWeight: 500,
+                fontWeight: 'bold',
                 fontSize: 20,
                 display: 'flex',
                 alignItems: 'center',
@@ -79,7 +79,7 @@ export const EndSleepBtn = (props: { onClick: Function, lowLight?: boolean, isLo
                 // paddingLeft: 40,
                 // paddingRight: 40,
                 color: global.sleepColor?global.sleepColor:ColorType.sleep,
-                fontWeight: 500,
+                fontWeight: 'bold',
                 fontSize: 20,
                 display: 'flex',
                 alignItems: 'center',
@@ -108,7 +108,7 @@ export const EndFastBtn = (props: { onClick: Function, lowLight?: boolean, isLoa
                 // paddingRight: 40,
                 color: global.fastColor?global.fastColor:ColorType.fast,
                 fontSize: 20,
-                fontWeight: 500,
+                fontWeight: 'bold',
                 display: 'flex',
                 alignItems: 'center',
                 justifyContent: 'center',
@@ -133,7 +133,7 @@ export const SetScheduleBtn = (props: { onClick: Function, title: string, isFast
                 paddingRight: 40,
                 color: 'black',
                 fontSize: 20,
-                fontWeight: 500,
+                fontWeight: 'bold',
                 display: 'flex',
                 alignItems: 'center',
                 justifyContent: 'center',
@@ -156,7 +156,7 @@ export const ChooseScenarioBtn = (props: { onClick: Function, title: string, bac
                 paddingRight: 40,
                 color: 'black',
                 fontSize: 20,
-                fontWeight: 500,
+                fontWeight: 'bold',
                 display: 'flex',
                 alignItems: 'center',
                 justifyContent: 'center',
@@ -178,7 +178,7 @@ export const RecordMetricBtn = (props: { onClick: Function, title: string, theme
                 backgroundColor: props.themeColor,
                 color: 'black',
                 fontSize: 20,
-                fontWeight: 500,
+                fontWeight: 'bold',
                 display: 'flex',
                 alignItems: 'center',
                 justifyContent: 'center',

+ 30 - 23
src/features/trackSomething/components/Activity.tsx

@@ -30,11 +30,13 @@ export default function Component(props: any) {
     const [latestRecord, setLatestRecord] = useState(null)
     const [triggered, setTriggered] = useState(true)
     const [showErrorPage, setErrorPage] = useState(false)
-    const [count,setCount] = useState(0)
+    const [count, setCount] = useState(0)
     // const [title, setTitle] = useState('打卡')
 
+
     //未登录<->已登录 状态切换时,重新拉取一次列表数据
     useEffect(() => {
+
         dispatch(resetStatus())
         getCards();
         const now = new Date();
@@ -42,7 +44,7 @@ export default function Component(props: any) {
         const timeUntilMidnight = nextMidnight.getTime() - now.getTime();
 
         setTimeout(() => {
-            setCount(count+1)
+            setCount(count + 1)
         }, timeUntilMidnight);
     }, [user.isLogin])
 
@@ -181,12 +183,12 @@ export default function Component(props: any) {
                     dispatch(checkRetry())
                 }
                 else {
-                    
+
                     setShowErrorBadge(false)
                     uploadSuccess(res, autoCheck, time)
-                    setTimeout(()=>{
-                        setCount(count+1)
-                    },31000)
+                    setTimeout(() => {
+                        setCount(count + 1)
+                    }, 31000)
                 }
 
             }).catch(e => {
@@ -219,9 +221,9 @@ export default function Component(props: any) {
 
                             setShowErrorBadge(false)
                             uploadSuccess(res, autoCheck, time)
-                            setTimeout(()=>{
-                                setCount(count+1)
-                            },31000)
+                            setTimeout(() => {
+                                setCount(count + 1)
+                            }, 31000)
                         }
 
                     }).catch(e => {
@@ -370,11 +372,6 @@ export default function Component(props: any) {
                         }
                     }
 
-                    // if (user.isLogin && !allowRun){
-                    //     value = '0'
-                    //     desc = '开启步数仅自己可见'
-                    //     unit = ''
-                    // }
 
                     return <MetricItem title={item.name}
                         // value={allowRun ? stepInfo ? (stepInfo as any).step : '' : '未开启'}
@@ -389,7 +386,6 @@ export default function Component(props: any) {
                         showDetail={showDetail}
                         onClick={() => {
                             tapBtn()
-                            // checkout()
                         }}
                     />
                 })
@@ -404,13 +400,24 @@ export default function Component(props: any) {
     //     {showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()}
     // </ScrollView>
     // return showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()
-    return <Layout children={showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()}
-        title={t('page.activity.title')}
-        type={TemplateType.grid}
-        refresh={() => { getCards() }}
-        triggered={triggered}
-        more={() => { getCards() }}
-        titleShowStyle={NaviBarTitleShowType.scrollToShow}
-    />
+
+
+    return <View style={{ position: 'relative' }}>
+        <Layout children={showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()}
+            title={t('page.activity.title')}
+            type={process.env.TARO_ENV == 'rn' ? TemplateType.flex : TemplateType.grid}
+            refresh={() => { getCards() }}
+            triggered={triggered}
+            titleShowStyle={NaviBarTitleShowType.scrollToShow}
+        />
+    </View>
+    // return <Layout children={showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()}
+    //     title={t('page.activity.title')}
+    //     type={TemplateType.grid}
+    //     refresh={() => { getCards() }}
+    //     triggered={triggered}
+    //     more={() => { getCards() }}
+    //     titleShowStyle={NaviBarTitleShowType.scrollToShow}
+    // />
 
 }

+ 12 - 2
src/features/trackSomething/components/Metric.tsx

@@ -338,10 +338,20 @@ export default function Component(props: any) {
         </View>
     }
 
-    // return showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()
+    function detailContent(){
+        if (process.env.TARO_ENV=='rn'){
+            return <ScrollView>
+                {
+                    detail()
+                }
+                <View style={{height:150}}/> 
+            </ScrollView>
+        }
+        return detail()
+    }
 
     return <View style={{ position:'relative' }}>
-        <Layout children={showErrorPage ? <NoData refresh={() => { getCards() }} /> : detail()}
+        <Layout children={showErrorPage ? <NoData refresh={() => { getCards() }} /> : detailContent()}
             title={t('page.metric.title')}
             type={TemplateType.flex}
             refresh={() => { getCards() }}

+ 0 - 6
src/features/trackSomething/components/MetricItem.tsx

@@ -35,12 +35,6 @@ export default function Component(props: {
             }
             
         </View>
-
-        {/* <View className="operate" style={{ backgroundColor: props.themeColor, opacity: props.isDisabled ? 0.5 : 1 }} onClick={clickBtn}>{props.btnText}
-            {
-                props.showBadge && <View className="badge"></View>
-            }
-        </View> */}
         <View style={{ position: 'relative',marginTop:10 }} >
             <RecordMetricBtn themeColor={props.themeColor} title={props.btnText} onClick={clickBtn} isDisable={props.isDisabled}/>
             {

+ 1 - 1
src/features/trackTimeDuration/components/Clock.tsx

@@ -2,7 +2,7 @@ import trackTimeService, { machine } from "@/store/trackTimeMachine";
 import { View, Text } from "@tarojs/components";
 import { useEffect, useState } from "react";
 import { TimeFormatter } from "@/utils/time_format";
-import Rings, { BgRing, CurrentDot, RealRing, RingCommon } from './Rings.weapp';
+import Rings, { BgRing, CurrentDot, RealRing, RingCommon } from './Rings';
 import { getBgRing, getCommon, getDot, getReal, getTarget } from "../hooks/RingData";
 import './Clock.scss'
 import { ColorType } from "@/context/themes/color";

+ 1 - 1
src/features/trackTimeDuration/components/RecordFastSleep.tsx

@@ -11,7 +11,7 @@ import TimelineFastSleep from "./TimelineFastSleep";
 import { TimeFormatter } from "@/utils/time_format";
 import './RecordFastSleep.scss'
 import { getBgRing, getCommon, getDot, getReal, getTarget } from "../hooks/RingData";
-import Rings from "./Rings.weapp";
+import Rings from "./Rings";
 import Segment from "@/components/navigation/Segment";
 import Stage from "./Stage";
 import CenterContentTitleModal from "@/features/common/CenterContentTitleModal";

+ 30 - 0
src/features/trackTimeDuration/components/Rings.rn.tsx

@@ -1,5 +1,35 @@
 import { View } from "@tarojs/components";
 
+export type RingCommon = {
+    useCase: string;
+    status: string;
+    isFast?: boolean;
+    radius: number;
+    lineWidth: number;
+}
+
+export type CurrentDot = {
+    color: string;
+    lineWidth: number;
+    borderColor: string;
+}
+
+export type RealRing = {
+    color: string;
+    startArc: number;
+    durationArc: number;
+}
+
+export type TargetRing = {
+    color: string;
+    startArc: number;
+    durationArc: number;
+}
+
+export type BgRing = {
+    color: string;
+}
+
 export default function Component(){
     return <View />
 }

+ 1 - 1
src/features/trackTimeDuration/components/Schedule.tsx

@@ -91,7 +91,7 @@ export default function Component(props: { type?: string, data?: any, delSuccess
             justifyContent: 'space-between', alignItems: 'center',
             marginBottom: 10, paddingRight: 10, boxSizing: 'border-box'
         }}>
-            <Text style={{ fontSize: 18, lineHeight: 18, fontWeight: 500 }}>
+            <Text style={{ fontSize: 18, lineHeight: 18, fontWeight: 'bold' }}>
                 {permission.wxPubFollow ? TimeFormatter.getDateAndWeek(new Date().getTime()) :
                     t('feature.track_time_duration.schedule.unfollow_title')}</Text>
             {

+ 6 - 4
src/pages/activity/Activity.tsx

@@ -12,12 +12,14 @@ export default function Page() {
 
     //     })
     // })
-    useShareAppMessage((e) => {
-        return {
+    if (process.env.TARO_ENV == 'weapp') {
+        useShareAppMessage((e) => {
+          return {
             title: t('share.title'),
             path: 'pages/clock/Clock'
-        }
-    })
+          }
+        })
+      }
 
     useDidShow(() => {
         global.updateTab(2)

+ 465 - 0
src/pages/clock/Clock.rn.tsx

@@ -0,0 +1,465 @@
+import { Component, PropsWithChildren, useEffect, useRef, useState } from 'react'
+import { View, Text, Button, Input, Picker, Swiper, SwiperItem, Icon } from '@tarojs/components'
+import '../index/index.scss'
+import './Clock.scss'
+// import './context/locales/index'
+import '@/context/locales/index'
+import Taro, { useDidShow, usePageScroll, useReady, useRouter, useShareAppMessage } from '@tarojs/taro'
+// import ComponentA from './component'
+
+
+import { useDispatch, useSelector } from 'react-redux';
+import { getInfoSuccess, logoutSuccess } from '@/store/user';
+import { wxPubFollow } from '@/services/permission';
+import { gobalConfigs, staticResources, uploadSessionKey } from '@/services/common';
+import Clocks from '@/features/trackTimeDuration/components/Clock';
+import Console from '@/features/trackTimeDuration/components/Console';
+import Schedule from '@/features/trackTimeDuration/components/Schedule';
+import { getChecks, getClocks } from '@/services/trackTimeDuration';
+import { setScenario } from '@/store/scenario';
+
+import { setSpecifiedStatus, setSpecifiedState, machine } from '@/store/trackTimeMachine';
+import trackTimeService from '@/store/trackTimeMachine';
+import { setWXFollow } from '@/store/permission';
+import Tooltip from '@/components/view/Tooltip'
+import RequestType, { thirdPartRequest } from '@/services/thirdPartRequest'
+import { setConfigs } from '@/store/common'
+import RecordFastSleep from '@/features/trackTimeDuration/components/RecordFastSleep'
+import Box from '@/components/layout/Box'
+import Layout from '@/components/layout/layout'
+import { CheckBoxType, NaviBarTitleShowType, TemplateType } from '@/utils/types'
+import { updateScenario } from '@/store/time'
+import { showModal } from '@/store/modal'
+import { ConsoleType, changeConsoleStatus } from '@/store/console'
+import TitleView from '@/features/trackTimeDuration/components/TitleView'
+import StatusIndicator from '@/features/trackTimeDuration/components/StatusIndicator'
+import { useTranslation } from 'react-i18next'
+import TableCellHeader from '@/components/layout/TableCellHeader'
+import SectionHeader from '@/components/layout/SectionHeader'
+import Header from '@/components/layout/Header'
+import { TimeFormatter } from '@/utils/time_format'
+import NoData from '@/components/view/NoData'
+import { ColorType } from '@/context/themes/color'
+// import TabBar from '../../components/Tabbar';
+
+// import Rings from '@components/view/Rings';
+
+
+export default function IndexPage() {
+    
+  const dispatch = useDispatch();
+  const { t } = useTranslation()
+  const [checkData, setCheckData] = useState(null)
+  const user = useSelector((state: any) => state.user);
+  const time = useSelector((state: any) => state.time);
+  const common = useSelector((state: any) => state.common);
+  const consoleData = useSelector((state: any) => state.console);
+  const [counter, setCounter] = useState(0)
+  const [timerId, setTimerId] = useState(null)
+  const [needShowAddTip, setNeedShowAddTip] = useState(false)
+  const [showErrorPage, setErrorPage] = useState(false)
+
+  const [swiperIndex, setSwiperIndex] = useState(0)
+  const [autoPlay, setAutoPlay] = useState(false)
+
+  const [showModal, setShowModal] = useState(false)
+  const [modalDetail, setModalDetail] = useState<any>({})
+
+  const [showModal2, setShowModal2] = useState(false)
+  const [modalDetail2, setModalDetail2] = useState<any>({})
+  const [showSingleFastEnd, setShowSingleFastEnd] = useState(false)
+  const [consoleStatus, setConsoleStatus] = useState(consoleData.status)
+  
+
+  global.dispatch = dispatch;
+
+  global.checkData = () => {
+    console.log('refresh clock data')
+    getCheckData()
+  }
+
+  useEffect(() => {
+    global.consoleType = 'idle'
+    dispatch(staticResources() as any);
+    // dispatch(gobalConfigs() as any);
+    trackTimeService.onTransition(state => {
+      if ((state.value as any).FAST_SLEEP == 'COMPLETED' ||
+        (state.value as any).FAST == 'ONGOING' ||
+        (state.value as any).SLEEP == 'ONGOING' ||
+        (state.value as any).FAST_SLEEP == 'ONGOING1' ||
+        (state.value as any).FAST_SLEEP == 'ONGOING2' ||
+        (state.value as any).FAST_SLEEP == 'ONGOING3' ||
+        (state.value as any).FAST == 'COMPLETED' ||
+        (state.value as any).SLEEP == 'COMPLETED') {
+        getCheckData()
+      }
+    })
+
+
+  }, [])
+
+  useEffect(() => {
+    setConsoleStatus(consoleData.status)
+    switch (consoleData.status) {
+      // case ConsoleType.going:
+      //   setShowSingleFastEnd(true)
+      //   setTimeout(() => {
+      //     setShowSingleFastEnd(false)
+      //     setSwiperIndex(1)
+      //     setAutoPlay(true)
+      //     dispatch(changeConsoleStatus({ status: ConsoleType.end }))
+      //   }, 2000)
+      //   break
+      case ConsoleType.end:
+        setTimeout(() => {
+          dispatch(changeConsoleStatus({ status: ConsoleType.idle }))
+        }, 2000)
+
+        break
+    }
+  }, [consoleData.status])
+
+  useEffect(() => {
+    if (user.isLogin) {
+      //检查用户是否添加过小程序
+      checkAddToMini();
+      //检查session是否过期
+      checkSession()
+      getCheckData()
+    }
+  }, [user.isLogin])
+
+  function checkSession() {
+    if (process.env.TARO_ENV === 'weapp') {
+      thirdPartRequest(RequestType.RequestTypeCheckSession).then(res => {
+      }).catch(err => {
+        console.log('session_key 已经失效,需要更新登录code')
+        thirdPartRequest(RequestType.RequestTypeWXLogin).then(result => {
+          uploadSessionKey({ type: 'WX_MP', code: (result as any).code });
+        })
+      })
+    }
+  }
+
+  function checkAddToMini() {
+    process.env.TARO_ENV == 'weapp' &&
+      wx.checkIsAddedToMyMiniProgram({
+        success: (res) => {
+          if (!res.added) {
+            setNeedShowAddTip(true)
+          }
+        },
+        fail: (e) => {
+        }
+      });
+  }
+
+  useEffect(() => {
+    startTimer();
+    return () => {
+      // 在组件卸载时清除定时器
+      if (timerId) {
+        clearInterval(timerId);
+      }
+    };
+  }, [timerId]);
+
+  const startTimer = () => {
+    // 避免重复启动定时器
+    if (timerId) {
+      return;
+    }
+
+    const id = setInterval(() => {
+      setCounter((prevCounter) => prevCounter + 1);
+      //每天0点刷新一下打卡数据
+      var now = new Date()
+      if (now.getHours() == 0 && now.getMinutes() == 0) {
+        getCheckData()
+      }
+    }, 1000);
+
+    setTimerId(id as any);
+  };
+
+
+  useReady(async () => {
+    // const userData = await getStorage('userData');
+    // if (userData) {
+    //   dispatch(getInfoSuccess(JSON.parse(userData as string)) as any);
+    //   setTimeout(() => {
+    //     checkWXPubFollow()
+    //     getCheckData()
+
+    //   }, 200)
+
+    // }
+  })
+
+  if (process.env.TARO_ENV == 'weapp') {
+    useShareAppMessage((e) => {
+      return {
+        title: t('share.title'),
+        path: 'pages/clock/Clock'
+      }
+    })
+  }
+
+  function clearTempScenarioCache() {
+    global.schedule_fast = null
+    global.schedule_sleep = null
+    Taro.removeStorage({
+      key: 'tempScenario',
+      success: function (res) {
+      }
+    })
+  }
+
+  usePageScroll((e) => {
+  })
+
+  useDidShow(() => {
+    global.updateTab(0)
+    if (user.isLogin) {
+      checkWXPubFollow()
+      // getCheckData();
+    }
+    clearTempScenarioCache()
+  })
+
+  global.refreshTime = () => {
+    getCheckData()
+  }
+
+  global.showSingleFastEnd = () => {
+    setShowSingleFastEnd(true)
+  }
+
+  function tapClock() {
+    if (!user.isLogin) {
+      Taro.navigateTo({
+        url: '/pages/account/ChooseAuth'
+      })
+    }
+  }
+
+  
+
+  function getCheckData() {
+    getClocks().then(res => {
+      setErrorPage(false)
+      dispatch(updateScenario((res as any).current_record))
+      dispatch(setConfigs((res as any).time_input_schema));
+      dispatch(setScenario((res as any).scenario));
+
+      if ((res as any).theme_color) {
+        global.fastColor = (res as any).theme_color.fast
+        global.sleepColor = (res as any).theme_color.sleep
+      }
+      machine.context.checkData = res as any;
+
+      global.scenario = (res as any).current_record.scenario;
+      const currentState = trackTimeService.getSnapshot();
+      let json = {};
+      var key = (res as any).current_record.scenario
+      var status = (res as any).current_record.status
+      json[key] = status
+      currentState.value = json;
+      machine.context.currentStatus = `${key}.${status}`;//'mixed.ON_GOING2'
+      setCheckData(res as any)
+
+      if ((res as any).current_record.status != 'ONGOING1') {
+        setSwiperIndex(0)
+      }
+      else {
+        if (global.consoleType == 'going') {
+          setShowSingleFastEnd(true)
+          setTimeout(() => {
+            setShowSingleFastEnd(false)
+            setSwiperIndex(1)
+            setAutoPlay(true)
+            global.consoleType = 'end'
+            dispatch(changeConsoleStatus({ status: ConsoleType.end }))
+            setTimeout(() => {
+              global.consoleType = 'idle'
+            }, 2000)
+          }, 500)
+        }
+        else {
+        }
+      }
+
+    }).catch(e => {
+      console.log('aaa')
+      if (!checkData) {
+        console.log('this is a test')
+        setErrorPage(true)
+      }
+      else {
+        console.log('sss')
+      }
+    })
+  }
+
+  
+
+  function checkWXPubFollow() {
+    wxPubFollow().then(res => {
+      dispatch(setWXFollow((res as any).wx_pub_followed));
+      console.log('当前的关注状态' + (res as any).wx_pub_followed);
+
+    })
+  }
+
+  async function getStorage(key: string) {
+    try {
+      const res = await Taro.getStorage({ key });
+      return res.data;
+    } catch {
+      return '';
+    }
+  }
+
+  
+
+  function schedule() {
+    if (!user.isLogin) {
+      return <View />
+    }
+    return <Schedule data={(checkData as any).current_record} />
+  }
+
+  function needSwiper() {
+    var isNeed = time.scenario == 'FAST_SLEEP' &&
+      (time.status == 'WAIT_FOR_START' ||
+        time.status == 'ONGOING1' ||
+        time.status == 'ONGOING2')
+    if (showSingleFastEnd) {
+      return false;
+    }
+    return isNeed
+  }
+
+  
+
+  global.showClockModal = (isShow: boolean, detail: any) => {
+    setShowModal(isShow)
+    setModalDetail(detail)
+  }
+
+  global.showClockModal2 = (isShow: boolean, detail: any) => {
+    setShowModal2(isShow)
+    setModalDetail2(detail)
+  }
+
+  function headerView() {
+    return <TitleView title={t('page.clock.title')} showAddBtn={true}>
+      <StatusIndicator />
+    </TitleView>
+  }
+
+  function errorView() {
+    if (showErrorPage) {
+      return <NoData refresh={() => { getCheckData() }} />
+    }
+    return <View />
+  }
+
+  
+
+  function consoleView() {
+    if (!checkData) {
+      return <View />
+    }
+    return <View className='console_bg'>
+      {
+        needSwiper() ? <Swiper className='swiper' indicatorColor='#333'
+          indicatorActiveColor='#999'
+          current={swiperIndex}
+          autoplay={autoPlay}
+          duration={300}
+          interval={300}
+          // indicator-margin={30}
+          indicator-offset={[0, -30]}
+          indicator-height={30}
+          indicatorDots={global.consoleType == 'idle'}
+          onChange={(e) => {
+            setSwiperIndex(e.detail.current)
+            if (e.detail.current == 0)
+              setAutoPlay(false)
+          }}
+        >
+          <SwiperItem className='swiperItem'>
+            <Console />
+          </SwiperItem>
+
+          <SwiperItem className='swiperItem'>
+            <Console isNextStep={true} />
+          </SwiperItem>
+        </Swiper> :
+          <Console isNextStep={showSingleFastEnd} />
+
+      }
+    </View>
+  }
+
+  
+
+
+  function detail() {
+    return (
+      <Layout type={TemplateType.customHeader} header={headerView()} title={t('page.clock.title')} titleShowStyle={NaviBarTitleShowType.scrollToShow}>
+        <View style={{ flex: 1, flexDirection: 'column', display: 'flex', backgroundColor: '#000', color: '#fff' }}>
+          {
+            needShowAddTip && <Tooltip title="添加到我的小程序" closeTip={() => { setNeedShowAddTip(false) }} />
+          }
+
+          <Box>
+            <View className='clock_bg' onClick={tapClock}>
+              <Clocks />
+            </View>
+          </Box>
+          {
+            errorView()
+          }
+          {
+            user.isLogin && consoleView()
+          }
+          {
+            user.isLogin && checkData && schedule()
+          }
+          {
+            user.isLogin && <View style={{ backgroundColor: global.isDebug ? 'pink' : 'transparent' }}>
+              {
+                checkData && (checkData as any).latest_record &&
+                <SectionHeader top={48} bottom={24} title={t('feature.track_time_duration.record_fast_sleep.header.latest_record')}>
+                  <Header title='' action={() => {
+                    Taro.navigateTo({
+                      url: '/pages/common/RecordsHistory?type=time&title=time'
+                    })
+                  }} />
+                </SectionHeader>
+              }
+            </View>
+          }
+          {
+            user.isLogin && checkData && (checkData as any).latest_record &&
+            <RecordFastSleep type='latest' data={(checkData as any).latest_record} delSuccess={getCheckData} />
+          }
+          <View style={{ height: 100 }} />
+        </View>
+
+        {
+          showModal && modalDetail
+        }
+        {
+          showModal2 && modalDetail2
+        }
+
+      </Layout>
+    )
+  }
+
+
+  return detail()
+}

+ 8 - 6
src/pages/clock/Clock.tsx → src/pages/clock/Clock.weapp.tsx

@@ -194,12 +194,14 @@ export default function IndexPage() {
     }
   })
 
-  useShareAppMessage((e) => {
-    return {
-      title: t('share.title'),
-      path: 'pages/clock/Clock'
-    }
-  })
+  if (process.env.TARO_ENV == 'weapp') {
+    useShareAppMessage((e) => {
+      return {
+        title: t('share.title'),
+        path: 'pages/clock/Clock'
+      }
+    })
+  }
 
   function clearTempScenarioCache() {
     global.schedule_fast = null

+ 9 - 7
src/pages/metric/Metric.tsx

@@ -5,18 +5,20 @@ import { useTranslation } from "react-i18next";
 
 export default function Page() {
     const { t } = useTranslation()
-    useShareAppMessage((e) => {
-        return {
-            title: t('share.title'),
-            path: 'pages/clock/Clock'
-        }
-    })
+    if (process.env.TARO_ENV == 'weapp') {
+        useShareAppMessage((e) => {
+            return {
+                title: t('share.title'),
+                path: 'pages/clock/Clock'
+            }
+        })
+    }
     useDidShow(() => {
         global.updateTab(1)
     })
 
     usePullDownRefresh(() => {
-        
+
         global.refreshMetric()
     })
     return <View className="container">

+ 4 - 0
src/pages/rn/RNMain.config.ts

@@ -0,0 +1,4 @@
+export default definePageConfig({
+    "disableScroll": true,
+    "navigationStyle":"custom"
+  })

+ 31 - 10
src/pages/rn/RNMain.tsx

@@ -3,8 +3,9 @@ import { NavigationContainer } from '@react-navigation/native';
 import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
 import { createStackNavigator } from '@react-navigation/stack';
 
-// import Clock from '../clock/Clock'
-import Login from '../account/Setting'
+import Clock from '../clock/Clock'
+import Metric from '../metric/Metric'
+import Activity from '../activity/Activity'
 import Profile from '../account/Profile'
 import { View } from '@tarojs/components';
 
@@ -48,12 +49,32 @@ const App: React.FC = () => {
 */
 
 export default function RNMain() {
-    return (
-        <NavigationContainer>
-            <Tab.Navigator>
-                <Tab.Screen name="Clock" component={Login} />
-                <Tab.Screen name="Profile" component={Profile} />
-            </Tab.Navigator>
-        </NavigationContainer>
-    )
+  return (
+    <NavigationContainer theme={{
+      dark:false,
+      colors:{
+        text:'white',
+        primary:'white',
+        card:'white',
+        border:'white',
+        background:'black',
+        notification:'red'
+      }
+    }}>
+      <Tab.Navigator screenOptions={({ route }) => ({
+        headerStyle: {
+          backgroundColor: 'black',
+        },
+        headerTintColor:'white',
+        tabBarStyle: { backgroundColor: 'black' }, // tabbar的背景色
+        tabBarActiveTintColor: 'white', // 活动标签的颜色
+        tabBarInactiveTintColor: 'gray', // 非活动标签的颜色
+      })}>
+        <Tab.Screen name="Clock" component={Clock} />
+        <Tab.Screen name="Metric" component={Metric} />
+        <Tab.Screen name="Activity" component={Activity} />
+        <Tab.Screen name="Profile" component={Profile} />
+      </Tab.Navigator>
+    </NavigationContainer>
+  )
 }