浏览代码

精简代码

leon 1 年之前
父节点
当前提交
345311aa65
共有 100 个文件被更改,包括 75 次插入9008 次删除
  1. 0 0
      android/app/src/main/assets/index.android.bundle
  2. 0 0
      android/app/src/main/assets/index.android.map
  3. 0 0
      android_fast/app/src/main/assets/index.android.bundle
  4. 0 0
      android_fast/app/src/main/assets/index.android.map
  5. 0 0
      android_main/app/src/main/assets/index.android.bundle
  6. 0 0
      android_main/app/src/main/assets/index.android.map
  7. 1 1
      config/env.ts
  8. 0 0
      ios/main.jsbundle
  9. 0 0
      rn_bundle/main.jsbundle.bundle
  10. 0 0
      src/_account/pages/Album.config.ts
  11. 0 0
      src/_account/pages/Album.scss
  12. 2 2
      src/_account/pages/Album.tsx
  13. 0 0
      src/_account/pages/Auth.tsx
  14. 0 0
      src/_account/pages/ChooseAuth.config.ts
  15. 0 0
      src/_account/pages/ChooseAuth.scss
  16. 4 4
      src/_account/pages/ChooseAuth.tsx
  17. 0 0
      src/_account/pages/EditPage.config.ts
  18. 0 0
      src/_account/pages/EditPage.tsx
  19. 1 1
      src/_account/pages/Login.tsx
  20. 0 0
      src/_account/pages/Member.tsx
  21. 0 0
      src/_account/pages/PhotoWall.config.ts
  22. 0 0
      src/_account/pages/PhotoWall.scss
  23. 0 0
      src/_account/pages/PhotoWall.tsx
  24. 0 0
      src/_account/pages/ProfileSetting.config.ts
  25. 0 0
      src/_account/pages/ProfileSetting.scss
  26. 2 2
      src/_account/pages/ProfileSetting.tsx
  27. 0 0
      src/_account/pages/Setting.config.ts
  28. 0 0
      src/_account/pages/Setting.tsx
  29. 1 1
      src/_health/components/icon_title_cell.tsx
  30. 0 1
      src/_health/pages/streak_weekly.tsx
  31. 14 30
      src/app.config.ts
  32. 0 1
      src/app.scss
  33. 二进制
      src/assets/_health/active.png
  34. 二进制
      src/assets/_health/album.png
  35. 二进制
      src/assets/_health/camera.png
  36. 二进制
      src/assets/_health/compass_sel.png
  37. 二进制
      src/assets/_health/eat.png
  38. 二进制
      src/assets/_health/fast.png
  39. 二进制
      src/assets/_health/fast_sleep.png
  40. 二进制
      src/assets/_health/guide_en.png
  41. 二进制
      src/assets/_health/guide_zh.png
  42. 二进制
      src/assets/_health/home_sel.png
  43. 二进制
      src/assets/_health/loading.png
  44. 二进制
      src/assets/_health/long_fast.png
  45. 二进制
      src/assets/_health/main_logo.png
  46. 二进制
      src/assets/_health/measurements.png
  47. 二进制
      src/assets/_health/moon.png
  48. 二进制
      src/assets/_health/null.png
  49. 二进制
      src/assets/_health/setting.png
  50. 二进制
      src/assets/_health/share_01.jpg
  51. 二进制
      src/assets/_health/sun.png
  52. 0 0
      src/assets/fonts/placeholder
  53. 2 3
      src/components/basic/Buttons.scss
  54. 2 2
      src/components/input/Inputs.scss
  55. 2 2
      src/components/input/LimitPickers.scss
  56. 1 1
      src/components/input/SingleSelect.scss
  57. 7 7
      src/components/input/Slider.scss
  58. 1 1
      src/components/input/Slider.tsx
  59. 2 2
      src/components/input/Stepper.scss
  60. 3 3
      src/components/layout/Box.scss
  61. 2 2
      src/components/layout/Header.scss
  62. 1 1
      src/components/layout/TableCell.scss
  63. 0 48
      src/custom-tab-bar2/index.scss
  64. 0 84
      src/custom-tab-bar2/index.tsx
  65. 2 2
      src/features/auth/components/Auth.scss
  66. 1 1
      src/features/auth/components/CreatePassword.tsx
  67. 0 466
      src/features/daynight/AllDayRings.tsx
  68. 0 39
      src/features/daynight/AllRings.scss
  69. 0 336
      src/features/daynight/AllRings.tsx
  70. 0 8
      src/features/daynight/DayNightCard.config.ts
  71. 0 366
      src/features/daynight/DayNightCard.scss
  72. 0 1027
      src/features/daynight/DayNightCard.tsx
  73. 0 889
      src/features/daynight/DayNightCard2.tsx
  74. 0 783
      src/features/daynight/DayNightDetailPopup.tsx
  75. 0 231
      src/features/daynight/DayNightRing.tsx
  76. 0 14
      src/features/daynight/DayNightStatus.scss
  77. 0 50
      src/features/daynight/DayNightStatus.tsx
  78. 0 213
      src/features/daynight/DayNightSwiper.tsx
  79. 0 408
      src/features/daynight/DayNightSwiperPopup.tsx
  80. 1 1
      src/features/food/FoodConsole.tsx
  81. 7 7
      src/features/health/MainConsole.tsx
  82. 2 2
      src/features/trackSomething/components/Activity.tsx
  83. 2 2
      src/features/trackSomething/components/ActivityHistory.scss
  84. 2 2
      src/features/trackSomething/components/Metric.tsx
  85. 2 2
      src/features/trackSomething/components/MetricHistory.scss
  86. 2 2
      src/features/trackSomething/components/MetricItem.scss
  87. 2 2
      src/features/trackSomething/components/Metric_backup.tsx
  88. 1 2
      src/features/trackTimeDuration/components/CheckAccess.scss
  89. 0 75
      src/features/trackTimeDuration/components/ChooseScenario.scss
  90. 0 350
      src/features/trackTimeDuration/components/ChooseScenario.tsx
  91. 0 231
      src/features/trackTimeDuration/components/CircadianDetailPopup.scss
  92. 0 1098
      src/features/trackTimeDuration/components/CircadianDetailPopup.tsx
  93. 1 2
      src/features/trackTimeDuration/components/CircadianStatus.scss
  94. 0 11
      src/features/trackTimeDuration/components/Dial.scss
  95. 0 509
      src/features/trackTimeDuration/components/Dial.tsx
  96. 2 2
      src/features/trackTimeDuration/components/Discovery.tsx
  97. 0 77
      src/features/trackTimeDuration/components/IndexConsole.scss
  98. 0 1032
      src/features/trackTimeDuration/components/IndexConsole.tsx
  99. 0 27
      src/features/trackTimeDuration/components/IndexConsoleMuti.scss
  100. 0 540
      src/features/trackTimeDuration/components/IndexConsoleMuti.tsx

文件差异内容过多而无法显示
+ 0 - 0
android/app/src/main/assets/index.android.bundle


文件差异内容过多而无法显示
+ 0 - 0
android/app/src/main/assets/index.android.map


文件差异内容过多而无法显示
+ 0 - 0
android_fast/app/src/main/assets/index.android.bundle


文件差异内容过多而无法显示
+ 0 - 0
android_fast/app/src/main/assets/index.android.map


文件差异内容过多而无法显示
+ 0 - 0
android_main/app/src/main/assets/index.android.bundle


文件差异内容过多而无法显示
+ 0 - 0
android_main/app/src/main/assets/index.android.map


+ 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.4'
+export const WX_VERSION = '1.5.5'

文件差异内容过多而无法显示
+ 0 - 0
ios/main.jsbundle


文件差异内容过多而无法显示
+ 0 - 0
rn_bundle/main.jsbundle.bundle


+ 0 - 0
src/pages/account/Album.config.ts → src/_account/pages/Album.config.ts


+ 0 - 0
src/pages/account/Album.scss → src/_account/pages/Album.scss


+ 2 - 2
src/pages/account/Album.tsx → src/_account/pages/Album.tsx

@@ -295,7 +295,7 @@ export default function Album() {
             {/* <View style={{ height: rpxToPx(36) }} /> */}
 
             {/* <View className="photo_wall" onClick={() => {
-                jumpPage('/pages/account/PhotoWall?window=' + window)
+                jumpPage('/_account/pages/PhotoWall?window=' + window)
             }}>
                 <View style={{ flex: 1 }} />
                 <Text className="photo_wall_text">Photo Wall</Text>
@@ -304,7 +304,7 @@ export default function Album() {
             </View> */}
 
             <RightArrowRow title={t('health.photo_wall')} height={rpxToPx(184)} onClick={() => {
-                jumpPage('/pages/account/PhotoWall?window=' + window)
+                jumpPage('/_account/pages/PhotoWall?window=' + window)
             }} />
             <View style={{
                 backgroundColor: '#fff',

+ 0 - 0
src/pages/account/Auth.tsx → src/_account/pages/Auth.tsx


+ 0 - 0
src/pages/account/ChooseAuth.config.ts → src/_account/pages/ChooseAuth.config.ts


+ 0 - 0
src/pages/account/ChooseAuth.scss → src/_account/pages/ChooseAuth.scss


+ 4 - 4
src/pages/account/ChooseAuth.tsx → src/_account/pages/ChooseAuth.tsx

@@ -50,14 +50,14 @@ export default function Page() {
                     // })
                     setTimeout(() => {
                         Taro.redirectTo({
-                            url: '/pages/account/ProfileSetting?newuser=1'
+                            url: '/_account/pages/ProfileSetting?newuser=1'
                         })
                     }, 100)
                 }
                 else {
                     console.log('replace')
                     Taro.redirectTo({
-                        url: '/pages/account/ProfileSetting?newuser=1'
+                        url: '/_account/pages/ProfileSetting?newuser=1'
                     })
                 }
 
@@ -155,11 +155,11 @@ export default function Page() {
     }
 
     function createAccount1() {
-        jumpPage('/pages/account/Auth', 'Auth', navigation)
+        jumpPage('/_account/pages/Auth', 'Auth', navigation)
     }
 
     function login1() {
-        jumpPage('/pages/account/Auth', 'Auth', navigation, { isLogin: true })
+        jumpPage('/_account/pages/Auth', 'Auth', navigation, { isLogin: true })
     }
 
     return <View className="container choose_container">

+ 0 - 0
src/pages/account/EditPage.config.ts → src/_account/pages/EditPage.config.ts


+ 0 - 0
src/pages/account/EditPage.tsx → src/_account/pages/EditPage.tsx


+ 1 - 1
src/pages/account/Login.tsx → src/_account/pages/Login.tsx

@@ -13,7 +13,7 @@ export default function Login(){
     array.push(<Rings  radius={50} strokeWidth={5} color={"pink"}/>)
 
     function goAuth(){
-        jumpPage('/pages/account/Auth')
+        jumpPage('/_account/pages/Auth')
     }
 
     return (

+ 0 - 0
src/pages/account/Member.tsx → src/_account/pages/Member.tsx


+ 0 - 0
src/pages/account/PhotoWall.config.ts → src/_account/pages/PhotoWall.config.ts


+ 0 - 0
src/pages/account/PhotoWall.scss → src/_account/pages/PhotoWall.scss


+ 0 - 0
src/pages/account/PhotoWall.tsx → src/_account/pages/PhotoWall.tsx


+ 0 - 0
src/pages/account/ProfileSetting.config.ts → src/_account/pages/ProfileSetting.config.ts


+ 0 - 0
src/pages/account/ProfileSetting.scss → src/_account/pages/ProfileSetting.scss


+ 2 - 2
src/pages/account/ProfileSetting.tsx → src/_account/pages/ProfileSetting.tsx

@@ -49,12 +49,12 @@ export default function Page() {
 
     function editNickname() {
         if (router.params.newuser == '1') {
-            jumpPage('/pages/account/EditPage?name=' + (name == user.nickname ? '' : user.nickname), 'EditPage', navigation, {
+            jumpPage('/_account/pages/EditPage?name=' + (name == user.nickname ? '' : user.nickname), 'EditPage', navigation, {
                 name: name == user.nickname ? '' : user.nickname
             })
         }
         else {
-            jumpPage('/pages/account/EditPage?name=' + user.nickname, 'EditPage', navigation, {
+            jumpPage('/_account/pages/EditPage?name=' + user.nickname, 'EditPage', navigation, {
                 name: user.nickname
             })
         }

+ 0 - 0
src/pages/account/Setting.config.ts → src/_account/pages/Setting.config.ts


+ 0 - 0
src/pages/account/Setting.tsx → src/_account/pages/Setting.tsx


+ 1 - 1
src/_health/components/icon_title_cell.tsx

@@ -28,7 +28,7 @@ export default function IconTitleCell(props: {
 
     return <Cell onClick={() => {
         if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
             return
         }
         props.onClick()

+ 0 - 1
src/_health/pages/streak_weekly.tsx

@@ -6,7 +6,6 @@ import { rpxToPx } from "@/utils/tools";
 import { View, Text } from "@tarojs/components";
 import { useState } from "react";
 import { useTranslation } from "react-i18next";
-import '../../pages/clock/Clock2.scss'
 import NewButton, { NewButtonType } from "../base/new_button";
 import Layout from "@/components/layout/layout";
 import { NaviBarTitleShowType, TemplateType } from "@/utils/types";

+ 14 - 30
src/app.config.ts

@@ -2,39 +2,14 @@ import { kIsIOS } from "./utils/tools";
 
 const appConfig = defineAppConfig({
   pages: [
-    // 'pages/clock/Index',
     'pages/clock/Clock',
-    // 'pages/clock/Suggest',
-    // 'pages/clock/SetGoal',
-
-    // 'pages/demo',
-    // 'pages/food/Food',
-    'pages/account/Login',
-    'pages/account/Auth',
-    'pages/account/ChooseAuth',
-    // 'pages/clock/ChooseScenario',
-    // 'pages/clock/SetSchedule',
     'pages/common/H5',
     'pages/account/Profile',
     'pages/metric/Metric',
-    'pages/activity/Activity',
-    'pages/common/RecordsHistory',
-    'pages/account/ProfileSetting',
-    'pages/account/Setting',
-    'pages/account/EditPage',
-    'pages/workout/Workout',
-    'pages/workout/WorkoutDetail',
-    'pages/workout/Working',
-    'pages/workout/History',
-    'pages/account/Member',
-    'pages/explore/Index',
-    'pages/clock/StreakDetail',
     'pages/notification/setting',
     'pages/store/product_list',
-    'pages/account/Album',
     'pages/account/Journal',
     'pages/account/JournalDetail',
-    'pages/account/PhotoWall',
     'pages/discover/discover'
   ],
   entryPagePath: 'pages/clock/Clock',
@@ -77,7 +52,20 @@ const appConfig = defineAppConfig({
         'pages/guide_sleep',
         'pages/guide_active',
         'pages/guide_full',
-
+      ]
+    },
+    {
+      root: '_account',
+      pages: [
+        'pages/Login',
+        'pages/Auth',
+        'pages/ChooseAuth',
+        'pages/ProfileSetting',
+        'pages/Setting',
+        'pages/EditPage',
+        'pages/Member',
+        'pages/Album',
+        'pages/PhotoWall',
       ]
     }
   ],
@@ -153,10 +141,6 @@ process.env.TARO_ENV === 'weapp' && (appConfig.tabBar = {
       pagePath: 'pages/discover/discover',
       text: '发现',
     },
-    {
-      pagePath: 'pages/explore/Index',
-      text: '发现',
-    },
     {
       pagePath: 'pages/notification/setting',
       text: '提醒',

+ 0 - 1
src/app.scss

@@ -1,5 +1,4 @@
 /* #ifdef weapp */
-// @import '@/utils/common.scss';
 
 page {
     background-color: #f5f5f5;

二进制
src/assets/_health/active.png


二进制
src/assets/_health/album.png


二进制
src/assets/_health/camera.png


二进制
src/assets/_health/compass_sel.png


二进制
src/assets/_health/eat.png


二进制
src/assets/_health/fast.png


二进制
src/assets/_health/fast_sleep.png


二进制
src/assets/_health/guide_en.png


二进制
src/assets/_health/guide_zh.png


二进制
src/assets/_health/home_sel.png


二进制
src/assets/_health/loading.png


二进制
src/assets/_health/long_fast.png


二进制
src/assets/_health/main_logo.png


二进制
src/assets/_health/measurements.png


二进制
src/assets/_health/moon.png


二进制
src/assets/_health/null.png


二进制
src/assets/_health/setting.png


二进制
src/assets/_health/share_01.jpg


二进制
src/assets/_health/sun.png


+ 0 - 0
src/assets/fonts/placeholder


+ 2 - 3
src/components/basic/Buttons.scss

@@ -1,4 +1,4 @@
-// @import '@/utils/common.scss';
+
 
 // /* #ifdef weapp */ 
 // .btn{
@@ -41,7 +41,6 @@
 //     border: 0;
 // }
 
-@import '@/utils/common.scss';
 
 .texted {
     // background: linear-gradient(to right, red, blue);
@@ -53,7 +52,7 @@
 
 /* #ifdef weapp */
 .mixed {
-    background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
+    // background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
     -webkit-background-clip: text;
     background-clip: text;
     color: transparent;

+ 2 - 2
src/components/input/Inputs.scss

@@ -1,4 +1,4 @@
-@import '@/utils/common.scss';
+
 
 .input_bg{
     width: 658px;
@@ -16,7 +16,7 @@
 .input{
     height: 96px;
     color: #000;
-    caret-color: $fastColor;
+    // caret-color: $fastColor;
     flex: 1;
     // border: solid 4px #000;
 }

+ 2 - 2
src/components/input/LimitPickers.scss

@@ -1,4 +1,4 @@
-@import '@/utils/common.scss';
+
 /* #ifdef weapp */
 .picker-mask {
     max-width: auto;
@@ -51,7 +51,7 @@
 }
 
 .picker-sel{
-    background-color: $sleepColor;
+    // background-color: $sleepColor;
 }
 
 .pickerEndTime{

+ 1 - 1
src/components/input/SingleSelect.scss

@@ -1,4 +1,4 @@
-@import '@/utils/common.scss';
+
 
 .item1{
     margin: 0 46px  40px 46px;

+ 7 - 7
src/components/input/Slider.scss

@@ -1,4 +1,4 @@
-@import '@/utils/common.scss';
+
 
 .slider-container {
     position: relative;
@@ -66,7 +66,7 @@
     margin-top: 12px;
     font-size: 20px;
     line-height: 24px;
-    background: linear-gradient(90deg, $fastColor 0%, #fff 100%);
+    // background: linear-gradient(90deg, $fastColor 0%, #fff 100%);
     -webkit-background-clip: text;
     background-clip: text;
     color: transparent;
@@ -76,7 +76,7 @@
     margin-top: 12px;
     font-size: 20px;
     line-height: 24px;
-    background: linear-gradient(90deg, #fff 0%, $foodColor 100%);
+    // background: linear-gradient(90deg, #fff 0%, $foodColor 100%);
     -webkit-background-clip: text;
     background-clip: text;
     color: transparent;
@@ -218,7 +218,7 @@
     padding-bottom: 40px;
     box-sizing: border-box;
     border-radius: 16px;
-    background-color: $tipBgColor;
+    // background-color: $tipBgColor;
     display: flex;
     flex-direction: column;
 }
@@ -231,7 +231,7 @@
     margin-top: -2px;
     border-left: 25px solid transparent;
     border-right: 25px solid transparent;
-    border-top: 20px solid $tipBgColor;
+    // border-top: 20px solid $tipBgColor;
 
 }
 
@@ -252,7 +252,7 @@
     font-size: 32px;
     line-height: 32px;
     font-weight: bold;
-    color: $fastColor;
+    // color: $fastColor;
 }
 
 
@@ -261,6 +261,6 @@
     font-size: 32px;
     line-height: 32px;
     font-weight: bold;
-    color: $foodColor;
+    // color: $foodColor;
 }
 

+ 1 - 1
src/components/input/Slider.tsx

@@ -32,7 +32,7 @@ export default function (props: { onChanged?: Function, value?: number, edit?: b
 
     const handleTouchStart = (event) => {
         if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth')
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
             return
         }
         setIsSliding(true);

+ 2 - 2
src/components/input/Stepper.scss

@@ -1,10 +1,10 @@
-@import '@/utils/common.scss';
+
 
 .stepper_bg{
     display: flex;
     flex-direction: row;
     align-items: center;
-    background-color: $ringColor;
+    // background-color: $ringColor;
     height: 128px;
     width: 578px;
     margin-bottom: 40px;

+ 3 - 3
src/components/layout/Box.scss

@@ -1,9 +1,9 @@
-@import '@/utils/common.scss';
+
 
 .box-container {
-    background-color: $boxColor;
+    // background-color: $boxColor;
     // background-color: #fff;
-    border-radius: $boxBorderRadius;
+    // border-radius: $boxBorderRadius;
     padding: 40px;
     margin-left: 46px;
     margin-right: 46px;

+ 2 - 2
src/components/layout/Header.scss

@@ -1,4 +1,4 @@
-@import '@/utils/common.scss';
+
 
 .header{
     display: flex;
@@ -31,7 +31,7 @@
 
 /* #ifdef weapp */
 .fast_sleep_more {
-    background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
+    // background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
     -webkit-background-clip: text;
     background-clip: text;
     color: transparent;

+ 1 - 1
src/components/layout/TableCell.scss

@@ -1,4 +1,4 @@
-@import '@/utils/common.scss';
+
 
 .table_cell {
     display: flex;

+ 0 - 48
src/custom-tab-bar2/index.scss

@@ -1,48 +0,0 @@
-
-/* #ifdef weapp */
-.tabbar{
-    display: flex;
-    position: fixed;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    height: 103px;
-    flex-direction: row;
-    justify-content: space-around;
-    background-color: #000;
-    // background-color: #000;
-    // background-color: red;
-    padding-bottom: constant(safe-area-inset-bottom);
-    /* 兼容 iOS < 11.2 */
-    padding-bottom: env(safe-area-inset-bottom);
-    border-top-color: rgba($color: #ffffff, $alpha: 0.2);
-    border-top-width: 1px;
-    border-top-style: solid;
-    z-index: 100;
-}
-
-/* #endif */
-
-/* #ifdef rn */
-
-/* #endif */
-
-//未选中 18 40%
-//选中 20 100%
-
-.tabbar-item{
-    color: rgba($color: #ffffff, $alpha: 0.4);
-    font-size: 36px;
-    // padding-top: 25px;
-    display: flex;
-    flex: 1;
-    align-items: center;
-    justify-content: center;
-    font-weight: bold;
-}
-
-.tabbar-item-sel{
-    color: #ffffff;
-    font-size: 40px;
-    font-weight: bold;
-}

+ 0 - 84
src/custom-tab-bar2/index.tsx

@@ -1,84 +0,0 @@
-import { View, Text } from '@tarojs/components'
-import './index.scss'
-import { useTranslation } from 'react-i18next'
-import Taro from '@tarojs/taro'
-import { useEffect, useState } from 'react'
-import { useDispatch, useSelector } from 'react-redux'
-import { changeTabbar } from '@/store/common'
-
-export default function TabBar() {
-    const { t } = useTranslation()
-    const common = useSelector((state: any) => state.common);
-    const [selIndex, setSelIndex] = useState(common.pageIndex)
-    const dispatch = useDispatch();
-    // useEffect(() => {
-    //     console.log('aaa',global.index)
-    //     setSelIndex(global.index?global.index:0)
-    //   }, [global.index])
-    // useEffect(()=>{
-    //     console.log('page 初始化')
-    // },[])
-
-    useEffect(()=>{
-        setSelIndex(common.pageIndex)
-    },[common.pageIndex])
-
-    function switchTab(index: number) {
-        // console.log(index,common.showTabbar)
-        if (!common.showTabbar){
-            return
-        }
-        // global.index = index;
-
-        // console.log(index,'apple')
-        // console.log(global.index)
-        dispatch(changeTabbar(index))
-        
-
-        switch (index) {
-            case 0:
-
-                Taro.switchTab({
-                    url: '/pages/clock/Clock'
-                })
-                break;
-            // case 1:
-            //     Taro.switchTab({
-            //         url: '/pages/metric/Metric'
-            //     })
-            //     break;
-            case 2:
-
-                Taro.switchTab({
-                    url: '/pages/activity/Activity'
-                })
-                break;
-            case 3:
-                Taro.switchTab({
-                    url: '/pages/account/Profile'
-                })
-                break;
-        }
-    }
-    return (
-        
-        <View className='tabbar'>
-            <View className={selIndex == 0 ? 'tabbar-item tabbar-item-sel' : 'tabbar-item'} onClick={() => switchTab(0)}>
-                {/* <Text>{t('tabbar.clock')}</Text> */}
-                <Text>生物钟</Text>
-            </View>
-            <View className={selIndex == 1 ? 'tabbar-item tabbar-item-sel' : 'tabbar-item'} onClick={() => switchTab(1)}>
-                <Text>指标</Text>
-                {/* <Text>{t('tabbar.metric')}</Text> */}
-            </View>
-            <View className={selIndex == 2 ? 'tabbar-item tabbar-item-sel' : 'tabbar-item'} onClick={() => switchTab(2)}>
-                <Text>运动</Text>
-                {/* <Text>{t('tabbar.activity')}</Text> */}
-            </View>
-            <View className={selIndex == 3 ? 'tabbar-item tabbar-item-sel' : 'tabbar-item'} onClick={() => switchTab(3)}>
-                {/* <Text>{t('tabbar.more')}</Text> */}
-                <Text>更多</Text>
-            </View>
-        </View>
-    )
-}

+ 2 - 2
src/features/auth/components/Auth.scss

@@ -1,4 +1,4 @@
-@import '@/utils/common.scss';
+
 .agree_view{
     display: flex;
     flex-direction: row;
@@ -31,5 +31,5 @@
 
 .login2{
     font-size: 28px;
-    color: $fastColor;
+    // color: $fastColor;
 }

+ 1 - 1
src/features/auth/components/CreatePassword.tsx

@@ -51,7 +51,7 @@ export default function Component(prop: { name?: string, email?: string }) {
       })
 
       setTimeout(()=>{
-        jumpPage('/pages/account/ProfileSetting', 'ProfileSetting', navigation)
+        jumpPage('/_account/pages/ProfileSetting', 'ProfileSetting', navigation)
       },1000)
       
     }

+ 0 - 466
src/features/daynight/AllDayRings.tsx

@@ -1,466 +0,0 @@
-import Box from '@/components/layout/Box'
-import './AllRings.scss'
-import { PageContainer, View, Text, Image } from '@tarojs/components'
-import { useEffect, useState } from 'react'
-import Modal from '@/components/layout/Modal.weapp'
-import { rpxToPx } from '@/utils/tools'
-import { ColorType } from '@/context/themes/color'
-import Rings from "@/features/trackTimeDuration/components/Rings";
-import { bigRingRadius, getBgRing, getCommon, getDot, ringWidth, smallRingRadius, thirdRingRadius } from '../trackTimeDuration/hooks/RingData'
-import { RealRing } from '@/features/trackTimeDuration/components/Rings'
-import { useSelector } from 'react-redux'
-import { useTranslation } from 'react-i18next'
-import { TimeFormatter } from '@/utils/time_format'
-import '@/utils/ring_card.scss';
-import DayNightRing from './DayNightRing'
-// import GradientText from '@/components/basic/GradientText'
-
-let sunriseA = new Date()
-sunriseA.setHours(6)
-sunriseA.setMinutes(0)
-sunriseA.setSeconds(0)
-sunriseA.setMilliseconds(0)
-const sunsetA = new Date()
-sunsetA.setHours(18)
-sunsetA.setMinutes(0)
-sunsetA.setSeconds(0)
-sunsetA.setMilliseconds(0)
-
-const sunriseB = new Date()
-sunriseB.setHours(6)
-sunriseB.setMinutes(0)
-sunriseB.setSeconds(0)
-sunriseB.setMilliseconds(0)
-
-let GradientText
-if (process.env.TARO_ENV == 'rn') {
-    GradientText = require('@/components/basic/GradientText').default
-}
-
-export default function AllDayRings(props: { schedule: any }) {
-    const [authInfo, setAuthInfo] = useState(global.locationDetail ? global.locationDetail : null)
-    const [showRing, setShowRing] = useState(false)
-    const user = useSelector((state: any) => state.user);
-    const ring = useSelector((state: any) => state.ring);
-    const [schedule] = useState(props.schedule)
-    const { t } = useTranslation()
-
-    useEffect(() => {
-        setAuthInfo(global.locationDetail)
-    }, [global.locationDetail])
-
-    global.tapShowDay = () => {
-        setShowRing(true)
-    }
-
-    function getFoodTime() {
-        if (ring.schedule) {
-            return [ring.schedule.fast.end_time, ring.schedule.fast.start_time]
-        }
-        var obj;
-        (schedule as any).map(item => {
-            if (item.name == 'FAST') {
-                obj = item
-            }
-        })
-        if (!obj) {
-            console.log('报错', schedule)
-            return ['16:00', '08:00'];
-        }
-        return [obj.schedule.fast.end_time, obj.schedule.fast.start_time]
-    }
-
-    function getActivityTime() {
-        if (ring.schedule) {
-            return [ring.schedule.sleep.end_time, ring.schedule.sleep.start_time]
-        }
-        var obj;
-        (schedule as any).map(item => {
-            if (item.name == 'SLEEP') {
-                obj = item
-            }
-        })
-        return [obj.schedule.sleep.end_time, obj.schedule.sleep.start_time]
-    }
-
-    function bigRing() {
-        var common = getCommon(null, true)
-        common.radius = bigRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-        const targetRing: RealRing = {
-            color: (ring.current_record && ring.current_record.scenario == 'SLEEP') ? ColorType.activity + '66' : ColorType.food + '66',
-            startArc: 0,
-            durationArc: 2
-        }
-        var list = getFoodTime()
-        var start;
-        var end;
-
-        if (ring.current_record && ring.current_record.scenario == 'SLEEP') {
-            var list2 = getActivityTime()
-            start = parseInt(list2[0].split(':')[0]) * 60 + parseInt(list2[0].split(':')[1])
-            end = parseInt(list2[1].split(':')[0]) * 60 + parseInt(list2[1].split(':')[1])
-            if (ring.current_record.status != 'WAIT_FOR_START') {
-                var startDate = new Date(ring.current_record.sleep.target_start_time)
-                var endDate = new Date(ring.current_record.sleep.target_end_time)
-                end = startDate.getHours() * 60 + startDate.getMinutes()
-                start = endDate.getHours() * 60 + endDate.getMinutes()
-            }
-        }
-        else {
-            start = parseInt(list[0].split(':')[0]) * 60 + parseInt(list[0].split(':')[1])
-            end = parseInt(list[1].split(':')[0]) * 60 + parseInt(list[1].split(':')[1])
-            if (ring.current_record && ring.current_record.status != 'WAIT_FOR_START') {
-                var startDate = new Date(ring.current_record.fast.target_start_time)
-                var endDate = new Date(ring.current_record.fast.target_end_time)
-                end = startDate.getHours() * 60 + startDate.getMinutes()
-                start = endDate.getHours() * 60 + endDate.getMinutes()
-            }
-        }
-
-        if (end < start) {
-            end += 24 * 60
-        }
-        var duration = end - start
-        targetRing.startArc = (start * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
-        targetRing.durationArc = (duration * 60) / (24 * 3600) * 2 * Math.PI;
-
-        var currentDot = getDot(null, false)
-        var date = new Date()
-        var minutes = date.getHours() * 60 + date.getMinutes()
-        if (minutes < start) {
-            minutes += 1440
-        }
-
-        currentDot.color = ColorType.food
-
-
-        var now = new Date()
-        var t = now.getHours() * 60 + now.getMinutes()
-        var duration2 = t - start
-        if (duration2 < 0) {
-            duration2 += 24 * 60
-        }
-
-        let realRing: RealRing = {
-            color: ColorType.food,
-            startArc: (start * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0,
-            durationArc: (duration2 * 60) / (24 * 3600) * 2 * Math.PI
-        }
-
-        if (ring.current_record && ring.current_record.scenario == 'SLEEP') {
-            realRing.color = ColorType.activity
-            currentDot.color = ColorType.activity
-        }
-
-        if (!user.isLogin) {
-            currentDot = null
-            realRing = null
-        }
-
-        if (ring.current_record.status == 'ONGOING1') {
-            realRing = null
-        }
-
-        return <Rings common={common} bgRing={bgRing} targetRing={targetRing} realRing={duration2 <= duration ? realRing : null} currentDot={currentDot} canvasId={'pop_day_big'} />
-    }
-    function smallRing() {
-        var common = getCommon(null, false)
-        common.radius = smallRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-        const realRingBig: RealRing = {
-            color: ColorType.activity + '66',
-            startArc: 0,
-            durationArc: 2
-        }
-        var list = getActivityTime()
-        var start = parseInt(list[0].split(':')[0]) * 60 + parseInt(list[0].split(':')[1])
-        var end = parseInt(list[1].split(':')[0]) * 60 + parseInt(list[1].split(':')[1])
-        if (ring.current_record) {
-            if (ring.current_record.scenario == 'SLEEP') {
-                if (ring.current_record.status == 'ONGOING') {
-                    var startDate = new Date(ring.current_record.sleep.target_start_time)
-                    var endDate = new Date(ring.current_record.sleep.target_end_time)
-                    end = startDate.getHours() * 60 + startDate.getMinutes()
-                    start = endDate.getHours() * 60 + endDate.getMinutes()
-                }
-            }
-            else {
-                if (ring.current_record.status == 'ONGOING2') {
-                    var startDate = new Date(ring.current_record.sleep.target_start_time)
-                    var endDate = new Date(ring.current_record.sleep.target_end_time)
-                    end = startDate.getHours() * 60 + startDate.getMinutes()
-                    start = endDate.getHours() * 60 + endDate.getMinutes()
-                }
-                else if (ring.current_record.status == 'ONGOING3') {
-                    //睡眠已完成时,睡眠小于24小时,使用真实的real_end_time-real_start_time
-                    //大于24小时,使用real_end_time+sleep_duration
-                    if (ring.current_record.sleep.real_end_time - ring.current_record.sleep.real_start_time < 24 * 3600 * 1000) {
-                        var startDate = new Date(ring.current_record.sleep.real_start_time)
-                        var endDate = new Date(ring.current_record.sleep.real_end_time)
-                        end = startDate.getHours() * 60 + startDate.getMinutes()
-                        start = endDate.getHours() * 60 + endDate.getMinutes()
-                    }
-                    else {
-                        var startDate = new Date(ring.current_record.sleep.real_end_time)
-                        var durationTemp = end - start//ring.current_record.sleep.target_end_time-ring.current_record.sleep.target_start_time
-                        if (durationTemp < 0) {
-                            durationTemp += 24 * 60
-                        }
-                        var endDate = new Date(startDate.getTime() + durationTemp * 60 * 1000)
-                        start = startDate.getHours() * 60 + startDate.getMinutes()
-                        end = endDate.getHours() * 60 + endDate.getMinutes()
-                    }
-                }
-            }
-
-        }
-        if (end < start) {
-            end += 24 * 60
-        }
-        var duration = end - start
-        realRingBig.startArc = (start * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
-        realRingBig.durationArc = (duration * 60) / (24 * 3600) * 2 * Math.PI;
-
-        var currentDot = getDot(null, false)
-        var date = new Date()
-        var minutes = date.getHours() * 60 + date.getMinutes()
-        if (minutes < start) {
-            minutes += 1440
-        }
-
-        currentDot.color = ColorType.activity
-
-
-        var now = new Date()
-        var t = now.getHours() * 60 + now.getMinutes()
-        var duration2 = t - start
-        if (duration2 < 0) {
-            duration2 += 24 * 60
-        }
-        let realRing: RealRing = {
-            color: ColorType.activity,
-            startArc: (start * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0,
-            durationArc: (duration2 * 60) / (24 * 3600) * 2 * Math.PI
-        }
-
-        if (!user.isLogin) {
-            currentDot = null
-            realRing = null
-        }
-
-        if (ring.current_record.status == 'ONGOING2') {
-            realRing = null
-        }
-
-        return <Rings common={common} bgRing={bgRing} targetRing={realRingBig} realRing={duration2 <= duration ? realRing : null} currentDot={currentDot} canvasId={'pop_day_small'} />
-    }
-    function dayRing() {
-        return <DayNightRing
-            isNight={false}
-            isThirdRing={true}
-            canvasId={'day_night_card_big_day_ring111'}
-            authInfo={authInfo}
-        />
-    }
-
-
-    function rings() {
-        return <View style={{
-            position: 'relative', zIndex: 1,
-            marginLeft: -6,
-        }}>
-            {
-                bigRing()
-            }
-            {
-                ring.current_record && ring.current_record.scenario == 'FAST_SLEEP' &&
-                <View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
-                    {
-                        smallRing()
-                    }
-                </View>
-            }
-            {
-                <View style={{ display: 'flex', position: 'absolute', left: -14, top: -14, right: -14, bottom: -14 }}>
-                    {
-                        dayRing()
-                    }
-                </View>
-            }
-
-        </View>
-    }
-
-    function dayDuration() {
-        return global.sunriseDuration
-    }
-
-    function eatDuration() {
-        var list = getFoodTime()
-        var start = parseInt(list[0].split(':')[0]) * 60 + parseInt(list[0].split(':')[1])
-        var end = parseInt(list[1].split(':')[0]) * 60 + parseInt(list[1].split(':')[1])
-        if (ring.current_record && ring.current_record.status != 'WAIT_FOR_START' && ring.current_record.scenario != 'SLEEP') {
-            var startDate = new Date(ring.current_record.fast.target_start_time)
-            var endDate = new Date(ring.current_record.fast.target_end_time)
-            end = startDate.getHours() * 60 + startDate.getMinutes()
-            start = endDate.getHours() * 60 + endDate.getMinutes()
-        }
-        if (end < start) {
-            end += 24 * 60
-        }
-        var duration = (end - start) * 60 * 1000
-        return TimeFormatter.calculateTimeDifference(new Date().getTime(), new Date().getTime() + duration);
-    }
-
-    function activityDuration() {
-        var list = getActivityTime()
-        var start = parseInt(list[0].split(':')[0]) * 3600 + parseInt(list[0].split(':')[1]) * 60
-        var end = parseInt(list[1].split(':')[0]) * 3600 + parseInt(list[1].split(':')[1]) * 60
-        if (ring.current_record) {
-            if (ring.current_record.scenario == 'SLEEP') {
-                if (ring.current_record.status == 'ONGOING') {
-                    var startDate = new Date(ring.current_record.sleep.target_start_time)
-                    var endDate = new Date(ring.current_record.sleep.target_end_time)
-                    end = startDate.getHours() * 3600 + startDate.getMinutes() * 60 + startDate.getSeconds()
-                    start = endDate.getHours() * 3600 + endDate.getMinutes() * 60 + endDate.getSeconds()
-                }
-            }
-            else {
-                if (ring.current_record.status == 'ONGOING2') {
-                    var startDate = new Date(ring.current_record.sleep.target_start_time)
-                    var endDate = new Date(ring.current_record.sleep.target_end_time)
-                    end = startDate.getHours() * 3600 + startDate.getMinutes() * 60 + startDate.getSeconds()
-                    start = endDate.getHours() * 3600 + endDate.getMinutes() * 60 + endDate.getSeconds()
-                }
-                else if (ring.current_record.status == 'ONGOING3') {
-                    //睡眠已完成时,睡眠小于24小时,使用真实的real_end_time-real_start_time
-                    //大于24小时,使用real_end_time+sleep_duration
-                    if (ring.current_record.sleep.real_end_time - ring.current_record.sleep.real_start_time < 24 * 3600 * 1000) {
-                        var startDate = new Date(ring.current_record.sleep.real_start_time)
-                        var endDate = new Date(ring.current_record.sleep.real_end_time)
-                        end = startDate.getHours() * 3600 + startDate.getMinutes() * 60 + startDate.getSeconds()
-                        start = endDate.getHours() * 3600 + endDate.getMinutes() * 60 + endDate.getSeconds()
-                    }
-                    else {
-                        var startDate = new Date(ring.current_record.sleep.real_end_time)
-                        var durationTemp = start - end//ring.current_record.sleep.target_end_time-ring.current_record.sleep.target_start_time
-
-                        if (durationTemp < 0) {
-                            durationTemp += 24 * 3600
-                        }
-                        var endDate = new Date(startDate.getTime() + durationTemp * 1000)
-                        end = startDate.getHours() * 3600 + startDate.getMinutes() * 60 + startDate.getSeconds()
-                        start = endDate.getHours() * 3600 + endDate.getMinutes() * 60 + endDate.getSeconds()
-                        debugger
-                        console.log('active', end, start, durationTemp)
-                    }
-                }
-            }
-
-        }
-        if (end < start) {
-            end += 24 * 3600
-        }
-        var duration = (end - start) * 1000
-        return TimeFormatter.calculateTimeDifference(new Date().getTime(), new Date().getTime() + duration);
-    }
-
-    function fastDuration() {
-        return global.fastDuration
-    }
-
-    function sleepDuration() {
-        return global.sleepDuration
-    }
-
-    function popDetail() {
-        return <Box>
-            <View className="ring_full_container" >
-                <View className="time_operate_item1">
-                    <View className='fast_sleep_item three_ring_card_detail'>
-                        {
-                            rings()
-                        }
-                        <View className="duration_bg3"
-                            style={{ 
-                                display:'flex',
-                                flexDirection:'column',
-                                marginLeft: rpxToPx(68),
-                             height: bigRingRadius * 2, 
-                             overflow: 'visible' }}>
-                            <Text className="duration_title2" style={{ color: '#fff', opacity: 0.4 }}>{t('feature.common.day')}</Text>
-                            <Text className="duration_value2" style={{ color: ColorType.day }}>{dayDuration()}</Text>
-
-                            {
-                                (ring.current_record && ring.current_record.scenario != 'SLEEP') && <Text className="duration_title2" style={{ color: '#fff', opacity: 0.4 }}>{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
-                            }
-                            {
-                                (ring.current_record && ring.current_record.scenario != 'SLEEP') && <Text className="duration_value2" style={{ color: global.fastColor ? global.fastColor : ColorType.fast }}>{fastDuration()}</Text>
-                            }
-                            {
-                                (ring.current_record && ring.current_record.scenario != 'FAST') && <Text className="duration_title2" style={{ color: '#fff', opacity: 0.4 }}>{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
-                            }
-                            {
-                                (ring.current_record && ring.current_record.scenario != 'FAST') && <Text className="duration_value2" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep, marginBottom: 0 }}>{sleepDuration()}</Text>
-                            }
-                            {/* {
-                                ring.current_record && ring.current_record.scenario != 'SLEEP' && <Text className="duration_title2" style={{ color: '#fff', opacity: 0.4 }}>{t('feature.common.eat')}</Text>
-                            }
-                            {
-                                ring.current_record && ring.current_record.scenario != 'SLEEP' && <Text className="duration_value2" style={{ color: ColorType.food }}>{eatDuration()}</Text>
-                            }
-                            {
-                                ring.current_record && ring.current_record.scenario != 'FAST' && <Text className="duration_title2" style={{ color: '#fff', opacity: 0.4 }}>{t('feature.common.move')}</Text>
-                            }
-                            {
-                                ring.current_record && ring.current_record.scenario != 'FAST' && <Text className="duration_value2" style={{ color: ColorType.activity, marginBottom: 0 }}>{activityDuration()}</Text>
-                            } */}
-                        </View>
-
-
-                    </View>
-                </View>
-            </View>
-        </Box>
-    }
-
-    function modalContent() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowRing(false)
-            }}
-            confirm={() => { }}>
-            {popDetail()}
-        </Modal>
-    }
-
-    return <View>
-        {
-            showRing && modalContent()
-        }
-    </View>
-
-    // return <Box onClick={tapShow}>
-    //     <View onClick={tapShow} style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
-    //         <Image className='three_ring_icon' src={require('@assets/images/day_three_ring.png')} />
-    //         {/* <View className='day_show_full'>{t('feature.day_night.show_all_rings')}</View> */}
-    //         {
-    //             process.env.TARO_ENV == 'weapp' ? <Text className='day_show_full'>{t('feature.day_night.show_all_rings')}</Text> :
-    //                 <GradientText
-    //                     colors={[ColorType.day, ColorType.food, ColorType.activity]}
-    //                     style={{
-    //                         fontSize: rpxToPx(32),
-    //                         fontWeight: 'bold',
-
-    //                     }}>{t('feature.day_night.show_all_rings')}</GradientText>
-    //         }
-    //     </View>
-    //     {
-    //         showRing && modalContent()
-    //     }
-    // </Box>
-}

+ 0 - 39
src/features/daynight/AllRings.scss

@@ -1,39 +0,0 @@
-@import '@/utils/common.scss';
-
-.fast_sleep_item {
-    // display: 'flex',position:'relative', flex-: 'row', alignItems: 'center'
-    display: flex;
-    position: relative;
-    flex-direction: row;
-    align-items: center;
-    width: 578px;
-    // padding-top: 20px;
-    // padding-bottom: 20px;
-}
-
-/* #ifdef weapp */
-.day_show_full {
-    background: linear-gradient(90deg, $dayColor, $foodColor, $activityColor);
-    -webkit-background-clip: text;
-    background-clip: text;
-    color: transparent;
-    font-weight: bold;
-    font-size: 32px;
-}
-
-.night_show_full {
-    background: linear-gradient(90deg, $nightColor, $fastColor, $sleepColor);
-    -webkit-background-clip: text;
-    background-clip: text;
-    color: transparent;
-    font-weight: bold;
-    font-size: 32px;
-}
-
-/* #endif */
-
-.three_ring_icon{
-    width: 48px;
-    height: 48px;
-    margin-right: 16px;
-}

+ 0 - 336
src/features/daynight/AllRings.tsx

@@ -1,336 +0,0 @@
-import Box from '@/components/layout/Box'
-import './AllRings.scss'
-import './DayNightCard.scss'
-import '../trackTimeDuration/components/IndexItem.scss'
-import { PageContainer, View, Text, Image } from '@tarojs/components'
-import { useEffect, useState } from 'react'
-import Modal from '@/components/layout/Modal.weapp'
-import { bigRingRadius, getBgRing, getCommon, getDot, getReal, getSchedule, getTarget, ringWidth, smallRingRadius, thirdRingRadius, timeTotimestamp } from '../trackTimeDuration/hooks/RingData'
-import { rpxToPx } from '@/utils/tools'
-import { ColorType } from '@/context/themes/color'
-import { useTranslation } from 'react-i18next'
-import Rings from "@/features/trackTimeDuration/components/Rings";
-import { TimeFormatter } from '@/utils/time_format'
-import { useSelector } from 'react-redux'
-import { RealRing } from '@/features/trackTimeDuration/components/Rings'
-import DayNightRing from './DayNightRing'
-import '@/utils/ring_card.scss';
-// import GradientText from '@/components/basic/GradientText'
-
-let GradientText
-if (process.env.TARO_ENV == 'rn') {
-    GradientText = require('@/components/basic/GradientText').default
-}
-
-export default function AllRings(props: { data?: any, time?: any }) {
-    const [showRing, setShowRing] = useState(false)
-    const [record, setRecord] = useState(props.data.current_record);
-    const user = useSelector((state: any) => state.user);
-    const nightStore = useSelector((state: any) => state.night);
-    const [isDay,setIsDay] = useState(false)
-    const [authInfo, setAuthInfo] = useState(global.locationDetail ? global.locationDetail : null)
-    const { t } = useTranslation()
-
-    useEffect(() => {
-        setAuthInfo(global.locationDetail)
-    }, [global.locationDetail])
-
-    useEffect(() => {
-        setRecord(props.data.current_record);
-    }, [props.data])
-
-    global.tapShowNight = () => {
-        setShowRing(true)
-    }
-
-    global.tapShowThirdRing = (isDayMode:boolean)=>{
-        setIsDay(isDayMode)
-        setShowRing(true)
-    }
-
-    function durationArc(start_time: number, end_time: number) {
-        var duration = (end_time - start_time) / 1000;
-        return duration / (24 * 3600) * 2 * Math.PI;
-    }
-
-    const startArc = (time: number) => {
-        var date = new Date(time);
-        var hour = date.getHours();
-        var minute = date.getMinutes();
-        var second = date.getSeconds();
-        return (hour * 3600 + minute * 60 + second) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
-    }
-
-    function bigRing() {
-        var common = getCommon(null, true)
-        common.radius = bigRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-
-        var currentDot1 = getDot(record, true)
-        var targetBigRing1 = getTarget(record, true)
-        targetBigRing1.color = record.scenario == 'SLEEP' ? ColorType.sleep + '66' : ColorType.fast + '66'
-        if (record.status == 'ONGOING') {
-            var realRing1 = getReal(record, true, false)
-            // debugger
-            return <Rings common={common} bgRing={bgRing} currentDot={currentDot1} realRing={realRing1} targetRing={targetBigRing1} canvasId={props.type + 'index_big'} />
-        }
-        if (record.status == 'WAIT_FOR_START') {
-            var scenario = JSON.parse(JSON.stringify(props.data.scenario))
-
-            if (scenario.name == 'SLEEP') {
-                var countduration = (props.data.current_record.sleep.target_end_time - props.data.current_record.sleep.target_start_time) / 60000
-                var min1 = TimeFormatter.timestringToSeconds(scenario.schedule.sleep.start_time) / 60
-                var min2 = TimeFormatter.timestringToSeconds(scenario.schedule.sleep.end_time) / 60
-                var leftMinutes = min1 < min2 ? min2 - min1 : min2 + 24 * 60 - min1
-                if (leftMinutes != countduration) {
-                    min2 = min1 + countduration
-                    if (min2 > 1440) {
-                        min2 -= 1440
-                    }
-                    var hour = Math.floor(min2 / 60)
-                    var minute = min2 % 60
-                    scenario.schedule.sleep.end_time = `${hour}:${minute}`
-                }
-            }
-            else {
-                var countduration = (props.data.current_record.fast.target_end_time - props.data.current_record.fast.target_start_time) / 60000
-                var min1 = TimeFormatter.timestringToSeconds(scenario.schedule.fast.start_time) / 60
-                var min2 = TimeFormatter.timestringToSeconds(scenario.schedule.fast.end_time) / 60
-                var leftMinutes = min1 < min2 ? min2 - min1 : min2 + 24 * 60 - min1
-                if (leftMinutes != countduration) {
-                    min2 = min1 + countduration
-                    if (min2 > 1440) {
-                        min2 -= 1440
-                    }
-                    var hour = Math.floor(min2 / 60)
-                    var minute = min2 % 60
-                    scenario.schedule.fast.end_time = `${hour}:${minute}`
-                }
-            }
-
-            var realRing1 = getSchedule(scenario, scenario.name != 'SLEEP', true, true)//getSchedule(record, props.type != 'SLEEP', true)
-            var list: any = []
-            if (scenario.name == 'FAST_SLEEP') {
-                realRing1.color = ColorType.fast + '66'
-            }
-            else if (scenario.name == 'SLEEP') {
-                realRing1.color = ColorType.sleep + '66'
-            }
-            else {
-                realRing1.color = ColorType.fast + '66'
-            }
-
-            if (user.isLogin) {
-                list = []
-            }
-            if (!user.isLogin) {
-                currentDot1 = null
-                // realRing1 = null
-            }
-            return <Rings common={common} bgRing={bgRing} currentDot={currentDot1} stageList={list} realRing={realRing1} canvasId={'full_index_big'} />
-        }
-        var realRing1 = getReal(record, true, false)
-        return <Rings common={common} bgRing={bgRing} realRing={realRing1} currentDot={currentDot1} targetRing={targetBigRing1} canvasId={'full_index_big'} />
-
-    }
-
-    function smallRing() {
-
-        var common = getCommon(null, false)
-        common.radius = smallRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-        var realRing = getReal(record, false, false)
-        if (props.data.scenario.name == 'FAST_SLEEP') {
-            if (!record.sleep) {
-                return null
-            }
-            if (record.sleep.status == 'WAIT_FOR_END') {
-                var targetBigRing1 = getTarget(record, false)
-                targetBigRing1.color = ColorType.sleep + '66'
-                var currentDot = getDot(record, false)
-                realRing.durationArc = durationArc(record.sleep.target_start_time, (new Date()).getTime())
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'full_index_small'} targetRing={targetBigRing1} realRing={realRing} />
-            }
-            else if (record.status == 'WAIT_FOR_START' || record.status == 'ONGOING1') {
-
-                var scenario = JSON.parse(JSON.stringify(props.data.scenario))
-
-                if (record.status == 'WAIT_FOR_START') {
-                    realRing = getSchedule(scenario, false, true, record.status == 'WAIT_FOR_START')//getSchedule(record, false, true)
-
-                }
-                else {
-                    realRing.startArc = startArc(record.sleep.target_start_time)
-                    realRing.durationArc = durationArc(record.sleep.target_start_time, record.sleep.target_end_time)
-                }
-
-                realRing.color = ColorType.sleep + '66'
-
-                var currentDot = getDot(record, false)
-
-                if (!user.isLogin) {
-                    currentDot = null
-                }
-
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot} realRing={realRing} canvasId={'full_index_small'} />
-            }
-            else if (record.sleep.status == 'NOT_COMPLETED') {
-                realRing.durationArc = 0.01
-                var currentDot = getDot(record, false)
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'full_index_small'} realRing={realRing} />
-            }
-            else if (record.sleep.status == 'COMPLETED') {
-                realRing = getReal(record, false, true)
-                var currentDot = getDot(record, false)
-                if (record.status == 'ONGOING3') {
-                    currentDot = null
-                    // currentDot.color = '#ffffffff'
-                }
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'full_index_small'} realRing={realRing} />
-            }
-            else if (record.sleep.status == 'ONGOING2') {
-                var currentDot = getDot(record, false)
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'full_index_small'} />
-            }
-            return <Rings common={common} bgRing={bgRing} canvasId={'full_index_small'} />
-        }
-        else {
-
-
-            var currentDot = getDot(record, false)
-            var targetRing = getTarget(record, false)
-            if (record.status == 'ONGOING2') {
-                var realRing = getReal(record, false, false)
-                return <Rings common={common} bgRing={bgRing} realRing={realRing} currentDot={currentDot} targetRing={targetRing} canvasId={'full_index_small'} />
-            }
-            if (record.status == 'ONGOING3') {
-                currentDot.color = 'rgba(0, 255, 255, 0.5)'
-            }
-            return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'full_index_small'} />
-        }
-
-    }
-
-    function dayRing() {
-        return <DayNightRing
-            isNight={!isDay}
-            isThirdRing={true}
-            canvasId={'day_night_card_big_night_ring111'}
-            authInfo={authInfo}
-        />
-    }
-
-    function rings() {
-        return <View style={{
-            position: 'relative', zIndex: 1,
-            marginLeft: -6,
-        }}>
-            {
-                bigRing()
-            }
-            {
-                props.data.scenario.name == 'FAST_SLEEP' && <View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
-                    {
-                        smallRing()
-                    }
-                </View>
-            }
-            {
-                <View style={{ display: 'flex', position: 'absolute', left: -14, top: -14, right: -14, bottom: -14 }}>
-                    {
-                        dayRing()
-                    }
-                </View>
-            }
-
-        </View>
-    }
-
-
-    function fastDuration() {
-        return global.fastDuration
-    }
-
-    function sleepDuration() {
-        return global.sleepDuration
-    }
-
-    function nightDuration() {
-        return global.sunsetDuration
-    }
-
-    function dayDuration(){
-        return global.sunriseDuration
-    }
-
-
-    function popDetail() {
-        return <Box>
-            <View className="ring_full_container">
-                <View className="time_operate_item1">
-                    <View className='fast_sleep_item three_ring_card_detail'>
-                        {
-                            rings()
-                        }
-                        <View className="duration_bg2" style={{ marginLeft: rpxToPx(68), height: bigRingRadius * 2, overflow: 'visible' }}>
-
-                            <Text className="duration_title2" style={{ color: '#fff', opacity: 0.4 }}>{isDay?t('feature.common.day'):t('feature.common.overnight')}</Text>
-                            <Text className="duration_value2" style={{ color: isDay?ColorType.day:ColorType.night }}>{isDay?dayDuration():nightDuration()}</Text>
-                            {
-                                (props.data.scenario.name == 'FAST' || props.data.scenario.name == 'FAST_SLEEP') && <Text className="duration_title2" style={{ color: '#fff', opacity: 0.4 }}>{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
-                            }
-                            {
-                                (props.data.scenario.name == 'FAST' || props.data.scenario.name == 'FAST_SLEEP') && <Text className="duration_value2" style={{ color: global.fastColor ? global.fastColor : ColorType.fast }}>{fastDuration()}</Text>
-                            }
-                            {
-                                (props.data.scenario.name == 'SLEEP' || props.data.scenario.name == 'FAST_SLEEP') && <Text className="duration_title2" style={{ color: '#fff', opacity: 0.4 }}>{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
-                            }
-                            {
-                                (props.data.scenario.name == 'SLEEP' || props.data.scenario.name == 'FAST_SLEEP') && <Text className="duration_value2" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep, marginBottom: 0 }}>{sleepDuration()}</Text>
-                            }
-                        </View>
-
-
-                    </View>
-                </View>
-            </View>
-        </Box>
-    }
-
-    function modalContent() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowRing(false)
-            }}
-            confirm={() => { }}>
-            {popDetail()}
-        </Modal>
-    }
-    return <View>
-        {
-            showRing && modalContent()
-        }
-    </View>
-    // return <Box onClick={tapShow}>
-    //     <View onClick={tapShow} style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
-    //         <Image className='three_ring_icon' src={require('@assets/images/night_three_ring.png')} />
-    //         {
-    //             process.env.TARO_ENV == 'weapp' ? <Text className='night_show_full'>{t('feature.day_night.show_all_rings')}</Text> :
-    //                 <GradientText
-    //                     colors={[ColorType.night, ColorType.fast, ColorType.sleep]}
-    //                     style={{
-    //                         fontSize: rpxToPx(32),
-    //                         fontWeight: 'bold',
-    //                     }}>{t('feature.day_night.show_all_rings')}</GradientText>
-    //         }
-
-
-    //     </View>
-    // {
-    //     showRing && modalContent()
-    // }
-    // </Box>
-}

+ 0 - 8
src/features/daynight/DayNightCard.config.ts

@@ -1,8 +0,0 @@
-export default {
-    usingComponents: {
-      // 定义需要引入的第三方组件
-      // 1. key 值指定第三方组件名字,以小写开头
-      // 2. value 值指定第三方组件 js 文件的相对路径
-      'mySwitch': '@/components/input/switch',
-    },
-  }

+ 0 - 366
src/features/daynight/DayNightCard.scss

@@ -1,366 +0,0 @@
-@import '@/utils/common.scss';
-
-.day_night_top {
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    color: #fff;
-    // background-color: red;
-}
-
-.day_night_title {
-    font-size: 32px;
-    line-height: 32px;
-    opacity: 0.6;
-}
-
-.day_night_status {
-    height: 36px;
-    line-height: 36px;
-    border-radius: 18px;
-    font-size: 20px;
-    display: flex;
-    // align-items: center;
-    // justify-content: center;
-    padding-left: 16px;
-    padding-right: 16px;
-    margin-left: 6px;
-    font-weight: bold;
-}
-
-.day_night_card_footer {
-    display: flex;
-    flex-direction: row;
-    justify-content: space-between;
-    align-items: center;
-    padding-top: 20px;
-    margin-top: 20px;
-    border-top-style: solid;
-    border-top-color: #D8D8D852;
-    border-top-width: 1px;
-}
-
-.day_night_value {
-    font-size: 32px;
-    line-height: 32px;
-    font-weight: bold;
-    left: 0;
-    // background-color: red;
-}
-
-.day_night_desc {
-    font-size: 20px;
-    line-height: 32px;
-    color: #fff;
-    opacity: 0.2;
-    width: 468px;
-    margin-top: 8px;
-    // background-color: red;
-}
-
-.day_night_card_btn {
-    // width: 598px;
-    height: 88px;
-    border-radius: 44px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    color: #000;
-    font-size: 28px;
-    font-weight: bold;
-}
-
-
-/* #ifdef weapp */
-.buy_night {
-    background: linear-gradient(to right, #1446B9, #AAFF00);
-}
-
-.buy_day {
-    background: linear-gradient(to right, #C9DAFF, #AAFF00);
-}
-
-.day_card_header {
-    position: absolute;
-    right: 0;
-    top: -16px;
-
-}
-
-/* #endif */
-
-/* #ifdef rn */
-//top 12 right 20
-.day_card_header {
-    position: absolute;
-    // right: -46px;
-    // top: -42px;
-    right: -6px;
-    top: -18px;
-}
-
-/* #endif */
-
-.day_location_btn {
-    background-color: #C9DAFF33;
-    color: #C9DAFF;
-    height: 72px;
-    padding-left: 48px;
-    padding-right: 48px;
-    border-radius: 36px;
-    text-align: center;
-    font-size: 24px;
-    font-weight: bold;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-}
-
-.night_location_btn {
-    background-color: #1446B933;
-    color: #1446B9;
-    height: 72px;
-    padding-left: 48px;
-    padding-right: 48px;
-    border-radius: 36px;
-    text-align: center;
-    font-size: 24px;
-    font-weight: bold;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-}
-
-.night_choose_location {
-    margin-top: 8px;
-    line-height: 32px;
-    font-weight: bold;
-    font-size: 24px;
-    width: 438px;
-    font-weight: bold;
-    color: #1446B9;
-}
-
-.day_choose_location {
-    margin-top: 8px;
-    line-height: 32px;
-    font-weight: bold;
-    font-size: 24px;
-    width: 438px;
-    font-weight: bold;
-    color: #C9DAFF;
-}
-
-.switch {
-    transform: scale(0.85);
-    transform-origin: right center;
-    margin-right: -10px;
-}
-
-.day_night_detail {
-    display: flex;
-    flex-direction: row;
-    margin-top: 18px;
-    margin-bottom: 14px;
-    // background-color: pink;
-}
-
-.day_night_detail_icon {
-    margin-right: 22px;
-    // background-color: red;
-}
-
-.duration_title2 {
-    font-size: 32px;
-    line-height: 32px;
-    color: #fff;
-    font-weight: 400;
-    opacity: 0.6;
-}
-
-.duration_value22 {
-    font-weight: bold;
-    font-size: 36px;
-    line-height: 36px;
-    margin-top: 8px;
-    display: flex;
-    flex-shrink: 0;
-}
-
-.daynightsummary {
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-}
-
-.sunicon {
-    width: 72px;
-    height: 72px;
-    margin-right: -8px; //-40px;
-}
-
-.sunicon_bg {
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    justify-content: center;
-}
-
-.content_icon_bg {
-    display: flex;
-    align-items: center;
-    justify-content: flex-end;
-    // background-color: pink;
-}
-
-.sunrise_item {
-    display: flex;
-    flex-direction: row;
-    align-items: flex-end;
-}
-
-.arrow2 {
-    width: 40px;
-    height: 40px;
-    opacity: 0.4;
-}
-
-.myMap {
-    position: absolute;
-    left: 0;
-    right: 0;
-    top: 0;
-    bottom: 0;
-    z-index: 0;
-}
-
-
-
-.day_card_footer {
-    position: absolute;
-    right: 0px;
-    bottom: -8px;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-}
-
-.day_night_card_footer1 {
-    position: absolute;
-    right: 0;
-    bottom: -16px;
-    // background-color: red;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    height: 40px;
-    // width: 100px;
-}
-
-.card_arrowaaa {
-    width: 40px;
-    height: 40px;
-    opacity: 0.4;
-}
-
-.footer_sun_icon_bg {
-    width: 40px;
-    height: 40px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-}
-
-.footer_desc_text {
-    font-size: 28px;
-    line-height: 28px;
-    color: #fff;
-    opacity: 0.4;
-}
-
-.day_card_footer2 {
-    position: absolute;
-    right: 0px;
-    bottom: -8px;
-    display: flex;
-    flex-direction: row;
-    height: 30px;
-}
-
-.day_card_footer_date {
-    opacity: 0.4;
-    color: #767676;
-    font-size: 24px;
-    line-height: 48px;
-}
-
-
-
-.card_arrow2 {
-    width: 48px;
-    height: 48px;
-    opacity: 0.2;
-}
-
-
-
-.ring_clock {
-    font-size: 28px;
-    line-height: 36px;
-    font-weight: bold;
-}
-
-.ring_city {
-    font-size: 18px;
-    line-height: 20px;
-    color: #767676;
-    opacity: 0.4;
-    max-width: 112px;
-    text-align: center;
-    overflow: hidden;
-    text-overflow: ellipsis;
-    white-space: nowrap;
-}
-
-.ring_timezone {
-    font-size: 14px;
-    line-height: 20px;
-    color: #767676;
-    opacity: 0.4;
-    max-width: 112px;
-    text-align: center;
-}
-
-.polar_tag {
-    height: 32px;
-    padding-left: 8px;
-    padding-right: 8px;
-    border-radius: 12px;
-    font-size: 16px;
-    line-height: 32px;
-    margin-left: 6px;
-    background-color: #ffffff33;
-    color: #ffffff99;
-}
-
-.rn_card_bg{
-    margin-left: 46px;
-    margin-right: 46px;
-    display: flex;
-    width: 658px;
-    background-color: $boxColor;
-    box-sizing: border-box;
-    border-radius: $boxBorderRadius;
-    padding: 40px;
-    flex-direction: column;
-}
-
-.day_night_card_footer_btn{
-    width: 578px;
-    height: 84px;
-    border-radius: 42px;
-    margin-top: 40px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-}

+ 0 - 1027
src/features/daynight/DayNightCard.tsx

@@ -1,1027 +0,0 @@
-import { PageContainer, Switch, Text, View, Image } from '@tarojs/components'
-import './DayNightCard.scss'
-import { ColorType } from '@/context/themes/color'
-import { useEffect, useState } from 'react'
-import Box from '@/components/layout/Box'
-import Taro, { useDidHide, useDidShow } from '@tarojs/taro'
-import { clearLocation, getPerm, latestLocation, uploadPerm } from '@/services/user'
-import { useDispatch, useSelector } from 'react-redux'
-import { useTranslation } from 'react-i18next'
-import { TimeFormatter } from '@/utils/time_format'
-import { systemLocation } from '@/services/common'
-import { setDayRingData, showDay } from '@/store/day'
-import { setNightRingData, showNight, updateMember } from '@/store/night'
-import Modal from '@/components/layout/Modal.weapp'
-import { getTimezone, rpxToPx } from '@/utils/tools'
-import { jumpPage } from '@/features/trackTimeDuration/hooks/Common'
-import DayNightDetailPopup from './DayNightDetailPopup'
-import '@/utils/ring_card.scss';
-import { IconNight, IconSunrise, IconSunset } from '@/components/basic/Icons'
-import DayNightRing from './DayNightRing'
-import dayjs from 'dayjs'
-import DayNightStatus from './DayNightStatus'
-import showAlert from '@/components/basic/Alert'
-
-let useNavigation;
-let Linking;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-    Linking = require('react-native').Linking;
-}
-
-let locationDetail;
-
-let sunriseA = new Date()
-sunriseA.setHours(6)
-sunriseA.setMinutes(0)
-sunriseA.setSeconds(0)
-sunriseA.setMilliseconds(0)
-const sunsetA = new Date()
-sunsetA.setHours(18)
-sunsetA.setMinutes(0)
-sunsetA.setSeconds(0)
-sunsetA.setMilliseconds(0)
-
-const utc = require('dayjs/plugin/utc')
-const timezone = require('dayjs/plugin/timezone')
-var advanced = require("dayjs/plugin/advancedFormat")
-
-dayjs.extend(utc)
-dayjs.extend(timezone)
-dayjs.extend(advanced)
-
-
-let noTimestampData = false;
-export default function DayNightCard(props: { isNight: boolean, count: number, detailPop?: Function }) {
-    const user = useSelector((state: any) => state.user);
-    const dayStore = useSelector((state: any) => state.day);
-    const nightStore = useSelector((state: any) => state.night);
-    const [authInfo, setAuthInfo] = useState(global.locationDetail ? global.locationDetail : null)
-
-    const [sunriseDate, setSunriseDate] = useState<any>(sunriseA)
-    const [sunsetDate, setSunsetDate] = useState<any>(sunsetA)
-
-
-    const [showDetailModal, setShowDetailModal] = useState(false)
-    const [showDetailPopup, setShowDetailPopup] = useState(false)
-    
-    const [nightDate, setNightDate] = useState(new Date())
-    const [dayDate, setDayDate] = useState(new Date())
-    const dispatch = useDispatch();
-    const { t } = useTranslation()
-    const isMember = true;
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    useEffect(() => {
-        if (user.isLogin) {
-            if (global.locationDetail) {
-                locationDetail = global.locationDetail
-
-                setAuthInfo(locationDetail)
-            }
-
-            getLatestLocation()
-
-            if (props.isNight) {
-                global.refreshNight = () => {
-                    getLatestLocation()
-                }
-            }
-            else {
-                global.refreshDay = () => {
-                    getLatestLocation()
-                }
-            }
-
-        } else {
-            setSunriseDate(sunriseA)
-            setSunsetDate(sunsetA)
-
-            dispatch(setDayRingData({
-                date: new Date().getTime(),
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-            dispatch(setNightRingData({
-                date: new Date().getTime(),
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-
-            setAuthInfo(null)
-            global.locationDetail = null
-            updateUnloginData()
-        }
-    }, [user.isLogin])
-
-    useEffect(() => {
-        locationDetail = global.locationDetail
-        setAuthInfo(locationDetail)
-    }, [global.locationDetail])
-
-    useEffect(() => {
-        if (locationDetail)
-            updateDate(locationDetail)
-    }, [])
-
-    
-
-    useEffect(() => {
-        if (!locationDetail && global.locationDetail){
-            locationDetail = global.locationDetail
-        }
-        if (locationDetail) {
-            var detail: any = locationDetail
-            var now = new Date()
-            if (now.getHours() == 0 && now.getMinutes() == 0 && now.getSeconds() == 0) {
-                detail.daylights.splice(0, 1)
-            }
-            locationDetail = detail
-
-            if (detail && (detail as any).daylights) {
-                (detail as any).daylights.map(item => {
-                    if (noTimestampData) {
-                        item.sunrise_ts = new Date(item.date + 'T' + item.sunrise + ':00').getTime()
-                        item.sunset_ts = new Date(item.date + 'T' + item.sunset + ':00').getTime()
-                    }
-                })
-            }
-
-
-            // setLocationDetail(detail)
-            updateDate(detail)
-        }
-    }, [props.count])
-
-    useDidShow(() => {
-        if (!user.isLogin) {
-            dispatch(showNight(false))
-            dispatch(showDay(false))
-            Taro.setStorage({
-                key: 'showNightRing',
-                data: false
-            })
-            Taro.setStorage({
-                key: 'showDayRing',
-                data: false
-            })
-        }
-    })
-
-    function getLatestLocation() {
-        var today = new Date()
-        var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
-        var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000 * 50)
-        var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
-        var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
-        latestLocation({
-            date_start: strYesterday, date_end: strTomorrow
-        }).then(data => {
-            // (data as any).timezone = 'GMT-1000'
-            if (data && (data as any).daylights) {
-                (data as any).daylights.map(item => {
-                    if (!item.sunrise_ts) {
-                        noTimestampData = true
-                        item.sunrise_ts = new Date(item.date + 'T' + item.sunrise + ':00').getTime()
-                        item.sunset_ts = new Date(item.date + 'T' + item.sunset + ':00').getTime()
-                    }
-                    else {
-                        noTimestampData = false
-                    }
-                })
-            }
-            setAuthInfo(data as any)
-            updateDate(data)
-            locationDetail = data
-            global.locationDetail = locationDetail
-            Taro.setStorage({
-                key: 'gps',
-                data: JSON.stringify(data as any)
-            })
-        })
-    }
-
-    function updateDate(data) {
-        var today = new Date()
-        if (user.isLogin && isMember && data && data.daylights && data.daylights.length > 0) {
-            // var sunriseObj,sunsetObj;
-            var list = data.daylights
-            for (var i = 0; i < (list.length - 1); i++) {
-                //夜间
-                if (list[i].sunset_ts < today.getTime() && list[i + 1].sunrise_ts > today.getTime()) {
-                    if (props.isNight) {
-                        global.nightObj = {
-                            is_polar_night: list[i].is_polar_night,
-                            sunrise: {
-                                timestamp: list[i + 1].sunrise_ts,
-                                time: list[i + 1].sunrise
-                            },
-                            sunset: {
-                                timestamp: list[i].sunset_ts,
-                                time: list[i].sunset
-                            }
-                        }
-                    }
-                    else {
-                        global.dayObj = {
-                            is_polar_day: list[i + 1].is_polar_day,
-                            sunrise: {
-                                timestamp: list[i + 1].sunrise_ts,
-                                time: list[i + 1].sunrise
-                            },
-                            sunset: {
-                                timestamp: list[i + 1].sunset_ts,
-                                time: list[i + 1].sunset
-                            }
-                        }
-                    }
-                }
-                //白天
-                else if (list[i].sunrise_ts < today.getTime() && list[i].sunset_ts > today.getTime()) {
-                    if (props.isNight) {
-                        global.nightObj = {
-                            is_polar_night: list[i].is_polar_night,
-                            sunrise: {
-                                timestamp: list[i + 1].sunrise_ts,
-                                time: list[i + 1].sunrise
-                            },
-                            sunset: {
-                                timestamp: list[i].sunset_ts,
-                                time: list[i].sunset
-                            }
-                        }
-                    }
-                    else {
-                        global.dayObj = {
-                            is_polar_day: list[i].is_polar_day,
-                            sunrise: {
-                                timestamp: list[i].sunrise_ts,
-                                time: list[i].sunrise
-                            },
-                            sunset: {
-                                timestamp: list[i].sunset_ts,
-                                time: list[i].sunset
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        else {
-            locationDetail = null
-            setAuthInfo(null)
-            dispatch(updateMember({ isMember: isMember, gpsInfo: null }))
-
-            dispatch(setDayRingData({
-                date: sunriseDate.getTime(),
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-            dispatch(setNightRingData({
-                date: sunsetDate.getTime(),
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-            debugger
-            updateUnloginData()
-
-        }
-
-    }
-
-    function updateUnloginData() {
-        var now = new Date()
-        var sunriseT = 0
-        var sunsetT = 0
-        var sunriseTDay = 0
-        var sunsetTDay = 0
-        if (now.getHours() < 6) {
-            var temp1 = new Date(now.getTime() - 24 * 3600 * 1000)
-            temp1.setHours(18)
-            temp1.setMinutes(0)
-            temp1.setSeconds(0)
-            temp1.setMilliseconds(0)
-            sunsetT = temp1.getTime()
-            sunriseT = sunsetT + 12 * 3600 * 1000
-            sunriseTDay = sunriseT
-            sunsetTDay = sunriseTDay + 12 * 3600 * 1000
-        }
-        else if (now.getHours() < 18) {
-            var temp1 = new Date()
-            temp1.setHours(6)
-            temp1.setMinutes(0)
-            temp1.setSeconds(0)
-            temp1.setMilliseconds(0)
-
-            sunriseTDay = temp1.getTime()
-            sunsetTDay = sunriseTDay + 12 * 3600 * 1000
-            sunsetT = sunsetTDay
-            sunriseT = sunsetT + 12 * 3600 * 1000
-        }
-        else {
-            var temp1 = new Date()
-            temp1.setHours(18)
-            temp1.setMinutes(0)
-            temp1.setSeconds(0)
-            temp1.setMilliseconds(0)
-            sunsetT = temp1.getTime()
-            sunriseT = sunsetT + 12 * 3600 * 1000
-            sunriseTDay = sunriseT
-            sunsetTDay = sunriseTDay + 12 * 3600 * 1000
-        }
-        global.nightObj = {
-            sunrise: {
-                timestamp: sunriseT,
-                time: '06:00'
-            },
-            sunset: {
-                timestamp: sunsetT,
-                time: '18:00'
-            }
-        }
-
-        global.dayObj = {
-            sunrise: {
-                timestamp: sunriseTDay,
-                time: '06:00'
-            },
-            sunset: {
-                timestamp: sunsetTDay,
-                time: '18:00'
-            }
-        }
-    }
-
-
-    function tapCard(e) {
-        // if (process.env.TARO_ENV == 'weapp') {
-        //     e.stopPropagation()
-        // }
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-            return
-        }
-        global.showDayNightSwiperPop(props.isNight, nightDate, dayDate)
-        // if (!dayStore.showDayRing) {
-        //     return
-        // }
-        // setShowDetailPopup(true)
-        // if (props.detailPop)
-        //     props.detailPop(props.isNight, nightDate, dayDate)
-    }
-
-    function auth(e?: any) {
-        if (e && process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        var today = new Date()
-        var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
-        var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000 * 5)
-        var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
-        var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
-
-        if (process.env.TARO_ENV == 'rn') {
-            Taro.getLocation({
-                success(res) {
-                    systemLocation({
-                        lat: res.latitude,
-                        lng: res.longitude,
-                        date_start: strYesterday,
-                        date_end: strTomorrow,
-                        coordinate_system_standard: 'WGS-84'
-                    }).then(data => {
-                        noTimestampData = false
-                        console.log('get Location', data)
-                        updateDate(data);
-                        locationDetail = data;
-                        global.locationDetail = locationDetail
-                        setAuthInfo(data as any)
-                        Taro.setStorage({
-                            key: 'gps',
-                            data: JSON.stringify(data as any)
-                        })
-                        dispatch(updateMember({ isMember: isMember, gpsInfo: (data as any) }))
-                        showRing()
-                        if (Taro.getSystemInfoSync().platform == 'android' && process.env.TARO_ENV == 'rn') {
-                            var ToastAndroid = require('react-native').ToastAndroid;
-                            ToastAndroid.show(t('feature.day_night.location_updated'), ToastAndroid.LONG);
-                        }
-                        else {
-                            showAlert({
-                                title:'Success',
-                                content:t('feature.day_night.location_updated'),
-                                showCancel:false
-                            })
-                            // Taro.showToast({
-                            //     title: t('feature.day_night.location_updated'),
-                            //     icon: 'none'
-                            // })
-                        }
-
-                    })
-                },
-                fail(res) {
-                    if (res.errMsg == 'Permissions denied!') {
-                        showAlert({
-                            title: t('feature.auth_sys.location_title'),
-                            content: t('feature.auth_sys.location_desc'),
-                            showCancel: true,
-                            cancelText: t('feature.auth_sys.location_cancel'),
-                            confirmText: t('feature.auth_sys.location_confirm'),
-                            confirm: () => {
-                                Linking.openURL('app-settings:')
-                            }
-                        })
-                    }
-                    else {
-                        if (Taro.getSystemInfoSync().platform == 'android' && process.env.TARO_ENV == 'rn') {
-                            var ToastAndroid = require('react-native').ToastAndroid;
-                            ToastAndroid.show(t('feature.day_night.location_failed'), ToastAndroid.LONG);
-                        }
-                        else {
-                            showAlert({
-                                title:'Error',
-                                content:t('feature.day_night.location_failed'),
-                                showCancel:false
-                            })
-                            // Taro.showToast({
-                            //     title: t('feature.day_night.location_failed'),
-                            //     icon: 'none'
-                            // })
-                        }
-                    }
-                    console.log(res)
-                    showRing()
-                },
-                complete(res) {
-
-                }
-            })
-            return
-        }
-        Taro.chooseLocation({
-            latitude: authInfo && authInfo.lat ? authInfo.lat : undefined,
-            longitude: authInfo && authInfo.lat ? authInfo.lng : undefined,
-            success: function (res) {
-
-                systemLocation({
-                    lat: res.latitude,
-                    lng: res.longitude,
-                    name: res.name,
-                    address: res.address,
-                    date_start: strYesterday,
-                    date_end: strTomorrow,
-                    coordinate_system_standard: 'GCJ-02'
-                }).then(data => {
-                    noTimestampData = false;
-                    updateDate(data);
-                    locationDetail = data;
-                    global.locationDetail = locationDetail
-                    setAuthInfo(data as any)
-                    Taro.setStorage({
-                        key: 'gps',
-                        data: JSON.stringify(data as any)
-                    })
-                    showRing()
-                    dispatch(updateMember({ isMember: isMember, gpsInfo: (data as any) }))
-
-                    if (global.swiperDayNightRefresh) {
-                        global.swiperDayNightRefresh()
-                    }
-                })
-
-            },
-            fail(res) {
-                Taro.showToast({
-                    title: '位置修改失败!\n请重新选择就近位置',
-                    icon: 'none'
-                })
-                showRing()
-            },
-            complete(res) {
-
-            }
-        })
-
-    }
-
-    function showRing() {
-        dispatch(showNight(true))
-        dispatch(showDay(true))
-        Taro.setStorage({
-            key: 'showNightRing',
-            data: true
-        })
-        Taro.setStorage({
-            key: 'showDayRing',
-            data: true
-        })
-    }
-
-    function getLocation() {
-        if (!authInfo) {
-            return ''
-        }
-        return `${getCity()} | ${Math.abs(parseInt(authInfo.lat))}°${parseInt(authInfo.lat) < 0 ? 'S' : 'N'} ${Math.abs(parseInt(authInfo.lng))}°${parseInt(authInfo.lng) < 0 ? 'W' : 'E'}`
-    }
-
-    function getCity() {
-        var city = ''
-        if (!authInfo) {
-            return ''
-        }
-        if ((authInfo as any).address) {
-            if ((authInfo as any).address.city.length > 0) {
-                city = (authInfo as any).address.city
-            }
-            else if ((authInfo as any).address.province.length > 0) {
-                city = (authInfo as any).address.province
-            }
-            else if ((authInfo as any).address.country.length > 0) {
-                city = (authInfo as any).address.country
-            }
-            else {
-                city = t('feature.track_time_duration.third_ring.unknown')
-            }
-        }
-        else {
-            city = t('feature.track_time_duration.third_ring.unknown')
-        }
-        return city
-    }
-
-    function clearData() {
-        Taro.showModal({
-            title: '提示',
-            content: '确认清除位置数据?',
-            success: function (res) {
-                if (res.confirm) {
-                    clearLocation().then(res => {
-                        getLatestLocation()
-                    })
-                } else if (res.cancel) {
-                    console.log('用户点击取消')
-                }
-            }
-        })
-    }
-
-    function detailModalContent() {
-        var timezone = getTimezone()
-        if (!authInfo || !(authInfo as any).lat) {
-            return <View style={{ height: 100, display: 'flex', alignItems: 'center', justifyContent: 'center', width: rpxToPx(750) }}>
-                <Text>暂无位置信息</Text>
-            </View>
-        }
-        return <View style={{ display: 'flex', flexDirection: 'column' }}>
-            {
-                <View className="cell_bg">
-                    {
-                        <View className="cell_full">
-                            <Text className="cell_title">{t('feature.track_time_duration.third_ring.location')}</Text>
-                            <Text className="cell_value">{authInfo ? getLocation() : t('feature.track_time_duration.third_ring.enter')}</Text>
-                        </View>
-                    }
-                    <View className="cell_line" style={{ height: 1 }} />
-
-
-                    {
-                        <View className="cell_full" >
-                            <Text className="cell_title">{t('feature.track_time_duration.third_ring.latitude')}</Text>
-
-                            <Text className="cell_value">{(authInfo as any).lat}</Text>
-
-
-                        </View>
-                    }
-                    <View className="cell_line" style={{ height: 1 }} />
-
-                    <View className="cell_full">
-                        <Text className="cell_title" >{t('feature.track_time_duration.third_ring.longitude')}</Text>
-
-                        <Text className="cell_value">{(authInfo as any).lng}</Text>
-
-                    </View>
-                    <View className="cell_line" style={{ height: 1 }} />
-                    <View className="cell_full">
-                        <Text className="cell_title">{t('feature.track_time_duration.third_ring.timezone')}</Text>
-
-                        <Text className="cell_value">{timezone}</Text>
-
-                    </View>
-
-
-
-                </View>
-
-            }
-
-            <Text onClick={() => {
-                clearData()
-                setShowDetailModal(false)
-            }} style={{ width: '100%', textAlign: 'center', marginBottom: 50, color: '#fff', marginTop: 20 }}>清除位置</Text>
-        </View>
-    }
-
-    function modalContent2() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowDetailModal(false)
-            }}
-            confirm={() => { }}>
-            {
-                detailModalContent()
-            }
-        </Modal>
-    }
-
-    function modalContent() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowDetailPopup(false)
-            }}
-            confirm={() => { }}>
-            <DayNightDetailPopup
-                isNight={props.isNight}
-                authInfo={authInfo}
-                nightDate={nightDate}
-                dayDate={dayDate}
-                updateLocation={auth}
-                onClose={() => { setShowDetailPopup(false) }}
-            />
-        </Modal>
-    }
-
-
-    function longClick() {
-        if (user.isLogin && user.test_user && authInfo)
-            global.showDayNightSwiperModal()
-        // setShowDetailModal(true)
-    }
-
-    function showLocationAlert(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        tapCard(e)
-    }
-
-    function nightRing() {
-        return <DayNightRing
-            isNight={true}
-            isThirdRing={false}
-            canvasId={'day_night_card_night_ring'}
-            authInfo={authInfo}
-        />
-    }
-
-    function localNow(now: Date) {
-        if (authInfo && authInfo.timezone) {
-            return new Date(TimeFormatter.transferTimestamp(now.getTime(), authInfo.timezone.gmt))
-        }
-        return now
-    }
-
-    function dayRing() {
-        return <DayNightRing
-            isNight={false}
-            isThirdRing={false}
-            canvasId={'day_night_card_big_day'}
-            authInfo={authInfo}
-        />
-    }
-
-    function getSunsetDuration() {
-
-        if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
-            global.sunsetDuration = TimeFormatter.calculateTimeDifference(authInfo.night_completed.sunrise_ts, authInfo.night_completed.sunset_ts, true)
-            return TimeFormatter.calculateTimeDifference(authInfo.night_completed.sunrise_ts, authInfo.night_completed.sunset_ts, true)
-        }
-
-        var now = new Date()
-        if (authInfo && global.nightObj) {
-            var nightObj = global.nightObj
-            if (nightObj.sunset.timestamp < now.getTime() && nightObj.sunrise.timestamp > now.getTime()) {
-                global.sunsetDuration = TimeFormatter.countdown(nightObj.sunset.timestamp, now.getTime(), true)
-                return TimeFormatter.countdown(nightObj.sunset.timestamp, now.getTime(), true)
-            }
-            global.sunsetDuration = TimeFormatter.calculateTimeDifference(nightObj.sunset.timestamp, nightObj.sunrise.timestamp);
-            return TimeFormatter.calculateTimeDifference(nightObj.sunset.timestamp, nightObj.sunrise.timestamp);
-        }
-
-        now = localNow(now)
-        if (props.isNight && sunsetDate) {
-            if (now.getTime() > sunsetDate.getTime()) {
-                global.sunsetDuration = TimeFormatter.countdown(sunsetDate.getTime(), now.getTime(), true)
-                return TimeFormatter.countdown(sunsetDate.getTime(), now.getTime(), true)
-            }
-            // return TimeFormatter.countdown(sunsetDate.getTime())
-        }
-
-
-        var sunRiseObj = nightStore.nightRingSunrise
-        var sunSetObj = nightStore.nightRingSunset
-        var sunRise = 24 * 60 + parseInt(sunRiseObj.split(':')[0]) * 60 + parseInt(sunRiseObj.split(':')[1])
-        var sunSet = parseInt(sunSetObj.split(':')[0]) * 60 + parseInt(sunSetObj.split(':')[1])
-        if (sunSetObj.indexOf('PM') != -1) {
-            sunSet += 12 * 60
-        }
-
-        var duration = (sunRise - sunSet) * 60 * 1000
-        global.sunsetDuration = TimeFormatter.calculateTimeDifference(now.getTime(), now.getTime() + duration);
-        return TimeFormatter.calculateTimeDifference(now.getTime(), now.getTime() + duration);
-    }
-
-    function getSunriseDuration() {
-        if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
-            global.sunriseDuration = TimeFormatter.calculateTimeDifference(authInfo.day_completed.sunrise_ts, authInfo.day_completed.sunset_ts, true)
-            return TimeFormatter.calculateTimeDifference(authInfo.day_completed.sunrise_ts, authInfo.day_completed.sunset_ts, true)
-        }
-
-        var now = new Date()
-        var now = new Date()
-        if (global.dayObj) {
-            var dayObj = global.dayObj
-            if (dayObj.sunrise.timestamp < now.getTime() && dayObj.sunset.timestamp > now.getTime()) {
-                global.sunriseDuration = TimeFormatter.countdown(dayObj.sunrise.timestamp, now.getTime(), true)
-                return TimeFormatter.countdown(dayObj.sunrise.timestamp, now.getTime(), true)
-            }
-            global.sunriseDuration = TimeFormatter.calculateTimeDifference(dayObj.sunrise.timestamp, dayObj.sunset.timestamp, true);
-            return TimeFormatter.calculateTimeDifference(dayObj.sunrise.timestamp, dayObj.sunset.timestamp, true);
-        }
-        return ''
-
-
-
-
-        // now = localNow(now)
-        // if (!props.isNight && sunriseDate) {
-        //     if (now.getTime() > sunriseDate.getTime()) {
-        //         global.sunriseDuration = TimeFormatter.countdown(sunriseDate.getTime())
-        //         return TimeFormatter.countdown(sunriseDate.getTime(), now.getTime())
-        //     }
-        // }
-
-
-        // var sunRiseObj = dayStore.dayRingSunrise
-        // var sunSetObj = dayStore.dayRingSunset
-        // var sunRise = parseInt(sunRiseObj.split(':')[0]) * 60 + parseInt(sunRiseObj.split(':')[1])
-        // var sunSet = parseInt(sunSetObj.split(':')[0]) * 60 + parseInt(sunSetObj.split(':')[1])
-        // if (sunSetObj.indexOf('PM') != -1) {
-        //     sunSet += 12 * 60
-        // }
-
-        // var duration = (sunSet - sunRise) * 60 * 1000
-        // global.sunriseDuration = TimeFormatter.calculateTimeDifference(now.getTime(), now.getTime() + duration);
-        // return TimeFormatter.calculateTimeDifference(now.getTime(), now.getTime() + duration);
-    }
-
-    function completedDate() {
-        if (props.isNight) {
-            if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
-                if (localNow(new Date()).getTime() != new Date().getTime()) {
-                    return TimeFormatter.getMonthAndDayByTimestamp(authInfo.night_completed.sunrise_ts, true)
-                }
-                return TimeFormatter.dateDescription(authInfo.night_completed.sunrise_ts, true)
-            }
-            return ''
-        }
-        if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
-            if (localNow(new Date()).getTime() != new Date().getTime()) {
-                return TimeFormatter.getMonthAndDayByTimestamp(authInfo.day_completed.sunset_ts, true)
-            }
-            return TimeFormatter.dateDescription(authInfo.day_completed.sunset_ts, true)
-        }
-        return ''
-    }
-
-    function showArrow() {
-        if (props.isNight) {
-            if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
-                return true
-            }
-            return false
-        }
-        if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
-            return true
-        }
-        return false
-    }
-
-    function currentStatus() {
-        if (showArrow()) {
-            if (props.isNight) {
-                if (authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
-                    return t('feature.day_night.last_updated')
-                }
-                return t('feature.day_night.ended')
-            }
-            return t('feature.day_night.last_updated')
-        }
-        var strTime = props.isNight ? getSunsetDuration() : getSunriseDuration()
-        return (strTime.indexOf('小时') != -1 || strTime.indexOf('分钟') != -1) ? t('feature.day_night.upcoming') : t('feature.day_night.in_real_time')
-    }
-
-    function footerDesc() {
-        var now = new Date()
-        if (props.isNight) {
-            if (global.nightObj) {
-                if (now.getTime() < global.nightObj.sunset.timestamp) {
-                    return TimeFormatter.countdown(global.nightObj.sunset.timestamp, now.getTime(), true)
-                }
-                return TimeFormatter.countdown(global.nightObj.sunrise.timestamp, now.getTime(), true)
-            }
-        }
-        else {
-            if (global.dayObj) {
-                if (now.getTime() < global.dayObj.sunrise.timestamp) {
-                    return TimeFormatter.countdown(global.dayObj.sunrise.timestamp, now.getTime(), true)
-                }
-                return TimeFormatter.countdown(global.dayObj.sunset.timestamp, now.getTime(), true)
-            }
-        }
-
-        return ''
-    }
-
-    function footerIcon() {
-        var now = new Date()
-        if (props.isNight) {
-            if (now.getTime() < sunsetDate.getTime()) {
-                return <IconSunset color={ColorType.white + '66'} width={rpxToPx(28)} />
-
-            }
-            return <IconSunrise color={ColorType.white + '66'} width={rpxToPx(28)} />
-        }
-
-        if (now.getTime() > sunriseDate.getTime() && now.getTime() < sunsetDate.getTime()) {
-
-            return <IconSunset color={ColorType.white + '66'} width={rpxToPx(28)} />
-        }
-        return <IconSunrise color={ColorType.white + '66'} width={rpxToPx(28)} />
-
-    }
-
-    function currentTime() {
-        var now = new Date()
-        if (authInfo && authInfo.timezone) {
-            var t1 = TimeFormatter.tzLocalTime(now.getTime(), authInfo.timezone.id)////dayjs(now.getTime()).tz(authInfo.timezone.id)
-            if (now.getHours() == t1.hour() && now.getMinutes() == t1.minute()) {
-                return <View />
-            }
-        }
-
-        var now2 = localNow(now)
-        if (now.getTime() == now2.getTime()) {
-            return ''
-        }
-        let offset = 0;
-        if (authInfo && authInfo.timezone) {
-            var current1 = dayjs()
-            var current = TimeFormatter.tzLocalTime(now.getTime(), authInfo.timezone.id)//dayjs().tz(authInfo.timezone.id)
-            offset = current.date() * 24 * 60 + current.hour() * 60 + current.minute() - current1.date() * 24 * 60 - current1.hour() * 60 - current1.minute()
-        }
-        var hour = Math.floor(Math.abs(offset) / 60)
-        var minute = Math.abs(offset) % 60
-        var time = ''
-        if (global.language == 'en') {
-            time = `${hour} h`
-            if (minute > 0) {
-                time += ` ${minute} m`
-            }
-        }
-        else {
-            time = `${hour}小时`
-            if (minute > 0) {
-                time += `${minute}分钟`
-            }
-        }
-        // const ccc = dayjs().tz('Arctic/Longyearbyen').format('YYYY-MM-DD HH:mm:ss')
-        // const current = dayjs().utcOffset(offset).format('YYYY-MM-DD HH:mm:ss')
-        var current;
-        if (authInfo && authInfo.timezone) {
-            current = TimeFormatter.tzTimeFormateLocalTime(new Date().getTime(), authInfo.timezone.id, 'HH:mm')//dayjs().tz(authInfo.timezone.id).format('HH:mm')
-        }
-        else {
-            current = dayjs().format('HH:mm')
-        }
-
-        return <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
-            <Text className='ring_city' numberOfLines={1}>{getCity()}</Text>
-            <Text className='ring_clock' style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{current}</Text>
-            <Text className='ring_timezone'>{
-                offset > 0 ? t('feature.day_night.ahead_desc', { time: time }) : t('feature.day_night.behind_desc', { time: time })
-            }</Text>
-        </View>
-    }
-
-    function cardContent() {
-        return <View style={{ position: 'relative' }}>
-            <View style={{ display: 'flex', flexDirection: 'column', zIndex: 1 }} onClick={showLocationAlert} onLongPress={longClick}>
-                <View className="ring_full_container" style={{ paddingBottom: 0 }}>
-                    <View style={{
-                        display: 'flex',
-                        flexDirection: 'row',
-                        marginTop: 0,
-                        marginBottom: 0,
-                        padding: 0,
-                        alignItems: 'center'
-                    }}>
-                        <View style={{ display: 'flex', position: 'relative' }}>
-                            {
-                                props.isNight ? nightRing() : dayRing()
-                            }
-                            <View style={{ color: '#fff', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center', display: 'flex' }}>{currentTime()}</View>
-                        </View>
-                        <View style={{ display: 'flex', flexDirection: 'column', flexShrink: 0, flex: 1, marginLeft: rpxToPx(52) }}>
-                            <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
-                                <Text className='ring_card_duration_title'>{props.isNight ? t('feature.common.overnight') : t('feature.common.day')}</Text>
-                                {
-                                    !props.isNight && global.dayObj && global.dayObj.is_polar_day && <View className='polar_tag'>{t('feature.day_night.polar_day')}</View>
-                                }
-                                {
-                                    props.isNight && global.nightObj && global.nightObj.is_polar_night && <View className='polar_tag'>{t('feature.day_night.polar_night')}</View>
-                                }
-                            </View>
-
-                            <Text className='ring_card_duration_value' style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{props.isNight ? getSunsetDuration() : getSunriseDuration()}</Text>
-
-                        </View>
-                        {/* {
-                        !showArrow() && <Image className="card_arrow2" src={require('@/assets/images/arrow3.png')} />
-                    } */}
-                        <View className='day_card_header'>
-                            {
-                                props.isNight && global.nightObj && <DayNightStatus
-                                    authInfo={authInfo}
-                                    isNight={props.isNight}
-                                    sunrise_ts={global.nightObj.sunrise.timestamp}
-                                    sunset_ts={global.nightObj.sunset.timestamp}
-                                />
-                            }
-                            {
-                                !props.isNight && global.dayObj && <DayNightStatus
-                                    authInfo={authInfo}
-                                    isNight={props.isNight}
-                                    sunrise_ts={global.dayObj.sunrise.timestamp}
-                                    sunset_ts={global.dayObj.sunset.timestamp}
-                                />
-                            }
-                        </View>
-                        <Image className="card_arrowaaa"
-                                style={{ backgroundColor: global.isDebug ? 'blue' : 'transparent' }}
-                                src={require('@/assets/images/arrow3.png')} />
-                        {/* <View className='day_night_card_footer1' style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>
-                            {
-                                !showArrow() && <View className='footer_sun_icon_bg' style={{ backgroundColor: global.isDebug ? 'pink' : 'transparent' }}>
-                                    {
-                                        footerIcon()
-                                    }
-                                </View>
-                            }
-                            <Text className='footer_desc_text' style={{ backgroundColor: global.isDebug ? 'black' : 'transparent' }}>{showArrow() ? completedDate() : footerDesc()}</Text>
-                            <Image className="card_arrowaaa"
-                                style={{ backgroundColor: global.isDebug ? 'blue' : 'transparent' }}
-                                src={require('@/assets/images/arrow3.png')} />
-                        </View> */}
-                    </View>
-                </View>
-            </View>
-            {
-                showDetailPopup && modalContent()
-            }
-            {
-                showDetailModal && modalContent2()
-            }
-        </View>
-    }
-
-    function detail() {
-        return <View>
-            {cardContent()}
-            <View className='day_night_card_footer_btn'
-                onClick={(e) => {
-                    if (process.env.TARO_ENV == 'weapp') {
-                        e.stopPropagation()
-                    }
-                    if (props.isNight) {
-                        global.tapShowThirdRing(false)
-                    }
-                    else {
-                        global.tapShowThirdRing(true)
-                    }
-                }}
-                style={{ backgroundColor: props.isNight ? ColorType.night : ColorType.day }}>
-                <Text style={{ color: props.isNight ? ColorType.white : ColorType.black, fontWeight: 'bold' }}>{t('feature.day_night.sync')}</Text>
-            </View>
-        </View>
-    }
-
-    return process.env.TARO_ENV == 'weapp' ? <Box style={{marginBottom:0}}>{detail()}</Box> :
-        <View className='rn_card_bg'>{detail()}</View>
-}

+ 0 - 889
src/features/daynight/DayNightCard2.tsx

@@ -1,889 +0,0 @@
-import { PageContainer, Switch, Text, View, Image } from '@tarojs/components'
-import './DayNightCard.scss'
-import { ColorType } from '@/context/themes/color'
-import { useEffect, useState } from 'react'
-import Box from '@/components/layout/Box'
-import Taro, { useDidShow } from '@tarojs/taro'
-import { clearLocation, getPerm, latestLocation, uploadPerm } from '@/services/user'
-import { useDispatch, useSelector } from 'react-redux'
-import { useTranslation } from 'react-i18next'
-import { TimeFormatter } from '@/utils/time_format'
-import { systemLocation } from '@/services/common'
-import { setDayRingData, showDay } from '@/store/day'
-import { setNightRingData, showNight, updateMember } from '@/store/night'
-import Modal from '@/components/layout/Modal.weapp'
-import { getTimezone, rpxToPx } from '@/utils/tools'
-import { jumpPage } from '@/features/trackTimeDuration/hooks/Common'
-import DayNightDetailPopup from './DayNightDetailPopup'
-import '@/utils/ring_card.scss';
-import { IconNight, IconSunrise, IconSunset } from '@/components/basic/Icons'
-import DayNightRing from './DayNightRing'
-import dayjs from 'dayjs'
-import DayNightStatus from './DayNightStatus'
-import showAlert from '@/components/basic/Alert'
-
-let useNavigation;
-let Linking;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-    Linking = require('react-native').Linking;
-}
-
-let locationDetail;
-
-let sunriseA = new Date()
-sunriseA.setHours(6)
-sunriseA.setMinutes(0)
-sunriseA.setSeconds(0)
-sunriseA.setMilliseconds(0)
-const sunsetA = new Date()
-sunsetA.setHours(18)
-sunsetA.setMinutes(0)
-sunsetA.setSeconds(0)
-sunsetA.setMilliseconds(0)
-
-const utc = require('dayjs/plugin/utc')
-const timezone = require('dayjs/plugin/timezone')
-var advanced = require("dayjs/plugin/advancedFormat")
-
-dayjs.extend(utc)
-dayjs.extend(timezone)
-dayjs.extend(advanced)
-
-
-let noTimestampData = false;
-export default function DayNightCard(props: { isNight: boolean, count: number,authInfo:any,refresh:Function }) {
-    const user = useSelector((state: any) => state.user);
-    const dayStore = useSelector((state: any) => state.day);
-    const nightStore = useSelector((state: any) => state.night);
-    const [authInfo, setAuthInfo] = useState(props.authInfo)
-
-    const [sunriseDate, setSunriseDate] = useState<any>(sunriseA)
-    const [sunsetDate, setSunsetDate] = useState<any>(sunsetA)
-
-
-    const [showDetailModal, setShowDetailModal] = useState(false)
-    const [showDetailPopup, setShowDetailPopup] = useState(false)
-
-    const [nightDate, setNightDate] = useState(new Date())
-    const [dayDate, setDayDate] = useState(new Date())
-    const dispatch = useDispatch();
-    const { t } = useTranslation()
-    const isMember = true;
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    useEffect(() => {
-        if (user.isLogin) {
-        } else {
-            setSunriseDate(sunriseA)
-            setSunsetDate(sunsetA)
-
-            dispatch(setDayRingData({
-                date: new Date().getTime(),
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-            dispatch(setNightRingData({
-                date: new Date().getTime(),
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-
-            setAuthInfo(null)
-            updateUnloginData()
-        }
-    }, [user.isLogin])
-
-    useEffect(() => {
-        setAuthInfo(props.authInfo)
-    }, [props.authInfo])
-
-    useEffect(() => {
-        if (locationDetail)
-            updateDate(locationDetail)
-    }, [])
-
-    useEffect(() => {
-        if (locationDetail) {
-            var detail: any = locationDetail
-            var now = new Date()
-            if (now.getHours() == 0 && now.getMinutes() == 0 && now.getSeconds() == 0) {
-                detail.daylights.splice(0, 1)
-            }
-            locationDetail = detail
-
-            if (detail && (detail as any).daylights) {
-                (detail as any).daylights.map(item => {
-                    if (noTimestampData) {
-                        item.sunrise_ts = new Date(item.date + 'T' + item.sunrise + ':00').getTime()
-                        item.sunset_ts = new Date(item.date + 'T' + item.sunset + ':00').getTime()
-                    }
-                })
-            }
-            updateDate(detail)
-        }
-    }, [props.count])
-
-    useDidShow(() => {
-        if (!user.isLogin) {
-            Taro.setStorage({
-                key: 'showNightRing',
-                data: false
-            })
-            Taro.setStorage({
-                key: 'showDayRing',
-                data: false
-            })
-        }
-    })
-
-    function updateDate(data) {
-        var today = new Date()
-        if (user.isLogin && authInfo && isMember && data && data.daylights && data.daylights.length > 0) {
-            // var sunriseObj,sunsetObj;
-            var list = data.daylights
-            for (var i = 0; i < (list.length - 1); i++) {
-                //夜间
-                if (list[i].sunset_ts < today.getTime() && list[i + 1].sunrise_ts > today.getTime()) {
-                    if (props.isNight) {
-                        global.nightObj = {
-                            is_polar_night: list[i].is_polar_night,
-                            sunrise: {
-                                timestamp: list[i + 1].sunrise_ts,
-                                time: list[i + 1].sunrise
-                            },
-                            sunset: {
-                                timestamp: list[i].sunset_ts,
-                                time: list[i].sunset
-                            }
-                        }
-                    }
-                    else {
-                        global.dayObj = {
-                            is_polar_day: list[i + 1].is_polar_day,
-                            sunrise: {
-                                timestamp: list[i + 1].sunrise_ts,
-                                time: list[i + 1].sunrise
-                            },
-                            sunset: {
-                                timestamp: list[i + 1].sunset_ts,
-                                time: list[i + 1].sunset
-                            }
-                        }
-                    }
-                }
-                //白天
-                else if (list[i].sunrise_ts < today.getTime() && list[i].sunset_ts > today.getTime()) {
-                    if (props.isNight) {
-                        global.nightObj = {
-                            is_polar_night: list[i].is_polar_night,
-                            sunrise: {
-                                timestamp: list[i + 1].sunrise_ts,
-                                time: list[i + 1].sunrise
-                            },
-                            sunset: {
-                                timestamp: list[i].sunset_ts,
-                                time: list[i].sunset
-                            }
-                        }
-                    }
-                    else {
-                        global.dayObj = {
-                            is_polar_day: list[i].is_polar_day,
-                            sunrise: {
-                                timestamp: list[i].sunrise_ts,
-                                time: list[i].sunrise
-                            },
-                            sunset: {
-                                timestamp: list[i].sunset_ts,
-                                time: list[i].sunset
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        else {
-            locationDetail = null
-            setAuthInfo(null)
-            dispatch(updateMember({ isMember: isMember, gpsInfo: null }))
-
-            dispatch(setDayRingData({
-                date: sunriseDate,
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-            dispatch(setNightRingData({
-                date: sunsetDate,
-                sunrise: '06:00',
-                sunset: '18:00'
-            }))
-            updateUnloginData()
-
-        }
-
-    }
-
-    function updateUnloginData() {
-        var now = new Date()
-        var sunriseT = 0
-        var sunsetT = 0
-        var sunriseTDay = 0
-        var sunsetTDay = 0
-        if (now.getHours() < 6) {
-            var temp1 = new Date(now.getTime() - 24 * 3600 * 1000)
-            temp1.setHours(18)
-            temp1.setMinutes(0)
-            temp1.setSeconds(0)
-            temp1.setMilliseconds(0)
-            sunsetT = temp1.getTime()
-            sunriseT = sunsetT + 12 * 3600 * 1000
-            sunriseTDay = sunriseT
-            sunsetTDay = sunriseTDay + 12 * 3600 * 1000
-        }
-        else if (now.getHours() < 18) {
-            var temp1 = new Date()
-            temp1.setHours(6)
-            temp1.setMinutes(0)
-            temp1.setSeconds(0)
-            temp1.setMilliseconds(0)
-
-            sunriseTDay = temp1.getTime()
-            sunsetTDay = sunriseTDay + 12 * 3600 * 1000
-            sunsetT = sunsetTDay
-            sunriseT = sunsetT + 12 * 3600 * 1000
-        }
-        else {
-            var temp1 = new Date()
-            temp1.setHours(18)
-            temp1.setMinutes(0)
-            temp1.setSeconds(0)
-            temp1.setMilliseconds(0)
-            sunsetT = temp1.getTime()
-            sunriseT = sunsetT + 12 * 3600 * 1000
-            sunriseTDay = sunriseT
-            sunsetTDay = sunriseTDay + 12 * 3600 * 1000
-        }
-        global.nightObj = {
-            sunrise: {
-                timestamp: sunriseT,
-                time: '06:00'
-            },
-            sunset: {
-                timestamp: sunsetT,
-                time: '18:00'
-            }
-        }
-
-        global.dayObj = {
-            sunrise: {
-                timestamp: sunriseTDay,
-                time: '06:00'
-            },
-            sunset: {
-                timestamp: sunsetTDay,
-                time: '18:00'
-            }
-        }
-    }
-
-
-    function tapCard(e) {
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-            return
-        }
-        setShowDetailPopup(true)
-    }
-
-    function auth(e?: any) {
-        if (e && process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        var today = new Date()
-        var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
-        var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000 * 5)
-        var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
-        var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
-
-        if (process.env.TARO_ENV == 'rn') {
-            Taro.getLocation({
-                success(res) {
-                    systemLocation({
-                        lat: res.latitude,
-                        lng: res.longitude,
-                        date_start: strYesterday,
-                        date_end: strTomorrow,
-                        coordinate_system_standard: 'WGS-84'
-                    }).then(data => {
-                        noTimestampData = false
-                        console.log('get Location', data)
-                        updateDate(data);
-                        locationDetail = data;
-                        global.locationDetail = locationDetail
-                        setAuthInfo(data as any)
-                        Taro.setStorage({
-                            key: 'gps',
-                            data: JSON.stringify(data as any)
-                        })
-                        dispatch(updateMember({ isMember: isMember, gpsInfo: (data as any) }))
-                        showRing()
-                        if (Taro.getSystemInfoSync().platform == 'android' && process.env.TARO_ENV == 'rn') {
-                            var ToastAndroid = require('react-native').ToastAndroid;
-                            ToastAndroid.show(t('feature.day_night.location_updated'), ToastAndroid.LONG);
-                        }
-                        else {
-                            Taro.showToast({
-                                title: t('feature.day_night.location_updated'),
-                                icon: 'none'
-                            })
-                        }
-                        
-                    })
-                },
-                fail(res) {
-                    if (res.errMsg == 'Permissions denied!') {
-                        showAlert({
-                            title: t('feature.auth_sys.location_title'),
-                            content: t('feature.auth_sys.location_desc'),
-                            showCancel: true,
-                            cancelText: t('feature.auth_sys.location_cancel'),
-                            confirmText: t('feature.auth_sys.location_confirm'),
-                            confirm: () => {
-                                Linking.openURL('app-settings:')
-                            }
-                        })
-                    }
-                    else {
-                        if (Taro.getSystemInfoSync().platform == 'android' && process.env.TARO_ENV == 'rn') {
-                            var ToastAndroid = require('react-native').ToastAndroid;
-                            ToastAndroid.show(t('feature.day_night.location_failed'), ToastAndroid.LONG);
-                        }
-                        else {
-                            Taro.showToast({
-                                title: t('feature.day_night.location_failed'),
-                                icon: 'none'
-                            })
-                        }
-                    }
-                    console.log(res)
-                    showRing()
-                },
-                complete(res) {
-
-                }
-            })
-            return
-        }
-        Taro.chooseLocation({
-            latitude: authInfo && authInfo.lat ? authInfo.lat : undefined,
-            longitude: authInfo && authInfo.lat ? authInfo.lng : undefined,
-            success: function (res) {
-
-                systemLocation({
-                    lat: res.latitude,
-                    lng: res.longitude,
-                    name: res.name,
-                    address: res.address,
-                    date_start: strYesterday,
-                    date_end: strTomorrow,
-                    coordinate_system_standard: 'GCJ-02'
-                }).then(data => {
-                    noTimestampData = false;
-                    updateDate(data);
-                    locationDetail = data;
-                    global.locationDetail = locationDetail
-                    setAuthInfo(data as any)
-                    Taro.setStorage({
-                        key: 'gps',
-                        data: JSON.stringify(data as any)
-                    })
-                    showRing()
-                    dispatch(updateMember({ isMember: isMember, gpsInfo: (data as any) }))
-
-                    if (global.swiperDayNightRefresh) {
-                        global.swiperDayNightRefresh()
-                    }
-                })
-
-            },
-            fail(res) {
-                Taro.showToast({
-                    title: '位置修改失败!\n请重新选择就近位置',
-                    icon: 'none'
-                })
-                showRing()
-            },
-            complete(res) {
-
-            }
-        })
-
-    }
-
-    function showRing() {
-        dispatch(showNight(true))
-        dispatch(showDay(true))
-        Taro.setStorage({
-            key: 'showNightRing',
-            data: true
-        })
-        Taro.setStorage({
-            key: 'showDayRing',
-            data: true
-        })
-    }
-
-    function getLocation() {
-        if (!authInfo) {
-            return ''
-        }
-        return `${getCity()} | ${Math.abs(parseInt(authInfo.lat))}°${parseInt(authInfo.lat) < 0 ? 'S' : 'N'} ${Math.abs(parseInt(authInfo.lng))}°${parseInt(authInfo.lng) < 0 ? 'W' : 'E'}`
-    }
-
-    function getCity() {
-        var city = ''
-        if (!authInfo) {
-            return ''
-        }
-        if ((authInfo as any).address) {
-            if ((authInfo as any).address.city.length > 0) {
-                city = (authInfo as any).address.city
-            }
-            else if ((authInfo as any).address.province.length > 0) {
-                city = (authInfo as any).address.province
-            }
-            else if ((authInfo as any).address.country.length > 0) {
-                city = (authInfo as any).address.country
-            }
-            else {
-                city = t('feature.track_time_duration.third_ring.unknown')
-            }
-        }
-        else {
-            city = t('feature.track_time_duration.third_ring.unknown')
-        }
-        return city
-    }
-
-    function clearData() {
-        Taro.showModal({
-            title: '提示',
-            content: '确认清除位置数据?',
-            success: function (res) {
-                if (res.confirm) {
-                    clearLocation().then(res => {
-                        props.refresh()
-                    })
-                } else if (res.cancel) {
-                    console.log('用户点击取消')
-                }
-            }
-        })
-    }
-
-    function detailModalContent() {
-        var timezone = getTimezone()
-        if (!authInfo || !(authInfo as any).lat) {
-            return <View style={{ height: 100, display: 'flex', alignItems: 'center', justifyContent: 'center', width: rpxToPx(750) }}>
-                <Text>暂无位置信息</Text>
-            </View>
-        }
-        return <View style={{ display: 'flex', flexDirection: 'column' }}>
-            {
-                <View className="cell_bg">
-                    {
-                        <View className="cell_full">
-                            <Text className="cell_title">{t('feature.track_time_duration.third_ring.location')}</Text>
-                            <Text className="cell_value">{authInfo ? getLocation() : t('feature.track_time_duration.third_ring.enter')}</Text>
-                        </View>
-                    }
-                    <View className="cell_line" style={{ height: 1 }} />
-
-
-                    {
-                        <View className="cell_full" >
-                            <Text className="cell_title">{t('feature.track_time_duration.third_ring.latitude')}</Text>
-
-                            <Text className="cell_value">{(authInfo as any).lat}</Text>
-
-
-                        </View>
-                    }
-                    <View className="cell_line" style={{ height: 1 }} />
-
-                    <View className="cell_full">
-                        <Text className="cell_title" >{t('feature.track_time_duration.third_ring.longitude')}</Text>
-
-                        <Text className="cell_value">{(authInfo as any).lng}</Text>
-
-                    </View>
-                    <View className="cell_line" style={{ height: 1 }} />
-                    <View className="cell_full">
-                        <Text className="cell_title">{t('feature.track_time_duration.third_ring.timezone')}</Text>
-
-                        <Text className="cell_value">{timezone}</Text>
-
-                    </View>
-
-
-
-                </View>
-
-            }
-
-            <Text onClick={() => {
-                clearData()
-                setShowDetailModal(false)
-            }} style={{ width: '100%', textAlign: 'center', marginBottom: 50, color: '#fff', marginTop: 20 }}>清除位置</Text>
-        </View>
-    }
-
-    function modalContent2() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowDetailModal(false)
-            }}
-            confirm={() => { }}>
-            {
-                detailModalContent()
-            }
-        </Modal>
-    }
-
-    function modalContent() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowDetailPopup(false)
-            }}
-            confirm={() => { }}>
-            <DayNightDetailPopup
-                isNight={props.isNight}
-                authInfo={authInfo}
-                nightDate={nightDate}
-                dayDate={dayDate}
-                updateLocation={auth}
-                onClose={() => { setShowDetailPopup(false) }}
-            />
-        </Modal>
-    }
-
-
-    function longClick() {
-        if (user.isLogin && user.test_user && authInfo)
-            setShowDetailModal(true)
-    }
-
-    function showLocationAlert(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        tapCard(e)
-    }
-
-    function nightRing() {
-        return <DayNightRing
-            isNight={true}
-            isThirdRing={false}
-            canvasId={'day_night_card_night_ring'}
-            authInfo={authInfo}
-        />
-    }
-
-    function localNow(now: Date) {
-        if (authInfo && authInfo.timezone) {
-            return new Date(TimeFormatter.transferTimestamp(now.getTime(), authInfo.timezone.gmt))
-        }
-        return now
-    }
-
-    function dayRing() {
-        return <DayNightRing
-            isNight={false}
-            isThirdRing={false}
-            canvasId={'day_night_card_big_day'}
-            authInfo={authInfo}
-        />
-    }
-
-    function getSunsetDuration() {
-
-        if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
-            global.sunsetDuration = TimeFormatter.durationFormate(authInfo.night_completed.sunrise_ts, authInfo.night_completed.sunset_ts, true)
-            return TimeFormatter.durationFormate(authInfo.night_completed.sunrise_ts, authInfo.night_completed.sunset_ts, true)
-        }
-
-        var now = new Date()
-        if (authInfo && global.nightObj) {
-            var nightObj = global.nightObj
-            if (nightObj.sunset.timestamp < now.getTime() && nightObj.sunrise.timestamp > now.getTime()) {
-                global.sunsetDuration = TimeFormatter.countdown(nightObj.sunset.timestamp, now.getTime(), true)
-                return TimeFormatter.countdown(nightObj.sunset.timestamp, now.getTime(), true)
-            }
-            global.sunsetDuration = TimeFormatter.calculateTimeDifference(nightObj.sunset.timestamp, nightObj.sunrise.timestamp);
-            return TimeFormatter.calculateTimeDifference(nightObj.sunset.timestamp, nightObj.sunrise.timestamp);
-        }
-
-        now = localNow(now)
-        if (props.isNight && sunsetDate) {
-            if (now.getTime() > sunsetDate.getTime()) {
-                global.sunsetDuration = TimeFormatter.countdown(sunsetDate.getTime(), now.getTime(), true)
-                return TimeFormatter.countdown(sunsetDate.getTime(), now.getTime(), true)
-            }
-            // return TimeFormatter.countdown(sunsetDate.getTime())
-        }
-
-
-        var sunRiseObj = nightStore.nightRingSunrise
-        var sunSetObj = nightStore.nightRingSunset
-        var sunRise = 24 * 60 + parseInt(sunRiseObj.split(':')[0]) * 60 + parseInt(sunRiseObj.split(':')[1])
-        var sunSet = parseInt(sunSetObj.split(':')[0]) * 60 + parseInt(sunSetObj.split(':')[1])
-        if (sunSetObj.indexOf('PM') != -1) {
-            sunSet += 12 * 60
-        }
-
-        var duration = (sunRise - sunSet) * 60 * 1000
-        global.sunsetDuration = TimeFormatter.calculateTimeDifference(now.getTime(), now.getTime() + duration);
-        return TimeFormatter.calculateTimeDifference(now.getTime(), now.getTime() + duration);
-    }
-
-    function getSunriseDuration() {
-        if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
-            global.sunriseDuration = TimeFormatter.durationFormate(authInfo.day_completed.sunrise_ts, authInfo.day_completed.sunset_ts, true)
-            return TimeFormatter.durationFormate(authInfo.day_completed.sunrise_ts, authInfo.day_completed.sunset_ts, true)
-        }
-
-        var now = new Date()
-        var now = new Date()
-        if (global.dayObj) {
-            var dayObj = global.dayObj
-            if (dayObj.sunrise.timestamp < now.getTime() && dayObj.sunset.timestamp > now.getTime()) {
-                global.sunriseDuration = TimeFormatter.countdown(dayObj.sunrise.timestamp, now.getTime(), true)
-                return TimeFormatter.countdown(dayObj.sunrise.timestamp, now.getTime(), true)
-            }
-            global.sunriseDuration = TimeFormatter.calculateTimeDifference(dayObj.sunrise.timestamp, dayObj.sunset.timestamp, true);
-            return TimeFormatter.calculateTimeDifference(dayObj.sunrise.timestamp, dayObj.sunset.timestamp, true);
-        }
-        return ''
-    }
-
-    function completedDate() {
-        if (props.isNight) {
-            if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
-                if (localNow(new Date()).getTime() != new Date().getTime()) {
-                    return TimeFormatter.getMonthAndDayByTimestamp(authInfo.night_completed.sunrise_ts, true)
-                }
-                return TimeFormatter.dateDescription(authInfo.night_completed.sunrise_ts, true)
-            }
-            return ''
-        }
-        if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
-            if (localNow(new Date()).getTime() != new Date().getTime()) {
-                return TimeFormatter.getMonthAndDayByTimestamp(authInfo.day_completed.sunset_ts, true)
-            }
-            return TimeFormatter.dateDescription(authInfo.day_completed.sunset_ts, true)
-        }
-        return ''
-    }
-
-    function showArrow() {
-        if (props.isNight) {
-            if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
-                return true
-            }
-            return false
-        }
-        if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
-            return true
-        }
-        return false
-    }
-
-    function currentStatus() {
-        if (showArrow()) {
-            if (props.isNight) {
-                if (authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
-                    return t('feature.day_night.last_updated')
-                }
-                return t('feature.day_night.ended')
-            }
-            return t('feature.day_night.last_updated')
-        }
-        var strTime = props.isNight ? getSunsetDuration() : getSunriseDuration()
-        return (strTime.indexOf('小时') != -1 || strTime.indexOf('分钟') != -1) ? t('feature.day_night.upcoming') : t('feature.day_night.in_real_time')
-    }
-
-    function footerDesc() {
-        var now = new Date()
-        if (props.isNight) {
-            if (global.nightObj) {
-                if (now.getTime() < global.nightObj.sunset.timestamp) {
-                    return TimeFormatter.countdown(global.nightObj.sunset.timestamp, now.getTime(), true)
-                }
-                return TimeFormatter.countdown(global.nightObj.sunrise.timestamp, now.getTime(), true)
-            }
-        }
-        else {
-            if (global.dayObj) {
-                if (now.getTime() < global.dayObj.sunrise.timestamp) {
-                    return TimeFormatter.countdown(global.dayObj.sunrise.timestamp, now.getTime(), true)
-                }
-                return TimeFormatter.countdown(global.dayObj.sunset.timestamp, now.getTime(), true)
-            }
-        }
-
-        return ''
-    }
-
-    function footerIcon() {
-        var now = new Date()
-        if (props.isNight) {
-            if (now.getTime() < sunsetDate.getTime()) {
-                return <IconSunset color={ColorType.white + '66'} width={rpxToPx(28)} />
-
-            }
-            return <IconSunrise color={ColorType.white + '66'} width={rpxToPx(28)} />
-        }
-
-        if (now.getTime() > sunriseDate.getTime() && now.getTime() < sunsetDate.getTime()) {
-
-            return <IconSunset color={ColorType.white + '66'} width={rpxToPx(28)} />
-        }
-        return <IconSunrise color={ColorType.white + '66'} width={rpxToPx(28)} />
-
-    }
-
-    function currentTime() {
-        var now = new Date()
-        if (authInfo && authInfo.timezone) {
-            var t1 = TimeFormatter.tzLocalTime(now.getTime(),authInfo.timezone.id)////dayjs(now.getTime()).tz(authInfo.timezone.id)
-            if (now.getHours() == t1.hour() && now.getMinutes() == t1.minute()) {
-                return <View />
-            }
-        }
-
-        var now2 = localNow(now)
-        if (now.getTime() == now2.getTime()) {
-            return ''
-        }
-        let offset = 0;
-        if (authInfo && authInfo.timezone) {
-            var current1 = dayjs()
-            var current = TimeFormatter.tzLocalTime(now.getTime(),authInfo.timezone.id)//dayjs().tz(authInfo.timezone.id)
-            offset = current.date() * 24 * 60 + current.hour() * 60 + current.minute() - current1.date() * 24 * 60 - current1.hour() * 60 - current1.minute()
-        }
-        var hour = Math.floor(Math.abs(offset) / 60)
-        var minute = Math.abs(offset) % 60
-        var time = ''
-        if (global.language == 'en') {
-            time = `${hour} h`
-            if (minute > 0) {
-                time += ` ${minute} m`
-            }
-        }
-        else {
-            time = `${hour}小时`
-            if (minute > 0) {
-                time += `${minute}分钟`
-            }
-        }
-        // const ccc = dayjs().tz('Arctic/Longyearbyen').format('YYYY-MM-DD HH:mm:ss')
-        // const current = dayjs().utcOffset(offset).format('YYYY-MM-DD HH:mm:ss')
-        var current;
-        if (authInfo && authInfo.timezone) {
-            current = TimeFormatter.tzTimeFormateLocalTime(new Date().getTime(),authInfo.timezone.id,'HH:mm')//dayjs().tz(authInfo.timezone.id).format('HH:mm')
-        }
-        else {
-            current = dayjs().format('HH:mm')
-        }
-
-        return <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
-            <Text className='ring_city' numberOfLines={1}>{getCity()}</Text>
-            <Text className='ring_clock' style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{current}</Text>
-            <Text className='ring_timezone'>{
-                offset > 0 ? t('feature.day_night.ahead_desc', { time: time }) : t('feature.day_night.behind_desc', { time: time })
-            }</Text>
-        </View>
-    }
-
-    function cardContent() {
-        return <View style={{ position: 'relative' }}>
-            <View style={{ display: 'flex', flexDirection: 'column', zIndex: 1 }} onClick={showLocationAlert} onLongPress={longClick}>
-                <View className="ring_full_container" style={{ paddingBottom: 0 }}>
-                    <View style={{
-                        display: 'flex',
-                        flexDirection: 'row',
-                        marginTop: 0,
-                        marginBottom: 0,
-                        padding: 0,
-                        alignItems: 'center'
-                    }}>
-                        <View style={{ display: 'flex', position: 'relative' }}>
-                            {
-                                props.isNight ? nightRing() : dayRing()
-                            }
-                            <View style={{ color: '#fff', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center', display: 'flex' }}>{currentTime()}</View>
-                        </View>
-                        <View style={{ display: 'flex', flexDirection: 'column', flexShrink: 0, flex: 1, marginLeft: rpxToPx(52) }}>
-                            <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
-                                <Text className='ring_card_duration_title'>{props.isNight ? t('feature.common.overnight') : t('feature.common.day')}</Text>
-                                {
-                                    !props.isNight && global.dayObj && global.dayObj.is_polar_day && <View className='polar_tag'>{t('feature.day_night.polar_day')}</View>
-                                }
-                                {
-                                    props.isNight && global.nightObj && global.nightObj.is_polar_night && <View className='polar_tag'>{t('feature.day_night.polar_night')}</View>
-                                }
-                            </View>
-
-                            <Text className='ring_card_duration_value' style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{props.isNight ? getSunsetDuration() : getSunriseDuration()}</Text>
-
-                        </View>
-                        <View className='day_card_header'>
-                            {
-                                props.isNight && global.nightObj && <DayNightStatus
-                                    authInfo={authInfo}
-                                    isNight={props.isNight}
-                                    sunrise_ts={global.nightObj.sunrise.timestamp}
-                                    sunset_ts={global.nightObj.sunset.timestamp}
-                                />
-                            }
-                            {
-                                !props.isNight && global.dayObj && <DayNightStatus
-                                    authInfo={authInfo}
-                                    isNight={props.isNight}
-                                    sunrise_ts={global.dayObj.sunrise.timestamp}
-                                    sunset_ts={global.dayObj.sunset.timestamp}
-                                />
-                            }
-                        </View>
-                        <View className='day_night_card_footer1' style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>
-                            {
-                                !showArrow() && <View className='footer_sun_icon_bg' style={{ backgroundColor: global.isDebug ? 'pink' : 'transparent' }}>
-                                    {
-                                        footerIcon()
-                                    }
-                                </View>
-                            }
-                            <Text className='footer_desc_text' style={{ backgroundColor: global.isDebug ? 'black' : 'transparent' }}>{showArrow() ? completedDate() : footerDesc()}</Text>
-                            <Image className="card_arrowaaa" style={{ backgroundColor: global.isDebug ? 'blue' : 'transparent' }} src={require('@/assets/images/arrow3.png')} />
-                        </View>
-                    </View>
-                </View>
-            </View>
-            {
-                showDetailPopup && modalContent()
-            }
-            {
-                showDetailModal && modalContent2()
-            }
-        </View>
-    }
-
-    return process.env.TARO_ENV =='weapp'?<Box>{cardContent()}</Box>:
-    <View className='rn_card_bg'>{cardContent()}</View>
-}

+ 0 - 783
src/features/daynight/DayNightDetailPopup.tsx

@@ -1,783 +0,0 @@
-import { View, Text } from '@tarojs/components'
-import '@/features/trackTimeDuration/components/CircadianDetailPopup.scss'
-import { useTranslation } from 'react-i18next'
-import { useEffect, useState } from 'react'
-import { getTimezone, getTimezoneName, kIsIOS, rpxToPx } from '@/utils/tools'
-import { TimeFormatter } from '@/utils/time_format'
-import { useSelector } from 'react-redux'
-import { ColorType } from '@/context/themes/color'
-import Timeline from '@/components/view/Timeline'
-import Taro from '@tarojs/taro'
-import dayjs, { Dayjs } from 'dayjs'
-import showAlert from '@/components/basic/Alert'
-import { AtActivityIndicator } from 'taro-ui'
-import showActionSheet from '@/components/basic/ActionSheet'
-import { jumpPage } from '../trackTimeDuration/hooks/Common'
-
-
-const utc = require('dayjs/plugin/utc')
-const timezone = require('dayjs/plugin/timezone')
-
-dayjs.extend(utc)
-dayjs.extend(timezone)
-
-let LinearGradient, useActionSheet, useNavigation
-if (process.env.TARO_ENV == 'rn') {
-    LinearGradient = require('react-native-linear-gradient').default
-    useActionSheet = require('@expo/react-native-action-sheet').useActionSheet
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-export default function DayNightDetailPopup(props: {
-    isNight: boolean,
-    authInfo: any,
-    nightDate: any,
-    dayDate: any,
-    onClose: Function,
-    updateLocation: Function
-}) {
-    const dayNight = useSelector((state: any) => state.night);
-    const day = useSelector((state: any) => state.day);
-    const user = useSelector((state: any) => state.user);
-    const [tabIndex, setTabIndex] = useState(0)
-    const [isLoading, setIsLoading] = useState(false)
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-    const { t } = useTranslation()
-
-    let showActionSheetWithOptions;
-    if (process.env.TARO_ENV == 'rn') {
-        showActionSheetWithOptions = useActionSheet()
-    }
-
-    useEffect(() => {
-        if (isCompleted()) {
-            setTabIndex(1)
-        }
-    }, [])
-
-    global.updateLocationLoading = (status) => {
-        setIsLoading(status)
-    }
-
-    function localNow(now: Date) {
-        if (props.authInfo && props.authInfo.timezone) {
-            return new Date(TimeFormatter.transferTimestamp(now.getTime(), props.authInfo.timezone.gmt))
-        }
-        return now
-    }
-
-    function getTitle() {
-        return props.isNight ? t('feature.day_night.night_popover') : t('feature.day_night.day_popover')
-    }
-
-    function getCompletedTitle() {
-        if (props.isNight) {
-            return TimeFormatter.getDayOfWeek(new Date(props.authInfo.night_completed.sunrise_ts).getDay(), true)
-        }
-        return TimeFormatter.getDayOfWeek(new Date(props.authInfo.night_completed.sunset_ts).getDay(), true)
-    }
-
-    function getSubTitle() {
-        var now = new Date()
-        if (props.isNight) {
-            if (localNow(now).getTime() != now.getTime()) {
-                return TimeFormatter.getMonthAndDayByTimestamp(props.authInfo.night_completed.sunrise_ts, true)
-            }
-            return TimeFormatter.dateDescription(props.authInfo.night_completed.sunrise_ts, true)
-        }
-        if (localNow(now).getTime() != now.getTime()) {
-            return TimeFormatter.getMonthAndDayByTimestamp(props.authInfo.night_completed.sunset_ts, true)
-        }
-        return TimeFormatter.dateDescription(props.authInfo.night_completed.sunset_ts, true)
-    }
-
-    function isCompleted() {
-        if (props.isNight) {
-            if (props.authInfo && props.authInfo.night_completed && new Date().getTime() > props.authInfo.night_completed.sunrise_ts) {
-                return true
-            }
-        }
-        else {
-            if (props.authInfo && props.authInfo.day_completed && new Date().getTime() > props.authInfo.day_completed.sunset_ts) {
-
-                return true
-            }
-        }
-        return false
-    }
-
-    function nightDuration() {
-        if (isCompleted()) {
-            return TimeFormatter.calculateTimeDifference(props.authInfo.night_completed.sunset_ts, props.authInfo.night_completed.sunrise_ts, true);
-        }
-
-        if (global.nightObj) {
-            return TimeFormatter.calculateTimeDifference(global.nightObj.sunset.timestamp, global.nightObj.sunrise.timestamp, true);
-        }
-        return ''
-    }
-
-    function dayDuration() {
-        if (isCompleted()) {
-            return TimeFormatter.calculateTimeDifference(props.authInfo.day_completed.sunrise_ts, props.authInfo.day_completed.sunset_ts, true);
-        }
-        if (global.dayObj) {
-            return TimeFormatter.calculateTimeDifference(global.dayObj.sunrise.timestamp, global.dayObj.sunset.timestamp, true);
-        }
-        return ''
-    }
-
-    function showExtraData() {
-        var now = new Date()
-        if (props.isNight) {
-            if (global.nightObj.sunset.timestamp > now.getTime()) {
-                return false
-            }
-            return true
-        }
-        if (global.dayObj.sunrise.timestamp < now.getTime() && now.getTime() < global.dayObj.sunset.timestamp) {
-            return true;
-        }
-        return false
-    }
-
-    function timeCount() {
-        var now = new Date()
-        if (props.isNight) {
-            if (now.getTime() < global.nightObj.sunrise.timestamp) {
-                return TimeFormatter.countdown(global.nightObj.sunset.timestamp, now.getTime(), true)
-            }
-            return TimeFormatter.countdown(global.nightObj.sunset.timestamp, now.getTime(), true)
-        } else {
-
-            if (now.getTime() < global.dayObj.sunset.timestamp) {
-                return TimeFormatter.countdown(global.dayObj.sunrise.timestamp, now.getTime(), true)
-            }
-            return TimeFormatter.countdown(global.dayObj.sunrise.timestamp, now.getTime(), true)
-
-
-        }
-    }
-
-    function timeCount2() {
-        var now = new Date()
-        if (props.isNight) {
-
-            if (now.getTime() < global.nightObj.sunset.timestamp) {
-                return TimeFormatter.countdown(global.nightObj.sunrise.timestamp, now.getTime(), true)
-            }
-            return TimeFormatter.countdown(global.nightObj.sunrise.timestamp, now.getTime(), true)
-
-        } else {
-            return TimeFormatter.countdown(global.dayObj.sunset.timestamp, now.getTime(), true)
-        }
-    }
-
-    function timeDesc() {
-        var now = new Date()
-        if (props.isNight) {
-            if (global.nightObj.sunset.timestamp < now.getTime()) {
-                return t('feature.day_night.time_past_sunset')//'Time past Sunset'
-            }
-            return t('feature.day_night.time_to_sunset')//'Time to Sunset'
-        }
-        else {
-            if (now.getTime() < global.dayObj.sunrise.timestamp) {
-                return t('feature.day_night.time_to_sunrise')//'Time to Sunrise'
-            }
-            return t('feature.day_night.time_past_sunrise')//'Time past Sunrise'
-        }
-    }
-
-    function timeDesc2() {
-        if (props.isNight) {
-            return t('feature.day_night.time_to_sunrise')//'Time to Sunrise'
-        }
-        return t('feature.day_night.time_to_sunset')//'Time to Sunset'
-    }
-
-    function overview() {
-        return <View className='pop_ring_bg pop_overview_bg'>
-            <Text className='pop_duration_title'>{props.isNight ? t('feature.day_night.night_duration') : t('feature.day_night.day_duration')}</Text>
-            <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
-                <Text className='pop_duration_txt'>{props.isNight ? nightDuration() : dayDuration()}</Text>
-            </View>
-            {
-                !isCompleted() && <View style={{ marginTop: rpxToPx(20), display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
-                    <View className='countdown_time_bg'>
-                        <Text className='title' style={{ color: '#fff', opacity: 0.4 }}>{timeDesc()}</Text>
-                        <Text className='value' style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{timeCount()}</Text>
-                    </View>
-                    {
-                        showExtraData() && <View className='countdown_time_bg'>
-                            <Text className='title' style={{ color: '#fff', opacity: 0.4 }}>{timeDesc2()}</Text>
-                            <Text className='value' style={{ opacity: 0.4, color: props.isNight ? ColorType.night : ColorType.day }}>{timeCount2()}</Text>
-                        </View>
-                    }
-
-                </View>
-            }
-
-        </View>
-    }
-
-    function nightDurationDesc() {
-        if (!props.authInfo || !(props.authInfo as any).lat) {
-            if (new Date().getHours() >= 6) {
-                return [t('feature.day_night.tonight'), t('feature.day_night.tomorrow')]
-            }
-            return [t('feature.day_night.last_night'), t('feature.day_night.today')]
-        }
-
-        if (diffTimeZone()) {
-            var sunriseDate = new Date(TimeFormatter.transferTimestamp(global.nightObj.sunrise.timestamp, props.authInfo.timezone.gmt))
-            var sunsetDate = new Date(TimeFormatter.transferTimestamp(global.nightObj.sunset.timestamp, props.authInfo.timezone.gmt))
-            return [
-                (sunsetDate.getMonth() + 1) + '月' + sunsetDate.getDate() + '日',
-                (sunriseDate.getMonth() + 1) + '月' + sunriseDate.getDate() + '日',
-            ];
-        }
-        var strSunset = ''
-        var strSunrise = '';
-        if (global.nightObj) {
-            if (new Date().getDate() == new Date(global.nightObj.sunset.timestamp).getDate()) {
-                strSunset = t('feature.day_night.tonight')
-            }
-            else if (new Date().getDate() == new Date(global.nightObj.sunset.timestamp + 24 * 3600 * 1000).getDate()) {
-                strSunset = t('feature.day_night.last_night')
-            }
-            else if (new Date().getDate() == new Date(global.nightObj.sunset.timestamp - 24 * 3600 * 1000).getDate()) {
-                strSunset = t('feature.day_night.tomorrow')
-            }
-            else {
-                strSunset = dayjs(global.nightObj.sunset.timestamp).format(global.language == 'en' ? 'MMM D' : 'M月D日')
-            }
-            if (new Date().getDate() == new Date(global.nightObj.sunrise.timestamp).getDate()) {
-                strSunrise = t('feature.day_night.today')
-            }
-            else if (new Date().getDate() == new Date(global.nightObj.sunrise.timestamp + 24 * 3600 * 1000).getDate()) {
-                strSunrise = t('feature.day_night.yesterday')
-            }
-            else if (new Date().getDate() == new Date(global.nightObj.sunrise.timestamp - 24 * 3600 * 1000).getDate()) {
-                strSunrise = t('feature.day_night.tomorrow')
-            }
-            else {
-                strSunrise = dayjs(global.nightObj.sunrise.timestamp).format(global.language == 'en' ? 'MMM D' : 'M月D日')
-            }
-        }
-        return [strSunset, strSunrise];
-    }
-
-    function dayDurationDesc() {
-        debugger
-        if (!props.authInfo || !(props.authInfo as any).lat) {
-            if (new Date().getHours() >= 18) {
-                return [t('feature.day_night.tomorrow'), t('feature.day_night.tomorrow')]
-            }
-            return [t('feature.day_night.today'), t('feature.day_night.today')]
-        }
-        if (diffTimeZone()) {
-            var sunriseDate = new Date(TimeFormatter.transferTimestamp(global.dayObj.sunrise.timestamp, props.authInfo.timezone.gmt))
-            var sunsetDate = new Date(TimeFormatter.transferTimestamp(global.dayObj.sunset.timestamp, props.authInfo.timezone.gmt))
-            return [
-                (sunriseDate.getMonth() + 1) + '月' + sunriseDate.getDate() + '日',
-                (sunsetDate.getMonth() + 1) + '月' + sunsetDate.getDate() + '日',
-            ];
-        }
-        var strSunset = ''
-        var strSunrise = '';
-        if (global.dayObj) {
-            if (new Date().getDate() == new Date(global.dayObj.sunset.timestamp).getDate()) {
-                strSunset = t('feature.day_night.tonight')
-            }
-            else if (new Date().getDate() == new Date(global.dayObj.sunset.timestamp + 24 * 3600 * 1000).getDate()) {
-                strSunset = t('feature.day_night.last_night')
-            }
-            else if (new Date().getDate() == new Date(global.dayObj.sunset.timestamp - 24 * 3600 * 1000).getDate()) {
-                strSunset = t('feature.day_night.tomorrow')
-            }
-            else {
-                strSunset = dayjs(global.dayObj.sunset.timestamp).format(global.language == 'en' ? 'MMM D' : 'M月D日')
-            }
-            if (new Date().getDate() == new Date(global.dayObj.sunrise.timestamp).getDate()) {
-                strSunrise = t('feature.day_night.today')
-            }
-            else if (new Date().getDate() == new Date(global.dayObj.sunrise.timestamp + 24 * 3600 * 1000).getDate()) {
-                strSunrise = t('feature.day_night.yesterday')
-            }
-            else if (new Date().getDate() == new Date(global.dayObj.sunrise.timestamp - 24 * 3600 * 1000).getDate()) {
-                strSunrise = t('feature.day_night.tomorrow')
-            }
-            else {
-                strSunrise = dayjs(global.dayObj.sunrise.timestamp).format(global.language == 'en' ? 'MMM D' : 'M月D日')
-            }
-        }
-        return [strSunrise, strSunset];
-        // if (props.dayDate.getDate() == new Date().getDate()) {
-        //     return [t('feature.day_night.today'),t('feature.day_night.today')]
-        // }
-        // return [t('feature.day_night.tomorrow'),t('feature.day_night.tomorrow')]
-    }
-
-    function diffTimeZone() {
-        var now = new Date()
-        if (props.authInfo && props.authInfo.timezone) {
-            var t1 = TimeFormatter.tzLocalTime(now.getTime(), props.authInfo.timezone.id)//dayjs(now.getTime()).tz(props.authInfo.timezone.id)
-            if (now.getHours() == t1.hour() && now.getMinutes() == t1.minute()) {
-                return false
-            }
-            else {
-                return true
-            }
-        }
-        return false
-    }
-
-    function events() {
-        let timelineItems: any = []
-
-        const timeFormat = global.language == 'en' ? 'MMM D HH:mm' : 'M月D日 HH:mm'
-        const timeFormat2 = global.language == 'en' ? 'MMM D' : 'M月D日'
-
-        if (props.isNight) {
-            if (isCompleted()) {
-                var newT;
-                if (props.authInfo.timezone) {
-                    newT = TimeFormatter.tzTimeFormateLocalTime(props.authInfo.night_completed.sunset_ts, props.authInfo.timezone.id, timeFormat)
-                    //dayjs(props.authInfo.night_completed.sunset_ts).tz(props.authInfo.timezone.id).format('M月D日 HH:mm')
-                }
-                else {
-                    newT = dayjs(props.authInfo.night_completed.sunset_ts).format(timeFormat)
-                }
-
-                var list = nightDurationDesc()
-                timelineItems.push(
-                    {
-                        status: 'done',
-                        title: t('feature.day_night.sunset'),//list[0],
-                        // content: newT,
-                        content: diffTimeZone() ? newT : TimeFormatter.dateTimeFormate(props.authInfo.night_completed.sunset_ts, true),
-                        date: '',
-                        color: ColorType.night
-                    }
-                )
-                var newT2;
-                if (props.authInfo.timezone) {
-                    newT2 = TimeFormatter.tzTimeFormateLocalTime(props.authInfo.night_completed.sunrise_ts, props.authInfo.timezone.id, timeFormat)
-
-                    //dayjs(props.authInfo.night_completed.sunrise_ts).tz(props.authInfo.timezone.id).format('M月D日 HH:mm')
-                }
-                else {
-                    newT2 = dayjs(props.authInfo.night_completed.sunrise_ts).format(timeFormat)
-                }
-                // var newT2 = dayjs(props.authInfo.night_completed.sunrise_ts).tz('GMT+0800').format('MM-DD HH:mm')//TimeFormatter.transferTimestamp(props.authInfo.night_completed.sunrise_ts, props.authInfo.timezone)
-                timelineItems.push(
-                    {
-                        status: 'done',
-                        title: t('feature.day_night.sunrise'),//list[1],
-                        // content: newT2,//list[1] + ' ' + global.nightObj.sunrise.time.substring(0, 5),
-                        content: diffTimeZone() ? newT2 : TimeFormatter.dateTimeFormate(props.authInfo.night_completed.sunrise_ts, true),
-                        date: '',
-                        color: ColorType.night
-                    }
-                )
-            }
-            else {
-
-                var list = nightDurationDesc()
-                if (diffTimeZone() && global.nightObj) {
-                    list[0] = TimeFormatter.tzTimeFormateLocalTime(global.nightObj.sunset.timestamp, props.authInfo.timezone.id, timeFormat2)
-                    list[1] = TimeFormatter.tzTimeFormateLocalTime(global.nightObj.sunrise.timestamp, props.authInfo.timezone.id, timeFormat2)
-                    // list[0] = dayjs(global.nightObj.sunset.timestamp).tz(props.authInfo.timezone.id).format('M月D日')
-                    // list[1] = dayjs(global.nightObj.sunrise.timestamp).tz(props.authInfo.timezone.id).format('M月D日')
-
-                }
-                timelineItems.push(
-                    {
-                        status: showExtraData() ? 'done' : 'padding',
-                        title: t('feature.day_night.sunset'),//list[0],
-                        content: list[0] + ' ' + global.nightObj.sunset.time.substring(0, 5),
-                        date: '',
-                        color: ColorType.night
-                    }
-                )
-
-                timelineItems.push(
-                    {
-                        status: 'padding',
-                        title: t('feature.day_night.sunrise'),//list[1],
-                        content: list[1] + ' ' + global.nightObj.sunrise.time.substring(0, 5),
-                        date: '',
-                        color: ColorType.night
-                    }
-                )
-
-            }
-
-        }
-        else {
-            if (isCompleted()) {
-                var newT;
-                if (props.authInfo.timezone) {
-                    newT = TimeFormatter.tzTimeFormateLocalTime(props.authInfo.day_completed.sunrise_ts, props.authInfo.timezone.id, timeFormat)
-                    // newT = dayjs(props.authInfo.day_completed.sunrise_ts).tz(props.authInfo.timezone.id).format('M月D日 HH:mm')
-                }
-                else {
-                    newT = dayjs(props.authInfo.day_completed.sunrise_ts).format(timeFormat)
-                }
-
-                timelineItems.push(
-                    {
-                        status: 'done',
-                        title: t('feature.day_night.sunrise'),//list[0],
-                        content: diffTimeZone() ? newT : TimeFormatter.dateTimeFormate(props.authInfo.day_completed.sunrise_ts, true),
-                        date: '',
-                        color: ColorType.day
-                    }
-                )
-                var newT2;
-                if (props.authInfo.timezone) {
-                    newT2 = TimeFormatter.tzTimeFormateLocalTime(props.authInfo.day_completed.sunset_ts, props.authInfo.timezone.id, timeFormat)
-                    // newT2 = dayjs(props.authInfo.day_completed.sunset_ts).tz(props.authInfo.timezone.id).format('M月D日 HH:mm')
-                }
-                else {
-                    newT2 = dayjs(props.authInfo.day_completed.sunset_ts).format(timeFormat)
-                }
-                timelineItems.push(
-                    {
-                        status: 'done',
-                        title: t('feature.day_night.sunset'),//list[1],
-                        content: diffTimeZone() ? newT2 : TimeFormatter.dateTimeFormate(props.authInfo.day_completed.sunset_ts, true),
-                        date: '',
-                        color: ColorType.day
-                    }
-                )
-            }
-            else {
-                var list = dayDurationDesc()
-                if (diffTimeZone() && global.dayObj) {
-                    list[0] = TimeFormatter.tzTimeFormateLocalTime(global.dayObj.sunrise.timestamp, props.authInfo.timezone.id, timeFormat2)
-                    list[1] = TimeFormatter.tzTimeFormateLocalTime(global.dayObj.sunset.timestamp, props.authInfo.timezone.id, timeFormat2)
-                    // list[0] = dayjs(global.dayObj.sunrise.timestamp).tz(props.authInfo.timezone.id).format('M月D日')
-                    // list[1] = dayjs(global.dayObj.sunset.timestamp).tz(props.authInfo.timezone.id).format('M月D日')
-
-                }
-                timelineItems.push(
-                    {
-                        status: showExtraData() ? 'done' : 'padding',
-                        title: t('feature.day_night.sunrise'),//dayDurationDesc(),
-                        content: list[0] + ' ' + global.dayObj.sunrise.time.substring(0, 5),
-                        date: '',
-                        color: ColorType.day
-                    }
-                )
-
-                timelineItems.push(
-                    {
-                        status: 'padding',
-                        title: t('feature.day_night.sunset'),//dayDurationDesc(),
-                        content: list[1] + ' ' + global.dayObj.sunset.time.substring(0, 5),
-                        date: '',
-                        color: ColorType.day
-                    }
-                )
-            }
-        }
-        return <View><View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
-            <Timeline items={timelineItems} title='' width={468} />
-
-        </View>
-            {
-                diffTimeZone() && <Text className="tz_note_desc" style={{ color: '#FA5151', opacity: 0.4, marginBottom: 10 }}>{diffentTZDesc()}</Text>
-            }
-        </View>
-    }
-
-    function getTZLocation() {
-        var name = props.authInfo.timezone.gmt
-        if (props.authInfo.timezone.name) {
-            name = `${name} (${props.authInfo.timezone.name})`
-        }
-        return name
-
-    }
-
-    function getDeviceLocation() {
-        return `${getTimezone()} (${getTimezoneName()})`
-    }
-
-    function getTZOffset() {
-        var current1 = dayjs()
-        var current = TimeFormatter.tzLocalTime(new Date().getTime(), props.authInfo.timezone.id)//dayjs().tz(props.authInfo.timezone.id)
-        var offset = current.date() * 24 * 60 + current.hour() * 60 + current.minute() - current1.date() * 24 * 60 - current1.hour() * 60 - current1.minute()
-
-        var hour = Math.floor(Math.abs(offset) / 60)
-        var minute = Math.abs(offset) % 60
-        var time = ''
-        if (global.language == 'en') {
-            time = `${hour} h`
-            if (minute > 0) {
-                time += ` ${minute} m`
-            }
-        }
-        else {
-            time = `${hour}小时`
-            if (minute > 0) {
-                time += `${minute}分钟`
-            }
-        }
-        return offset > 0 ? t('feature.day_night.ahead_desc', { time: time }) : t('feature.day_night.behind_desc', { time: time })
-    }
-
-
-
-    function diffentTZDesc() {
-        var current1 = dayjs()
-        var current = TimeFormatter.tzLocalTime(new Date().getTime(), props.authInfo.timezone.id)//dayjs().tz(props.authInfo.timezone.id)
-        var offset = current.date() * 24 * 60 + current.hour() * 60 + current.minute() - current1.date() * 24 * 60 - current1.hour() * 60 - current1.minute()
-        var hour = Math.floor(Math.abs(offset) / 60)
-        var minute = Math.abs(offset) % 60
-        var time = ''
-        var type = ''
-        if (global.language == 'en') {
-            time = `${hour} h`
-            type = offset > 0 ? t('feature.day_night.ahead_of') : t('feature.day_night.behind')
-            if (minute > 0) {
-                time += ` ${minute} m`
-            }
-        }
-        else {
-            time = `${hour}小时`
-            type = offset > 0 ? t('feature.day_night.ahead_of') : t('feature.day_night.behind')
-            if (minute > 0) {
-                time += `${minute}分钟`
-            }
-        }
-        return t('feature.common.diff_tz_desc', { location: getTZLocation(), device_location: getDeviceLocation(), offset: getTZOffset() })
-    }
-
-
-
-    function getLocation() {
-        var city = ''
-        if ((props.authInfo as any).address) {
-            if ((props.authInfo as any).address.city.length > 0) {
-                city = (props.authInfo as any).address.city
-            }
-            else if ((props.authInfo as any).address.province.length > 0) {
-                city = (props.authInfo as any).address.province
-            }
-            else if ((props.authInfo as any).address.country.length > 0) {
-                city = (props.authInfo as any).address.country
-            }
-            else {
-                city = t('feature.track_time_duration.third_ring.unknown')
-            }
-        }
-        else {
-            city = t('feature.track_time_duration.third_ring.unknown')
-        }
-        // return city +' | '+parseInt(authInfo.lat)+'°'+ ' '+parseInt(authInfo.lng)
-        return `${city} | ${Math.abs(parseInt(props.authInfo.lat))}°${parseInt(props.authInfo.lat) < 0 ? 'S' : 'N'} ${Math.abs(parseInt(props.authInfo.lng))}°${parseInt(props.authInfo.lng) < 0 ? 'W' : 'E'} | ${props.authInfo.timezone.gmt}`
-    }
-    async function getStorage(key: string) {
-        try {
-            const res = await Taro.getStorage({ key });
-            return res.data;
-        } catch {
-            return '';
-        }
-    }
-
-    async function chooseLocation() {
-        if (process.env.TARO_ENV == 'rn') {
-            const zoom = await getStorage('zoom') || 8
-            jumpPage('', 'map', navigation, {
-                zoom: zoom,
-                lat: props.authInfo ? props.authInfo.lat : null,
-                lng: props.authInfo ? props.authInfo.lng : null
-            })
-            props.onClose()
-            return;
-        }
-        props.updateLocation()
-    }
-
-    async function clickFooterBtn(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        else {
-            const zoom = await getStorage('zoom') || 8
-            jumpPage('', 'map', navigation,{
-                zoom: zoom,
-            })
-            if (props.onClose) {
-                props.onClose()
-            }
-
-            return
-        }
-        // else {
-        //     props.onClose()
-        // }
-        // 
-        showAlert({
-            title: t('feature.day_night.location_need'),
-            content: props.isNight ? t('feature.day_night.location_need_content_night') : t('feature.day_night.location_need_content_day'),
-            showCancel: true,
-            cancelText: t('feature.day_night.later'),
-            confirmText: t('feature.day_night.picker_now'),
-            confirm: () => {
-                props.updateLocation()
-            }
-        })
-    }
-
-    function testTapLocationIndex(index) {
-        switch (index) {
-            case 0:
-                {
-                    global.uploadLocation({
-                        latitude: 40.697,
-                        longitude: -74.309
-                    })
-                }
-                break;
-            case 1:
-                {
-                    global.uploadLocation({
-                        latitude: 59.699,
-                        longitude: -179.463
-                    })
-                }
-                break;
-            case 2:
-                {
-                    global.uploadLocation({
-                        latitude: 64.4190338,
-                        longitude: 15.3812476
-                    })
-                }
-                break;
-            case 3:
-                {
-                    global.uploadLocation({
-                        latitude: -40.4221762,
-                        longitude: 164.4216501
-                    })
-                }
-                break;
-        }
-    }
-
-    function testChangeLocation() {
-        if (process.env.TARO_ENV == 'rn' && kIsIOS) {
-            showActionSheet({
-                showActionSheetWithOptions: showActionSheetWithOptions,
-                itemList: [
-                    '纽约40.697,-74.309',
-                    '阿拉斯加59.699,-179.463',
-                    '芬兰64.4190338,15.3812476',
-                    '新西兰-40.4221762,164.4216501'
-                ],
-                success: (res) => {
-                    testTapLocationIndex(res)
-                }
-            });
-            return
-        }
-
-        Taro.showActionSheet({
-            itemList: [
-                '纽约40.697,-74.309',
-                '阿拉斯加59.699,-179.463',
-                '芬兰64.4190338,15.3812476',
-                '新西兰-40.4221762,164.4216501'
-            ]
-        })
-            .then(res => {
-                console.log(res.tapIndex)
-                testTapLocationIndex(res.tapIndex)
-            })
-            .catch(err => {
-                console.log(err.errMsg)
-            })
-    }
-
-    return <View className='detail_container'>
-        {/* {
-            isCompleted() ? <Text className='detail_popup_title' >{getCompletedTitle()}<Text className='detail_popup_subttitle'> {getSubTitle()}</Text></Text> :
-                <Text className='detail_popup_title' >{getTitle()}</Text>
-
-        } */}
-        <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'flex-end' }}>
-            <Text className='detail_popup_title'>{isCompleted() ? getCompletedTitle() : getTitle()}</Text>
-            {
-                isCompleted() && <Text className='detail_popup_subttitle'> {getSubTitle()}</Text>
-            }
-
-        </View>
-        {
-            user.test_user && <Text style={{ color: '#fff', fontSize: 20, fontWeight: 'bold' }} onClick={testChangeLocation}>位置更改测试</Text>
-        }
-
-        <View className='detail_tabbar'>
-            <View onClick={() => { setTabIndex(0) }} className={tabIndex == 0 ? 'detail_tabitem_sel' : 'detail_tabitem_nor'}>{t('feature.day_night.overview')}</View>
-            <View onClick={() => { setTabIndex(1) }} className={tabIndex == 1 ? 'detail_tabitem_sel' : 'detail_tabitem_nor'}>{t('feature.day_night.events')}</View>
-        </View>
-
-        <View className='detail_content'>
-            {
-                tabIndex == 0 ? overview() : events()
-            }
-        </View>
-
-        {
-            (props.authInfo && props.authInfo.lat) ?
-                <View style={{ display: 'flex', flexDirection: 'column' }}>
-                    <Text className='day_night_pop_location'>{getLocation()}</Text>
-                    <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
-                        <Text className='day_night_pop_desc'>{t('feature.track_time_duration.third_ring.base_location_desc')}</Text>
-                        <View onClick={chooseLocation}>
-                            <Text className='day_night_pop_choose' style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{t('feature.track_time_duration.third_ring.update_my_location')}</Text>
-                        </View>
-                    </View>
-                </View> :
-                <View className='detail_bottom'>{
-                    process.env.TARO_ENV == 'weapp' ?
-                        <View className='detail_bottom_btn' style={{ color: '#000' }} onClick={(e) => {
-                            clickFooterBtn(e)
-                        }}>{props.isNight ? t('feature.day_night.get_local_time') : t('feature.day_night.get_local_time_sunrise')}</View> :
-                        <View onClick={(e) => {
-                            clickFooterBtn(e)
-                        }}>
-                            <LinearGradient
-                                style={{
-                                    width: 300,
-                                    height: 50,
-                                    borderRadius: 25,
-                                    alignItems: 'center',
-                                    justifyContent: 'center',
-                                    flexDirection: 'row'
-                                }}
-                                colors={[ColorType.fast, ColorType.sleep]}
-                                start={{ x: 0, y: 0 }}
-                                end={{ x: 1, y: 0 }}
-
-                            >
-                                {
-                                    isLoading && <View style={{ display: 'flex', overflow: 'hidden', height: 20, marginRight: 5 }}><AtActivityIndicator mode="center" color="#000" /></View>
-                                }
-                                <Text style={{ fontWeight: 'bold', fontSize: 18, color: '#000', opacity: isLoading ? 0.6 : 1.0 }}>{props.isNight ? t('feature.day_night.get_local_time') : t('feature.day_night.get_local_time_sunrise')}</Text>
-                            </LinearGradient>
-                        </View>
-                }
-                </View>
-        }
-
-
-    </View>
-}

+ 0 - 231
src/features/daynight/DayNightRing.tsx

@@ -1,231 +0,0 @@
-import { View } from "@tarojs/components"
-import { bigRingRadius, getBgRing, getCommon, getDot, ringWidth, thirdRingRadius } from "../trackTimeDuration/hooks/RingData";
-import Rings from "@/features/trackTimeDuration/components/Rings";
-import { RealRing } from '@/features/trackTimeDuration/components/Rings'
-import { ColorType } from "@/context/themes/color";
-import { useEffect, useState } from "react";
-import { TimeFormatter } from "@/utils/time_format";
-import dayjs from 'dayjs'
-
-
-const utc = require('dayjs/plugin/utc')
-const timezone = require('dayjs/plugin/timezone')
-dayjs.extend(utc)
-dayjs.extend(timezone)
-
-export default function DayNightRing(props: {
-    isNight: boolean,
-    isThirdRing: boolean,
-    canvasId: any,
-    authInfo: any
-}) {
-    const [authInfo, setAuthInfo] = useState(props.authInfo)
-
-
-    useEffect(() => {
-        setAuthInfo(props.authInfo)
-    }, [props.authInfo])
-
-    function dayRing() {
-        var common = getCommon(null, true)
-        common.radius = props.isThirdRing ? thirdRingRadius : bigRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-
-        let realRingBig: RealRing = {
-            color: ColorType.day + '66',
-            startArc: 0,
-            durationArc: 2
-        }
-
-        var now = new Date().getTime()
-
-        if (authInfo && authInfo.day_completed && now > authInfo.day_completed.sunset_ts) {
-            realRingBig.color = ColorType.day
-            var duration = (authInfo.day_completed.sunset_ts - authInfo.day_completed.sunrise_ts) / 1000
-            var time = authInfo.day_completed.sunrise
-            time = time.substring(time.length - 8, time.length)
-            var start = new Date('2024-01-01T' + time)
-            realRingBig.startArc = (start.getHours() * 3600 + start.getMinutes() * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
-            realRingBig.durationArc = (duration) / (24 * 3600) * 2 * Math.PI;
-            return <Rings common={common} bgRing={bgRing} targetRing={realRingBig} canvasId={props.canvasId} />
-
-        }
-
-        var sunRise = 6 * 60
-        var sunSet = 18 * 60
-
-        if (global.dayObj) {
-            sunRise = parseInt(global.dayObj.sunrise.time.split(':')[0]) * 60 + parseInt(global.dayObj.sunrise.time.split(':')[1])
-            sunSet = parseInt(global.dayObj.sunset.time.split(':')[0]) * 60 + parseInt(global.dayObj.sunset.time.split(':')[1])
-        }
-
-
-        var duration = sunSet - sunRise
-
-        if (global.dayObj) {
-            duration = (global.dayObj.sunset.timestamp - global.dayObj.sunrise.timestamp) / 60000
-        }
-
-        realRingBig.startArc = (sunRise * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
-        realRingBig.durationArc = (duration * 60) / (24 * 3600) * 2 * Math.PI;
-
-        var currentDot = getDot(null, false)
-
-        if (authInfo && authInfo.timezone && authInfo.timezone.id) {
-            var current1 = dayjs()
-            var current = TimeFormatter.tzLocalTime(new Date().getTime(),authInfo.timezone.id)//dayjs().tz(authInfo.timezone.id)
-            var offset = current.day() * 24 * 60 + current.hour() * 60 + current.minute() - current1.day() * 24 * 60 - current1.hour() * 60 - current1.minute()
-            currentDot.offset = offset
-        }
-        var date = new Date(now)
-        var minutes = date.getHours() * 60 + date.getMinutes()
-        if (minutes < sunRise) {
-            minutes += 1440
-        }
-
-        currentDot.color = ColorType.day
-
-        var t = date.getHours() * 60 + date.getMinutes()
-        var duration2 = t - sunRise
-        if (duration2 < 0) {
-            duration2 += 24 * 60
-        }
-
-        if (global.dayObj) {
-            if (global.dayObj.sunrise.timestamp < now && global.dayObj.sunset.timestamp > now) {
-                duration2 = (now - global.dayObj.sunrise.timestamp) / 60000
-            }
-            else {
-                duration2 = -1
-            }
-        }
-        var realRing: RealRing = {
-            color: ColorType.day,
-            startArc: (sunRise * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0,
-            durationArc: (duration2 * 60) / (24 * 3600) * 2 * Math.PI
-        }
-        if (duration2 == -1) {
-            realRing = null
-        }
-
-        return <Rings common={common} bgRing={bgRing} targetRing={realRingBig} realRing={realRing} currentDot={currentDot} canvasId={props.canvasId} />
-
-    }
-
-    function nightRing() {
-        var common = getCommon(null, true)
-        common.radius = props.isThirdRing ? thirdRingRadius : bigRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-
-        let realRingBig: RealRing = {
-            color: ColorType.night + '66',
-            startArc: 0,
-            durationArc: 2
-        }
-
-        var currentDot = getDot(null, false)
-        currentDot.color = ColorType.night
-        if (authInfo && authInfo.timezone && authInfo.timezone.id) {
-            var current1 = dayjs()
-            var current = TimeFormatter.tzLocalTime(new Date().getTime(),authInfo.timezone.id)//dayjs().tz(authInfo.timezone.id)
-            var offset = current.date() * 24 * 60 + current.hour() * 60 + current.minute() - current1.date() * 24 * 60 - current1.hour() * 60 - current1.minute()
-            currentDot.offset = offset
-        }
-
-
-        var now1 = new Date().getTime()
-        if (authInfo && authInfo.timezone) {
-            now1 = TimeFormatter.transferTimestamp(now1, authInfo.timezone.gmt)
-        }
-
-        if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
-            var isCompleted = false;
-            if (authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
-                isCompleted = true
-            }
-
-            realRingBig.color = ColorType.night
-            var duration = (authInfo.night_completed.sunrise_ts - authInfo.night_completed.sunset_ts) / 1000
-            var time = authInfo.night_completed.sunset
-            time = time.substring(time.length - 8, time.length)
-            var start = new Date('2024-01-01T' + time)
-
-            realRingBig.startArc = (start.getHours() * 3600 + start.getMinutes() * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
-            realRingBig.durationArc = (duration) / (24 * 3600) * 2 * Math.PI;
-            //已结束未更新暂停时,显示current_dot
-            if (isCompleted) {
-                currentDot = null
-            }
-            // if (!realRingBig.startArc){
-            //     realRingBig = null
-            // }
-            return <Rings common={common} bgRing={bgRing} targetRing={realRingBig} currentDot={currentDot} canvasId={props.canvasId} />
-
-        }
-
-        var sunRise = 24 * 60 + 6 * 60
-        var sunSet = 18 * 60
-
-        if (global.nightObj) {
-            sunRise = 24 * 60 + parseInt(global.nightObj.sunrise.time.split(':')[0]) * 60 + parseInt(global.nightObj.sunrise.time.split(':')[1])
-            sunSet = parseInt(global.nightObj.sunset.time.split(':')[0]) * 60 + parseInt(global.nightObj.sunset.time.split(':')[1])
-        }
-        var duration = sunRise - sunSet
-
-        if (global.nightObj) {
-            duration = (global.nightObj.sunrise.timestamp - global.nightObj.sunset.timestamp) / 60000
-            // if (global.nightObj.sunrise.timestamp-new Date().getTime()>48*3600*1000){
-            //     duration = 24*60
-            // }
-        }
-
-        realRingBig.startArc = (sunSet * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
-        realRingBig.durationArc = (duration * 60) / (24 * 3600) * 2 * Math.PI;
-
-        var now = new Date()
-
-
-        var t1 = now.getHours() * 60 + now.getMinutes()
-        var duration2 = t1 - sunSet
-        if (duration2 < 0) {
-            duration2 += 24 * 60
-        }
-
-        if (global.nightObj) {
-            if (global.nightObj.sunset.timestamp < now.getTime() && global.nightObj.sunrise.timestamp > now.getTime()) {
-                duration2 = (now.getTime() - global.nightObj.sunset.timestamp) / 60000
-            }
-            else {
-                duration2 = -1
-            }
-        }
-        let realRing: RealRing = {
-            color: ColorType.night,
-            startArc: (sunSet * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0,
-            durationArc: (duration2 * 60) / (24 * 3600) * 2 * Math.PI
-        }
-
-        if (duration2 == -1) {
-            realRing = null;
-        }
-
-        // if (night.nightRingDate) {
-        //     if (new Date(night.nightRingDate).getDate() == now.getDate() && now.getHours() < 12) {
-        //         realRing = null;
-        //     }
-        // }
-
-        // if (!user.isLogin) {
-        //     currentDot = null;
-        //     realRing = null;
-        // }
-
-
-        return <Rings common={common} bgRing={bgRing} targetRing={realRingBig} realRing={duration2 > duration ? null : realRing} currentDot={currentDot} canvasId={props.canvasId} />
-
-    }
-
-    return props.isNight ? nightRing() : dayRing()
-}

+ 0 - 14
src/features/daynight/DayNightStatus.scss

@@ -1,14 +0,0 @@
-.day_night_status {
-    height: 36px;
-    // line-height: 36px;
-    border-radius: 18px;
-    font-size: 20px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    padding-left: 16px;
-    padding-right: 16px;
-    margin-left: 6px;
-    font-weight: bold;
-    letter-spacing: 0;
-}

+ 0 - 50
src/features/daynight/DayNightStatus.tsx

@@ -1,50 +0,0 @@
-import { View } from "@tarojs/components";
-import './DayNightStatus.scss'
-import { useTranslation } from "react-i18next";
-import { ColorType } from "@/context/themes/color";
-
-export default function DayNightStatus(props: { authInfo: any, isNight: boolean, sunset_ts: number, sunrise_ts: number }) {
-    const { t } = useTranslation()
-    //ongoing //wfs //ended //completed
-    function status() {
-        if (props.isNight) {
-            if (props.authInfo && props.authInfo.day_completed && new Date().getTime() > props.authInfo.day_completed.sunset_ts) {
-                return 'completed'
-            }
-            if (props.authInfo && props.authInfo.night_completed && new Date().getTime() > props.authInfo.night_completed.sunrise_ts) {
-                return 'ended'
-            }
-            if (props.sunset_ts < new Date().getTime()) {
-                return 'ongoing'
-            }
-            return 'wait_for_start'
-
-        }
-        if (props.authInfo && props.authInfo.day_completed && new Date().getTime() > props.authInfo.day_completed.sunset_ts) {
-            return 'completed'
-        }
-        if (props.sunrise_ts < new Date().getTime()) {
-            return 'ongoing'
-        }
-        return 'wait_for_start'
-    }
-
-    if (status() == 'wait_for_start') {
-        return <View className="day_night_status"
-            style={{ backgroundColor: props.isNight ? ColorType.night + '66' : ColorType.day + '66', color: props.isNight ? ColorType.night : ColorType.day }}
-        >{t('feature.day_night.upcoming')}</View>
-    }
-    if (status() == 'ongoing') {
-        return <View className="day_night_status"
-            style={{ backgroundColor: props.isNight ? ColorType.night : ColorType.day, color: props.isNight ? '#fff' : '#000' }}
-        >{t('feature.day_night.in_real_time')}</View>
-    }
-    if (status() == 'ended') {
-        return <View className="day_night_status"
-            style={{ backgroundColor: props.isNight ? ColorType.night : ColorType.day, color: props.isNight ? '#fff' : '#000' }}
-        >{t('feature.day_night.ended')}</View>
-    }
-    return <View className="day_night_status"
-        style={{ backgroundColor: props.isNight ? ColorType.night : ColorType.day, color: '#FA5151' }}
-    >{t('feature.day_night.last_updated')}</View>
-}

+ 0 - 213
src/features/daynight/DayNightSwiper.tsx

@@ -1,213 +0,0 @@
-import { Swiper, SwiperItem, View, Text } from "@tarojs/components";
-import DayNightCard from "./DayNightCard";
-import { useEffect, useState } from "react";
-import { TimeFormatter } from "@/utils/time_format";
-import { clearLocation, latestLocation } from "@/services/user";
-import { useDispatch, useSelector } from "react-redux";
-import '@/pages/clock/Clock.scss';
-import AllRings from "./AllRings";
-import AllDayRings from "./AllDayRings";
-import DayNightSwiperPopup from "./DayNightSwiperPopup";
-import { kIsIOS, rpxToPx } from "@/utils/tools";
-import dayjs from "dayjs";
-
-let locationObj
-
-let useNavigation;
-let Linking;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-    Linking = require('react-native').Linking;
-}
-
-export default function DayNightSwiper(props: { count: number, schedule: any, homeData: any }) {
-    const user = useSelector((state: any) => state.user);
-    const [loaded, setLoaded] = useState(false)
-    const [firstNight, setFirstNight] = useState(true)
-    const [current, setCurrent] = useState(0)
-    const [authInfo, setAuthInfo] = useState<any>(null)
-
-
-    useEffect(() => {
-        setLoaded(false)
-        getLatestLocation()
-    }, [user.isLogin])
-    global.swiperDayNightRefresh = () => {
-        getLatestLocation()
-    }
-
-    global.updateSwiper = () => {
-        getLatestLocation()
-    }
-
-    useEffect(() => {
-        if (loaded) {
-            updateDate(user.isLogin ? locationObj : null)
-        }
-    }, [props.count])
-
-    function getLatestLocation() {
-        if (!user.isLogin) {
-            setLoaded(true)
-            updateDate(null)
-            return
-        }
-        var today = new Date()
-        var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
-        var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000 * 50)
-        var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
-        var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
-        latestLocation({
-            date_start: strYesterday, date_end: strTomorrow
-        }).then(data => {
-            // (data as any).timezone = 'GMT-1000'
-            if (data && (data as any).daylights) {
-                (data as any).daylights.map(item => {
-                    if (!item.sunrise_ts) {
-                        item.sunrise_ts = new Date(item.date + 'T' + item.sunrise + ':00').getTime()
-                        item.sunset_ts = new Date(item.date + 'T' + item.sunset + ':00').getTime()
-                    }
-                })
-            }
-            if (process.env.TARO_ENV == 'rn') {
-                setLocalPush(data)
-            }
-            setAuthInfo(data)
-            updateDate(data)
-            locationObj = data
-            setLoaded(true)
-        }).catch(e => {
-            setLoaded(true)
-            updateDate(null)
-        })
-    }
-
-    function setLocalPush(data) {
-        const { sunrise, sunset, solar_noon } = data.local_push;
-        var list: any = [];
-        if (!data.has_daylight_calc) {
-            return;
-        }
-        if (data && (data as any).daylights) {
-            (data as any).daylights.map((item, index) => {
-                var dayDuration = ''
-                var nightDuration = ''
-                if (item.sunrise_ts && item.sunset_ts) {
-                    dayDuration = TimeFormatter.durationFormate(item.sunset_ts, item.sunrise_ts, true)
-                }
-                if (index + 1 < (data as any).daylights.length - 1) {
-                    var nextObj = (data as any).daylights[index + 1];
-                    if (nextObj.sunrise_ts && item.sunset_ts) {
-                        nightDuration = TimeFormatter.durationFormate(nextObj.sunrise_ts, item.sunset_ts, true)
-                    }
-                }
-
-                if (sunrise && item.sunrise_ts && item.push) {
-                    list.push({
-                        channel_id: 'REMINDER_SUN',
-                        category_id: 'REMINDER_SUN_RISE',
-                        title: item.push.sunrise_title,
-                        body: item.push.sunrise_body,
-                        timestamp: item.sunrise_ts
-                    })
-                }
-                if (sunset && item.sunset_ts && item.push) {
-                    list.push({
-                        channel_id: 'REMINDER_SUN',
-                        category_id: 'REMINDER_SUN_SET',
-                        title: item.push.sunset_title,
-                        body: item.push.sunset_body,
-                        timestamp: item.sunset_ts
-                    })
-                }
-                if (solar_noon && item.solar_noon_ts) {
-                    list.push({
-                        channel_id: 'REMINDER_SUN',
-                        category_id: 'REMINDER_SUN_SOLAR_NOON',
-                        title: item.push.solar_noon_title,
-                        body: item.push.solar_noon_body,
-                        timestamp: item.solar_noon_ts
-                    })
-                }
-            })
-        }
-        if (process.env.TARO_ENV == 'rn') {
-            var Jto = require('react-native').NativeModules.NativeBridge;
-            if (list.length == 0) {
-                return
-            }
-            if (kIsIOS) {
-
-                Jto.addSunPush(list)
-            }
-            else {
-                Jto.addSunPush(JSON.stringify(list))
-            }
-        }
-    }
-
-    function updateDate(data) {
-        var today = new Date()
-        if (data && data.daylights && data.daylights.length > 0) {
-            if (data.night_completed) {
-                if (today.getTime() > data.night_completed.sunrise_ts) {
-                    setFirstNight(true)
-                    setCurrent(1)
-                    return;
-                }
-            }
-            setCurrent(0)
-            // var sunriseObj,sunsetObj;
-            var list = data.daylights
-            for (var i = 0; i < (list.length - 1); i++) {
-                //夜间
-                if (list[i].sunset_ts < today.getTime() && list[i + 1].sunrise_ts > today.getTime()) {
-                    setFirstNight(true)
-                }
-                //白天
-                else if (list[i].sunrise_ts < today.getTime() && list[i].sunset_ts > today.getTime()) {
-                    setFirstNight(false)
-                }
-            }
-        }
-        else {
-            setCurrent(0)
-            if (today.getHours() < 6 || today.getHours() > 18) {
-                setFirstNight(true)
-            } else {
-                setFirstNight(false)
-            }
-        }
-
-    }
-
-
-
-
-    if (!loaded)
-        return <View className="rn_swiper" />
-
-
-    var timestamp = new Date().getTime()
-
-    return <View><Swiper
-        className="rn_swiper"
-        indicatorDots
-        indicatorColor='#ffffff66'
-        indicatorActiveColor='#ffffff99'
-        current={current}
-        style={{ height: process.env.TARO_ENV == 'weapp' ? rpxToPx(204) + 96 + 4 : rpxToPx(204) + 96 + 12 + 10 }}
-
-    >
-        <SwiperItem>
-            <DayNightCard isNight={firstNight} count={props.count} />
-        </SwiperItem>
-        <SwiperItem>
-            <DayNightCard isNight={!firstNight} count={props.count} />
-        </SwiperItem>
-    </Swiper>
-        <AllRings data={props.homeData} time={timestamp} />
-        {/* <AllDayRings schedule={props.schedule} /> */}
-        <DayNightSwiperPopup authInfo={authInfo} />
-    </View>
-}

+ 0 - 408
src/features/daynight/DayNightSwiperPopup.tsx

@@ -1,408 +0,0 @@
-import { PageContainer, Switch, Text, View, Image } from '@tarojs/components'
-import Modal from '@/components/layout/Modal.weapp'
-import { useEffect, useState } from 'react'
-import DayNightDetailPopup from './DayNightDetailPopup'
-import { useTranslation } from 'react-i18next'
-import Taro from '@tarojs/taro'
-import { systemLocation } from '@/services/common'
-import showAlert from '@/components/basic/Alert'
-import { getTimezone, kIsAndroid, kIsIOS, rpxToPx } from '@/utils/tools'
-import { clearLocation } from '@/services/user'
-import { TimeFormatter } from '@/utils/time_format'
-
-
-let Linking;
-if (process.env.TARO_ENV == 'rn') {
-    // useNavigation = require("@react-navigation/native").useNavigation
-    Linking = require('react-native').Linking;
-}
-export default function DayNightSwiperPopup(props: { authInfo: any }) {
-    const [showDetailModal, setShowDetailModal] = useState(false)
-    const [showDetailPopup, setShowDetailPopup] = useState(false)
-    const [isLoading, setIsLoading] = useState(false)
-    const [authInfo, setAuthInfo] = useState<any>(props.authInfo)
-    const [dayDate, setDayDate] = useState<any>('')
-    const [nightDate, setNightDate] = useState<any>('')
-    const [isNight, setIsNight] = useState(false)
-
-
-    useEffect(() => {
-        setAuthInfo(props.authInfo)
-    }, [props.authInfo])
-
-    useEffect(() => {
-        if (global.updateLocationLoading) {
-            global.updateLocationLoading(isLoading)
-        }
-    }, [isLoading])
-
-    const { t } = useTranslation()
-
-    function modalContent() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowDetailPopup(false)
-                setIsLoading(false)
-                if (process.env.TARO_ENV == 'rn' && kIsAndroid) {
-                    var Jto = require('react-native').NativeModules.NativeBridge;
-                    Jto.stopLocation()
-                }
-            }}
-            confirm={() => { }}>
-            <DayNightDetailPopup
-                isNight={isNight}
-                authInfo={authInfo}
-                nightDate={nightDate}
-                dayDate={dayDate}
-                updateLocation={auth}
-                onClose={() => {
-                    setShowDetailPopup(false)
-                    setIsLoading(false)
-                    if (process.env.TARO_ENV == 'rn' && kIsAndroid) {
-                        var Jto = require('react-native').NativeModules.NativeBridge;
-                        Jto.stopLocation()
-                    }
-                }}
-            />
-        </Modal>
-    }
-
-    function modalContent2() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowDetailModal(false)
-            }}
-            confirm={() => { }}>
-            {
-                detailModalContent()
-            }
-        </Modal>
-    }
-
-    function getLocation() {
-        if (!authInfo) {
-            return ''
-        }
-        return `${getCity()} | ${Math.abs(parseInt(authInfo.lat))}°${parseInt(authInfo.lat) < 0 ? 'S' : 'N'} ${Math.abs(parseInt(authInfo.lng))}°${parseInt(authInfo.lng) < 0 ? 'W' : 'E'}`
-    }
-
-    function getCity() {
-        var city = ''
-        if (!authInfo) {
-            return ''
-        }
-        if ((authInfo as any).address) {
-            if ((authInfo as any).address.city.length > 0) {
-                city = (authInfo as any).address.city
-            }
-            else if ((authInfo as any).address.province.length > 0) {
-                city = (authInfo as any).address.province
-            }
-            else if ((authInfo as any).address.country.length > 0) {
-                city = (authInfo as any).address.country
-            }
-            else {
-                city = t('feature.track_time_duration.third_ring.unknown')
-            }
-        }
-        else {
-            city = t('feature.track_time_duration.third_ring.unknown')
-        }
-        return city
-    }
-
-
-    function detailModalContent() {
-        var timezone = getTimezone()
-        if (!authInfo || !(authInfo as any).lat) {
-            return <View style={{ height: 100, display: 'flex', alignItems: 'center', justifyContent: 'center', width: rpxToPx(750) }}>
-                <Text>{t('feature.location.no_location')}</Text>
-            </View>
-        }
-        return <View style={{ display: 'flex', flexDirection: 'column' }}>
-            {
-                <View className="cell_bg">
-                    {
-                        <View className="cell_full">
-                            <Text className="cell_title">{t('feature.track_time_duration.third_ring.location')}</Text>
-                            <Text className="cell_value">{authInfo ? getLocation() : t('feature.track_time_duration.third_ring.enter')}</Text>
-                        </View>
-                    }
-                    <View className="cell_line" style={{ height: 1 }} />
-
-
-                    {
-                        <View className="cell_full" >
-                            <Text className="cell_title">{t('feature.track_time_duration.third_ring.latitude')}</Text>
-
-                            <Text className="cell_value">{(authInfo as any).lat}</Text>
-
-
-                        </View>
-                    }
-                    <View className="cell_line" style={{ height: 1 }} />
-
-                    <View className="cell_full">
-                        <Text className="cell_title" >{t('feature.track_time_duration.third_ring.longitude')}</Text>
-
-                        <Text className="cell_value">{(authInfo as any).lng}</Text>
-
-                    </View>
-                    <View className="cell_line" style={{ height: 1 }} />
-                    <View className="cell_full">
-                        <Text className="cell_title">{t('feature.track_time_duration.third_ring.timezone')}</Text>
-
-                        <Text className="cell_value">{timezone}</Text>
-
-                    </View>
-
-
-
-                </View>
-
-            }
-
-            <Text onClick={() => {
-                clearData()
-                setShowDetailModal(false)
-            }} style={{ width: '100%', textAlign: 'center', marginBottom: 50, color: '#fff', marginTop: 20 }}>{t('feature.location.clear_info')}</Text>
-        </View>
-    }
-
-    function clearData() {
-        showAlert({
-            title: t('feature.location.clear_alert_title'),
-            content: t('feature.location.clear_alert_content'),
-            cancelText: t('feature.location.clear_alert_cancel'),
-            confirmText: t('feature.location.clear_alert_confirm'),
-            showCancel: true,
-            confirm: () => {
-                clearLocation().then(res => {
-                    setAuthInfo(null)
-                    global.swiperDayNightRefresh()
-                    global.refreshNight()
-                    global.refreshDay()
-                })
-            }
-        })
-    }
-
-    function auth(e?: any) {
-        if (e && process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (process.env.TARO_ENV == 'weapp') {
-            authLocation()
-        }
-        else {
-            if (kIsIOS) {
-                authLocation()
-            }
-            else {
-                var Jto = require('react-native').NativeModules.NativeBridge;
-                Jto.checkSystemLocationService().then(res => {
-                    console.log('授权状态', res)
-                    if (res) {
-                        var checkMultiple = require('react-native-permissions').checkMultiple
-                        var PERMISSIONS = require('react-native-permissions').PERMISSIONS
-                        checkMultiple([PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION]).then(statuses => {
-                            var status = statuses[PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION];
-                            if (status == 'granted') {
-                                var Jto = require('react-native').NativeModules.NativeBridge;
-                                setIsLoading(true)
-                                Jto.getLocation().then(result => {
-                                    uploadLocation(JSON.parse(result));
-                                    setIsLoading(false)
-                                }).catch(e => {
-                                    console.log('rn location error', e)
-                                    showAlert({
-                                        title: 'Failure',
-                                        content: t('feature.day_night.location_failed'),
-                                        showCancel: false
-                                    })
-                                    setIsLoading(false)
-                                    // var ToastAndroid = require('react-native').ToastAndroid;
-                                    // ToastAndroid.show(t('feature.day_night.location_failed'), ToastAndroid.LONG);
-                                })
-                            }
-                            else {
-                                authLocation()
-                            }
-                        })
-                    }
-                    else {
-                        showAlert({
-                            title: t('feature.auth_sys.location_title'),
-                            content: t('feature.auth_sys.device_location_desc'),
-                            showCancel: true,
-                            cancelText: t('feature.auth_sys.location_cancel'),
-                            confirmText: t('feature.auth_sys.device_confirm'),
-                            confirm: () => {
-                                Jto.openSystemLocationSettings()
-                            }
-                        })
-                    }
-                })
-            }
-        }
-
-    }
-
-    function authLocation() {
-        if (process.env.TARO_ENV == 'rn') {
-            setIsLoading(true)
-            Taro.getLocation({
-                success(res) {
-                    uploadLocation(res);
-                    setIsLoading(false)
-                },
-                fail(res) {
-                    console.log('location update failed reason', res)
-                    if (res.errMsg == 'Permissions denied!') {
-                        setIsLoading(false)
-                        showAlert({
-                            title: t('feature.auth_sys.location_title'),
-                            content: kIsIOS ? t('feature.auth_sys.location_desc') : t('feature.auth_sys.location_android_service_desc'),
-                            showCancel: true,
-                            cancelText: t('feature.auth_sys.location_cancel'),
-                            confirmText: kIsIOS ? t('feature.auth_sys.location_confirm') : t('feature.auth_sys.service_confirm'),
-                            confirm: () => {
-                                if (kIsIOS) {
-                                    Linking.openURL('app-settings:')
-                                }
-                                else {
-                                    // Linking.openSettings()
-                                    var Jto = require('react-native').NativeModules.NativeBridge;
-                                    Jto.openNotificationSettings()
-                                }
-
-                            }
-                        })
-                    }
-                    else {
-                        if (kIsAndroid) {
-
-                            var Jto = require('react-native').NativeModules.NativeBridge;
-                            Jto.getLocation().then(result => {
-                                uploadLocation(JSON.parse(result));
-                                setIsLoading(false)
-
-                            }).catch(e => {
-                                showAlert({
-                                    title: 'Failure',
-                                    content: t('feature.day_night.location_failed'),
-                                    showCancel: false
-                                })
-                                setIsLoading(false)
-                                // console.log('rn location error', e)
-                                // var ToastAndroid = require('react-native').ToastAndroid;
-                                // ToastAndroid.show(t('feature.day_night.location_failed'), ToastAndroid.LONG);
-                            })
-                        }
-                        else {
-                            setIsLoading(false)
-                            showAlert({
-                                title: 'Failure',
-                                content: t('feature.day_night.location_failed'),
-                                showCancel: false
-                            })
-                        }
-                    }
-                    console.log(res)
-                },
-                complete(res) {
-
-                }
-            })
-            return
-        }
-        Taro.chooseLocation({
-            latitude: authInfo && authInfo.lat ? authInfo.lat : undefined,
-            longitude: authInfo && authInfo.lat ? authInfo.lng : undefined,
-            success: function (res) {
-                uploadLocation(res)
-            },
-            fail(res) {
-                Taro.showToast({
-                    title: '位置修改失败!\n请重新选择就近位置',
-                    icon: 'none'
-                })
-            },
-            complete(res) {
-
-            }
-        })
-    }
-
-    global.uploadLocation= (res)=>{
-        uploadLocation(res)
-    }
-
-    function uploadLocation(res) {
-        var today = new Date()
-        var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
-        var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000 * 5)
-        var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
-        var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
-
-        systemLocation({
-            lat: res.latitude,
-            lng: res.longitude,
-            name: res.name,
-            address: res.address,
-            date_start: strYesterday,
-            date_end: strTomorrow,
-            coordinate_system_standard: process.env.TARO_ENV == 'weapp' ? 'GCJ-02' : 'WGS-84'
-        }).then(data => {
-            global.locationDetail = data
-            setAuthInfo(data as any)
-            Taro.setStorage({
-                key: 'gps',
-                data: JSON.stringify(data as any)
-            })
-            // dispatch(updateMember({ isMember: isMember, gpsInfo: (data as any) }))
-
-            if (global.swiperDayNightRefresh) {
-                global.swiperDayNightRefresh()
-            }
-            global.refreshNight()
-            global.refreshDay()
-            if (process.env.TARO_ENV == 'rn') {
-                showAlert({
-                    title: 'Success',
-                    content: t('feature.day_night.location_updated'),
-                    showCancel: false
-                })
-            }
-        })
-    }
-
-    global.showDayNightSwiperPop = (isNight, strNight, strDay) => {
-        setNightDate(strNight)
-        setDayDate(strDay)
-        setIsNight(isNight)
-        setShowDetailPopup(true)
-    }
-
-    global.showDayNightSwiperPop2 = (isNight, strNight, strDay) => {
-        setNightDate(strNight)
-        setDayDate(strDay)
-        setIsNight(isNight)
-        setShowDetailPopup(true)
-    }
-
-    global.showDayNightSwiperModal = () => {
-        setShowDetailModal(true)
-    }
-
-    return <View>
-        {
-            showDetailPopup && modalContent()
-        }
-        {
-            showDetailModal && modalContent2()
-        }
-    </View>
-}

+ 1 - 1
src/features/food/FoodConsole.tsx

@@ -78,7 +78,7 @@ export default function Component(props: { addItem: Function, firstItem: any })
 
     async function choose(isAlbum = true) {
         if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
             return;
         }
 

+ 7 - 7
src/features/health/MainConsole.tsx

@@ -127,7 +127,7 @@ export default function MainConsole(props: { type: WindowType }) {
             return;
         }
         if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
             return
         }
         console.log(item)
@@ -137,7 +137,7 @@ export default function MainConsole(props: { type: WindowType }) {
 
     function record(item) {
         if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
             return
         }
 
@@ -307,7 +307,7 @@ export default function MainConsole(props: { type: WindowType }) {
             return;
         }
         if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
             return
         }
         if (!item.event_id) {
@@ -465,7 +465,7 @@ export default function MainConsole(props: { type: WindowType }) {
 
     function more() {
         if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
             return
         }
 
@@ -688,7 +688,7 @@ export default function MainConsole(props: { type: WindowType }) {
                     //                     btnTitle="Action"
                     //                     onClick={() => {
                     //                         if (!user.isLogin) {
-                    //                             jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+                    //                             jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
                     //                             return
                     //                         }
                     //                         jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(item))
@@ -703,7 +703,7 @@ export default function MainConsole(props: { type: WindowType }) {
                         btnTitle={t('health.add_my_first_activity')}
                         onClick={() => {
                             if (!user.isLogin) {
-                                jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+                                jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
                                 return
                             }
                             // if (!health.finish_setup) {
@@ -802,7 +802,7 @@ export default function MainConsole(props: { type: WindowType }) {
 
     function chooseLocation() {
         if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
             return
         }
         var scenario = getScenario(health.windows, health.mode)

+ 2 - 2
src/features/trackSomething/components/Activity.tsx

@@ -190,7 +190,7 @@ export default function Component(props: any) {
             }
         }
         else {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
         }
     }
 
@@ -321,7 +321,7 @@ export default function Component(props: any) {
             jumpPage('/pages/common/RecordsHistory?type=activity&refreshList=getCards&title=' + item.name + '&themeColor=' + item.theme_color)
         }
         else {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
         }
 
     }

+ 2 - 2
src/features/trackSomething/components/ActivityHistory.scss

@@ -1,4 +1,4 @@
-@import '@/utils/common.scss';
+
 .modalTitle{
     display: flex;
     font-size: 36px;
@@ -16,7 +16,7 @@
     flex-direction: row;
     align-items: center;
     background-color: #1C1C1C;
-    border-radius: $boxBorderRadius;
+    // border-radius: $boxBorderRadius;
     padding-left: 40px;
     padding-right: 40px;
     margin-top: 16px;

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

@@ -168,7 +168,7 @@ export default function Component(props: any) {
             })
         }
         else {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
         }
     }
 
@@ -198,7 +198,7 @@ export default function Component(props: any) {
             openModal()
         }
         else {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
         }
     }
 

+ 2 - 2
src/features/trackSomething/components/MetricHistory.scss

@@ -1,4 +1,4 @@
-@import '@/utils/common.scss';
+
 
 .year{
     margin-left: 46px;
@@ -34,7 +34,7 @@
     flex-direction: row;
     align-items: center;
     background-color: #fff;
-    border-radius: $boxBorderRadius;
+    // border-radius: $boxBorderRadius;
     padding-left: 40px;
     padding-right: 40px;
     margin-top: 16px;

+ 2 - 2
src/features/trackSomething/components/MetricItem.scss

@@ -1,10 +1,10 @@
-@import '@/utils/common.scss';
+
 
 .metric_bg {
     width: 320px;
     display: flex;
     flex-direction: column;
-    border-radius: $boxBorderRadius;
+    border-radius: 36px;
     padding-left: 36px;
     padding-right: 36px;
     padding-top: 24px;

+ 2 - 2
src/features/trackSomething/components/Metric_backup.tsx

@@ -149,7 +149,7 @@ export default function Component(props: any) {
             jumpPage('/pages/common/RecordsHistory?type=metric&refreshList=getCards&code=' + item.code + `&title=${item.name}` + '&themeColor=' + item.theme_color)
         }
         else {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
         }
     }
 
@@ -165,7 +165,7 @@ export default function Component(props: any) {
             openModal()
         }
         else {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
         }
     }
 

+ 1 - 2
src/features/trackTimeDuration/components/CheckAccess.scss

@@ -1,4 +1,3 @@
-@import '@/utils/common.scss';
 
 
 
@@ -38,7 +37,7 @@
     height: 96px;
     border-radius: 48px;
     color: #000D1FFF;
-    background-color: $fastColor;
+    // background-color: $fastColor;
     font-size: 32px;
     font-weight: bold;
     display: flex;

+ 0 - 75
src/features/trackTimeDuration/components/ChooseScenario.scss

@@ -1,75 +0,0 @@
-@import '@/utils/common.scss';
-
-.item_row {
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-
-}
-
-.item_txt_bg {
-    position: relative;
-    margin-left: 60px;
-}
-
-.scenario_count {
-    position: absolute;
-    top: -34px;
-    right: -200px;
-    width: 200px;
-    display: flex;
-    flex-direction: row;
-}
-
-.badge_view1 {
-
-    display: flex;
-    height: 44px;
-    border-top-left-radius: 22px;
-    border-top-right-radius: 22px;
-    border-bottom-right-radius: 22px;
-    border-bottom-left-radius: 4px;
-    padding-left: 12px;
-    padding-right: 12px;
-    box-sizing: border-box;
-}
-
-
-
-.badge1 {
-    font-size: 20px;
-    line-height: 44px;
-    color: #000;
-}
-
-.item_txt {
-    font-size: 48px;
-    font-weight: 500;
-}
-
-/* #ifdef weapp */
-.fast_sleep_text {
-    background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
-    -webkit-background-clip: text;
-    background-clip: text;
-    color: transparent;
-}
-
-.linear_badge_bg{
-    background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
-}
-
-/* #endif */
-
-/* #ifdef rn */
-.fast_sleep_text {
-    // background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
-    -webkit-background-clip: text;
-    background-clip: text;
-    color: transparent;
-}
-
-.linear_badge_bg{
-    // background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
-}
-/* #endif */

+ 0 - 350
src/features/trackTimeDuration/components/ChooseScenario.tsx

@@ -1,350 +0,0 @@
-import { View, Text } from "@tarojs/components";
-import Buttons from '@/components/basic/Buttons';
-import Texts from '@/components/basic/Texts';
-import Rings from '@components/view/Rings';
-import Rings2, { BgRing, RingCommon, TargetRing } from './Rings';
-import Footer from '@/components/layout/Footer';
-import SingleSelect from '../../../components/input/SingleSelect';
-import { ComponentStatus, NaviBarTitleShowType, TemplateType, TextType } from "@utils/types";
-import { useTranslation } from 'react-i18next'
-
-import './ChooseScenario.scss'
-import { useEffect, useState } from "react";
-import { useDidShow, useReady } from "@tarojs/taro";
-import Taro from "@tarojs/taro";
-import { useDispatch, useSelector } from "react-redux";
-import { setScenario, setScenarioName, setStep } from "@/store/scenario";
-import { getPlans } from "@/services/trackTimeDuration";
-import { ChooseScenarioBtn } from "@/features/common/SpecBtns";
-import Layout from "@/components/layout/layout";
-import { ColorType } from "@/context/themes/color";
-import TitleView from "./TitleView";
-import { jumpPage } from "../hooks/Common";
-import { rpxToPx } from "@/utils/tools";
-//import LinearGradient from "react-native-linear-gradient";
-
-let useNavigation;
-let GradientText
-let LinearGradient
-if (process.env.TARO_ENV == 'rn') {
-    GradientText = require('@/components/basic/GradientText').default
-    useNavigation = require("@react-navigation/native").useNavigation
-    LinearGradient = require('react-native-linear-gradient').default
-}
-export default function Component() {
-    const isFastFirst = true;
-    const { t } = useTranslation()
-    const dispatch = useDispatch();
-    const [selIndex, setSelIndex] = useState(-1)
-    const [scenarios, setScenarios] = useState<any[]>([])
-    const selScenario = useSelector((state: any) => state.scenario);
-    const time = useSelector((state: any) => state.time);
-    const [count, setCount] = useState(0)
-
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    useDidShow(() => {
-        setCount(count + 1)
-    })
-
-    useEffect(() => {
-        if (selScenario) {
-            if (selScenario.name == 'FAST_SLEEP') {
-                dispatch(setStep(isFastFirst ? 'fast' : 'sleep'))
-                setSelIndex(2)
-            }
-            else if (selScenario.name == 'SLEEP') {
-                dispatch(setStep('sleep'))
-                setSelIndex(1)
-            }
-            else {
-                dispatch(setStep('fast'))
-                setSelIndex(0)
-            }
-        }
-
-        if (time) {
-            if (time.scenario == 'FAST_SLEEP') {
-                setSelIndex(2)
-            }
-            else if (time.scenario == 'SLEEP') {
-                setSelIndex(1)
-            }
-            else {
-                setSelIndex(0)
-            }
-        }
-        Taro.getStorage({ key: 'scenarios' }).then(res => {
-            if (res) {
-                setScenarios(JSON.parse(res.data as any))
-            }
-        })
-        getPlans().then(res => {
-            const data = res as { scenarios: any[] };
-            Taro.setStorage({ key: 'scenarios', data: JSON.stringify(data.scenarios as any) })
-            setScenarios(data.scenarios)
-        })
-    }, [])
-
-    useReady(() => {
-
-    })
-
-    function next() {
-        switch (selIndex) {
-            case 0:
-                {
-                    dispatch(setStep('fast'))
-                }
-                break;
-            case 1:
-                {
-                    dispatch(setStep('sleep'))
-                }
-                break;
-
-            case 2:
-                {
-                    dispatch(setStep(isFastFirst ? 'fast' : 'sleep'))
-                }
-        }
-        jumpPage('/pages/clock/SetSchedule', 'SetSchedule', navigation)
-    }
-
-    function footerContent() {
-        var style = {}
-        var background;
-        switch (selIndex) {
-            case 0:
-                style = { backgroundColor: global.fastColor ? global.fastColor : ColorType.fast }
-                background = global.fastColor ? global.fastColor : ColorType.fast
-                break;
-            case 1:
-                style = { backgroundColor: global.sleepColor ? global.sleepColor : ColorType.sleep }
-                background = global.sleepColor ? global.sleepColor : ColorType.sleep
-                break;
-            case 2:
-                style = {
-                    background: 'linear-gradient(to right, ' + (global.fastColor ? global.fastColor : ColorType.fast) + ', ' + (global.sleepColor ? global.sleepColor : ColorType.sleep) + ')'
-                }
-                background = 'linear-gradient(to right, ' + (global.fastColor ? global.fastColor : ColorType.fast) + ', ' + (global.sleepColor ? global.sleepColor : ColorType.sleep) + ')'
-                break;
-        }
-        return <View>
-            {
-                process.env.TARO_ENV == 'rn' && selIndex == 2 ? <View onClick={next}>
-                    <LinearGradient
-                        style={{
-                            width: 300,
-                            height: 50,
-                            borderRadius: 25,
-                            alignItems: 'center',
-                            justifyContent: 'center',
-                        }}
-                        colors={[ColorType.fast, ColorType.sleep]}
-                        start={{ x: 0, y: 0 }}
-                        end={{ x: 1, y: 0 }}
-                    >
-                        <Text style={{fontWeight:'bold',fontSize:20}}>{t('feature.common.btn_next')}</Text>
-                    </LinearGradient>
-                </View> :
-                    <ChooseScenarioBtn title={t('feature.common.btn_next')} onClick={next} background={background} />
-            }
-
-            {/* <Buttons title='Next' onClick={next} btnStyle={{ ...style, width: 320 }} /> */}
-        </View>
-    }
-
-    function timeToArc(time: string) {
-        var count: number = parseInt(time.split(':')[1]) + parseInt(time.split(':')[0]) * 60
-        // count = count>720?count-720:count
-        return (count as any) / 1440 * 2 * Math.PI - Math.PI / 2
-    }
-
-    function durationToArc(startTime: string, endTime: string) {
-        var start: number = parseInt(startTime.split(':')[1]) + parseInt(startTime.split(':')[0]) * 60
-        var end: number = parseInt(endTime.split(':')[1]) + parseInt(endTime.split(':')[0]) * 60
-        if (end <= start) {
-            end += 1440
-        }
-
-        return (end - start) / 1440 * 2 * Math.PI
-    }
-
-    function getScheduleTarget(isFast: boolean) {
-        for (var i = 0; i < scenarios.length; i++) {
-            if (isFast && scenarios[i].name == 'FAST') {
-                if (global.schedule_fast) {
-                    return global.schedule_fast
-                }
-                return scenarios[i].schedule.fast
-            }
-            else if (!isFast && scenarios[i].name == 'SLEEP') {
-                if (global.schedule_sleep) {
-                    return global.schedule_sleep
-                }
-                return scenarios[i].schedule.sleep
-            }
-        }
-
-    }
-
-    function items() {
-        const array: any[] = []
-        const common: RingCommon = {
-            useCase: 'ChooseScenario',
-            radius: 33,
-            lineWidth: 8,
-            isFast: true,
-            status: 'WAIT_FOR_START'
-        }
-        const common2: RingCommon = {
-            useCase: 'ChooseScenario',
-            radius: 23,
-            lineWidth: 6,
-            isFast: true,
-            status: 'WAIT_FOR_START'
-        }
-
-        const bgRing: BgRing = {
-            color: '#262626'
-        }
-
-        const targetRing: TargetRing = {
-            color: global.fastColor ? global.fastColor : ColorType.fast,
-            startArc: timeToArc((getScheduleTarget(true) as any).start_time),
-            durationArc: durationToArc((getScheduleTarget(true) as any).start_time, (getScheduleTarget(true) as any).end_time)
-        }
-
-        const targetRing2: TargetRing = {
-            color: global.sleepColor ? global.sleepColor : ColorType.sleep,
-            startArc: timeToArc((getScheduleTarget(false) as any).start_time),
-            durationArc: durationToArc((getScheduleTarget(false) as any).start_time, (getScheduleTarget(false) as any).end_time)
-        }
-
-
-        array.push(
-            <View className="item_row" style={{ opacity: scenarios.length > 0 ? 1 : 0 }}>
-                <Rings2 common={common} bgRing={bgRing} targetRing={targetRing} canvasId='0' />
-                <View className="item_txt_bg">
-                    <Text className="item_txt" style={{ color: global.fastColor ? global.fastColor : ColorType.fast }}>{t('feature.track_time_duration.choose_scenario.list.item1.name')}</Text>
-                    {
-                        scenarios[0].count > 0 && <View className="scenario_count">
-                            <View className="badge_view1" style={{ backgroundColor: global.fastColor ? global.fastColor : ColorType.fast }}>
-                                <Text className="badge1">x{scenarios[0].count}</Text>
-                            </View>
-
-                        </View>
-                    }
-                </View>
-            </View>
-        );
-        array.push(
-            <View className="item_row" style={{ opacity: scenarios.length > 0 ? 1 : 0 }}>
-                <Rings2 common={common} bgRing={bgRing} targetRing={targetRing2} canvasId='1' />
-                <View className="item_txt_bg">
-                    <Text className="item_txt" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep }}>{t('feature.track_time_duration.choose_scenario.list.item2.name')}</Text>
-                    {
-                        scenarios[1].count > 0 && <View className="scenario_count">
-                            <View className="badge_view1" style={{ backgroundColor: global.sleepColor ? global.sleepColor : ColorType.sleep }}>
-                                <Text className="badge1">x{scenarios[1].count}</Text>
-                            </View>
-
-                        </View>
-                    }
-                </View>
-            </View>
-        )
-        array.push(
-            <View className="item_row" style={{ opacity: scenarios.length > 0 ? 1 : 0 }}>
-                <View style={{ position: 'relative', zIndex: 1 }}>
-                    <Rings2 common={common} bgRing={bgRing} targetRing={targetRing} canvasId='3' />
-                    <View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
-                        <Rings2 common={common2} bgRing={bgRing} targetRing={targetRing2} canvasId='4' />
-                    </View>
-                </View>
-                <View className="item_txt_bg">
-                    {
-                        process.env.TARO_ENV == 'weapp' && <Text className="item_txt fast_sleep_text" >{t('feature.track_time_duration.choose_scenario.list.item3.name')}</Text>
-                    }
-                    {
-                        process.env.TARO_ENV == 'rn' && <GradientText style={{ fontSize: rpxToPx(48), fontWeight: 'bold' }}>{t('feature.track_time_duration.choose_scenario.list.item3.name')}</GradientText>
-                    }
-
-                    {
-                        scenarios[2].count > 0 && process.env.TARO_ENV == 'weapp' &&
-                        <View className="scenario_count">
-                            <View className="badge_view1" style={{
-                                background: 'linear-gradient(to right, ' +
-                                    (global.fastColor ? global.fastColor : ColorType.fast) + ', '
-                                    + (global.sleepColor ? global.sleepColor : ColorType.sleep) + ')'
-                            }}>
-                                <Text className="badge1">x{scenarios[2].count}</Text>
-                            </View>
-
-                        </View>
-                    }
-                    {
-                        scenarios[2].count > 0 && process.env.TARO_ENV == 'rn' && <View className="scenario_count">
-                            <LinearGradient className="badge_view1"
-                                colors={[ColorType.fast, ColorType.sleep]}
-                                start={{ x: 0, y: 0 }}
-                                end={{ x: 1, y: 0 }}
-                            >
-                                <Text className="badge1">x{scenarios[2].count}</Text>
-                            </LinearGradient>
-                        </View>
-                    }
-                </View>
-            </View>
-        )
-        return array;
-    }
-
-    function handleItemSelect(index: number) {
-        setSelIndex(index)
-        dispatch(setScenario(scenarios[index]) as any)
-        if (index == 0) {
-            dispatch(setStep('fast'))
-        }
-        else if (index == 1) {
-            dispatch(setStep('sleep'))
-        }
-        else {
-            dispatch(setStep(isFastFirst ? 'fast' : 'sleep'))
-        }
-    }
-
-    return <Layout title={t('page.choose_scenario.title')}
-        titleShowStyle={NaviBarTitleShowType.scrollToShow} type={TemplateType.customHeader}>
-        <View className="container">
-            <TitleView title={t('page.choose_scenario.title')}
-                subTitle={t('page.choose_scenario.sub_title')}
-                // titleSize={t('page.choose_scenario.title_size')}
-            />
-            {
-                scenarios.length > 0 && <View style={{ position: 'relative', zIndex: 1,marginTop:20 }}>
-                    <SingleSelect items={items()} itemSelect={handleItemSelect} selIndex={selIndex} />
-                </View>
-            }
-
-            {
-                process.env.TARO_ENV == 'rn' && <View style={{ height: 30 }} />
-            }
-
-            {/* <LinearGradient
-                colors={[ ColorType.fast,ColorType.sleep]}
-                start={{ x: 0, y: 0 }}
-                end={{ x: 1, y: 0 }}
-            >
-                <Text>hlsdjgfaspgopdfag</Text>
-            </LinearGradient> */}
-
-
-            <Footer children={footerContent()} />
-        </View>
-    </Layout>
-}

+ 0 - 231
src/features/trackTimeDuration/components/CircadianDetailPopup.scss

@@ -1,231 +0,0 @@
-.detail_container {
-    padding-left: 46px;
-    padding-right: 46px;
-    padding-top: 40px;
-    padding-bottom: 80px;
-}
-
-.detail_popup_title {
-    color: #fff;
-    font-weight: bold;
-    font-size: 48px;
-    line-height: 48px;
-    height: 48px;
-    // background-color: red;
-}
-
-.detail_popup_subttitle {
-    font-size: 24px;
-    line-height: 24px;
-    color: #fff;
-    opacity: 0.4;
-}
-
-.detail_tabbar {
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    margin-top: 32px;
-    margin-bottom: 32px;
-}
-
-.detail_tabitem_nor {
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    height: 56px;
-    border-radius: 28px;
-    padding-left: 22px;
-    padding-right: 22px;
-    box-sizing: border-box;
-    color: #ffffff66;
-    font-size: 32px;
-    font-weight: bold;
-    border-style: solid;
-    border-color: #d8d8d8;
-    border-width: 2px;
-    margin-right: 40px;
-}
-
-.detail_tabitem_sel {
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    height: 56px;
-    border-radius: 28px;
-    padding-left: 22px;
-    padding-right: 22px;
-    box-sizing: border-box;
-    color: #1c1c1c;
-    font-size: 32px;
-    font-weight: bold;
-    background-color: #D8D8D8;
-    border-style: solid;
-    border-color: #d8d8d8;
-    border-width: 2px;
-    margin-right: 40px;
-}
-
-.detail_bottom {
-    display: flex;
-    margin-top: 28px;
-    align-items: center;
-    justify-content: center;
-}
-
-/* #ifdef weapp */
-.detail_bottom_btn {
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    width: 578px;
-    height: 84px;
-    border-radius: 42px;
-    color: #090909;
-    font-size: 32px;
-    font-weight: bold;
-    background: linear-gradient(90deg, #00FFFF 0%, #8961F5 100%);
-}
-/* #endif */
-
-/* #ifdef rn */
-.detail_bottom_btn {
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    width: 578px;
-    height: 84px;
-    border-radius: 42px;
-    color: #090909;
-    font-size: 32px;
-    font-weight: bold;
-}
-/* #endif */
-
-.pop_ring_bg {
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    border-top-style: solid;
-    border-top-width: 2px;
-    border-top-color: #ffffff25;
-    padding-top: 20px;
-    padding-bottom: 20px;
-}
-
-.pop_overview_bg {
-    flex-direction: column;
-    padding-top: 40px;
-    padding-bottom: 40px;
-    align-items: flex-start;
-}
-
-.pop_duration_bg {
-    margin-left: 50px;
-    display: flex;
-    flex-direction: column;
-    flex: 1;
-}
-
-.pop_duration_title {
-    font-size: 32px;
-    line-height: 32px;
-    color: #fff;
-    opacity: 0.6;
-    font-weight: 400;
-}
-
-.pop_duration_value {
-    margin-top: 2px;
-    font-size: 36px;
-    line-height: 36px;
-    font-weight: 500;
-    margin-bottom: 12px;
-}
-
-.pop_duration_txt{
-    font-size: 48px;
-    line-height: 48px;
-    font-weight: bold;
-    flex: 1;
-    display: flex;
-    color: #fff;
-}
-
-.minus{
-    width: 72px;
-    height: 72px;
-    border-top-left-radius: 12px;
-    border-bottom-left-radius: 12px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-}
-
-.plus{
-    width: 72px;
-    height: 72px;
-    border-top-right-radius: 12px;
-    border-bottom-right-radius: 12px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-}
-
-.arrow2 {
-    width: 40px;
-    height: 40px;
-    opacity: 0.4;
-}
-
-.countdown_time_bg{
-    width: 240px;
-    display: flex;
-    flex-direction: column;
-}
-
-.countdown_time_bg .title{
-    font-size: 24px;
-    line-height: 32px;
-    color: #fff;
-    opacity: 0.6;
-}
-
-.countdown_time_bg .value{
-    font-size: 36px;
-    line-height: 48px;
-    font-weight: bold;
-}
-
-.free {
-    height: 36px;
-    line-height: 35px;
-    border-radius: 18px;
-    font-size: 20px;
-    display: flex;
-    // align-items: center;
-    // justify-content: center;
-    padding-left: 16px;
-    padding-right: 16px;
-    margin-left: 6px;
-}
-
-.day_night_pop_location{
-    color: #fff;
-    font-size: 24px;
-    line-height: 24px;
-    opacity: 0.6;
-}
-
-.day_night_pop_desc{
-    color: #fff;
-    opacity: 0.4;
-    font-size: 20px;
-    line-height: 28px;
-}
-
-.day_night_pop_choose{
-    color: #fff;
-    font-size: 20px;
-    line-height: 32px;
-}

+ 0 - 1098
src/features/trackTimeDuration/components/CircadianDetailPopup.tsx

@@ -1,1098 +0,0 @@
-import { View, Text, PageContainer, Image } from '@tarojs/components'
-import './CircadianDetailPopup.scss'
-import { useEffect, useRef, useState } from 'react'
-import TimelineFastSleep from './TimelineFastSleep'
-import { RealRing } from "@/features/trackTimeDuration/components/Rings";
-import Rings from "./Rings";
-import { bigRingRadius, getBgRing, getCommon, getDot, ringWidth } from '../hooks/RingData';
-import { ColorType } from '@/context/themes/color';
-import { useTranslation } from 'react-i18next';
-import { TimeFormatter } from '@/utils/time_format';
-import { getTimezone, rpxToPx } from '@/utils/tools';
-import { useSelector } from 'react-redux';
-import { durationDatas, durationIndex, getColor, getDurationTitle } from '../hooks/Console';
-import Modal from '@/components/layout/Modal.weapp';
-import { updateRecord } from '@/services/trackTimeDuration';
-import PickerViews from '@/components/input/PickerViews';
-import Taro from '@tarojs/taro';
-import { IconInfo, IconMinus, IconPlus } from '@/components/basic/Icons';
-import showAlert from '@/components/basic/Alert';
-import { getLocalPush } from '../actions/TrackTimeActions';
-
-
-let LinearGradient
-if (process.env.TARO_ENV == 'rn') {
-    LinearGradient = require('react-native-linear-gradient').default
-}
-
-export default function CircadianDetailPopup(props: { record: any, schedule?: any, onClose: Function, stageIndex?: number, onlyStage?: boolean }) {
-
-    const [tabIndex, setTabIndex] = useState(0)
-    const [diffTimeZone, setDiffTimeZone] = useState(false)
-    const [multiTimeZone, setMultiTimeZone] = useState(false)
-    const [detail, setDetail] = useState(JSON.parse(JSON.stringify(props.record)))
-    const [showDurationPicker, setShowDurationPicker] = useState(false)
-    const [fastPickerValue, setFastPickerValue] = useState([0, 0])
-    const [sleepPickerValue, setSleepPickerValue] = useState([0, 0])
-    const [showEditPicker, setShowEditPicker] = useState(false)
-    const [schedule, setSchedule] = useState(props.schedule)
-    const [isFast, setIsFast] = useState(true)
-    const durationPickerRef = useRef(null)
-    const common = useSelector((state: any) => state.common);
-    const { t } = useTranslation()
-
-    useEffect(() => {
-        if (props.record.status == 'COMPLETED') {
-            if ((props.record.sleep && props.record.sleep.status == 'COMPLETED') &&
-                props.record.scenario == 'FAST_SLEEP') {
-                setTabIndex(1)
-            }
-            else {
-                setTabIndex(2)
-            }
-        }
-
-    }, [])
-
-    useEffect(() => {
-        checkTimezone()
-        // var current_record = props.record
-        if (detail.fast)
-            setFastPickerValue(durationIndex(detail.fast.target_start_time, detail.fast.target_end_time, common))
-        if (detail.sleep)
-            setSleepPickerValue(durationIndex(detail.sleep.target_start_time, detail.sleep.target_end_time, common))
-
-    }, [detail])
-
-    useEffect(() => {
-        setDetail(JSON.parse(JSON.stringify(props.record)))
-    }, [props.record])
-
-
-
-    function checkTimezone() {
-        var currentTZ = getTimezone()
-        var isDiff = false;
-        var isMulti = false;
-        var tempTZ = '';
-        if (props.record.fast) {
-            if (props.record.fast.real_start_timezone && props.record.fast.real_start_timezone.gmt) {
-                tempTZ = props.record.fast.real_start_timezone.gmt
-                if (props.record.fast.real_start_timezone.gmt != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-            if (props.record.fast.real_end_timezone && props.record.fast.real_end_timezone.gmt) {
-                if (tempTZ != props.record.fast.real_end_timezone.gmt) {
-                    isMulti = true
-                }
-                if (props.record.fast.real_end_timezone.gmt != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-        }
-
-        if (props.record.sleep) {
-            if (props.record.sleep.real_start_timezone && props.record.sleep.real_start_timezone.gmt) {
-                if (tempTZ == '') {
-                    tempTZ = props.record.sleep.real_start_timezone.gmt
-                }
-                else if (tempTZ != props.record.sleep.real_start_timezone.gmt) {
-                    isMulti = true
-                }
-                if (props.record.sleep.real_start_timezone.gmt != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-            if (props.record.sleep.real_end_timezone && props.record.sleep.real_end_timezone.gmt) {
-                if (tempTZ != props.record.sleep.real_end_timezone.gmt) {
-                    isMulti = true
-                }
-                if (props.record.sleep.real_end_timezone.gmt != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-
-        }
-        setDiffTimeZone(isDiff)
-        setMultiTimeZone(isMulti)
-    }
-
-    function getTitle() {
-        if (props.record.status == 'COMPLETED') {
-            var timestamp = props.record.first_real_check_time
-            if (props.record.first_timezone) {
-                timestamp = TimeFormatter.transferTimestamp(timestamp, props.record.first_timezone.gmt)
-            }
-            return TimeFormatter.getDayOfWeek(new Date(timestamp).getDay(), true)
-        }
-        if (props.record.status == 'WAIT_FOR_START') {
-            return t('feature.track_time_duration.common.schedule')
-        }
-        return t('feature.track_time_duration.common.current_schedule')
-    }
-
-    function getSubTitle() {
-        if (props.record.status == 'COMPLETED') {
-            var timestamp = props.record.first_real_check_time
-            if (props.record.first_timezone) {
-                timestamp = TimeFormatter.transferTimestamp(timestamp, props.record.first_timezone.gmt)
-            }
-            return TimeFormatter.dateDescription(timestamp, true)
-        }
-        return ''
-    }
-
-    function getBottomText() {
-        if (props.record.status == 'WAIT_FOR_START') {
-            return t('feature.track_time_duration.common.im_ready')
-        }
-        if (props.record.status == 'COMPLETED') {
-            return t('feature.track_time_duration.common.got_it')
-        }
-        return t('feature.track_time_duration.common.okay')
-    }
-    const startArc = (time: number) => {
-        var date = new Date(time);
-        var hour = date.getHours();
-        var minute = date.getMinutes();
-        var second = date.getSeconds();
-        return (hour * 3600 + minute * 60 + second) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
-    }
-
-    function durationArc(start_time: number, end_time: number) {
-        var duration = (end_time - start_time) / 1000;
-        return duration / (24 * 3600) * 2 * Math.PI;
-    }
-
-    function getStageDuration(index) {
-        var start, end;
-        switch (index) {
-            case 0:
-                if (props.record.status == 'WAIT_FOR_START') {
-                    start = props.record.fast.target_start_time
-                    end = props.record.sleep.target_start_time
-                }
-                else if (props.record.status == 'ONGOING1') {
-                    return TimeFormatter.countdown(props.record.fast.real_start_time)
-                }
-                else {
-                    start = props.record.fast.real_start_time
-                    end = props.record.sleep.real_start_time
-                }
-
-                break
-            case 1:
-                if (props.record.status == 'WAIT_FOR_START' ||
-                    props.record.status == 'ONGOING1') {
-                    start = props.record.sleep.target_start_time
-                    end = props.record.sleep.target_end_time
-                }
-                else if (props.record.status == 'ONGOING2') {
-                    return TimeFormatter.countdown(props.record.sleep.real_start_time)
-                }
-                else {
-                    start = props.record.sleep.real_start_time
-                    end = props.record.sleep.real_end_time
-                }
-                break
-            case 2:
-                if (props.record.status == 'WAIT_FOR_START' ||
-                    props.record.status == 'ONGOING1' ||
-                    props.record.status == 'ONGOING2') {
-                    start = props.record.sleep.target_end_time
-                    end = props.record.fast.target_end_time
-                }
-                else if (props.record.status == 'ONGOING3') {
-                    return TimeFormatter.countdown(props.record.sleep.real_end_time)
-                }
-                else {
-                    start = props.record.sleep.real_end_time
-                    end = props.record.fast.real_end_time
-                }
-                break
-            case 3:
-                start = props.record.fast.real_start_time
-                end = props.record.fast.real_end_time
-                if (props.record.fast.status == 'NOT_COMPLETED') {
-                    return t('feature.track_time_duration.stage.not_completed')
-                }
-                break
-            case 4:
-                if (props.record.sleep.status == 'NOT_STARTED') {
-                    return t('feature.track_time_duration.stage.not_started')
-                }
-                else if (props.record.sleep.status == 'NOT_COMPLETED') {
-                    return t('feature.track_time_duration.stage.not_completed')
-                }
-                start = props.record.sleep.real_start_time
-                end = props.record.sleep.real_end_time
-                break;
-        }
-        if (start > end) {
-            return t('feature.track_time_duration.console.no_duration_available')
-            // return '-' + TimeFormatter.durationFormate2(start, end)
-        }
-        return TimeFormatter.durationFormate(start, end)
-        // return TimeFormatter.calculateTimeDifference(start, end)
-    }
-
-    function completedOverView() {
-        var bgRing = getBgRing()
-        var common = getCommon(null, false)
-        common.radius = bigRingRadius;
-        common.lineWidth = ringWidth;
-
-        var fastRing: RealRing = null
-        if (props.record.fast) {
-            var timestamp = TimeFormatter.transferTimestamp(props.record.fast.real_start_time, props.record.fast.real_end_timezone ? props.record.fast.real_end_timezone.gmt : '')
-            fastRing = {
-                color: global.fastColor ? global.fastColor : ColorType.fast,
-                startArc: startArc(timestamp),//startArc(props.record.fast.real_start_time),
-                durationArc: durationArc(props.record.fast.real_start_time, props.record.fast.real_end_time)
-            }
-            if (props.record.fast.status == 'NOT_COMPLETED') {
-                fastRing.durationArc = 0.01
-            }
-        }
-
-        var sleepRing: RealRing = null
-        if (props.record.sleep && props.record.sleep.status == 'COMPLETED') {
-            var timestamp = TimeFormatter.transferTimestamp(props.record.sleep.real_start_time,
-                props.record.fast ? props.record.fast.real_end_timezone.gmt : props.record.sleep.real_end_timezone.gmt)
-            sleepRing = {
-                color: global.sleepColor ? global.sleepColor : ColorType.sleep,
-                startArc: startArc(timestamp),//startArc(props.record.sleep.real_start_time),
-                durationArc: durationArc(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
-            }
-        }
-        if (props.record.sleep && props.record.sleep.status == 'NOT_COMPLETED') {
-            var timestamp = TimeFormatter.transferTimestamp(props.record.sleep.real_start_time,
-                props.record.fast ? props.record.fast.real_end_timezone.gmt : props.record.sleep.real_end_timezone.gmt)
-            sleepRing = {
-                color: global.sleepColor ? global.sleepColor : ColorType.sleep,
-                startArc: startArc(timestamp),//startArc(props.record.sleep.real_start_time),
-                durationArc: 0.01
-            }
-        }
-
-        return <View>
-            {
-                props.record.fast && <View className='pop_ring_bg'>
-                    <Rings common={common} bgRing={bgRing} canvasId={'pop_fast_ring'} realRing={fastRing} />
-                    <View className="pop_duration_bg">
-                        <Text className="pop_duration_title">{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
-                        <Text className="pop_duration_value" style={{ color: ColorType.fast }}>{getStageDuration(3)}</Text>
-                    </View>
-                </View>
-            }
-            {
-                props.record.sleep && <View className='pop_ring_bg'>
-                    <Rings common={common} bgRing={bgRing} canvasId={'pop_sleep_ring'} realRing={sleepRing} />
-                    <View className="pop_duration_bg">
-                        <Text className="pop_duration_title">{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
-                        <Text className="pop_duration_value" style={{ color: ColorType.sleep }}>{getStageDuration(4)}</Text>
-                    </View>
-                </View>
-            }
-
-        </View>
-    }
-
-    function tapDuration(isFast: boolean) {
-        if (isFast) {
-            setIsFast(true)
-            global.pauseIndexTimer = true
-            if (props.record.status == 'WAIT_FOR_START') {
-                setShowDurationPicker(true)
-            }
-            else {
-                setShowEditPicker(true)
-            }
-        }
-        else {
-            setIsFast(false)
-            if (props.record.status == 'WAIT_FOR_START' && props.record.scenario == 'FAST_SLEEP') {
-                Taro.showToast({
-                    title: t('feature.track_time_duration.common.start_fasting_first'),
-                    icon: 'none'
-                })
-                return;
-            }
-            global.pauseIndexTimer = true
-            if (props.record.status == 'WAIT_FOR_START' || props.record.status == 'ONGOING1') {
-                setShowDurationPicker(true)
-            }
-            else {
-                setShowEditPicker(true)
-            }
-        }
-    }
-
-    function tapMinus(isFast: boolean) {
-        if (isFast) {
-            var fastDuration = detail.fast.target_end_time - detail.fast.target_start_time
-            if (fastDuration == 3600000) {
-                Taro.showToast({
-                    icon: 'none',
-                    title: 'feature.common.toast.min_value'
-                })
-                return
-            }
-            var count = fastDuration - common.duration.step * 60 * 1000
-            count = count < 3600000 ? 3600000 : count
-
-            detail.fast.target_end_time = detail.fast.target_start_time + count;
-
-            setFastPickerValue(durationIndex(detail.fast.target_start_time, detail.fast.target_end_time, common))
-
-            if (props.record.status == 'WAIT_FOR_START') {
-                // var start = props.schedule.fast.start_time
-                // var startCount = (parseInt(start.split(':')[0]) * 60 + parseInt(start.split(':')[1])) * 60 * 1000
-                // var endCount = startCount + count
-                // if (endCount >= 24 * 3600 * 1000) {
-                //     endCount -= 24 * 3600 * 1000
-                // }
-                // endCount = endCount / 60000
-                // var endHour = Math.floor(endCount / 60)
-                // var endMinute = endCount % 60
-                // var endTime = TimeFormatter.padZero(endHour) + ':' + TimeFormatter.padZero(endMinute)
-                // console.log(endTime)
-                changeSchedule(count)
-            }
-
-        }
-        else {
-            if (props.record.status == 'WAIT_FOR_START' && props.record.scenario == 'FAST_SLEEP') {
-                Taro.showToast({
-                    title: t('feature.track_time_duration.common.start_fasting_first'),
-                    icon: 'none'
-                })
-                return;
-            }
-
-            var sleepDuration = detail.sleep.target_end_time - detail.sleep.target_start_time
-            if (sleepDuration == 3600000) {
-                Taro.showToast({
-                    icon: 'none',
-                    title: 'feature.common.toast.min_value'
-                })
-                return
-            }
-            var count = sleepDuration - common.duration.step * 60 * 1000
-            count = count < 3600000 ? 3600000 : count
-
-            detail.sleep.target_end_time = detail.sleep.target_start_time + count;
-            setSleepPickerValue(durationIndex(detail.sleep.target_start_time, detail.sleep.target_end_time, common))
-        }
-        setDetail(JSON.parse(JSON.stringify(detail)))
-    }
-
-    function tapPlus(isFast: boolean) {
-        if (isFast) {
-            var fastDuration = detail.fast.target_end_time - detail.fast.target_start_time
-            if (fastDuration == 23 * 3600000) {
-                Taro.showToast({
-                    icon: 'none',
-                    title: 'feature.common.toast.max_value'
-                })
-                return
-            }
-            var count = fastDuration + common.duration.step * 60 * 1000
-            count = count > 23 * 3600000 ? 23 * 3600000 : count
-
-            detail.fast.target_end_time = detail.fast.target_start_time + count;
-
-            setFastPickerValue(durationIndex(detail.fast.target_start_time, detail.fast.target_end_time, common))
-
-            if (props.record.status == 'WAIT_FOR_START') {
-                changeSchedule(count)
-                // var start = props.schedule.fast.start_time
-                // var startCount = (parseInt(start.split(':')[0]) * 60 + parseInt(start.split(':')[1])) * 60 * 1000
-                // var endCount = startCount + count
-                // if (endCount >= 24 * 3600 * 1000) {
-                //     endCount -= 24 * 3600 * 1000
-                // }
-                // endCount = endCount / 60000
-                // var endHour = Math.floor(endCount / 60)
-                // var endMinute = endCount % 60
-                // var endTime = TimeFormatter.padZero(endHour) + ':' + TimeFormatter.padZero(endMinute)
-                // console.log(endTime)
-            }
-        }
-        else {
-            if (props.record.status == 'WAIT_FOR_START' && props.record.scenario == 'FAST_SLEEP') {
-                Taro.showToast({
-                    title: t('feature.track_time_duration.common.start_fasting_first'),
-                    icon: 'none'
-                })
-                return;
-            }
-            var sleepDuration = detail.sleep.target_end_time - detail.sleep.target_start_time
-            if (sleepDuration == 23 * 3600000) {
-                Taro.showToast({
-                    icon: 'none',
-                    title: 'feature.common.toast.max_value'
-                })
-                return
-            }
-            var count = sleepDuration + common.duration.step * 60 * 1000
-
-            count = count > 23 * 3600000 ? 23 * 3600000 : count
-
-            detail.sleep.target_end_time = detail.sleep.target_start_time + count;
-            setSleepPickerValue(durationIndex(detail.sleep.target_start_time, detail.sleep.target_end_time, common))
-        }
-        setDetail(JSON.parse(JSON.stringify(detail)))
-    }
-
-    function changeSchedule(count: number) {
-        if (!schedule) {
-            return
-        }
-        var obj = JSON.parse(JSON.stringify(schedule))
-        var start = schedule.fast.start_time
-        var startCount = (parseInt(start.split(':')[0]) * 60 + parseInt(start.split(':')[1])) * 60 * 1000
-        var endCount = startCount + count
-        if (endCount >= 24 * 3600 * 1000) {
-            endCount -= 24 * 3600 * 1000
-        }
-        endCount = endCount / 60000
-        var endHour = Math.floor(endCount / 60)
-        var endMinute = endCount % 60
-        var endTime = TimeFormatter.padZero(endHour) + ':' + TimeFormatter.padZero(endMinute)
-        obj.fast.end_time = endTime
-        setSchedule(obj)
-    }
-
-    function sleepRealDuration() {
-        return getStageDuration(4)
-    }
-
-    function fastOverview() {
-        if (props.record.fast.status == 'WAIT_FOR_START') {
-            return <View className='pop_ring_bg pop_overview_bg'>
-                <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
-                <View onClick={() => tapDuration(true)} style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
-                    <Text className='pop_duration_txt' style={{ color: ColorType.fast }}>{TimeFormatter.durationFormate(detail.fast.target_start_time, detail.fast.target_end_time)}</Text>
-                    <View onClick={(e) => {
-                        if (process.env.TARO_ENV == 'weapp') {
-                            e.stopPropagation()
-                        }
-                        tapMinus(true)
-                    }} className='minus' style={{ backgroundColor: ColorType.fast, opacity: 0.6 }}><IconMinus color='#090909' /></View>
-                    <View onClick={(e) => {
-                        if (process.env.TARO_ENV == 'weapp') {
-                            e.stopPropagation()
-                        }
-                        tapPlus(true)
-                    }} className='plus' style={{ backgroundColor: ColorType.fast }}><IconPlus color='#090909' /></View>
-                </View>
-            </View>
-        }
-        else if (props.record.status != 'COMPLETED') {
-            return <View className='pop_ring_bg pop_overview_bg'>
-                <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
-                <View onClick={() => tapDuration(true)} style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
-                    <Text className='pop_duration_txt'>{TimeFormatter.durationFormate(detail.fast.target_start_time, detail.fast.target_end_time)}</Text>
-                    <Image onClick={() => tapDuration(true)} className="arrow2" src={require('@/assets/images/arrow3.png')} />
-                </View>
-                <View style={{ marginTop: rpxToPx(20), display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
-                    <View className='countdown_time_bg'>
-                        <Text className='title' style={{ color: '#fff', opacity: 0.4 }}>{t('feature.track_time_duration.console.countup')}</Text>
-                        <Text className='value' style={{ color: ColorType.fast }}>{TimeFormatter.formateTimeNow(props.record.fast.real_start_time)}</Text>
-                    </View>
-                    <View className='countdown_time_bg'>
-                        {
-                            props.record.fast.target_end_time < new Date().getTime() ? <Text className='title' style={{ color: '#fff', opacity: 0.4 }}>{t('feature.track_time_duration.console.timeout')}</Text> :
-                                <Text className='title' style={{ color: '#fff', opacity: 0.4 }}>{t('feature.track_time_duration.console.countdown_not_due')}</Text>
-                        }
-
-                        {
-                            props.record.fast.target_end_time < new Date().getTime() ?
-                                <Text className='value' style={{ color: ColorType.alert }}>{TimeFormatter.countdown(props.record.fast.target_end_time)}</Text> :
-                                <Text className='value' style={{ color: ColorType.fast, opacity: 0.6 }}>{TimeFormatter.countdown(props.record.fast.target_end_time)}</Text>
-                        }
-
-                    </View>
-                </View>
-            </View>
-        }
-    }
-
-    function sleepOverview() {
-        if (props.record.sleep.status == 'WAIT_FOR_START') {
-            return <View className='pop_ring_bg pop_overview_bg'>
-                <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
-                <View onClick={() => tapDuration(false)} style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
-                    <Text className='pop_duration_txt' style={{ color: ColorType.sleep }}>{TimeFormatter.durationFormate(detail.sleep.target_start_time, detail.sleep.target_end_time)}</Text>
-                    <View onClick={(e) => {
-                        if (process.env.TARO_ENV == 'weapp') {
-                            e.stopPropagation()
-                        }
-                        tapMinus(false)
-                    }} className='minus' style={{ backgroundColor: ColorType.sleep, opacity: 0.6 }}><IconMinus color='#090909' /></View>
-                    <View onClick={(e) => {
-                        if (process.env.TARO_ENV == 'weapp') {
-                            e.stopPropagation()
-                        }
-                        tapPlus(false)
-                    }} className='plus' style={{ backgroundColor: ColorType.sleep }}><IconPlus color='#090909' /></View>
-                </View>
-            </View>
-        }
-        else if (props.record.sleep.status == 'WAIT_FOR_END') {
-            return <View className='pop_ring_bg pop_overview_bg'>
-                <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
-                <View onClick={() => tapDuration(false)} style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
-                    <Text className='pop_duration_txt'>{TimeFormatter.durationFormate(detail.sleep.target_start_time, detail.sleep.target_end_time)}</Text>
-                    <Image onClick={() => tapDuration(false)} className="arrow2" src={require('@/assets/images/arrow3.png')} />
-                </View>
-                <View style={{ marginTop: rpxToPx(20), display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
-                    <View className='countdown_time_bg'>
-                        <Text className='title' style={{ color: '#fff', opacity: 0.4 }}>{t('feature.track_time_duration.console.countup')}</Text>
-                        <Text className='value' style={{ color: ColorType.sleep }}>{TimeFormatter.formateTimeNow(props.record.sleep.real_start_time)}</Text>
-                    </View>
-                    <View className='countdown_time_bg'>
-                        {
-                            props.record.sleep.target_end_time < new Date().getTime() ? <Text className='title' style={{ color: '#fff', opacity: 0.4 }}>{t('feature.track_time_duration.console.timeout')}</Text> :
-                                <Text className='title' style={{ color: '#fff', opacity: 0.4 }}>{t('feature.track_time_duration.console.countdown_not_due')}</Text>
-                        }
-                        {
-                            props.record.sleep.target_end_time < new Date().getTime() ?
-                                <Text className='value' style={{ color: ColorType.alert }}>{TimeFormatter.countdown(props.record.sleep.target_end_time)}</Text> :
-                                <Text className='value' style={{ color: ColorType.sleep, opacity: 0.6 }}>{TimeFormatter.countdown(props.record.sleep.target_end_time)}</Text>
-                        }
-
-                    </View>
-                </View>
-            </View>
-        }
-        else {
-            return <View className='pop_ring_bg pop_overview_bg'>
-                <Text className='pop_duration_title'>{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
-                <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: rpxToPx(8), display: 'flex', width: '100%' }}>
-                    <Text className='pop_duration_txt' style={{ color: ColorType.sleep }}>{sleepRealDuration()}</Text>
-                </View>
-            </View>
-        }
-    }
-
-    function overview() {
-        if (props.record.status == 'COMPLETED') {
-            return completedOverView()
-        }
-        return <View>
-            {
-                props.record.fast && fastOverview()
-            }
-            {
-                props.record.sleep && sleepOverview()
-            }
-        </View>
-    }
-
-    function showPredictedAlert() {
-        showAlert({
-            title: t('feature.track_time_duration.console.predicted_alert_title'),
-            content: t('feature.track_time_duration.console.predicted_alert_content'),
-            showCancel: false,
-            confirmText: t('feature.track_time_duration.console.predicted_alert_btn')
-        })
-    }
-
-    function stage() {
-        var bgRing = getBgRing()
-        var common = getCommon(null, false)
-        common.radius = bigRingRadius;
-        common.lineWidth = ringWidth;
-        var timestamp, timestamp2, timestamp3
-        var duration, duration2, duration3;
-
-        var predicted2 = false; //预估
-        var predicted3 = false;
-        var currentDot = getDot(null, true)
-        var currentDot2 = getDot(null, true)
-        var currentDot3 = getDot(null, true)
-        if (props.record.status == 'WAIT_FOR_START') {
-            var date = new Date()
-            date.setSeconds(0)
-            date.setMilliseconds(0)
-            var fastStart = props.schedule.fast.start_time
-            var sleepStart = props.schedule.sleep.start_time
-            var sleepEnd = props.schedule.sleep.end_time
-            date.setHours(parseInt(fastStart.split(':')[0]))
-            date.setMinutes(parseInt(fastStart.split(':')[1]))
-
-            timestamp = date.getTime()
-            date.setHours(parseInt(sleepStart.split(':')[0]))
-            date.setMinutes(parseInt(sleepStart.split(':')[1]))
-            timestamp2 = date.getTime()
-            if (timestamp2 < timestamp) {
-                timestamp2 += 24 * 3600 * 1000
-            }
-            date.setHours(parseInt(sleepEnd.split(':')[0]))
-            date.setMinutes(parseInt(sleepEnd.split(':')[1]))
-            timestamp3 = date.getTime()
-            if (timestamp3 < timestamp2) {
-                timestamp3 += 24 * 3600 * 1000
-            }
-
-            duration = durationArc(props.record.fast.target_start_time, props.record.sleep.target_start_time)
-            duration2 = durationArc(props.record.sleep.target_start_time, props.record.sleep.target_end_time)
-            duration3 = durationArc(props.record.sleep.target_end_time, props.record.fast.target_end_time)
-
-            currentDot = null
-            currentDot2 = null
-            currentDot3 = null
-        }
-
-        else if (props.record.status == 'ONGOING1') {
-            var date = new Date()
-            timestamp = props.record.fast.real_start_time
-            timestamp2 = props.record.sleep.target_start_time
-            timestamp3 = props.record.sleep.target_end_time
-            duration = durationArc(props.record.fast.real_start_time, date.getTime())
-            duration2 = durationArc(props.record.sleep.target_start_time, props.record.sleep.target_end_time)
-            duration3 = durationArc(props.record.sleep.target_end_time, props.record.fast.target_end_time)
-
-            predicted2 = true
-            predicted3 = true
-
-            currentDot.color = ColorType.fast
-            currentDot2 = null
-            currentDot3 = null
-        }
-        else if (props.record.status == 'ONGOING2') {
-            var date = new Date()
-            timestamp = props.record.fast.real_start_time
-            timestamp2 = props.record.sleep.real_start_time
-            timestamp3 = props.record.sleep.target_end_time
-            duration = durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
-            duration2 = durationArc(props.record.sleep.real_start_time, date.getTime())
-            duration3 = durationArc(props.record.sleep.target_end_time, props.record.fast.target_end_time)
-
-            predicted2 = false
-            predicted3 = true
-
-            currentDot = null
-            currentDot2.color = ColorType.sleep
-            currentDot3 = null
-        }
-        else if (props.record.status == 'ONGOING3') {
-            var date = new Date()
-            timestamp = props.record.fast.real_start_time
-            timestamp2 = props.record.sleep.real_start_time
-            timestamp3 = props.record.sleep.real_end_time
-            duration = durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
-            duration2 = durationArc(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
-            duration3 = durationArc(props.record.sleep.real_end_time, date.getTime())
-
-            currentDot = null
-            currentDot2 = null
-            currentDot3.color = ColorType.fast
-        }
-        else {
-            timestamp = TimeFormatter.transferTimestamp(props.record.fast.real_start_time, props.record.fast.real_end_timezone.gmt)
-            timestamp2 = TimeFormatter.transferTimestamp(props.record.sleep.real_start_time, props.record.fast.real_end_timezone.gmt)
-            timestamp3 = TimeFormatter.transferTimestamp(props.record.sleep.real_end_time, props.record.fast.real_end_timezone.gmt)
-            duration = durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
-            duration2 = durationArc(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
-            duration3 = durationArc(props.record.sleep.real_end_time, props.record.fast.real_end_time)
-            currentDot = null
-            currentDot2 = null
-            currentDot3 = null
-        }
-
-        const preRing: RealRing = {
-            color: global.fastColor ? global.fastColor : ColorType.fast,
-            startArc: startArc(timestamp),
-            durationArc: duration
-        }
-        let sleepRing: RealRing = {
-            color: global.sleepColor ? global.sleepColor : ColorType.sleep,
-            startArc: startArc(timestamp2),
-            durationArc: duration2
-        }
-        let wakeRing: RealRing = {
-            color: global.fastColor ? global.fastColor : ColorType.fast,
-            startArc: startArc(timestamp3),
-            durationArc: duration3
-        }
-
-        if (duration2 < 0) {
-            sleepRing = null
-        }
-        if (duration3 < 0) {
-            wakeRing = null
-        }
-        return <View>
-            <View className='pop_ring_bg'>
-                <Rings common={common} bgRing={bgRing} canvasId={'pre_sleep_ring'} realRing={preRing} currentDot={currentDot} />
-                <View className="pop_duration_bg">
-                    <Text className="pop_duration_title">{t('feature.track_time_duration.stage.a')}</Text>
-                    <Text className="pop_duration_value" style={{ color: ColorType.fast }}>{getStageDuration(0)}</Text>
-                </View>
-            </View>
-            <View className='pop_ring_bg'>
-                <Rings common={common} bgRing={bgRing} canvasId={'sleeping_ring'} realRing={sleepRing} currentDot={currentDot2} />
-                <View className="pop_duration_bg">
-                    <Text className="pop_duration_title">{t('feature.track_time_duration.stage.b')}</Text>
-                    <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
-                        <Text className="pop_duration_value" style={{ color: ColorType.sleep, marginBottom: 0 }}>{getStageDuration(1)}</Text>
-                        {
-                            predicted2 ? !sleepRing ? <View style={{ marginLeft: 5 }} onClick={showPredictedAlert}><IconInfo width={20} color={ColorType.sleep} /></View> : <View className='free' style={{ backgroundColor: ColorType.sleep, color: '#fff' }}>{t('feature.track_time_duration.console.predicted')}</View> : null
-                        }
-                    </View>
-
-                </View>
-            </View>
-            <View className='pop_ring_bg'>
-                <Rings common={common} bgRing={bgRing} canvasId={'later_sleep_ring'} realRing={wakeRing} currentDot={currentDot3} />
-                <View className="pop_duration_bg">
-                    <Text className="pop_duration_title">{t('feature.track_time_duration.stage.c')}</Text>
-                    <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
-                        <Text className="pop_duration_value" style={{ color: ColorType.fast, marginBottom: 0 }}>{getStageDuration(2)}</Text>
-                        {
-                            predicted3 ? !wakeRing ? <View style={{ marginLeft: 5 }} onClick={showPredictedAlert}><IconInfo width={20} color={ColorType.fast} /></View> : <View className='free' style={{ backgroundColor: ColorType.fast, color: '#fff' }}>{t('feature.track_time_duration.console.predicted')}</View> : null
-                        }
-                    </View>
-                </View>
-            </View>
-        </View>
-    }
-
-    function events() {
-        return <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
-            <TimelineFastSleep
-                data={props.record}
-                first_real_check_time={props.record.first_real_check_time ? props.record.first_real_check_time : 0}
-                scenario={schedule ? { schedule: schedule } : null}
-                diffTimeZone={diffTimeZone} multiTimeZone={multiTimeZone} />
-        </View>
-    }
-
-    function durationPickerContent() {
-        var color = getColor(props.record)
-        var title = getDurationTitle(props.record, t)
-        return <View style={{ color: '#fff', backgroundColor: 'transparent' }}>
-
-
-            <PickerViews ref={durationPickerRef}
-                onChange={durationChange}
-                items={durationDatas(common)}
-                value={isFast ? fastPickerValue : sleepPickerValue}
-                themeColor={color}
-                title={title}
-                showBtns={true}
-                onCancel={() => {
-                    setShowDurationPicker(false)
-                    global.pauseIndexTimer = false
-                }} />
-        </View>
-    }
-
-    function editPickerContent() {
-        return <View style={{ color: '#fff', backgroundColor: 'transparent' }}>
-            <PickerViews ref={durationPickerRef}
-                onChange={durationChange}
-                items={durationDatas(common)}
-                value={isFast ? fastPickerValue : sleepPickerValue}
-                themeColor={isFast ? ColorType.fast : ColorType.sleep}
-                title={isFast ? t('feature.track_time_duration.action_sheet.edit_fasting_goal') :
-                    t('feature.track_time_duration.action_sheet.edit_sleeping_goal')}
-                showBtns={true}
-                onCancel={() => {
-                    setShowEditPicker(false)
-                    global.pauseIndexTimer = false
-                }} />
-        </View>
-    }
-
-    function durationChange(e) {
-        global.pauseIndexTimer = false
-        var count = (e[0] + common.duration.min) * 60 + e[1] * common.duration.step
-        // var count = (e[0] + 1) * 60 + e[1] * 5
-        if (showDurationPicker) {
-            // global.changeTargetDuration(count, isFast)
-            if (isFast) {
-                detail.fast.target_end_time = detail.fast.target_start_time + count * 60 * 1000
-                if (props.record.status == 'WAIT_FOR_START') {
-                    changeSchedule(count * 1000 * 60)
-                }
-
-            }
-            else {
-                detail.sleep.target_end_time = detail.sleep.target_start_time + count * 60 * 1000
-            }
-            setDetail(JSON.parse(JSON.stringify(detail)))
-        }
-        else {
-            var params: any = {}
-            if (isFast) {
-                params = {
-                    fast: {
-                        target_duration: count * 60 * 1000
-                    }
-                }
-            }
-            else {
-                params = {
-                    sleep: {
-                        target_duration: count * 60 * 1000
-                    }
-                }
-            }
-            updateRecord({
-                ...params
-            }, props.record.id).then(res => {
-                //刷新本地推送schedule
-                getLocalPush()
-                //刷新首页数据
-                global.indexPageRefresh()
-            }).catch(e => {
-
-            })
-        }
-        setShowDurationPicker(false)
-        setShowEditPicker(false)
-    }
-
-    function modalContent() {
-        if (showDurationPicker || showEditPicker) {
-            return <Modal
-                testInfo={null}
-                dismiss={() => {
-                    setShowDurationPicker(false)
-                    setShowEditPicker(false)
-                    global.pauseIndexTimer = false
-                }}
-                confirm={() => { }}>
-                {
-                    showDurationPicker ? durationPickerContent() : editPickerContent()
-                }
-            </Modal>
-
-        }
-        return <View />
-    }
-
-    function onlyStageContent() {
-        var bgRing = getBgRing()
-        var common = getCommon(null, false)
-        common.radius = bigRingRadius;
-        common.lineWidth = ringWidth;
-
-        var timestamp, timestamp2, timestamp3
-        var duration, duration2, duration3;
-
-        var currentDot = getDot(null, true)
-        if (props.record.status == 'WAIT_FOR_START') {
-            var date = new Date()
-            date.setSeconds(0)
-            date.setMilliseconds(0)
-            var fastStart = props.schedule.fast.start_time
-            var sleepStart = props.schedule.sleep.start_time
-            var sleepEnd = props.schedule.sleep.end_time
-            date.setHours(parseInt(fastStart.split(':')[0]))
-            date.setMinutes(parseInt(fastStart.split(':')[1]))
-
-            timestamp = date.getTime()
-            date.setHours(parseInt(sleepStart.split(':')[0]))
-            date.setMinutes(parseInt(sleepStart.split(':')[1]))
-            timestamp2 = date.getTime()
-            if (timestamp2 < timestamp) {
-                timestamp2 += 24 * 3600 * 1000
-            }
-            date.setHours(parseInt(sleepEnd.split(':')[0]))
-            date.setMinutes(parseInt(sleepEnd.split(':')[1]))
-            timestamp3 = date.getTime()
-            if (timestamp3 < timestamp2) {
-                timestamp3 += 24 * 3600 * 1000
-            }
-
-            duration = durationArc(props.record.fast.target_start_time, props.record.sleep.target_start_time)
-            duration2 = durationArc(props.record.sleep.target_start_time, props.record.sleep.target_end_time)
-            duration3 = durationArc(props.record.sleep.target_end_time, props.record.fast.target_end_time)
-
-            currentDot = null;
-        }
-        else if (props.record.status == 'ONGOING1') {
-            var date = new Date()
-            timestamp = props.record.fast.real_start_time
-            timestamp2 = props.record.sleep.target_start_time
-            timestamp3 = props.record.sleep.target_end_time
-            duration = durationArc(props.record.fast.real_start_time, date.getTime())
-            duration2 = durationArc(props.record.sleep.target_start_time, props.record.sleep.target_end_time)
-            duration3 = durationArc(props.record.sleep.target_end_time, props.record.fast.target_end_time)
-
-            if (props.stageIndex == 0) {
-                currentDot.color = ColorType.fast
-            }
-            else {
-                currentDot = null
-            }
-        }
-        else if (props.record.status == 'ONGOING2') {
-            var date = new Date()
-            timestamp = props.record.fast.real_start_time
-            timestamp2 = props.record.sleep.real_start_time
-            timestamp3 = props.record.sleep.target_end_time
-            duration = durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
-            duration2 = durationArc(props.record.sleep.real_start_time, date.getTime())
-            duration3 = durationArc(props.record.sleep.target_end_time, props.record.fast.target_end_time)
-            if (props.stageIndex == 1) {
-                currentDot.color = ColorType.sleep
-            }
-            else {
-                currentDot = null
-            }
-        }
-        else if (props.record.status == 'ONGOING3') {
-            var date = new Date()
-            timestamp = props.record.fast.real_start_time
-            timestamp2 = props.record.sleep.real_start_time
-            timestamp3 = props.record.sleep.real_end_time
-            duration = durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
-            duration2 = durationArc(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
-            duration3 = durationArc(props.record.sleep.real_end_time, date.getTime())
-            if (props.stageIndex == 2) {
-                currentDot.color = ColorType.fast
-            }
-            else {
-                currentDot = null
-            }
-        }
-        else {
-            timestamp = TimeFormatter.transferTimestamp(props.record.fast.real_start_time, props.record.fast.real_end_timezone.gmt)
-            timestamp2 = TimeFormatter.transferTimestamp(props.record.sleep.real_start_time, props.record.fast.real_end_timezone.gmt)
-            timestamp3 = TimeFormatter.transferTimestamp(props.record.sleep.real_end_time, props.record.fast.real_end_timezone.gmt)
-            duration = durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
-            duration2 = durationArc(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
-            duration3 = durationArc(props.record.sleep.real_end_time, props.record.fast.real_end_time)
-            currentDot = null
-        }
-
-        const preRing: RealRing = {
-            color: global.fastColor ? global.fastColor : ColorType.fast,
-            startArc: startArc(timestamp),
-            durationArc: duration
-        }
-        const sleepRing: RealRing = {
-            color: global.sleepColor ? global.sleepColor : ColorType.sleep,
-            startArc: startArc(timestamp2),
-            durationArc: duration2
-        }
-        const wakeRing: RealRing = {
-            color: global.fastColor ? global.fastColor : ColorType.fast,
-            startArc: startArc(timestamp3),
-            durationArc: duration3
-        }
-
-        return <View className='detail_container'>
-            {/* <Text className='detail_popup_title'>{getTitle()}<Text className='detail_popup_subttitle'> {getSubTitle()}</Text></Text> */}
-            <View style={{ marginTop: rpxToPx(0) }}>
-                {
-                    props.stageIndex == 0 && <View className='pop_ring_bg' style={{ borderTopColor: 'transparent' }}>
-                        <Rings common={common} bgRing={bgRing} canvasId={'pre_sleep_ring'} realRing={preRing} currentDot={currentDot} />
-                        <View className="pop_duration_bg">
-                            <Text className="pop_duration_title">{t('feature.track_time_duration.stage.a')}</Text>
-                            <Text className="pop_duration_value" style={{ color: ColorType.fast }}>{getStageDuration(0)}</Text>
-                        </View>
-                    </View>
-                }
-                {
-                    props.stageIndex == 1 && <View className='pop_ring_bg' style={{ borderTopColor: 'transparent' }}>
-                        <Rings common={common} bgRing={bgRing} canvasId={'sleeping_ring'} realRing={sleepRing} currentDot={currentDot} />
-                        <View className="pop_duration_bg">
-                            <Text className="pop_duration_title">{t('feature.track_time_duration.stage.b')}</Text>
-                            <Text className="pop_duration_value" style={{ color: ColorType.sleep }}>{getStageDuration(1)}</Text>
-                        </View>
-                    </View>
-                }
-                {
-                    props.stageIndex == 2 && <View className='pop_ring_bg' style={{ borderTopColor: 'transparent' }}>
-                        <Rings common={common} bgRing={bgRing} canvasId={'later_sleep_ring'} realRing={wakeRing} currentDot={currentDot} />
-                        <View className="pop_duration_bg">
-                            <Text className="pop_duration_title">{t('feature.track_time_duration.stage.c')}</Text>
-                            <Text className="pop_duration_value" style={{ color: ColorType.fast }}>{getStageDuration(2)}</Text>
-                        </View>
-                    </View>
-                }
-            </View>
-        </View>
-    }
-
-    if (props.onlyStage) {
-        return onlyStageContent()
-    }
-
-
-    return <View className='detail_container'>
-        <View style={{display:'flex',flexDirection:'row',alignItems:'flex-end'}}>
-            <Text className='detail_popup_title'>{getTitle()}</Text>
-            <Text className='detail_popup_subttitle'> {getSubTitle()}</Text>
-        </View>
-
-        {/* <Text className='detail_popup_title'>{getTitle()}<Text className='detail_popup_subttitle'> {getSubTitle()}</Text></Text> */}
-        <View className='detail_tabbar'>
-            <View onClick={() => { setTabIndex(0) }} className={tabIndex == 0 ? 'detail_tabitem_sel' : 'detail_tabitem_nor'}>{t('feature.day_night.overview')}</View>
-            {
-                // props.record.status == 'COMPLETED' &&
-                // (props.record.sleep && props.record.sleep.status == 'COMPLETED') &&
-                props.record.scenario == 'FAST_SLEEP' &&
-                <View onClick={() => { setTabIndex(1) }} className={tabIndex == 1 ? 'detail_tabitem_sel' : 'detail_tabitem_nor'}>{t('feature.day_night.stages')}</View>
-            }
-            <View onClick={() => { setTabIndex(2) }} className={tabIndex == 2 ? 'detail_tabitem_sel' : 'detail_tabitem_nor'}>{t('feature.day_night.events')}</View>
-        </View>
-        <View className='detail_content'>
-            {
-                tabIndex == 0 ? overview() : tabIndex == 1 ? stage() : events()
-            }
-        </View>
-        <View className='detail_bottom'>
-            {
-                process.env.TARO_ENV == 'weapp' ?
-                    <View className='detail_bottom_btn' onClick={(e) => {
-                        if (process.env.TARO_ENV == 'weapp') {
-                            e.stopPropagation()
-                        }
-                        global.updateFastSleepData(detail, schedule)
-                        props.onClose();
-                    }}>{getBottomText()}</View> :
-                    <View onClick={(e) => {
-                        global.updateFastSleepData(detail, schedule)
-                        props.onClose();
-                    }}>
-                        <LinearGradient
-                            style={{
-                                width: 300,
-                                height: 50,
-                                borderRadius: 25,
-                                alignItems: 'center',
-                                justifyContent: 'center',
-                            }}
-                            colors={[ColorType.fast, ColorType.sleep]}
-                            start={{ x: 0, y: 0 }}
-                            end={{ x: 1, y: 0 }}
-
-                        >
-                            <Text style={{ fontWeight: 'bold', fontSize: 20,color:ColorType.black }}>{getBottomText()}</Text>
-                        </LinearGradient>
-                    </View>
-                // <View className='detail_bottom_btn' onClick={(e) => {
-                //     global.updateFastSleepData(detail, schedule)
-                //     props.onClose();
-                // }}>{getBottomText()}</View>
-            }
-
-        </View>
-        {
-            modalContent()
-        }
-    </View>
-}

+ 1 - 2
src/features/trackTimeDuration/components/CircadianStatus.scss

@@ -1,4 +1,3 @@
-@import '@/utils/common.scss';
 
 .day_night_status {
     height: 36px;
@@ -17,7 +16,7 @@
 
 /* #ifdef weapp */
 .day_night_status_mixed {
-    background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
+    // background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
 
 }
 

+ 0 - 11
src/features/trackTimeDuration/components/Dial.scss

@@ -1,11 +0,0 @@
-.inner{
-    position: absolute;
-    left: 0;
-    top: 0;
-    bottom: 0;
-    right: 0;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    pointer-events: none;
-}

+ 0 - 509
src/features/trackTimeDuration/components/Dial.tsx

@@ -1,509 +0,0 @@
-import Taro from '@tarojs/taro';
-import { Canvas, View, Image } from '@tarojs/components';
-import { useEffect, useRef, useState } from 'react';
-import React from 'react';
-import './Dial.scss'
-import { useSelector } from 'react-redux';
-import { ColorType } from '@/context/themes/color';
-
-const Component = (props) => {
-    const [scenario] = useState(useSelector((state: any) => state.scenario))
-    const [currentContext, setCurrentContext] = useState(null)
-    const [count, setCount] = useState(0)
-    const canvasWidth: number = 334;
-    const canvasHeight: number = 334;
-    const dpr = Taro.getSystemInfoSync().pixelRatio; // 获取设备的像素比
-    const canvasRef = useRef<any>(null);
-    const watchLineWidth = 300
-    const canvasId = scenario.step;
-
-    var canStartDrag = false;
-    var canEndDrag = false;
-    var canRingDrag = false;
-
-    var current = {
-        start: global.startTime,
-        end: global.endTime
-    }
-
-    var startCount = parseInt((current.start.split(':') as any)[0]) * 60 + parseInt((current.start.split(':') as any)[1]);
-    var endCount = parseInt((current.end.split(':') as any)[0]) * 60 + parseInt((current.end.split(':') as any)[1]);
-    var startAngle = (startCount / 1440) * 2 * Math.PI - Math.PI / 2;
-    var endAngle = (endCount / 1440) * 2 * Math.PI - Math.PI / 2;
-    endAngle = endAngle > startAngle ? endAngle : endAngle + 2 * Math.PI;
-
-    var lastAngle;
-    var lastDuration = 0;
-
-    var strStart = current.start;
-    var strEnd = current.end;
-
-    var needDrawFastRing = false;
-    if (scenario.name == 'FAST_SLEEP' && scenario.step == 'sleep') {
-        needDrawFastRing = true;
-    }
-
-    useEffect(() => {
-        setCount(count + 1)
-        if (currentContext){
-            drawCanvas(currentContext)
-            console.log('a')
-        }
-        else {
-            console.log('b')
-        }
-            
-    }, [global.startTime, global.endTime])
-
-    useEffect(() => {
-
-        const query = Taro.createSelectorQuery();
-        query.select(`.${canvasId}`).fields({ node: true, size: true });
-        query.exec((res) => {
-            if (res[0] == null) return;
-            const _canvas = res[0].node;
-            _canvas.width = res[0].width * dpr;
-            _canvas.height = res[0].height * dpr;
-            global.canvas = _canvas
-            const ctx = _canvas.getContext('2d');
-
-            setCurrentContext(ctx)
-
-            // 设置画布尺寸
-            ctx.scale(dpr, dpr);
-
-
-            drawCanvas(ctx);
-        });
-    }, []);
-
-    const drawCanvas = (ctx: any) => {
-
-
-
-        const centerX = canvasWidth / 2;
-        const centerY = canvasHeight / 2;
-        const radius = 140;//Math.min(centerX, centerY) - 38;
-
-        ctx.clearRect(0, 0, canvasWidth, canvasHeight);
-
-        //画断食环
-        if (needDrawFastRing) {
-            ctx.beginPath();
-            ctx.arc(centerX, centerY, radius + 16 + 8, global.fast_start_angle, global.fast_end_angle);
-            ctx.strokeStyle = global.fastColor ? global.fastColor : ColorType.fast;
-            ctx.lineWidth = 2;
-            ctx.stroke();
-        }
-
-        // 绘制圆环
-        ctx.beginPath();
-        ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
-        ctx.strokeStyle = "rgba(0,0,0,0.5)";
-        ctx.lineWidth = 38;
-        ctx.stroke();
-
-        //绘制起终点圆弧
-        ctx.beginPath();
-        ctx.arc(centerX, centerY, radius, startAngle, endAngle);
-        ctx.strokeStyle = (canRingDrag || canStartDrag || canEndDrag) ? "#3e3e3e" : "#1c1c1c";
-        ctx.lineWidth = 38;
-        ctx.lineCap = "round";
-        ctx.stroke();
-
-
-        //画刻度线
-        ctx.save()
-        ctx.beginPath()
-        ctx.moveTo(centerX, centerY)
-
-        ctx.arc(
-            centerX, centerY, watchLineWidth / 2.0, startAngle, endAngle
-        )
-
-        ctx.clip()
-        if (global.canvas_watch_line) {
-            ctx.drawImage(global.canvas_watch_line, centerX - watchLineWidth / 2.0, centerY - watchLineWidth / 2.0, watchLineWidth, watchLineWidth)
-        }
-        else {
-            let tempImage = global.canvas.createImage()
-            tempImage.src = require('@/assets/images/watch_line.png')//'./watch_line.png'//'..//assets/images/watch_line.png'
-            tempImage.onload = () => {
-                global.canvas_watch_line = tempImage
-                drawCanvas(ctx)
-            }
-        }
-        ctx.restore()
-        ctx.closePath()
-
-        if (scenario.step == 'fast') {
-            global.fast_start_angle = startAngle;
-            global.fast_end_angle = endAngle;
-        }
-
-        const pointX = centerX + Math.cos(startAngle) * radius;
-        const pointY = centerY + Math.sin(startAngle) * radius;
-
-        //绘制起点圆点
-        ctx.beginPath();
-        ctx.arc(pointX, pointY, 17, 0, 2 * Math.PI);
-        // ctx.fillStyle = (canRingDrag || canStartDrag) ? "#1c1c1c" : "#3e3e3e";
-        if (canEndDrag || canRingDrag) { //拖icon
-            ctx.fillStyle = '#3e3e3e'
-        }
-        else {  //idle
-            ctx.fillStyle = '#1c1c1c'
-        }
-        ctx.fill();
-
-        //绘制起点图标
-        ctx.save()
-        ctx.beginPath()
-        ctx.translate(pointX, pointY)
-        ctx.rotate(startAngle)
-        ctx.translate(-pointX, -pointY)
-
-        if (global.canvas_start_icon) {
-            ctx.drawImage(global.canvas_start_icon, pointX - 15, pointY - 15, 30, 30)
-        }
-        else {
-            let tempImage = global.canvas.createImage()
-            tempImage.src = require('@/assets/images/dial_start.png')//'./watch_line.png'//'..//assets/images/watch_line.png'
-            tempImage.onload = () => {
-                global.canvas_start_icon = tempImage
-                drawCanvas(ctx)
-            }
-        }
-
-        ctx.restore()
-        ctx.closePath()
-
-        // 绘制终点圆点
-        const pointX2 = centerX + Math.cos(endAngle) * radius;
-        const pointY2 = centerY + Math.sin(endAngle) * radius;
-
-        ctx.beginPath();
-        ctx.arc(pointX2, pointY2, 17, 0, 2 * Math.PI);
-        // ctx.fillStyle = (canRingDrag || canEndDrag) ? "#1c1c1c" : "#3e3e3e";
-        if (canStartDrag || canRingDrag) { //拖icon
-            ctx.fillStyle = '#3e3e3e'
-        }
-        else {  //idle
-            ctx.fillStyle = '#1c1c1c'
-        }
-        ctx.fill();
-
-        //绘制终点图标
-        if (global.canvas_end_icon) {
-            ctx.drawImage(global.canvas_end_icon, pointX2 - 20, pointY2 - 20, 40, 40)
-        }
-        else {
-            let tempImage = global.canvas.createImage()
-            tempImage.src = require('@/assets/images/watch_end_white.png')//'./watch_line.png'//'..//assets/images/watch_line.png'
-            tempImage.onload = () => {
-                global.canvas_end_icon = tempImage
-                drawCanvas(ctx)
-            }
-        }
-    };
-
-
-    global.updateDial = (start, end) => {
-        var startCount = parseInt((start.split(':') as any)[0]) * 60 + parseInt((start.split(':') as any)[1]);
-        var endCount = parseInt((end.split(':') as any)[0]) * 60 + parseInt((end.split(':') as any)[1]);
-        startAngle = (startCount / 1440) * 2 * Math.PI - Math.PI / 2;
-        endAngle = (endCount / 1440) * 2 * Math.PI - Math.PI / 2;
-        endAngle = endAngle > startAngle ? endAngle : endAngle + 2 * Math.PI;
-        drawCanvas(currentContext);
-    }
-
-    function twoPointDistance(p1, p2) {
-        let dep = Math.sqrt(Math.pow((p1.x - p2.x), 2) + Math.pow((p1.y - p2.y), 2));
-        return dep;
-    }
-
-    function limitAngle(start, end) {
-        var angle1 = start < 0 ? start + 2 * Math.PI : start;
-        var angle2 = end < 0 ? end + 2 * Math.PI : end;
-        if (angle2 < angle1) {
-            angle2 = angle2 + 2 * Math.PI;
-        }
-
-        var leftAngle = angle2 - angle1;
-        if (leftAngle > Math.PI * 23 / 12) {
-            return 1;
-        }
-        else if (leftAngle < Math.PI / 12) {
-            return 2;
-        }
-        return 0;
-    }
-
-    function durationAngle(end, start) {
-        var angle1 = start < 0 ? start + 2 * Math.PI : start;
-        var angle2 = end < 0 ? end + 2 * Math.PI : end;
-        if (angle2 < angle1) {
-            angle2 = angle2 + 2 * Math.PI;
-        }
-
-        return angle2 - angle1;
-    }
-
-    const handleTouchMove = (e: any) => {
-        if (global.disableCanvasGesture){
-            return
-        }
-        const ctx = currentContext;//canvasRef.current.getContext('2d');
-        if (!canStartDrag && !canEndDrag && !canRingDrag) {
-            drawCanvas(ctx);
-            return;
-        }
-
-
-        const { x, y } = e.touches[0];
-
-        let angle = Math.atan2(y - canvasWidth / 2.0, x - canvasWidth / 2.0)
-
-        if (canStartDrag) {
-            if (Math.abs(durationAngle(endAngle, angle) - lastDuration) > Math.PI) {
-                //禁止跨越
-                return;
-            }
-
-            var result = limitAngle(angle, endAngle);
-            switch (result) {
-                case 0:
-                    startAngle = angle;
-                    break;
-                case 1:
-                    startAngle = endAngle - 23 * Math.PI / 12;
-                    break;
-                case 2:
-                    startAngle = endAngle - Math.PI / 12;
-                    break;
-            }
-
-        }
-
-        if (canEndDrag) {
-            if (Math.abs(durationAngle(angle, startAngle) - lastDuration) > Math.PI) {
-                //禁止跨越
-                return;
-            }
-
-            var result = limitAngle(startAngle, angle);
-            switch (result) {
-                case 0:
-                    endAngle = angle;
-                    break;
-                case 1:
-                    endAngle = startAngle + 23 * Math.PI / 12;
-                    break;
-                case 2:
-                    endAngle = startAngle + Math.PI / 12;
-                    break;
-            }
-
-        }
-
-        if (canRingDrag) {
-            let delta = angle - lastAngle;
-            startAngle += delta;
-            endAngle += delta;
-            lastAngle = angle;
-        }
-
-        startAngle = normalizeAngle(startAngle);
-        endAngle = normalizeAngle(endAngle);
-
-        angleToTime();
-
-        drawCanvas(ctx);
-
-        lastDuration = durationAngle(endAngle, startAngle);
-    };
-
-    function angleToTime() {
-        var oldStart = parseInt(strStart.split(':')[0] as any) * 60 + parseInt(strStart.split(':')[1] as any);
-        var oldEnd = parseInt(strEnd.split(':')[0] as any) * 60 + parseInt(strEnd.split(':')[1] as any);
-        if (oldEnd < oldStart) oldEnd += 1440;
-        var oldDuration = oldEnd - oldStart;
-
-
-        var startCount = (startAngle + Math.PI / 2) / (2 * Math.PI) * 1440;
-        var endCount = (endAngle + Math.PI / 2) / (2 * Math.PI) * 1440;
-        startCount = startCount > 0 ? startCount : startCount + 1440;
-        endCount = endCount > 0 ? endCount : endCount + 1440;
-
-        startCount = roundToNearestFive(startCount);
-        endCount = roundToNearestFive(endCount);
-
-        var startHour = Math.floor(startCount / 60);
-        var startMinute = Math.floor(startCount % 60);
-        var endHour = Math.floor(endCount / 60);
-        var endMinute = Math.floor(endCount % 60);
-        startHour = startHour < 24 ? startHour : startHour - 24;
-        endHour = endHour < 24 ? endHour : endHour - 24;
-        var start = (startHour < 10 ? '0' + startHour : startHour) + ':' + (startMinute < 10 ? '0' + startMinute : startMinute);
-        var end = (endHour < 10 ? '0' + endHour : endHour) + ':' + (endMinute < 10 ? '0' + endMinute : endMinute);
-
-        if (canStartDrag) {
-            strStart = start;
-            global.updateDuration(start, strEnd);
-        }
-        else if (canEndDrag) {
-            strEnd = end;
-            global.updateDuration(strStart, end);
-        }
-        else if (canRingDrag) {
-            var newCount = startHour * 60 + startMinute
-            var newEnd = oldDuration + newCount
-
-            const resultHour = Math.floor(newEnd / 60) % 24; // 对 24 取模以确保结果在 0-23 之间
-            const resultMinute = newEnd % 60;
-
-            strStart = start
-            strEnd = `${String(resultHour).padStart(2, '0')}:${String(resultMinute).padStart(2, '0')}`;
-            global.updateDuration(start, strEnd);
-        }
-
-    }
-
-    function roundToNearestFive(minutes: number): number {
-        const remainder = minutes % 5;
-        if (remainder === 0) {
-            return minutes;
-        } else if (remainder < 3) {
-            return minutes - remainder;
-        } else {
-            return minutes + (5 - remainder);
-        }
-    }
-
-    const handleClick = (e) => {
-        if (global.disableCanvasGesture){
-            return
-        }
-        const scaleX = 1//dpr//canvasRect.width / canvasRect.width;
-        const scaleY = 1//dpr//canvasRect.height / canvasRect.height;
-        const canvasX = (e.touches[0].x - 0) * scaleX;
-        const canvasY = (e.touches[0].y - 0) * scaleY;
-
-        // 判断点击位置是否在圆点范围内
-        const centerX = canvasWidth / 2;
-        const centerY = canvasWidth / 2;
-        const radius = Math.min(centerX, centerY) - 10;
-
-
-        const pointX = centerX + Math.cos(startAngle) * radius;
-        const pointY = centerY + Math.sin(startAngle) * radius;
-        const distance = Math.sqrt(Math.pow(canvasX - pointX, 2) + Math.pow(canvasY - pointY, 2));
-        if (distance <= 40) {
-            canStartDrag = true;
-        } else {
-            canStartDrag = false;
-        }
-
-        const pointX2 = centerX + Math.cos(endAngle) * radius;
-        const pointY2 = centerY + Math.sin(endAngle) * radius;
-        const distance2 = Math.sqrt(Math.pow(canvasX - pointX2, 2) + Math.pow(canvasY - pointY2, 2));
-        if (distance2 <= 40) {
-            canEndDrag = true;
-        } else {
-            canEndDrag = false;
-        }
-
-        if (canStartDrag && canEndDrag) {
-            if (distance < distance2) {
-                canEndDrag = false
-            }
-            else {
-                canStartDrag = false
-            }
-        }
-        lastDuration = durationAngle(endAngle, startAngle);
-
-        if (canStartDrag || canEndDrag) {
-            drawCanvas(currentContext);
-            canRingDrag = false;
-
-            if (canStartDrag || canEndDrag) {
-                var type = canStartDrag ? 1 : 2
-                global.startDuration(type)
-            }
-            return;
-        }
-
-        const distance3 = twoPointDistance({ x: canvasX, y: canvasY }, { x: centerX, y: centerY });
-        let angle = Math.atan2(canvasY - canvasWidth / 2.0, canvasX - canvasWidth / 2.0)
-
-        if (distance3 > 120 && distance3 < 190 && isCenterAngle(startAngle, angle, endAngle)) {
-            canRingDrag = true;
-        }
-        lastAngle = angle;
-        startAngle = normalizeAngle(startAngle);
-        endAngle = normalizeAngle(endAngle);
-
-
-        drawCanvas(currentContext);
-
-        if (canStartDrag || canEndDrag || canRingDrag) {
-            var type = canStartDrag ? 1 : canEndDrag ? 2 : 3
-            global.startDuration(type)
-        }
-        else {
-            global.endDuration()
-        }
-    };
-
-    const normalizeAngle = (angle) => {
-        if (angle < 0) {
-            angle = angle + 2 * Math.PI;
-            normalizeAngle(angle);
-        }
-        if (angle > 2 * Math.PI) {
-            angle = angle - 2 * Math.PI;
-            normalizeAngle(angle);
-        }
-        return angle;
-    }
-
-    const isCenterAngle = (start, center, end) => {
-        start = normalizeAngle(start);
-        center = normalizeAngle(center);
-        end = normalizeAngle(end);
-        if (start > end) {
-            end += 2 * Math.PI;
-        }
-        if (end > 2 * Math.PI && center < start) {
-            center += 2 * Math.PI;
-        }
-        return start < center && center < end;
-    }
-
-    const handleTouchEnd = (e) => {
-        if (global.disableCanvasGesture){
-            return
-        }
-        canStartDrag = false;
-        canEndDrag = false;
-        canRingDrag = false;
-        global.endDuration()
-        handleTouchMove(e)
-    }
-
-    return <View style={{ width: 334, height: 334, borderRadius: 167, backgroundColor: '#000', position: 'relative' }} ref={props.ref}>
-        <Canvas canvasId={canvasId} id={canvasId} className={canvasId} type="2d"
-            style={{ width: 334, height: 334, zIndex: 0 }}
-            onTouchMove={handleTouchMove}
-            onTouchEnd={handleTouchEnd}
-            onTouchStart={handleClick}
-            ref={canvasRef}
-        />
-        <View className='inner'>
-            <Image src={require('@/assets/images/watch-inner.png')} style={{ width: 226, height: 226 }} />
-        </View>
-    </View>
-}
-
-export default React.memo(Component);

+ 2 - 2
src/features/trackTimeDuration/components/Discovery.tsx

@@ -370,7 +370,7 @@ export default function Discovery() {
             jumpPage('/pages/workout/Workout', 'Workout', navigation)
             return
         }
-        jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+        jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
     }
 
     function goFood() {
@@ -378,7 +378,7 @@ export default function Discovery() {
             jumpPage('/pages/food/Food', 'Food', navigation)
             return
         }
-        jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
+        jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
     }
 
     function dayDuration() {

+ 0 - 77
src/features/trackTimeDuration/components/IndexConsole.scss

@@ -1,77 +0,0 @@
-@import '@/utils/common.scss';
-
-.console_btn {
-    height: 88px;
-    border-radius: 44px;
-    position: relative;
-    background-color: $fastColor;
-    // margin-left: 46px;
-    // margin-right: 46px;
-    // margin-bottom: 36px;
-    align-items: center;
-    justify-content: center;
-    display: flex;
-    color: #000;
-}
-
-.btn_line {
-    height: 32px;
-    width: 1px;
-    background-color: #fff;
-    opacity: 0.4;
-    margin-left: 68px;
-    flex-shrink: 0;
-    opacity: 0;
-}
-
-.stage_btn {
-    height: 88px;
-    border-radius: 44px;
-    position: relative;
-    // margin-left: 46px;
-    // margin-right: 46px;
-    // margin-bottom: 36px;
-    align-items: center;
-    justify-content: center;
-    flex-direction: row;
-    display: flex;
-    color: #fff;
-    border-width: 2px;
-    border-style: solid;
-    border-color: #fff;
-    opacity: 0.4;
-    box-sizing: border-box;
-    padding-left: 44px;
-    padding-right: 44px;
-}
-
-.lock {
-    left: 44px;
-    width: 48px;
-    height: 48px;
-    position: absolute;
-    top: 18px;
-}
-
-.btn_disable {
-    opacity: 0.4;
-}
-
-.btn_sleep {
-    background-color: $sleepColor;
-}
-
-.expand {
-    color: #fff;
-    opacity: 0.4;
-    width: 100%;
-    text-align: center;
-    display: flex;
-    font-size: 28px;
-    line-height: 48px;
-    font-weight: bold;
-    // margin-top: 36px;
-    margin-top: 16px;
-    align-items: center;
-    justify-content: center;
-}

+ 0 - 1032
src/features/trackTimeDuration/components/IndexConsole.tsx

@@ -1,1032 +0,0 @@
-import { View, Text, Image, PageContainer } from '@tarojs/components'
-import './IndexConsole.scss'
-import { useTranslation } from 'react-i18next'
-import { useDispatch, useSelector } from 'react-redux';
-import { endFast, endSleep, getLocalPush, startFast, startSleep, uploadLocalPushInfo } from "../actions/TrackTimeActions";
-import { jumpPage } from '../hooks/Common';
-import { useContext, useEffect, useRef, useState } from 'react';
-import ConsolePicker from './ConsolePicker';
-import LimitPickers from '@/components/input/LimitPickers';
-import LimitTimeoutPickers from '@/components/input/LimitTimeoutPickers';
-import { getColor, getTimePickerTitle } from '../hooks/Console';
-import { kIsIOS, rpxToPx, vibrate } from '@/utils/tools';
-import { TimeFormatter } from '@/utils/time_format';
-import Modal from '@/components/layout/Modal.weapp';
-import Taro, { useDidShow } from '@tarojs/taro';
-import { wxPubFollow } from '@/services/permission';
-import { setWXFollow } from '@/store/permission';
-import CircadianDetailPopup from './CircadianDetailPopup';
-import showAlert from '@/components/basic/Alert';
-import CheckAccess from './CheckAccess';
-import { ColorType } from '@/context/themes/color';
-import IndexConsoleMuti from './IndexConsoleMuti';
-
-let useNavigation;
-
-let Linking, PushNotification;
-let checkNotification;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-    Linking = require('react-native').Linking;
-    // JPush = require('jpush-react-native').default;
-    PushNotification = require('react-native-push-notification')
-    checkNotification = require('@/utils/native_permission_check').checkNotification;
-}
-let operateType = ''
-let min = 0
-let max = 0
-let defaultTimestamp = 0
-let isTimeout = false
-let stageIndex = 0
-
-let nativePushListener = null
-export default function IndexConsole(props: { record: any, count: number, access: any }) {
-    const user = useSelector((state: any) => state.user);
-    const { status } = props.record.current_record;
-    const currentRecord = props.record.current_record;
-    const { t } = useTranslation()
-    const [fastDuration, setFastDuration] = useState<number>(0);
-    const [sleepDuration, setSleepDuration] = useState<number>(0);
-    const [expand, setExpand] = useState(false);
-    const permission = useSelector((state: any) => state.permission);
-    const common = useSelector((state: any) => state.common);
-    const [firstEnter, setFirstEnter] = useState(true);
-
-    const dayMilliSeconds = 24 * 3600 * 1000;
-    const [btnDisable, setBtnDisable] = useState(false)
-    const [showStageModal, setShowStageModal] = useState(false)
-    const [showTimePicker, setShowTimePicker] = useState(false);
-    const [showMutiPicker, setShowMutiPicker] = useState(false);
-    const [mutiEvent, setMutiEvent] = useState('start_fast');
-    const [logEvent, setLogEvent] = useState('LOG_ONCE');
-    const [logEventTimestamp, setLogEventTimestamp] = useState(0)
-    const dispatch = useDispatch();
-
-
-    const limitPickerRef = useRef(null)
-
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    useDidShow(() => {
-        if (process.env.TARO_ENV == 'weapp') {
-            wxPubFollow({ force_refresh: true }).then(res => {
-                dispatch(setWXFollow((res as any).wx_pub_followed));
-            })
-        }
-
-    })
-
-    useEffect(() => {
-        if (process.env.TARO_ENV == 'rn') {
-            // console.error('current status',status)
-            var NativeAppEventEmitter = require('react-native').NativeAppEventEmitter;
-            if (nativePushListener) {
-                (nativePushListener as any).remove()
-            }
-            if (kIsIOS) {
-                var Jto = require('react-native').NativeModules.NativeBridge;
-                Jto.getNotificationAuthStatus()
-            }
-            nativePushListener = NativeAppEventEmitter.addListener('notificationReceive', (data) => {
-                console.log('notification receive action', data)
-                const { category_id, action_id, id } = data
-                const timestamp = new Date().getTime()
-                uploadLocalPushInfo({
-                    messageId: id
-                })
-                global.set_time = timestamp;
-                setLogEvent('NOTIFY_ONE_TAP');
-                setLogEventTimestamp(timestamp)
-                switch (action_id) {
-                    case 'START_TIMER_NOW':
-                        {
-                            if (category_id == 'REMINDER_FS_START_FAST') {
-                                operateType = 'startFast'
-                            }
-                            else {
-                                operateType = 'startSleep'
-                            }
-                            global.set_time = timestamp//new Date().getTime()
-                            pickerConfirm(timestamp, 'NOTIFY_ONE_TAP')
-                            // pickerConfirm(new Date().getTime())
-                        }
-                        break;
-                    case 'PICK_EARLIER_START':
-                        {
-                            if (category_id == 'REMINDER_FS_START_FAST') {
-                                tapStartFast(null)
-                            }
-                            else {
-                                tapStartSleep(null)
-                            }
-                        }
-                        break;
-                    case 'LOG_MY_TIMES':
-                        {
-                            if (category_id == 'REMINDER_FS_START_FAST_T2') {
-                                if (props.record.scenario.name == 'FAST_SLEEP') {
-                                    tapStartSleep(null)
-                                }
-                                else {
-                                    tapEndFast(null)
-                                }
-
-                            }
-                            if (props.record.scenario.name == 'FAST') {
-                                return
-                            }
-                            if (category_id == 'REMINDER_FS_START_FAST_T3') {
-                                tapEndSleep(null)
-                            }
-                            else if (category_id == 'REMINDER_FS_START_FAST_T4') {
-                                tapEndFast(null)
-                            }
-                            else if (category_id == 'REMINDER_FS_START_SLEEP_T3') {
-                                tapEndSleep(null)
-                            }
-                            else if (category_id == 'REMINDER_FS_START_SLEEP_T4') {
-                                tapEndFast(null)
-                            }
-                            else if (category_id == 'REMINDER_FS_END_SLEEP_T4') {
-                                tapEndFast(null)
-                            }
-                        }
-                        break;
-                    case 'END_TIMER_NOW':
-                        {
-                            if (category_id == 'REMINDER_FS_END_FAST') {
-                                operateType = 'endFast'
-                            }
-                            else {
-                                operateType = 'endSleep'
-                            }
-                            global.set_time = timestamp//new Date().getTime()
-                            pickerConfirm(timestamp, 'NOTIFY_ONE_TAP')
-                            // pickerConfirm(new Date().getTime())
-                        }
-                        break;
-                    case 'PICK_EARLIER_END':
-                        {
-                            if (category_id == 'REMINDER_FS_END_FAST') {
-                                tapEndFast(null)
-                            }
-                            else {
-                                tapEndSleep(null)
-                            }
-                        }
-                        break;
-                    case 'SKIP':
-                        break;
-                }
-            })
-        }
-    }, [props.record])
-
-    useEffect(() => {
-        if (currentRecord.fast) {
-            var fastCount = currentRecord.fast.target_end_time - currentRecord.fast.target_start_time
-            setFastDuration(fastCount)
-        }
-
-        if (currentRecord.sleep) {
-            var sleepCount = currentRecord.sleep.target_end_time - currentRecord.sleep.target_start_time
-            setSleepDuration(sleepCount)
-        }
-        if (props.record.current_record.status == 'WAIT_FOR_START') {
-            setExpand(false)
-        }
-
-    }, [props.record])
-
-
-    function tapStartFast(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth', navigation)
-            return
-        }
-        if (e) {
-            setLogEvent('LOG_ONCE')
-        }
-        operateType = 'startFast'
-        global.pauseIndexTimer = true
-        global.set_time = new Date().getTime()
-
-        defaultTimestamp = new Date().getTime()
-        // global.set_time = e ? new Date().getTime() : logEventTimestamp
-
-        // defaultTimestamp = e ? new Date().getTime() : logEventTimestamp
-        min = defaultTimestamp - 1 * 24 * 3600 * 1000
-        max = defaultTimestamp
-        isTimeout = false
-
-        setShowTimePicker(true)
-        // showPicker()
-    }
-
-    function tapStartSleep(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth')
-            return
-        }
-        if (e) {
-            setLogEvent('LOG_ONCE')
-        }
-        if (status != 'ONGOING1' && props.record.scenario.name == 'FAST_SLEEP') {
-            // if (status == 'WAIT_FOR_START') {
-            //     Taro.showToast({
-            //         title: t('feature.track_time_duration.console.lock_fast_tip'),
-            //         icon: 'none'
-            //     })
-            // }
-
-            // vibrate()
-            setMutiEvent('start_sleep')
-            setShowMutiPicker(true);
-            return;
-        }
-        operateType = 'startSleep'
-        global.pauseIndexTimer = true
-        // global.set_time = e ? new Date().getTime() : logEventTimestamp
-        global.set_time = new Date().getTime()
-
-
-        isTimeout = false
-        if (props.record.scenario.name == 'SLEEP') {
-            defaultTimestamp = new Date().getTime()
-            // defaultTimestamp = e ? new Date().getTime() : logEventTimestamp
-            min = defaultTimestamp - 6 * dayMilliSeconds
-            max = defaultTimestamp
-        }
-        else {
-            //todolist
-            var now = new Date().getTime()
-            var last_check_time = props.record.current_record.last_real_check_time
-            if (now - last_check_time >= dayMilliSeconds) {
-                //ongoing1 严重超时单独处理
-                // var schedule_start_time = props.record.current_record.sleep.target_start_time
-                // defaultTimestamp = Math.min(now, schedule_start_time)
-                // min = Math.max(last_check_time, schedule_start_time - 3 * dayMillionSeconds)
-                // max = Math.min(now, schedule_start_time + 3 * dayMillionSeconds)
-                defaultTimestamp = now
-                min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
-                max = defaultTimestamp
-            }
-            else {
-                defaultTimestamp = now
-                min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
-                max = defaultTimestamp
-            }
-
-        }
-
-
-        setShowTimePicker(true)
-        // showPicker()
-    }
-
-    function tapEndSleep(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth')
-            return
-        }
-        if (e) {
-            setLogEvent('LOG_ONCE')
-        }
-        if (status != 'ONGOING2' && status != 'ONGOING') {
-
-            // Taro.showToast({
-            //     title: t('feature.track_time_duration.console.lock_sleep_tip'),
-            //     icon: 'none'
-            // })
-
-            // vibrate()
-            setMutiEvent('end_sleep')
-            setShowMutiPicker(true);
-            return;
-        }
-        operateType = 'endSleep'
-        global.pauseIndexTimer = true
-        // global.set_time = e ? new Date().getTime() : logEventTimestamp
-        global.set_time = new Date().getTime()
-
-        var real_start_time = props.record.current_record.sleep.real_start_time
-        var last_check_time = props.record.current_record.last_real_check_time
-        var now = new Date().getTime()
-        if (now - real_start_time >= dayMilliSeconds) {
-            //严重超时
-            isTimeout = true
-            // defaultTimestamp = Math.min(props.record.current_record.sleep.target_end_time, now)
-            // min = Math.max(last_check_time, defaultTimestamp - 3 * dayMillionSeconds)
-            // max = Math.min(now, defaultTimestamp + 3 * dayMillionSeconds)
-            defaultTimestamp = now
-            min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
-            max = defaultTimestamp
-        }
-        else {
-            isTimeout = false
-            // defaultTimestamp = e ? new Date().getTime() : logEventTimestamp
-            defaultTimestamp = new Date().getTime()
-            min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
-            max = defaultTimestamp
-        }
-
-        setShowTimePicker(true)
-
-        // if (last_check_time + 24 * 3600 * 1000 <= new Date().getTime()) {
-        //     setShowTimePicker(true)
-        //     return
-        // }
-
-        // showPicker()
-    }
-
-    function tapEndFast(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (!user.isLogin) {
-            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth')
-            return
-        }
-        if (e) {
-            setLogEvent('LOG_ONCE')
-        }
-        if (status == 'WAIT_FOR_START') {
-            // Taro.showToast({
-            //     title: t('feature.track_time_duration.console.lock_fast_tip'),
-            //     icon: 'none'
-            // })
-            // vibrate()
-            setMutiEvent('end_fast')
-            setShowMutiPicker(true);
-            return;
-        }
-
-        if (status == 'ONGOING1') {
-            // showAlert({
-            //     title:t('feature.heads_up.alert_title'),
-            //     content:t('feature.heads_up.ongoing1_content'),
-            //     cancelText:t('feature.heads_up.ongoing1_cancel'),
-            //     confirmText:t('feature.heads_up.ongoing1_confirm'),
-            //     showCancel:true,
-            //     cancel:()=>{
-
-            //     },
-            //     confirm:()=>{
-            //         tapEndFastOperate()
-            //     }
-            // })
-            setMutiEvent('end_fast')
-            setShowMutiPicker(true);
-            return
-        }
-        else if (status == 'ONGOING2') {
-            setMutiEvent('end_fast')
-            setShowMutiPicker(true);
-            // showAlert({
-            //     title: t('feature.heads_up.alert_title'),
-            //     content: t('feature.heads_up.ongoing2_content'),
-            //     cancelText: t('feature.heads_up.ongoing2_cancel'),
-            //     confirmText: t('feature.heads_up.ongoing2_confirm'),
-            //     showCancel: true,
-            //     cancel: () => {
-
-            //     },
-            //     confirm: () => {
-            //         tapEndFastOperate()
-            //     }
-            // })
-            return
-        }
-
-        tapEndFastOperate(e)
-    }
-
-    function tapEndFastOperate(e) {
-        operateType = 'endFast'
-        global.pauseIndexTimer = true
-        // global.set_time = e ? new Date().getTime() : logEventTimestamp
-        global.set_time = new Date().getTime()
-
-        var real_start_time = props.record.current_record.fast.real_start_time
-        var last_check_time = props.record.current_record.last_real_check_time
-        // var now = e ? new Date().getTime() : logEventTimestamp
-        var now = new Date().getTime()
-        if (now - real_start_time >= dayMilliSeconds) {
-            //严重超时
-            isTimeout = true
-            defaultTimestamp = now
-            min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
-            max = defaultTimestamp
-        }
-        else {
-            isTimeout = false
-            defaultTimestamp = now
-            min = Math.max(last_check_time, defaultTimestamp - 6 * dayMilliSeconds)
-            max = defaultTimestamp
-        }
-
-        setShowTimePicker(true)
-    }
-
-    function layoutContent() {
-        var limit = global.set_time - 7 * 3600 * 1000 * 24;
-        global.limit = limit
-
-        if (currentRecord.last_real_check_time) {
-            limit = currentRecord.last_real_check_time
-            global.limit = limit
-            //当set_time秒数<=latest_record_time秒数时,最小限制时间戳需+1分钟
-            if (new Date(global.set_time).getSeconds() <= new Date(currentRecord.last_real_check_time).getSeconds() && global.set_time - currentRecord.last_real_check_time > 60000) {
-                limit = limit + 60 * 1000
-            }
-        }
-
-        var title = getTimePickerTitle(currentRecord, t, operateType == 'endFast')
-        var color = getColor(currentRecord, operateType == 'endFast')
-        var duration = 0
-        if (operateType == 'startFast' && currentRecord.fast) {
-            duration = currentRecord.fast.target_end_time - currentRecord.fast.target_start_time
-        }
-        if (operateType == 'startSleep' && currentRecord.sleep) {
-            duration = currentRecord.sleep.target_end_time - currentRecord.sleep.target_start_time
-        }
-
-        var endTimestamp = 0
-        if (operateType == 'endFast') {
-            endTimestamp = currentRecord.fast.target_end_time
-        }
-        else if (operateType == 'endSleep') {
-            endTimestamp = currentRecord.sleep.target_end_time
-        }
-        return <View className="modal_content">
-            <LimitPickers ref={limitPickerRef} limit={limit} limitDay={7}
-                themeColor={color}
-                title={title}
-                showEndTime={true}
-                isFast={operateType == 'startFast' || operateType == 'endFast'}
-                isEnd={operateType == 'endFast' || operateType == 'endSleep'}
-                endTimestamp={endTimestamp}
-                // showEndTime={operateType == 'startFast' || operateType == 'startSleep'}
-                duration={duration}
-                onCancel={hidePicker} onChange={(e) => {
-                    pickerConfirm(e, null)
-                    global.pauseIndexTimer = false
-                    // hidePicker()
-                }} />
-        </View>
-    }
-
-    function timePickerContent() {
-        var title = getTimePickerTitle(currentRecord, t, operateType == 'endFast')
-        var color = getColor(currentRecord, operateType == 'endFast')
-        // var limit = props.record.current_record.last_real_check_time
-        // var targetTime = props.record.current_record.fast.target_end_time
-        // if (props.record.current_record.status == 'ONGOING3') {
-        //     limit = 0
-        //     targetTime = props.record.current_record.sleep.real_end_time + 60 * 1000
-        // }
-        var endTimestamp = 0
-        if (operateType == 'endFast') {
-            endTimestamp = currentRecord.fast.target_end_time
-        }
-        else if (operateType == 'endSleep') {
-            endTimestamp = currentRecord.sleep.target_end_time
-        }
-
-        var duration = 0
-        if (operateType == 'startFast' && currentRecord.fast) {
-            duration = currentRecord.fast.target_end_time - currentRecord.fast.target_start_time
-        }
-        if (operateType == 'startSleep' && currentRecord.sleep) {
-            duration = currentRecord.sleep.target_end_time - currentRecord.sleep.target_start_time
-        }
-
-        return <View className="modal_content">
-            <ConsolePicker ref={limitPickerRef}
-                themeColor={color}
-                title={title}
-                onCancel={hidePicker}
-                min={min}
-                max={max}
-                current={defaultTimestamp}
-                duration={duration}
-                endTimestamp={endTimestamp}
-                isFast={operateType == 'startFast' || operateType == 'endFast'}
-                isEnd={operateType == 'endFast' || operateType == 'endSleep'}
-                isTimeout={isTimeout}
-                isLoading={btnDisable}
-                onChange={(e) => {
-                    pickerConfirm(e, null)
-                    global.pauseIndexTimer = false
-                }}
-            />
-            {/* <LimitTimeoutPickers ref={limitPickerRef} limit={limit} limitDay={7}
-                themeColor={color}
-                title={title}
-                isFast={operateType == 'endFast'}
-                endTimestamp={endTimestamp}
-                time={operateType == 'endFast' ? new Date(targetTime).getTime() :
-                    new Date(props.record.current_record.sleep.target_end_time).getTime()
-                }
-                onCancel={hidePicker} onChange={(e) => {
-                    pickerConfirm(e)
-                    global.pauseIndexTimer = false
-                }} /> */}
-
-        </View>
-    }
-
-    function showPicker() {
-        // global.scenario = 'FAST_SLEEP'
-        if (global.testInfotimer) {
-            return
-        }
-        global.pauseIndexTimer = true
-        global.set_time = new Date().getTime()
-        updateNodeInfo()
-        if (!global.isDebug) {
-            return
-        }
-        // global.testInfotimer = setInterval(() => {
-        // updateNodeInfo()
-
-        // }, 1000)
-
-    }
-
-    function updateNodeInfo() {
-        var node = layoutContent()
-        global.showIndexModal(true, node, null);
-    }
-
-    function hidePicker() {
-        var node = layoutContent()
-        global.showIndexModal(false, node, null);
-        setShowTimePicker(false)
-        setBtnDisable(false)
-        global.pauseIndexTimer = false
-    }
-
-
-    function followWxPub() {
-        const resource = common.resources.filter((item: any) => {
-            return item.code == 'follow_wx_pub'
-        })
-
-        jumpPage('/pages/common/H5?title=fast16cc 关注服务号&url=' + resource[0].url)
-    }
-
-    function pickerConfirm(t1: number, event: any) {
-        if (btnDisable) {
-            return
-        }
-        setBtnDisable(true)
-        // hidePicker()
-        var date = new Date(t1)
-        var setDate = new Date(global.set_time);
-        date.setMilliseconds(setDate.getMilliseconds());
-        date.setSeconds(setDate.getSeconds());
-
-        t1 = date.getTime();
-
-
-
-        switch (operateType) {
-            case 'startFast':
-                startFast(t1, fastDuration, event ? event : logEvent).then(res => {
-                    global.indexPageRefresh()
-                    setFirstEnter(false)
-                    hidePicker()
-                    setBtnDisable(false)
-                    refreshDayNight()
-
-                    if (process.env.TARO_ENV == 'weapp') {
-                        if (permission.wxPubFollow) {
-                            // showAlert({
-                            //     title: t('feature.track_time_duration.reminders.fast_end_title'),
-                            //     content:
-                            //         t('feature.track_time_duration.reminders.enable_post_fast_content',
-                            //             { date: TimeFormatter.dateDescription(t1 + fastDuration, true), time: TimeFormatter.timeDescription(t1 + fastDuration) }
-                            //         ),
-                            //     showCancel: false,
-                            //     confirmText: t('feature.track_time_duration.reminders.ok')
-                            // })
-                        }
-                        else {
-                            showAlert({
-                                title: t('feature.track_time_duration.reminders.fast_end_title'),
-                                content: t('feature.track_time_duration.reminders.post_fast_content',
-                                    { date: TimeFormatter.dateDescription(t1 + fastDuration, true), time: TimeFormatter.timeDescription(t1 + fastDuration) }
-                                ),
-                                showCancel: true,
-                                cancelText: t('feature.track_time_duration.reminders.later'),
-                                confirmText: t('feature.track_time_duration.reminders.open'),
-                                confirm: () => { followWxPub() }
-                            })
-                        }
-                    }
-                    else {
-                        PushNotification.checkPermissions((res) => {
-                            //允许授权
-                            if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)) {
-                                getLocalPush()
-                                // showAlert({
-                                //     title: t('feature.track_time_duration.reminders.fast_end_title'),
-                                //     content:
-                                //         t('feature.track_time_duration.reminders.enable_post_fast_content',
-                                //             { date: TimeFormatter.dateDescription(t1 + fastDuration, true), time: TimeFormatter.timeDescription(t1 + fastDuration) }
-                                //         ),
-                                //     showCancel: false,
-                                //     confirmText: t('feature.track_time_duration.reminders.ok')
-                                // })
-                            }
-                            else {
-                                showAlert({
-                                    title: t('feature.track_time_duration.reminders.fast_end_title'),
-                                    content: t('feature.track_time_duration.reminders.post_fast_content',
-                                        { date: TimeFormatter.dateDescription(t1 + fastDuration, true), time: TimeFormatter.timeDescription(t1 + fastDuration) }
-                                    ),
-                                    showCancel: true,
-                                    cancelText: t('feature.track_time_duration.reminders.later'),
-                                    confirmText: t('feature.track_time_duration.reminders.open'),
-                                    confirm: () => {
-                                        // Linking.openURL('app-settings:notifications')
-                                        checkNotification()
-                                    }
-                                })
-                            }
-                        })
-
-                    }
-
-
-                }).catch(e => {
-                    setBtnDisable(false)
-                })
-                break
-            case 'startSleep':
-                startSleep(t1, sleepDuration, event ? event : logEvent).then(res => {
-                    global.indexPageRefresh()
-                    setFirstEnter(false)
-                    hidePicker()
-                    setBtnDisable(false)
-                    refreshDayNight()
-                    if (process.env.TARO_ENV == 'weapp') {
-                        if (permission.wxPubFollow) {
-                            // showAlert({
-                            //     title: t('feature.track_time_duration.reminders.wake_title'),
-                            //     content:
-                            //         t('feature.track_time_duration.reminders.enable_post_sleep_content',
-                            //             { date: TimeFormatter.dateDescription(t1 + sleepDuration, true), time: TimeFormatter.timeDescription(t1 + sleepDuration) }),
-                            //     showCancel: false,
-                            //     confirmText: t('feature.track_time_duration.reminders.ok')
-                            // })
-                        }
-                        else {
-
-                            showAlert({
-                                title: t('feature.track_time_duration.reminders.wake_title'),
-                                content: t('feature.track_time_duration.reminders.post_sleep_content',
-                                    { date: TimeFormatter.dateDescription(t1 + sleepDuration, true), time: TimeFormatter.timeDescription(t1 + sleepDuration) }),
-                                cancelText: t('feature.track_time_duration.reminders.later'),
-                                confirmText: t('feature.track_time_duration.reminders.open'),
-                                showCancel: true,
-                                confirm: () => { followWxPub() }
-
-                            })
-                        }
-                    }
-                    else {
-                        PushNotification.checkPermissions((res) => {
-                            //允许授权
-                            if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)) {
-                                getLocalPush()
-                                // showAlert({
-                                //     title: t('feature.track_time_duration.reminders.wake_title'),
-                                //     content:
-                                //         t('feature.track_time_duration.reminders.enable_post_sleep_content',
-                                //             { date: TimeFormatter.dateDescription(t1 + sleepDuration, true), time: TimeFormatter.timeDescription(t1 + sleepDuration) }),
-                                //     showCancel: false,
-                                //     confirmText: t('feature.track_time_duration.reminders.ok')
-                                // })
-                            }
-                            else {
-                                showAlert({
-                                    title: t('feature.track_time_duration.reminders.wake_title'),
-                                    content: t('feature.track_time_duration.reminders.post_sleep_content',
-                                        { date: TimeFormatter.dateDescription(t1 + sleepDuration, true), time: TimeFormatter.timeDescription(t1 + sleepDuration) }),
-                                    cancelText: t('feature.track_time_duration.reminders.later'),
-                                    confirmText: t('feature.track_time_duration.reminders.open'),
-                                    showCancel: true,
-                                    confirm: () => {
-                                        checkNotification()
-                                        // Linking.openURL('app-settings:notifications')
-                                    }
-                                })
-                            }
-                        })
-
-
-
-
-
-
-                    }
-
-                }).catch((e) => {
-                    setBtnDisable(false)
-                    var picker = limitPickerRef.current;
-                    (picker as any).resetPickerData()
-                })
-                break
-            case 'endSleep':
-                endSleep(t1, event ? event : logEvent).then(res => {
-                    getLocalPush()
-                    setBtnDisable(false)
-                    global.indexPageRefresh()
-                    setFirstEnter(false)
-                    hidePicker()
-                    global.refrehWeekly()
-                    global.refreshStreaks()
-                    refreshDayNight()
-                    if (props.record.current_record.scenario == 'SLEEP') {
-                        global.scrollToLatest()
-
-                    }
-                }).catch((e) => {
-
-                    setBtnDisable(false)
-                    var picker = limitPickerRef.current;
-                    (picker as any).resetPickerData()
-
-
-                })
-                break
-            case 'endFast':
-                endFast(t1, event ? event : logEvent).then(res => {
-                    getLocalPush()
-                    setBtnDisable(false)
-                    global.indexPageRefresh()
-                    setFirstEnter(false)
-                    hidePicker()
-                    global.scrollToLatest()
-                    refreshDayNight()
-                    global.checkAccess((res as any).access)
-                    // checkAccessProvisional((res as any).access,showFastAlert)
-                }).catch((e) => {
-
-                    setBtnDisable(false)
-                    var picker = limitPickerRef.current;
-                    (picker as any).resetPickerData()
-
-
-                })
-                break
-        }
-    }
-
-    function refreshDayNight() {
-        if (global.refreshNight) {
-            global.refreshNight()
-        }
-        if (global.refreshDay) {
-            global.refreshDay()
-        }
-    }
-
-    function expandBtnText() {
-        if (status == 'WAIT_FOR_START') {
-            return t('feature.track_time_duration.console.next_steps')
-        }
-        else if (firstEnter) {
-            return t('feature.track_time_duration.console.show_more')
-        }
-        return t('feature.track_time_duration.console.next_steps')
-    }
-
-    function modalContent() {
-        global.set_time = new Date().getTime()
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                hidePicker()
-                // setShowTimeoutPicker(false)
-            }}
-            confirm={() => { }}>
-            {
-                timePickerContent()
-            }
-        </Modal>
-    }
-
-    function mutiContent() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowMutiPicker(false)
-            }}
-            confirm={() => { }}>
-            {
-                mutiPickerContent()
-            }
-        </Modal>
-    }
-
-    function mutiPickerContent() {
-        global.set_time = new Date().getTime()
-        return <IndexConsoleMuti status={status} event={mutiEvent} scenario={props.record.scenario.name} close={() => setShowMutiPicker(false)} />
-    }
-
-    function single() {
-        if (props.record.scenario.name == 'FAST') {
-            return <View style={{ marginTop: rpxToPx(0) }}>
-                {
-                    status == 'WAIT_FOR_START' &&
-                    <View onClick={tapStartFast} className='console_btn'>
-                        <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.start_fast')}</Text>
-                    </View>
-                }
-                {/* {
-                    status != 'WAIT_FOR_START' && <View className='btn_line' />
-                } */}
-                {
-                    status == 'ONGOING' && <View onClick={tapEndFast} className={status == 'ONGOING' ? 'console_btn' : 'console_btn'} style={{ backgroundColor: status == 'ONGOING' ? ColorType.fast : ColorType.fast + '66' }}>
-                        <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.end_fast')}</Text>
-                    </View>
-                }
-                {
-                    status == 'WAIT_FOR_START' && <View>
-                        {
-                            !expand && <Text className='expand' onClick={() => { setExpand(true) }}>{expandBtnText()}</Text>
-                        }
-                    </View>
-                }
-                {status == 'WAIT_FOR_START' && expand && <View className='btn_line' />}
-                {
-                    status == 'WAIT_FOR_START' && expand && <View onClick={tapEndFast} className={status == 'ONGOING3' ? 'console_btn' : 'console_btn'} style={{ backgroundColor: status == 'ONGOING3' ? ColorType.fast : ColorType.fast + '66' }}>
-                        <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.end_fast')}</Text>
-                    </View>
-                }
-                {
-                    showTimePicker && modalContent()
-                }
-                {
-                    showMutiPicker && mutiContent()
-                }
-            </View>
-        }
-        else if (props.record.scenario.name == 'SLEEP') {
-            return <View style={{ marginTop: rpxToPx(0) }}>
-                {
-                    status == 'WAIT_FOR_START' &&
-                    <View onClick={tapStartSleep} className='console_btn btn_sleep'>
-                        <Text style={{ fontWeight: 'bold' }}>{t('feature.track_time_duration.common.start_sleep')}</Text>
-                    </View>
-                }
-                {/* {
-                    status != 'WAIT_FOR_START' && <View className='btn_line' />
-                } */}
-                {
-                    status == 'ONGOING' && <View onClick={tapEndSleep} className='console_btn btn_sleep' style={{ backgroundColor: status == 'ONGOING' ? ColorType.sleep : ColorType.sleep + '66' }}>
-                        <Text style={{ fontWeight: 'bold' }}>{t('feature.track_time_duration.common.end_sleep')}</Text>
-                    </View>
-                }
-
-                {
-                    showTimePicker && modalContent()
-                }
-
-            </View>
-        }
-    }
-
-    function mixed() {
-        return <View style={{ marginTop: rpxToPx(0) }}>
-
-            {
-                status == 'WAIT_FOR_START' ?
-                    <View onClick={tapStartFast} className='console_btn'>
-                        <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.start_fast')}</Text>
-                    </View> :
-                    <View onClick={() => { tapStage(0) }} className='stage_btn'>
-                        <Text style={{ flex: 1, color: '#fff' }}>{t('feature.track_time_duration.stage.a')}</Text>
-                        {
-                            status == 'ONGOING1' ?
-                                <Text style={{ color: '#fff' }}>{TimeFormatter.countdown(currentRecord.fast.real_start_time)}</Text> :
-                                <Text style={{ color: '#fff' }}>{TimeFormatter.calculateTimeDifference(currentRecord.fast.real_start_time, currentRecord.sleep.real_start_time)}</Text>
-                        }
-
-                    </View>
-            }
-            <View className='btn_line' />
-            {
-                status == 'ONGOING1' && <View onClick={tapStartSleep} className='console_btn btn_sleep'>
-                    <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.start_sleep')}</Text>
-                </View>
-            }
-            {
-                status == 'WAIT_FOR_START' && <View onClick={tapStartSleep} className='console_btn btn_sleep' style={{ backgroundColor: ColorType.sleep + '66' }}>
-                    <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.start_sleep')}</Text>
-                </View>
-            }
-            {
-                (status != 'WAIT_FOR_START' && status != 'ONGOING1') &&
-                <View onClick={() => { tapStage(1) }} className='stage_btn'>
-                    <Text style={{ flex: 1, color: '#fff' }}>{t('feature.track_time_duration.stage.b')}</Text>
-                    {
-                        status == 'ONGOING2' ? <Text style={{ color: '#fff' }}>{TimeFormatter.countdown(currentRecord.sleep.real_start_time)}</Text> :
-                            <Text style={{ color: '#fff' }}>{TimeFormatter.calculateTimeDifference(currentRecord.sleep.real_start_time, currentRecord.sleep.real_end_time)}</Text>
-                    }
-
-
-                </View>
-            }
-            {(expand || (status != 'WAIT_FOR_START' && status != 'ONGOING1')) && <View className='btn_line' />}
-            {
-                (expand || (status != 'WAIT_FOR_START' && status != 'ONGOING1')) && (status == 'WAIT_FOR_START' || status == 'ONGOING1' || status == 'ONGOING2') &&
-                <View onClick={tapEndSleep} className='console_btn btn_sleep' style={{ backgroundColor: status == 'ONGOING2' ? ColorType.sleep : ColorType.sleep + '66' }}>
-                    <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.end_sleep')}</Text>
-                </View>
-            }
-            {
-                status == 'ONGOING3' &&
-                <View onClick={() => { tapStage(2) }} className='stage_btn'>
-                    <Text style={{ flex: 1, color: '#fff' }}>{t('feature.track_time_duration.stage.c')}</Text>
-                    <Text style={{ color: '#fff' }}>{TimeFormatter.countdown(currentRecord.sleep.real_end_time)}</Text>
-                </View>
-            }
-            {(expand || status == 'ONGOING3' || status == 'ONGOING') && <View className='btn_line' />}
-            {
-                (expand || status == 'ONGOING3' || status == 'ONGOING') &&
-                <View onClick={tapEndFast} className='console_btn' style={{ backgroundColor: status == 'ONGOING3' ? ColorType.fast : ColorType.fast + '66' }}>
-                    <Text style={{ fontWeight: 'bold', fontSize: rpxToPx(32), color: ColorType.black }}>{t('feature.track_time_duration.common.end_fast')}</Text>
-                </View>
-            }
-            {
-                (status == 'WAIT_FOR_START' || status == 'ONGOING1' || status == 'ONGOING2') &&
-                <View>
-                    {
-                        !expand && <Text className='expand' onClick={() => { setExpand(true) }}>{expandBtnText()}</Text>
-                    }
-                </View>
-            }
-            {
-                showTimePicker && modalContent()
-            }
-            {
-                showStageModal && stageContent()
-            }
-            {
-                showMutiPicker && mutiContent()
-            }
-
-
-        </View>
-    }
-
-    function stageContent() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                global.pauseIndexTimer = false
-                setShowStageModal(false)
-            }}
-            confirm={() => { }}>
-            {
-                <CircadianDetailPopup
-                    record={currentRecord}
-                    schedule={props.record.scenario.schedule}
-                    stageIndex={stageIndex}
-                    onlyStage={true}
-                    onClose={() => { setShowStageModal(false); }} />
-            }
-        </Modal>
-
-    }
-
-    function tapStage(index) {
-        stageIndex = index
-        setShowStageModal(true)
-    }
-
-    return <View>
-        {
-            props.record.scenario.name == 'FAST_SLEEP' ? mixed() : single()
-        }
-        <CheckAccess record={props.record} count={props.count} access={props.access} />
-    </View>
-
-}

+ 0 - 27
src/features/trackTimeDuration/components/IndexConsoleMuti.scss

@@ -1,27 +0,0 @@
-.new_item_cell{
-    height: 96px;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    margin-left: 40px;
-    margin-right: 40px;
-}
-
-.new_item_cell_title{
-    font-size: 28px;
-    color: #fff;
-}
-
-.new_item_cell_desc{
-    font-size: 28px;
-    color: #fff;
-    opacity: 0.4;
-}
-
-.new_item_cell_line{
-    height: 2px;
-    background-color: #fff;
-    opacity: 0.2;
-    margin-left: 40px;
-    transform: scaleY(0.5);
-}

+ 0 - 540
src/features/trackTimeDuration/components/IndexConsoleMuti.tsx

@@ -1,540 +0,0 @@
-import { View, Text, Image, PickerView, PickerViewColumn } from "@tarojs/components";
-import { useTranslation } from "react-i18next";
-import { AtActivityIndicator } from "taro-ui";
-import { alphaToHex, rpxToPx } from "@/utils/tools";
-import { ColorType } from "@/context/themes/color";
-import "@/components/layout/Modal.scss";
-import './IndexConsoleMuti.scss';
-import { useRef, useState } from "react";
-import { batchClocks, endFast, getLocalPush } from "../actions/TrackTimeActions";
-import dayjs from "dayjs";
-import Modal from "@/components/layout/Modal.weapp";
-import ConsolePicker from "./ConsolePicker";
-import Taro from "@tarojs/taro";
-import { TimeFormatter } from "@/utils/time_format";
-
-let min = 0
-let max = 0
-let defaultTimestamp = 0
-export default function IndexConsoleMuti(props: { status: string, event: string, close: Function, scenario: string }) {
-    const { t } = useTranslation();
-    const isLoading = false;
-    var color = ColorType.fast;
-    var alpha = alphaToHex(0.4)
-    const [fastStart, setFastStart] = useState<any>(null)
-    const [fastEnd, setFastEnd] = useState<any>(null)
-    const [sleepStart, setSleepStart] = useState<any>(null)
-    const [sleepEnd, setSleepEnd] = useState<any>(null)
-    const [showPicker, setShowPicker] = useState(false)
-    const [operateType, setOperateType] = useState('startFast')
-    const [commitLoading, setCommitLoading] = useState(false)
-    const pickerRef = useRef(null)
-
-
-    function cancel() {
-        props.close()
-    }
-
-    function confirm() {
-        if (commitLoading) {
-            return;
-        }
-        var fast: any = {}
-        var sleep: any = {}
-        switch (props.event) {
-            case 'start_sleep':
-                if (!fastStart) {
-                    Taro.showToast({
-                        icon: 'none',
-                        title: '请选择开始断食时间'
-                    })
-                    return
-                }
-                if (!sleepStart) {
-                    Taro.showToast({
-                        icon: 'none',
-                        title: '请选择就寝时间'
-                    })
-                    return
-                }
-                // fast.real_start_set_time = fastStart.set_time
-                // fast.real_start_confirm_time = fastStart.confirm_time
-                // fast.real_start_time = fastStart.time
-                // fast.real_start_date = fastStart.date
-                // sleep.real_start_set_time = sleepStart.set_time
-                // sleep.real_start_confirm_time = sleepStart.confirm_time
-                // sleep.real_start_time = sleepStart.time
-                // sleep.real_start_date = sleepStart.date
-
-                fast.real_start = {
-                    time: fastStart.time,
-                    date: fastStart.date,
-                    extra: {
-                        set_time: fastStart.set_time,
-                        confirm_time: fastStart.confirm_time
-                    }
-                }
-                sleep.real_start = {
-                    time: sleepStart.time,
-                    date: sleepStart.date,
-                    extra: {
-                        set_time: sleepStart.set_time,
-                        confirm_time: sleepStart.confirm_time
-                    }
-                }
-                break;
-            case 'end_sleep':
-                if (props.status == 'WAIT_FOR_START') {
-                    if (!fastStart) {
-                        Taro.showToast({
-                            icon: 'none',
-                            title: '请选择开始断食时间'
-                        })
-                        return
-                    }
-                    // fast.real_start_set_time = fastStart.set_time
-                    // fast.real_start_confirm_time = fastStart.confirm_time
-                    // fast.real_start_time = fastStart.time
-                    // fast.real_start_date = fastStart.date
-
-                    fast.real_start = {
-                        time: fastStart.time,
-                        date: fastStart.date,
-                        extra: {
-                            set_time: fastStart.set_time,
-                            confirm_time: fastStart.confirm_time
-                        }
-                    }
-                }
-                if (!sleepStart) {
-                    Taro.showToast({
-                        icon: 'none',
-                        title: '请选择就寝时间'
-                    })
-                    return
-                }
-                if (!sleepEnd) {
-                    Taro.showToast({
-                        icon: 'none',
-                        title: '请选择起床时间'
-                    })
-                    return
-                }
-                // sleep.real_start_set_time = sleepStart.set_time
-                // sleep.real_start_confirm_time = sleepStart.confirm_time
-                // sleep.real_start_time = sleepStart.time
-                // sleep.real_start_date = sleepStart.date
-                // sleep.real_end_set_time = sleepEnd.set_time
-                // sleep.real_end_confirm_time = sleepEnd.confirm_time
-                // sleep.real_end_time = sleepEnd.time
-                // sleep.real_end_date = sleepEnd.date
-
-                sleep.real_start = {
-                    time: sleepStart.time,
-                    date: sleepStart.date,
-                    extra: {
-                        set_time: sleepStart.set_time,
-                        confirm_time: sleepStart.confirm_time
-                    }
-                }
-
-                sleep.real_end = {
-                    time: sleepEnd.time,
-                    date: sleepEnd.date,
-                    extra: {
-                        set_time: sleepEnd.set_time,
-                        confirm_time: sleepEnd.confirm_time
-                    }
-                }
-                break;
-            case 'end_fast':
-                if (props.status == 'WAIT_FOR_START') {
-                    if (!fastStart) {
-                        Taro.showToast({
-                            icon: 'none',
-                            title: '请选择开始断食时间'
-                        })
-                        return
-                    }
-                    if (!sleepStart && props.scenario == 'FAST_SLEEP') {
-                        Taro.showToast({
-                            icon: 'none',
-                            title: '请选择就寝时间'
-                        })
-                        return
-                    }
-                    // fast.real_start_set_time = fastStart.set_time
-                    // fast.real_start_confirm_time = fastStart.confirm_time
-                    // fast.real_start_time = fastStart.time
-                    // fast.real_start_date = fastStart.date
-
-                    fast.real_start = {
-                        time: fastStart.time,
-                        date: fastStart.date,
-                        extra: {
-                            set_time: fastStart.set_time,
-                            confirm_time: fastStart.confirm_time
-                        }
-                    }
-
-                    if (props.scenario == 'FAST_SLEEP') {
-                        // sleep.real_start_set_time = sleepStart.set_time
-                        // sleep.real_start_confirm_time = sleepStart.confirm_time
-                        // sleep.real_start_time = sleepStart.time
-                        // sleep.real_start_date = sleepStart.date
-                        sleep.real_start = {
-                            time: sleepStart.time,
-                            date: sleepStart.date,
-                            extra: {
-                                set_time: sleepStart.set_time,
-                                confirm_time: sleepStart.confirm_time
-                            }
-                        }
-                    }
-
-
-                }
-                else if (props.status == 'ONGOING1') {
-                    if (!sleepStart) {
-                        Taro.showToast({
-                            icon: 'none',
-                            title: '请选择就寝时间'
-                        })
-                        return
-                    }
-                    // sleep.real_start_set_time = sleepStart.set_time
-                    // sleep.real_start_confirm_time = sleepStart.confirm_time
-                    // sleep.real_start_time = sleepStart.time
-                    // sleep.real_start_date = sleepStart.date
-                    sleep.real_start = {
-                        time: sleepStart.time,
-                        date: sleepStart.date,
-                        extra: {
-                            set_time: sleepStart.set_time,
-                            confirm_time: sleepStart.confirm_time
-                        }
-                    }
-                }
-                if (!sleepEnd && props.scenario == 'FAST_SLEEP') {
-                    Taro.showToast({
-                        icon: 'none',
-                        title: '请选择起床时间'
-                    })
-                    return
-                }
-                if (!fastEnd) {
-                    Taro.showToast({
-                        icon: 'none',
-                        title: '请选择结束断食时间'
-                    })
-                    return
-                }
-
-                if (props.scenario == 'FAST_SLEEP') {
-                    // sleep.real_end_set_time = sleepEnd.set_time
-                    // sleep.real_end_confirm_time = sleepEnd.confirm_time
-                    // sleep.real_end_time = sleepEnd.time
-                    // sleep.real_end_date = sleepEnd.date
-                    sleep.real_end = {
-                        time: sleepEnd.time,
-                        date: sleepEnd.date,
-                        extra: {
-                            set_time: sleepEnd.set_time,
-                            confirm_time: sleepEnd.confirm_time
-                        }
-                    }
-                }
-                // fast.real_end_set_time = fastEnd.set_time
-                // fast.real_end_confirm_time = fastEnd.confirm_time
-                // fast.real_end_time = fastEnd.time
-                // fast.real_end_date = fastEnd.date
-                fast.real_end = {
-                    time: fastEnd.time,
-                    date: fastEnd.date,
-                    extra: {
-                        set_time: fastEnd.set_time,
-                        confirm_time: fastEnd.confirm_time
-                    }
-                }
-                break;
-        }
-
-        setCommitLoading(true)
-        var params: any = {
-        }
-        if (props.scenario == 'FAST_SLEEP') {
-            params = {
-                fast,
-                sleep
-            }
-        }
-        else {
-            params = {
-                fast
-            }
-        }
-        params.showAlert = true
-        batchClocks(params).then(res => {
-            setCommitLoading(false)
-            getLocalPush()
-            global.indexPageRefresh()
-            if ((res as any).current_record.status == "WAIT_FOR_START") {
-                global.scrollToLatest()
-                global.swiperDayNightRefresh()
-                if (global.refreshNight) {
-                    global.refreshNight()
-                }
-                if (global.refreshDay) {
-                    global.refreshDay()
-                }
-            }
-
-            global.refrehWeekly()
-            global.refreshStreaks()
-            if (props.event == 'end_fast')
-                global.checkAccess((res as any).access)
-
-            cancel()
-        }).catch(e => {
-            setCommitLoading(false)
-        })
-    }
-
-    function tapItem(index: number) {
-        setShowPicker(true);
-        switch (index) {
-            case 0:
-                setOperateType('startFast')
-                break;
-            case 1:
-                setOperateType('startSleep')
-                break;
-            case 2:
-                setOperateType('endSleep')
-                break;
-            case 3:
-                setOperateType('endFast')
-                break;
-        }
-    }
-
-    function startFastCell() {
-        return <View className="new_item_cell" onClick={() => tapItem(0)}>
-            <Text className="new_item_cell_title">{t('feature.track_time_duration.common.start_fast')}</Text>
-            <View style={{ flex: 1 }} />
-            <Text className="new_item_cell_desc">{fastStart ? TimeFormatter.dateTimeFormate(fastStart.time, true) : t('feature.track_time_duration.log_timing.pick_time')}</Text>
-            <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />
-        </View>
-    }
-
-    function startSleepCell() {
-        return <View className="new_item_cell" onClick={() => tapItem(1)}>
-            <Text className="new_item_cell_title">{t('feature.track_time_duration.common.start_sleep')}</Text>
-            <View style={{ flex: 1 }} />
-            <Text className="new_item_cell_desc">{sleepStart ? TimeFormatter.dateTimeFormate(sleepStart.time, true) : t('feature.track_time_duration.log_timing.pick_time')}</Text>
-            <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />
-        </View>
-    }
-
-    function endSleepCell() {
-        return <View className="new_item_cell" onClick={() => tapItem(2)}>
-            <Text className="new_item_cell_title">{t('feature.track_time_duration.common.end_sleep')}</Text>
-            <View style={{ flex: 1 }} />
-            <Text className="new_item_cell_desc">{sleepEnd ? TimeFormatter.dateTimeFormate(sleepEnd.time, true) : t('feature.track_time_duration.log_timing.pick_time')}</Text>
-            <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />
-        </View>
-    }
-
-    function endFastCell() {
-        return <View className="new_item_cell" onClick={() => tapItem(3)}>
-            <Text className="new_item_cell_title">{t('feature.track_time_duration.common.end_fast')}</Text>
-            <View style={{ flex: 1 }} />
-            <Text className="new_item_cell_desc">{fastEnd ? TimeFormatter.dateTimeFormate(fastEnd.time, true) : t('feature.track_time_duration.log_timing.pick_time')}</Text>
-            <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />
-        </View>
-    }
-
-    function modalContent() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowPicker(false)
-            }}
-            confirm={() => { }}>
-            {
-                timePickerContent()
-            }
-        </Modal>
-    }
-
-    function timePickerContent() {
-        defaultTimestamp = new Date().getTime()
-        min = defaultTimestamp - 1 * 24 * 3600 * 1000
-        max = defaultTimestamp
-        global.pauseIndexTimer = true
-        var title = t('feature.track_time_duration.console.real_fast_start_dt')
-        if (operateType == 'endFast') {
-            title = t('feature.track_time_duration.console.real_fast_end_dt')
-        }
-        else if (operateType == 'startSleep') {
-            title = t('feature.track_time_duration.console.real_sleep_start_dt')
-        }
-        else if (operateType == 'endSleep') {
-            title = t('feature.track_time_duration.console.real_sleep_end_dt')
-        }
-
-        var color = operateType == 'startFast' || operateType == 'endFast' ? ColorType.fast : ColorType.sleep
-        var endTimestamp = min
-
-
-        var duration = 20000
-
-        return <View className="modal_content">
-
-            <ConsolePicker ref={pickerRef}
-                themeColor={color}
-                title={title}
-                onCancel={() => {
-                    setShowPicker(false)
-                    global.pauseIndexTimer = false
-                }}
-                min={min}
-                max={max}
-                current={defaultTimestamp}
-                duration={duration}
-                endTimestamp={endTimestamp}
-                isFast={operateType == 'startFast' || operateType == 'endFast'}
-                isEnd={operateType == 'endFast' || operateType == 'endSleep'}
-                isTimeout={false}
-                isLoading={false}
-                hidenEndTime={true}
-                onChange={(e) => {
-                    setShowPicker(false)
-                    global.pauseIndexTimer = false
-                    if (operateType == 'startFast') {
-                        setFastStart({
-                            set_time: defaultTimestamp,
-                            confirm_time: new Date().getTime(),
-                            time: e,
-                            date: dayjs(e).format('YYYYMMDD')
-                        })
-                    }
-                    else if (operateType == 'endFast') {
-                        setFastEnd({
-                            set_time: defaultTimestamp,
-                            confirm_time: new Date().getTime(),
-                            time: e,
-                            date: dayjs(e).format('YYYYMMDD')
-                        })
-                    }
-                    else if (operateType == 'startSleep') {
-                        setSleepStart({
-                            set_time: defaultTimestamp,
-                            confirm_time: new Date().getTime(),
-                            time: e,
-                            date: dayjs(e).format('YYYYMMDD')
-                        })
-                    }
-                    else {
-                        setSleepEnd({
-                            set_time: defaultTimestamp,
-                            confirm_time: new Date().getTime(),
-                            time: e,
-                            date: dayjs(e).format('YYYYMMDD')
-                        })
-                    }
-                }}
-            />
-
-        </View>
-    }
-
-    return <View className="modal_content">
-        <View style={{
-            marginLeft: rpxToPx(46),
-            height: rpxToPx(120), display: 'flex',
-            flexDirection: 'row', alignItems: 'center',
-            marginTop: rpxToPx(36),
-            marginBottom: rpxToPx(48)
-        }}>
-            <Text style={{ color: '#fff', fontWeight: 'bold', fontSize: rpxToPx(48) }}>{t('feature.track_time_duration.log_timing.log_timings')}</Text>
-        </View>
-
-        <View style={{
-            display: 'flex',
-            flexDirection: 'column',
-            backgroundColor: '#262626',
-            borderRadius: rpxToPx(24),
-            marginLeft: rpxToPx(46),
-            marginRight: rpxToPx(46),
-            marginBottom: rpxToPx(60)
-
-        }}>
-            {
-                props.event == 'start_sleep' && startFastCell()
-            }
-            {
-                props.event == 'start_sleep' && <View className="new_item_cell_line" />
-            }
-            {
-                props.event == 'start_sleep' && startSleepCell()
-            }
-            {
-                props.event == 'end_sleep' && props.status == 'WAIT_FOR_START' && startFastCell()
-            }
-            {
-                props.event == 'end_sleep' && props.status == 'WAIT_FOR_START' && <View className="new_item_cell_line" />
-            }
-            {
-                props.event == 'end_sleep' && startSleepCell()
-            }
-            {
-                props.event == 'end_sleep' && <View className="new_item_cell_line" />
-            }
-            {
-                props.event == 'end_sleep' && endSleepCell()
-            }
-            {
-                props.event == 'end_fast' && props.status == 'WAIT_FOR_START' && startFastCell()
-            }
-            {
-                props.event == 'end_fast' && props.status == 'WAIT_FOR_START' && <View className="new_item_cell_line" />
-            }
-            {
-                props.event == 'end_fast' && props.scenario == 'FAST_SLEEP' && (props.status == 'ONGOING1' || props.status == 'WAIT_FOR_START') && startSleepCell()
-            }
-            {
-                props.event == 'end_fast' && props.scenario == 'FAST_SLEEP' && (props.status == 'ONGOING1' || props.status == 'WAIT_FOR_START') && <View className="new_item_cell_line" />
-            }
-            {
-                props.event == 'end_fast' && props.scenario == 'FAST_SLEEP' && (props.status == 'ONGOING1' || props.status == 'ONGOING2' || props.status == 'WAIT_FOR_START') && endSleepCell()
-            }
-            {
-                props.event == 'end_fast' && props.scenario == 'FAST_SLEEP' && (props.status == 'ONGOING1' || props.status == 'ONGOING2' || props.status == 'WAIT_FOR_START') && <View className="new_item_cell_line" />
-            }
-            {
-                props.event == 'end_fast' && endFastCell()
-            }
-        </View>
-
-        <View className='modal_operate'>
-
-            <View className='modal_btn' style={{ backgroundColor: color + alpha }} onClick={cancel}>
-                <Text className='modal_cancel_text' style={{ color: color, fontWeight: 'bold' }}>{t('feature.common.picker_cancel_btn')}</Text>
-            </View>
-            <View className='btn_space' />
-            <View className='modal_btn' style={{ backgroundColor: color, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', opacity: commitLoading ? 0.6 : 1 }} onClick={confirm}>
-                {
-                    commitLoading && <View style={{ display: 'flex', overflow: 'hidden', height: 20, marginRight: 5 }}><AtActivityIndicator mode="center" color="#000" /></View>
-                }
-
-                <Text className='modal_confirm_text' style={{ color: '#000', fontWeight: 'bold' }}>{t('feature.common.picker_confirm_btn')}</Text>
-            </View>
-
-
-        </View>
-        {
-            showPicker && modalContent()
-        }
-    </View>
-}

部分文件因为文件数量过多而无法显示