leon před 1 rokem
rodič
revize
a246e123a6
59 změnil soubory, kde provedl 195 přidání a 8227 odebrání
  1. 2 0
      src/_account/pages/ChooseAuth.tsx
  2. 2 2
      src/_health/components/schedule_item.tsx
  3. 19 65
      src/_health/pages/add_moment.tsx
  4. 23 5
      src/_health/pages/move_schedule.tsx
  5. 25 6
      src/_health/pages/move_setting_reminder.tsx
  6. 36 30
      src/_health/pages/schedules.tsx
  7. 24 7
      src/_health/pages/schedules_edit.tsx
  8. 1 1
      src/app.tsx
  9. 0 1
      src/components/basic/Icons.tsx
  10. 0 1
      src/components/input/Switch2.tsx
  11. 6 1
      src/context/locales/en.js
  12. 6 0
      src/context/locales/zh.js
  13. 0 144
      src/features/food/FoodConsole.scss
  14. 0 326
      src/features/food/FoodConsole.tsx
  15. 0 9
      src/features/food/FoodJournal.scss
  16. 0 237
      src/features/food/FoodJournal.tsx
  17. 0 0
      src/features/food/FoodTimeline.scss
  18. 0 102
      src/features/food/FoodTimeline.tsx
  19. 0 160
      src/features/food/FoodTimelineItem.scss
  20. 0 490
      src/features/food/FoodTimelineItem.tsx
  21. 0 89
      src/features/food/hooks/ExtraData.tsx
  22. 19 13
      src/features/health/MainConsole.tsx
  23. 0 1
      src/features/health/MainDayNightCard.tsx
  24. 0 1
      src/features/health/MainFastEatCard.tsx
  25. 0 0
      src/features/payment/placeholder
  26. 0 0
      src/features/permissions/placeholder
  27. 0 493
      src/features/trackSomething/components/Metric_backup.tsx
  28. 0 201
      src/features/trackSomething/components/MoveOrderList_backup.tsx
  29. 0 274
      src/features/trackTimeDuration/components/ClockHeader.tsx
  30. 0 36
      src/features/trackTimeDuration/components/Discovery.scss
  31. 0 559
      src/features/trackTimeDuration/components/Discovery.tsx
  32. 0 109
      src/features/trackTimeDuration/components/IndexItem.scss
  33. 0 520
      src/features/trackTimeDuration/components/IndexItem.tsx
  34. 0 200
      src/features/trackTimeDuration/components/More.tsx
  35. 0 182
      src/features/trackTimeDuration/components/RecordFastSleep.scss
  36. 0 743
      src/features/trackTimeDuration/components/RecordFastSleep.tsx
  37. 0 84
      src/features/trackTimeDuration/components/Schedule.scss
  38. 0 326
      src/features/trackTimeDuration/components/Schedule.tsx
  39. 0 33
      src/features/trackTimeDuration/components/SegmentPop.tsx
  40. 0 642
      src/features/trackTimeDuration/components/SetSchedule.rn.tsx
  41. 0 96
      src/features/trackTimeDuration/components/SetSchedule.scss
  42. 0 527
      src/features/trackTimeDuration/components/SetSchedule.weapp.tsx
  43. 0 162
      src/features/trackTimeDuration/components/Stage.rn.tsx
  44. 0 101
      src/features/trackTimeDuration/components/Stage.scss
  45. 0 200
      src/features/trackTimeDuration/components/Stage.weapp.tsx
  46. 0 104
      src/features/trackTimeDuration/components/StageSelector.scss
  47. 0 95
      src/features/trackTimeDuration/components/StageSelector.tsx
  48. 0 1
      src/features/trackTimeDuration/components/StreakItem.tsx
  49. 0 34
      src/features/trackTimeDuration/components/TimelineFastSleep.scss
  50. 0 345
      src/features/trackTimeDuration/components/TimelineFastSleep.tsx
  51. 0 166
      src/features/trackTimeDuration/components/TimelineStage.rn.tsx
  52. 0 0
      src/features/trackTimeDuration/components/TimelineStage.scss
  53. 0 84
      src/features/trackTimeDuration/components/TimelineStage.weapp.tsx
  54. 0 0
      src/features/trackTimeDuration/components/TotalTime.scss
  55. 0 198
      src/features/trackTimeDuration/components/TotalTime.tsx
  56. 0 7
      src/features/trackTimeDuration/components/setschedule/ActionPlan.tsx
  57. 0 5
      src/features/trackTimeDuration/components/setschedule/ChooseAction.tsx
  58. 32 7
      src/pages/clock/ClockNew.tsx
  59. 0 2
      src/services/http/request.ts

+ 2 - 0
src/_account/pages/ChooseAuth.tsx

@@ -121,6 +121,8 @@ export default function Page() {
                 Taro.navigateBack({
                     delta: 1
                 })
+            }else {
+                Taro.setStorage({ key: '149alert', data: true })
             }
 
             // if (!(res as any).is_new_user){

+ 2 - 2
src/_health/components/schedule_item.tsx

@@ -250,9 +250,9 @@ export default function ScheduleItem(props: {
                         {
                             props.days && <View className="h30" style={{ color: MainColorType.g02 }}>+{props.days} day</View>
                         }
-                        {/* {
+                        {
                             !props.hideReminderIcon && props.obj.specific_time && !props.obj.reminder && <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
-                        } */}
+                        }
                         <View style={{ width: rpxToPx(12) }} />
                         {
                             !props.disable && props.obj.specific_time && <View className='edit_item_time schedule_border' onClick={() => {

+ 19 - 65
src/_health/pages/add_moment.tsx

@@ -3,10 +3,8 @@ import Taro, { useLoad, useRouter, useUnload } from "@tarojs/taro";
 import { useTranslation } from "react-i18next";
 import './add_moment.scss'
 import { useEffect, useState } from "react";
-import { saveFoodCache } from "@/features/food/hooks/ExtraData";
 import { baseUrl } from "@/services/http/api";
 import { checkAuthorized } from "@/utils/check_authorized";
-import { eatMeals } from "@/services/trackSomething";
 import Modal from "@/components/layout/Modal.weapp";
 import dayjs from "dayjs";
 import TimePicker from "@/features/common/TimePicker";
@@ -142,6 +140,25 @@ export default function AddMoment() {
             mediaType: ['image'],
             sourceType: source,
             success: function (res) {
+
+                Taro.downloadFile({
+                    url:'https://fast-prod.oss-cn-beijing.aliyuncs.com/users/832f82c2bf616063fcf5619063a060c9/food-journal/2024/64efc6fe-5fca-49a3-9828-497e87ad9582_20241216120746_684.jpg',
+                    success(result) {
+                        Taro.getImageInfo({
+                            src:result.tempFilePath,
+                            success(result2) {
+                                console.log(result2)
+                                debugger
+                            },
+                            fail(res) {
+                                console.log(res)
+                                debugger
+                            },
+                        })
+                    },
+                })
+
+                
                 chooseSuccess(res, true)
                 checkAuthorized()
             },
@@ -382,69 +399,6 @@ export default function AddMoment() {
         })
     }
 
-    async function chooseSuccess2(res, isAlbum) {
-        var params = {
-            event: 'add_a_picture',
-            value: isAlbum ? 'choose_from_album_confirm' : 'use_camera_confirm',
-        }
-
-        saveFoodCache('create', params)
-
-        var savedFilePath = process.env.TARO_ENV == 'rn' ? res.tempFiles[0].path : res.tempFiles[0].tempFilePath
-
-        uploadFile(savedFilePath, isAlbum ? 'album' : 'camera')
-
-
-    }
-
-    function uploadFile(path, source) {
-        Taro.showLoading({
-            title: t('health.uploading')
-        })
-        var dot = path.lastIndexOf('.')
-        var fileExt = dot > 0 ? path.substring(dot) : ''
-        Taro.request({
-            method: 'GET',
-            url: `${baseUrl}/api/thirdparty/aliyun/oss-form-upload`,
-            header: {
-                'Authorization': 'bearer ' + global.token
-            },
-            data: {
-                type: 'FOOD_JOURNAL',
-                file_ext: fileExt
-            },
-            success: (rsp) => {
-                if (rsp.statusCode != 200) {
-                    Taro.showToast({
-                        title: global.language == 'en' ? 'Posting failed. Please check your network.' : '操作失败,请检查网络',
-                        icon: 'none'
-                    })
-                    return
-                }
-                Taro.uploadFile({
-                    url: rsp.data.upload_url,
-                    filePath: path,
-                    name: 'file',
-                    formData: rsp.data.fields,
-                    success: rlt => {
-                        setImgUrl(rsp.data.view_url)
-                        Taro.hideLoading()
-                        // createData(rsp.data.view_url, source)
-
-                        // uploadAvatar(rsp.data.view_url)
-                        // _this.changeAvatar(rsp.data.view_url);
-                    },
-                    fail: rlt => {
-                        Taro.hideLoading()
-                        Taro.showModal({
-                            content: rlt.errMsg
-                        })
-                    }
-                })
-            }
-        })
-    }
-
     function timeContent() {
         return <Modal
             testInfo={null}

+ 23 - 5
src/_health/pages/move_schedule.tsx

@@ -15,6 +15,8 @@ import Layout from "@/components/layout/layout";
 import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
 import Card from "../components/card";
 import { useTranslation } from "react-i18next";
+import { useSelector } from "react-redux";
+import showAlert from "@/components/basic/Alert";
 
 let useRoute;
 let useNavigation;
@@ -45,8 +47,9 @@ export default function MoveSchedule() {
 
     const [hours, setHours] = useState<any>([])
     const [loaded, setLoaded] = useState(false)
+    const permission = useSelector((state: any) => state.permission);
     const [count, setCount] = useState(1)
-    const {t} = useTranslation()
+    const { t } = useTranslation()
 
 
     useEffect(() => {
@@ -165,7 +168,7 @@ export default function MoveSchedule() {
                                 status={<StatusIndicator type={StatusType.normal}
                                     color={MainColorType.active}
                                     text={t('health.waking_hour') + (index + 1)} />}
-                                title={t('health.check_begin_at2',{time:open+':50'})}
+                                title={t('health.check_begin_at2', { time: open + ':50' })}
                                 description={`${parseInt(start) < new Date().getHours() ? '' : ''}${start}:00-${end}:00`}
                                 subDesc={<Text className="schedule_item_time">  {firstTime(index)}</Text>}
                                 right={<View style={{
@@ -174,13 +177,28 @@ export default function MoveSchedule() {
                                     alignItems: 'center'
                                 }}>
                                     {
-                                        // item.reminder ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
+                                        item.reminder && permission.wxPubFollow ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
                                     }
                                     <View style={{ width: rpxToPx(12) }} />
                                     {
-                                        !global.hideRingIcon && <Switch checked={item.reminder} color={getThemeColor('ACTIVE')} onChange={e => {
+                                        !global.hideRingIcon && <Switch checked={item.reminder && permission.wxPubFollow} color={getThemeColor('ACTIVE')} onChange={e => {
                                             console.log(item)
-
+                                            if (!permission.wxPubFollow) {
+                                                showAlert({
+                                                    title: t('health.reminder_alert_title'),
+                                                    content: '',
+                                                    cancelText: t('health.reminder_cancel'),
+                                                    confirmText: t('health.reminder_confirm'),
+                                                    showCancel: true,
+                                                    cancel: () => {
+                                                    },
+                                                    confirm: () => {
+                                                        global.followWxPub()
+                                                        // checkNotification()
+                                                    }
+                                                })
+                                                return
+                                            }
                                             createSchedule({
                                                 schedules: [{
                                                     id: item.schedule_id,

+ 25 - 6
src/_health/pages/move_setting_reminder.tsx

@@ -15,13 +15,16 @@ import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
 import Card from "../components/card";
 import ConsoleCell from "../components/console_cell";
 import { useTranslation } from "react-i18next";
+import { useSelector } from "react-redux";
+import showAlert from "@/components/basic/Alert";
 
 export default function MoveSettingReminder() {
     const [selIndex, setSelIndex] = useState(-1)
     const [hours, setHours] = useState('')
     const [total, setTotal] = useState('')
     const [detail, setDetail] = useState<any>(null)
-    const {t} = useTranslation()
+    const permission = useSelector((state: any) => state.permission);
+    const { t } = useTranslation()
 
     useEffect(() => {
         getData()
@@ -50,7 +53,7 @@ export default function MoveSettingReminder() {
                                 status={<StatusIndicator type={StatusType.normal}
                                     color={MainColorType.active}
                                     text={t('health.waking_hour') + (index + 1)} />}
-                                title={t('health.check_begin_at2',{time:item.reminder_time})}
+                                title={t('health.check_begin_at2', { time: item.reminder_time })}
                                 description={`${item.title}`}
                                 subDesc={<Text className="schedule_item_time"></Text>}
                                 right={<View style={{
@@ -58,13 +61,29 @@ export default function MoveSettingReminder() {
                                     flexDirection: 'row',
                                     alignItems: 'center'
                                 }}>
-                                    {/* {
-                                        item.reminder ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
-                                    } */}
+                                    {
+                                        (item.reminder && permission.wxPubFollow) ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
+                                    }
                                     <View style={{ width: rpxToPx(12) }} />
                                     {
-                                        !global.hideRingIcon && <Switch checked={item.reminder} color={getThemeColor('ACTIVE')} onChange={e => {
+                                        !global.hideRingIcon && <Switch checked={(item.reminder && permission.wxPubFollow)} color={getThemeColor('ACTIVE')} onChange={e => {
                                             console.log(item)
+                                            if (!permission.wxPubFollow) {
+                                                showAlert({
+                                                    title: t('health.reminder_alert_title'),
+                                                    content: '',
+                                                    cancelText: t('health.reminder_cancel'),
+                                                    confirmText: t('health.reminder_confirm'),
+                                                    showCancel: true,
+                                                    cancel: () => {
+                                                    },
+                                                    confirm: () => {
+                                                        global.followWxPub()
+                                                        // checkNotification()
+                                                    }
+                                                })
+                                                return
+                                            }
 
                                             createSchedule({
                                                 schedules: [{

+ 36 - 30
src/_health/pages/schedules.tsx

@@ -273,12 +273,12 @@ export default function Schedules() {
             }
         }
         if (isMax) {
-            var type = isEat?t('health.member_meal'):t('health.member_activity')
+            var type = isEat ? t('health.member_meal') : t('health.member_activity')
             showAlert({
                 title: t('health.become_member_title'),
-                content: t('health.become_member_desc',{count:max,type:type}),
-                cancelText:t('health.not_now'),
-                confirmText:t('health.choose_plan'),
+                content: t('health.become_member_desc', { count: max, type: type }),
+                cancelText: t('health.not_now'),
+                confirmText: t('health.choose_plan'),
                 showCancel: true,
                 confirm: () => {
                     jumpPage('/pages/store/product_list', 'ProductList', navigation)
@@ -289,23 +289,23 @@ export default function Schedules() {
         setShowModal(true)
     }
 
-    function checkDel(obj){
-        const {window} = obj
-        if (window == 'EAT'){
+    function checkDel(obj) {
+        const { window } = obj
+        if (window == 'EAT') {
             var scenario = getScenario(health.windows, 'EAT')
             const countFastWindows = list.filter(item => item.window === 'EAT').length;
             var min = scenario.access.min
-            if (countFastWindows == min){
+            if (countFastWindows == min) {
                 var type = ''
-                if (global.language == 'en'){
-                    type = min == 1?'meal':'meals'
+                if (global.language == 'en') {
+                    type = min == 1 ? 'meal' : 'meals'
                 }
                 else {
                     type = '餐次'
                 }
                 Taro.showToast({
-                    title:t('health.keep_at_least',{number:min,type:type}),
-                    icon:'none'
+                    title: t('health.keep_at_least', { number: min, type: type }),
+                    icon: 'none'
                 })
                 return false
             }
@@ -314,17 +314,17 @@ export default function Schedules() {
             var scenario = getScenario(health.windows, 'ACTIVE')
             const countFastWindows = list.filter(item => item.window === 'ACTIVE').length;
             var min = scenario.access.min
-            if (countFastWindows == min){
+            if (countFastWindows == min) {
                 var type = ''
-                if (global.language == 'en'){
-                    type = min == 1?'activity':'activities'
+                if (global.language == 'en') {
+                    type = min == 1 ? 'activity' : 'activities'
                 }
                 else {
                     type = '活动'
                 }
                 Taro.showToast({
-                    title:t('health.keep_at_least',{number:min,type:type}),
-                    icon:'none'
+                    title: t('health.keep_at_least', { number: min, type: type }),
+                    icon: 'none'
                 })
                 return false
             }
@@ -370,6 +370,7 @@ export default function Schedules() {
             needOrder = true
             items.push(t('health.edit_order'))
         }
+        items.push(t('health.set_reminder'))
         if (errors.length == 0) {
             items.push(t('health.reset_schedule'))
         }
@@ -378,19 +379,24 @@ export default function Schedules() {
             title: t('health.more_actions'),
             itemList: items,
             success: (res) => {
-                if (res == 0 ) {
-                    var url = `./schedules_edit?type=name&mode=${selMode}`
-                    jumpPage(url)
-                }
-                else if (res == 1) {
-                    if (needOrder) {
-                        jumpPage('./schedules_order?list=' + JSON.stringify(temps))
-                        return
+                if (res >= 0) {
+                    var str = items[res]
+                    switch (str) {
+                        case t('health.edit_name'):
+                            var url = `./schedules_edit?type=name&mode=${selMode}`
+                            jumpPage(url)
+                            break;
+                        case t('health.set_reminder'):
+                            var url = `./schedules_edit?type=reminder&mode=${selMode}`
+                            jumpPage(url)
+                            break;
+                        case t('health.edit_order'):
+                            jumpPage('./schedules_order?list=' + JSON.stringify(temps))
+                            break;
+                        case t('health.reset_schedule'):
+                            jumpPage('/_health/pages/guide_begin')
+                            break
                     }
-                    jumpPage('/_health/pages/guide_begin')
-                }
-                else if (res == 2) {
-                    jumpPage('/_health/pages/guide_begin')
                 }
 
             }
@@ -503,7 +509,7 @@ export default function Schedules() {
                                             })
                                             return
                                         }
-                                        if (!checkDel(obj)){
+                                        if (!checkDel(obj)) {
                                             return;
                                         }
 

+ 24 - 7
src/_health/pages/schedules_edit.tsx

@@ -48,11 +48,12 @@ export default function SchedulesEdit() {
     const [labels, setLabels] = useState<any>([])
     const [showDel, setShowDel] = useState(false)
     const health = useSelector((state: any) => state.health);
+    const permission = useSelector((state: any) => state.permission);
     const [showTimePicker, setShowTimePicker] = useState(false)
     const [selItem, setSelItem] = useState<any>(null)
     const [editIndex, setEditIndex] = useState({ row: -1, index: -1 })
     const [delIds, setDelIds] = useState<any>([])
-    const {t} = useTranslation()
+    const { t } = useTranslation()
 
     useEffect(() => {
         schedules()
@@ -220,15 +221,31 @@ export default function SchedulesEdit() {
         if (obj.specific_time || health.mode == 'DAY' || health.mode == 'NIGHT') {
             return <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
                 {
-                    obj.reminder ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
+                    obj.reminder && permission.wxPubFollow ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
                 }
                 <View style={{ width: rpxToPx(12) }} />
-                <Switch checked={obj.reminder}
+                <Switch checked={obj.reminder && permission.wxPubFollow}
                     color={getThemeColor(obj.window)}
                     onChange={e => {
                         if (process.env.TARO_ENV == 'weapp') {
                             e.stopPropagation()
                         }
+                        if (!permission.wxPubFollow) {
+                            showAlert({
+                                title: t('health.reminder_alert_title'),
+                                content: '',
+                                cancelText: t('health.reminder_cancel'),
+                                confirmText: t('health.reminder_confirm'),
+                                showCancel: true,
+                                cancel: () => {
+                                },
+                                confirm: () => {
+                                    global.followWxPub()
+                                    // checkNotification()
+                                }
+                            })
+                            return
+                        }
 
                         obj.reminder = e.detail.value;
                         setList([...list])
@@ -243,7 +260,7 @@ export default function SchedulesEdit() {
             !(editIndex.row == index && editIndex.index == i)) {
             return <View style={{ marginRight: rpxToPx(12) }}>
                 <NewButton type={NewButtonType.link}
-                    title={global.language=='en'?'Change':"更改"}
+                    title={global.language == 'en' ? 'Change' : "更改"}
                     onClick={() => {
                         setSelItem(obj)
                         setEditIndex({
@@ -258,10 +275,10 @@ export default function SchedulesEdit() {
     }
 
     function detail() {
-        var info = Taro.getWindowInfo?Taro.getWindowInfo():Taro.getSystemInfoSync()
+        var info = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync()
         return <View className='schedule_list_bg'>
             <ScrollView enableFlex style={{ height: info.screenHeight - 220 }} scrollY>
-                <NewHeader title={t('health.edit_name')} type={NewHeaderType.left} />
+                <NewHeader title={router.params.type == 'reminder' ? t('health.set_reminder') : t('health.edit_name')} type={NewHeaderType.left} />
                 <Card>
                     <View style={{ display: 'flex', flexDirection: 'column' }}>
                         {
@@ -367,7 +384,7 @@ export default function SchedulesEdit() {
     }
 
     return <View>
-        <Layout title={t('health.edit_name')}
+        <Layout title={router.params.type == 'reminder' ? t('health.set_reminder') : t('health.edit_name')}
             titleShowStyle={NaviBarTitleShowType.scrollToShow}
             type={TemplateType.customHeader}
         // header={headerView()}

+ 1 - 1
src/app.tsx

@@ -36,7 +36,7 @@ if (process.env.TARO_ENV == 'rn') {
 const App: React.FC<PropsWithChildren> = ({ children }) => {
 
   
-  global.hideRingIcon = true
+  global.hideRingIcon = false
 
   Taro.setStorage({ key: 'showedDisqualifiedAlert', data: false })
 

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 1
src/components/basic/Icons.tsx


+ 0 - 1
src/components/input/Switch2.tsx

@@ -1,6 +1,5 @@
 import { View, Image } from "@tarojs/components";
 import './Switch2.scss'
-import { IconSwitchOff } from "../basic/Icons";
 import { rpxToPx } from "@/utils/tools";
 export default function Component(props: { isOn: boolean, onClick: Function }) {
     // alert('aa')

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

@@ -1215,6 +1215,11 @@ export default {
         share_food_journal: '{{date}} Food Journal',
         share_activity_journal: '{{date}} Activity Journal',
 
-        uploading:'Uploading',
+        uploading: 'Uploading',
+        set_reminder: 'Set Reminder',
+
+        reminder_alert_title: 'Activate reminders in the official account',
+        reminder_cancel: 'Later',
+        reminder_confirm: 'Activate',
     }
 }

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

@@ -1216,5 +1216,11 @@ export default {
         share_food_journal: '{{date}}饮食日记',
         share_activity_journal: '{{date}}活动日记',
         uploading:'上传中',
+
+        set_reminder:'设置提醒',
+
+        reminder_alert_title:'在公众号中,激活提醒功能',
+        reminder_cancel:'稍后',
+        reminder_confirm:'前往激活',
     }
 }

+ 0 - 144
src/features/food/FoodConsole.scss

@@ -1,144 +0,0 @@
-.box11 {
-    width: 304px;
-    height: 304px;
-    margin-left: 40px;
-    margin-right: 40px;
-    background-color: #00ffff;
-}
-
-.food_console_box {
-    background-color: #121212;
-    border-radius: 36px;
-    margin-left: 46px;
-    margin-right: 46px;
-    padding-top: 32px;
-    padding-bottom: 44px;
-    margin-bottom: 60px;
-}
-
-.food_console_title {
-    color: #fff;
-    font-size: 36px;
-    font-weight: bold;
-    margin-left: 40px;
-}
-
-.food_console_desc {
-    margin-top: 16px;
-    display: flex;
-    flex-direction: row;
-    color: #ffffff66;
-    font-size: 28px;
-    line-height: 48px;
-}
-
-.food_console_desc_off {
-    margin-top: 16px;
-    display: flex;
-    flex-direction: column;
-    color: #ffffff66;
-    font-size: 28px;
-    line-height: 48px;
-    margin-left: 40px;
-}
-
-.food_console_desc_point {
-    width: 12px;
-    height: 12px;
-    border-radius: 6px;
-    margin-right: 8px;
-    margin-left: 20px;
-    margin-top: 18px;
-}
-
-.demo1 {
-    width: 100px;
-    height: 100px;
-    position: relative;
-    // background-color: red;
-}
-
-.demo1::before {
-    position: absolute;
-    left: 0;
-    top: 0;
-    width: 100%;
-    height: 100%;
-    background-color: pink;
-    z-index: 1;
-}
-
-.demo1::after {
-    background-color: #ffffff66;
-}
-
-.camera_bg {
-    width: 304px;
-    height: 304px;
-    border-radius: 36px;
-    background-color: #1c1c1c;
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    position: relative;
-}
-
-.album_bottom {
-    position: absolute;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    height: 88px;
-}
-
-.camera_icon {
-    width: 72px;
-    height: 60px;
-    margin-top: 76px;
-}
-
-.camera_text {
-    margin-top: 18px;
-    font-size: 32px;
-    line-height: 32px;
-    color: #fff;
-    opacity: 0.4;
-    font-weight: bold;
-}
-
-.album_text {
-    margin-top: 60px;
-    font-size: 24px;
-    line-height: 26px;
-    color: #fff;
-    opacity: 0.2;
-    font-weight: bold;
-}
-
-.center_line2{
-    position: absolute;
-    left: 374px;
-    width: 2px;
-    top: 0;
-    bottom: 0;
-    background-color: #fff;
-    opacity: 0.2;
-    z-index: -1;
-}
-
-/* #ifdef weapp */
-.myswitch{
-    // width: 100px !important;
-    // height: 50px !important;
-    transform: scale(0.85);
-    transform-origin: right center;
-    margin-right: -10px;
-
-}
-
-/* #endif */
-
-/* #ifdef rn */
-.myswitch{
-}
-/* #endif */

+ 0 - 326
src/features/food/FoodConsole.tsx

@@ -1,326 +0,0 @@
-import { View, Image, Text, Switch } from '@tarojs/components'
-import './FoodConsole.scss'
-import { rpxToPx, vibrate } from '@/utils/tools'
-import Taro from '@tarojs/taro'
-import Slider from '@/components/input/Slider'
-import { useEffect, useState } from 'react'
-import { baseUrl } from '@/services/http/api'
-import { createFoodJournal } from '@/services/foodJournal'
-import { useSelector } from 'react-redux'
-import { jumpPage } from '../trackTimeDuration/hooks/Common'
-import { IconShare } from '@/components/basic/Icons'
-import { useTranslation } from 'react-i18next'
-import { ColorType } from '@/context/themes/color'
-import { clearFoodCache, getFoodCache, saveFoodCache } from './hooks/ExtraData'
-import { async } from 'q'
-import { checkAuthorized } from '@/utils/check_authorized'
-let useNavigation;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-
-export default function Component(props: { addItem: Function, firstItem: any }) {
-    const user = useSelector((state: any) => state.user);
-    const [modeOn, setModeOn] = useState(false)
-    const [firstData, setFirstData] = useState(props.firstItem)
-    const [lastUnFinished, setLastUnFinished] = useState(false)
-    const common = useSelector((state: any) => state.common);
-    const { t } = useTranslation()
-    const [imgUrl, setImgUrl] = useState('')
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    // useEffect(() => {
-    //     setFirstData(props.firstItem)
-    // }, [props.firstItem, props.firstItem.feel.post_meal])
-
-    useEffect(() => {
-        if (props.firstItem) {
-            setFirstData(props.firstItem)
-        }
-    }, [props.firstItem])
-
-    useEffect(() => {
-        if (firstData &&
-            firstData.mindful_mode == 'AWARE' &&
-            (firstData.status != 'PART_COMPLETED' && firstData.status != 'COMPLETED')
-        ) {
-            setLastUnFinished(true)
-            setModeOn(true)
-        }
-        else {
-            setLastUnFinished(false)
-            var isOn = Taro.getStorageSync('food_switch')
-            setModeOn(isOn)
-        }
-        // if (firstData &&
-        //     firstData.mindful_mode == 'AWARE' &&
-        //     firstData.status != 'PART_COMPLETED' &&
-        //     (!firstData.feel.post_meal || !firstData.feel.pre_meal)) {
-        //     setLastUnFinished(true)
-        //     setModeOn(true)
-        // }
-        // else {
-        //     setLastUnFinished(false)
-        //     var isOn = Taro.getStorageSync('food_switch')
-        //     setModeOn(isOn)
-        // }
-    }, [firstData])
-
-    useEffect(() => {
-        // var str = Taro.getStorageSync('pic')
-        // if (str && str.length > 0) {
-        //     setImgUrl(str)
-        // }
-    }, [])
-
-    async function choose(isAlbum = true) {
-        if (!user.isLogin) {
-            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
-            return;
-        }
-
-        var params = {
-            event: 'add_a_picture',
-            value: isAlbum ? 'choose_from_album' : 'use_camera',
-        }
-
-        saveFoodCache('create', params)
-
-        if (process.env.TARO_ENV == 'rn') {
-            Taro.chooseImage({
-                count: 1,
-                sizeType: ['compressed'],
-                sourceType: [isAlbum ? 'album' : 'camera'],
-                success: function (res) {
-                    chooseSuccess(res, isAlbum)
-                    checkAuthorized()
-                },
-                fail: function (res) {
-                    chooseFailed(res, isAlbum)
-                    checkAuthorized()
-                }
-            })
-
-        }
-        else {
-            Taro.chooseMedia({
-                count: 1,
-                sizeType: ['compressed'],
-                mediaType: ['image'],
-                sourceType: [isAlbum ? 'album' : 'camera'],
-                success: function (res) {
-                    chooseSuccess(res, isAlbum)
-                    checkAuthorized()
-                },
-                fail: function (res) {
-                    chooseFailed(res, isAlbum)
-                    checkAuthorized()
-                }
-            })
-        }
-    }
-
-    async function chooseSuccess(res, isAlbum) {
-        var params = {
-            event: 'add_a_picture',
-            value: isAlbum ? 'choose_from_album_confirm' : 'use_camera_confirm',
-        }
-
-        saveFoodCache('create', params)
-
-        var savedFilePath = process.env.TARO_ENV=='rn'?res.tempFiles[0].path:res.tempFiles[0].tempFilePath
-
-        // var savedFilePath = res.savedFilePath
-        // await Taro.setStorage({key:'pic', data:savedFilePath})
-        // setImgUrl(savedFilePath as any)
-
-        uploadFile(savedFilePath, isAlbum ? 'album' : 'camera')
-
-
-    }
-    function chooseFailed(res, isAlbum) {
-        var params = {
-            event: 'add_a_picture',
-            value: isAlbum ? 'choose_from_album_cancel' : 'use_camera_cancel',
-        }
-
-        saveFoodCache('create', params)
-    }
-
-
-    function uploadFile(path, source) {
-        Taro.showLoading({
-            title: '加载中'
-        })
-        var dot = path.lastIndexOf('.')
-        var fileExt = dot > 0 ? path.substring(dot) : ''
-        Taro.request({
-            method: 'GET',
-            url: `${baseUrl}/api/thirdparty/aliyun/oss-form-upload`,
-            header: {
-                'Authorization': 'bearer ' + global.token
-            },
-            data: {
-                type: 'FOOD_JOURNAL',
-                file_ext: fileExt
-            },
-            success: (rsp) => {
-                if (rsp.statusCode != 200) {
-                    Taro.showToast({
-                        title: global.language == 'en' ? 'Posting failed. Please check your network.' : '操作失败,请检查网络',
-                        icon: 'none'
-                    })
-                    return
-                }
-                Taro.uploadFile({
-                    url: rsp.data.upload_url,
-                    filePath: path,
-                    name: 'file',
-                    formData: rsp.data.fields,
-                    success: rlt => {
-                        createData(rsp.data.view_url, source)
-
-                        // uploadAvatar(rsp.data.view_url)
-                        // _this.changeAvatar(rsp.data.view_url);
-                    },
-                    fail: rlt => {
-                        Taro.hideLoading()
-                        Taro.showModal({
-                            content: rlt.errMsg
-                        })
-                    }
-                })
-            }
-        })
-    }
-
-    async function createData(url, source) {
-        var date = new Date();
-        var time = date.getTime()
-        var strDate = (date.getFullYear() + '') + (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)) + (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
-        var event = await getFoodCache('create')
-        createFoodJournal({
-            media: [{
-                url,
-                type: url.indexOf('mp4') != -1 ? 'video' : 'image',
-                source: source
-            }],
-            start: {
-                timestamp: time,
-                date: strDate
-            },
-            mindful_mode: modeOn ? 'AWARE' : 'NORMAL',
-            extra: {
-                event: event
-            }
-
-        }).then(res => {
-            props.addItem(res)
-            setImgUrl('')
-            Taro.removeStorage({key:'pic'})
-            Taro.hideLoading()
-            setFirstData(res)
-            clearFoodCache('create')
-        }).catch(e => {
-            Taro.hideLoading()
-        })
-    }
-
-    async function modeChange(e) {
-
-        setModeOn(e.detail.value)
-        await Taro.setStorage({key:'food_switch', data:e.detail.value})
-
-        var params = {
-            event: 'switch_toggle',
-            value: e.detail.value ? 'on' : 'off',
-        }
-
-
-        saveFoodCache('create', params)
-    }
-
-    function more() {
-        const resource = common.resources.filter((item: any) => {
-            return item.code == 'about_mindful_eating'
-        })
-
-        jumpPage('/pages/common/H5?title=' + '' + '&url=' + resource[0].url)
-    }
-
-    function getLineBottom() {
-        if (user.isLogin) {
-            return props.firstItem ? -rpxToPx(60) : 0
-        }
-        else {
-            return props.firstItem ? 0 : rpxToPx(60)
-        }
-    }
-
-    function clickSwitch() {
-        if (lastUnFinished) {
-            vibrate('heavy')
-            Taro.showModal({
-                title: t('feature.common.prompt'),
-                content: t('feature.food.disable_switch_modal_title'),
-                confirmText: t('feature.food.disable_switch_modal_btn'),
-                showCancel: false
-            })
-        }
-    }
-
-    return <View style={{ marginBottom: rpxToPx(60) }}>
-        <View className='food_console_box'>
-            <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
-                <Text className='food_console_title'>感知模式</Text>
-                <Switch className='myswitch'
-                    onClick={clickSwitch}
-                    disabled={lastUnFinished} checked={modeOn}
-                    color={props.firstItem && props.firstItem.status == 'WAIT_FOR_POSTMEAL' ? ColorType.food : ColorType.fast}
-                    style={{ marginRight: rpxToPx(40), opacity: lastUnFinished ? 0.4 : 1 }}
-                    onChange={modeChange} />
-            </View>
-            {
-                modeOn && <View className='food_console_desc'>
-                    <View className='food_console_desc_point'
-                        style={{
-                            backgroundColor: props.firstItem && props.firstItem.status == 'WAIT_FOR_POSTMEAL' ? ColorType.food : ColorType.fast,
-                            marginTop: props.firstItem && props.firstItem.status == 'WAIT_FOR_POSTMEAL' ? rpxToPx(46 + 18) : rpxToPx(18)
-                        }} />
-                    <Text style={{ color: '#ffffff66' }}>{t('feature.food.sence_desc')}</Text>
-                </View>
-            }
-            {
-                !modeOn && <View className='food_console_desc_off'>
-                    <Text style={{ color: '#ffffff66' }}>{t('feature.food.sence_desc_off')}</Text>
-                </View>
-            }
-        </View>
-        {
-            !lastUnFinished && <View style={{ display: 'flex', position: 'relative', width: rpxToPx(750), alignItems: 'center', justifyContent: 'center', flexDirection: 'column' }}>
-                <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
-                    <View className='camera_bg' onClick={() => choose(false)}>
-                        <Image src={require('@assets/images/camera2.png')} className='camera_icon' />
-                        <Text className='camera_text'>{t('feature.food.camera')}</Text>
-                        <Text className='album_text'>{t('feature.food.album')}</Text>
-                        <View className='album_bottom' onClick={(e) => {
-                            choose(true);
-                            if (process.env.TARO_ENV == 'weapp') {
-                                e.stopPropagation()
-                            }
-                        }} />
-                    </View>
-                    {
-                        modeOn && <View style={{ height: rpxToPx(60) }} />
-                    }
-                    {modeOn && <Slider edit={true} />}
-                </View>
-                <View className='center_line2' style={{ bottom: getLineBottom() }} />
-            </View>
-        }
-
-    </View>
-}

+ 0 - 9
src/features/food/FoodJournal.scss

@@ -1,9 +0,0 @@
-.center_line{
-    position: absolute;
-    left: 374px;
-    width: 2px;
-    top: 0;
-    background-color: #fff;
-    opacity: 0.2;
-    z-index: -1;
-}

+ 0 - 237
src/features/food/FoodJournal.tsx

@@ -1,237 +0,0 @@
-import { useTranslation } from "react-i18next"
-import TitleView from "../trackTimeDuration/components/TitleView"
-import { View } from "@tarojs/components"
-import FoodConsole from "./FoodConsole"
-import FoodTimeline from "./FoodTimeline"
-import Layout from "@/components/layout/layout"
-import { NaviBarTitleShowType, TemplateType } from "@/utils/types"
-import { useEffect, useState } from "react"
-import { getFoodJournals, getFoodScales, getFoodTags } from "@/services/foodJournal"
-import { usePullDownRefresh, useReachBottom, useReady } from "@tarojs/taro"
-import Taro from "@tarojs/taro"
-import { useDispatch, useSelector } from "react-redux"
-import { setFoodScales, setMealTags } from "@/store/common"
-import { getInfoSuccess } from "@/store/user"
-import './FoodJournal.scss'
-import { rpxToPx } from "@/utils/tools"
-import NoData from "@/components/view/NoData"
-import Timer from "@/components/basic/Timer"
-
-export default function Component() {
-    const { t } = useTranslation()
-    const dispatch = useDispatch();
-    const user = useSelector((state: any) => state.user);
-    const [pageIndex, setPageIndex] = useState(1)
-    const [list, setList] = useState<any[]>([])
-    const [count, setCount] = useState(0)
-    const [total, setTotal] = useState(0)
-    const [isLoading, setIsLoading] = useState(false)
-    const [loaded, setLoaded] = useState(false)
-    const [showError, setShowError] = useState(false)
-
-    useEffect(() => {
-        getConfigs()
-        if (user.isLogin) {
-            getList(1)
-        }
-    }, [user.isLogin])
-
-    useReady(async () => {
-        const userData = await getStorage('userData');
-        if (userData) {
-            dispatch(getInfoSuccess(JSON.parse(userData as string)) as any);
-            setTimeout(() => {
-                getList(1)
-            }, 200)
-        }
-    })
-
-    //0点刷新一下数据
-    useEffect(() => {
-        const now = new Date();
-        const nextMidnight = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0);
-        const timeUntilMidnight = nextMidnight.getTime() - now.getTime();
-
-        setTimeout(() => {
-            refreshData()
-        }, timeUntilMidnight);
-    }, [])
-
-
-
-    usePullDownRefresh(() => {
-        setPageIndex(1)
-        getList(1)
-    })
-
-    useReachBottom(() => {
-        more()
-        // setPageIndex(pageIndex+1)
-        // getHistory()
-    })
-
-    //0点刷新一下数据
-    function refreshData() {
-        list.map(item => {
-            item.showDate = false
-        })
-
-        var selDate = ''
-        for (var i = 0; i < list.length; i++) {
-            var obj = list[i]
-            if (obj.start.date != selDate) {
-                obj.showDate = true
-                selDate = obj.start.date
-            }
-        }
-
-        setList(list)
-        setCount(count + 1)
-    }
-
-    function removeIndex(index) {
-        list.map(item => {
-            item.showDate = false
-        })
-
-        var selDate = ''
-        for (var i = 0; i < list.length; i++) {
-            var obj = list[i]
-            if (obj.start.date != selDate) {
-                obj.showDate = true
-                selDate = obj.start.date
-            }
-        }
-        list.splice(index, 1)
-        setList(list)
-        setCount(count + 1)
-    }
-
-    function getConfigs() {
-        getFoodTags({
-            type: 'meal_tag'
-        }).then(res => {
-            dispatch(setMealTags((res as any).data))
-        }).catch(e => {
-
-        })
-
-        getFoodScales({
-            type: 'hunger_fullness'
-        }).then(res => {
-            dispatch(setFoodScales((res as any).data))
-        }).catch(e => { })
-    }
-
-    async function getStorage(key: string) {
-        try {
-            const res = await Taro.getStorage({ key });
-            return res.data;
-        } catch {
-            return '';
-        }
-    }
-
-    function more() {
-        if (total <= list.length || isLoading) {
-            return;
-        }
-        setIsLoading(true)
-        var page = pageIndex + 1
-        getList(page)
-    }
-
-
-    function getList(index) {
-        setPageIndex(index)
-        getFoodJournals({
-            page: index,
-            limit: 10
-        }).then(res => {
-            Taro.stopPullDownRefresh()
-            setShowError(false)
-            setLoaded(true)
-            setTotal((res as any).total)
-            var array;
-            if (index == 1) {
-                array = (res as any).data
-                // setList((res as any).data)
-            } else {
-                array = list.concat((res as any).data)
-                // setList(list.concat((res as any).data))
-            }
-            var selDate = ''
-            for (var i = 0; i < array.length; i++) {
-                var obj = array[i]
-                if (obj.start.date != selDate) {
-                    obj.showDate = true
-                    selDate = obj.start.date
-                }
-            }
-            setList(array)
-            setIsLoading(false)
-        }).catch(e => {
-            Taro.stopPullDownRefresh()
-            if (pageIndex == 1) {
-                setShowError(true)
-            }
-        })
-    }
-
-    function addItem(item) {
-        setCount(count + 1)
-        var temps: any = list
-        if (!temps) {
-            temps = []
-        }
-        temps.unshift(item)
-        temps.map(item => {
-            item.showDate = false
-        })
-
-        var selDate = ''
-        for (var i = 0; i < temps.length; i++) {
-            var obj = temps[i]
-            if (obj.start.date != selDate) {
-                obj.showDate = true
-                selDate = obj.start.date
-            }
-        }
-
-        setList(temps)
-    }
-
-    function headerView() {
-        return <TitleView title={t('page.food.title')} showAddBtn={false}>
-        </TitleView>
-    }
-    function detail() {
-        var tempFirst = list.length > 0 ? list[0] : null
-        if (!user.isLogin) {
-            tempFirst = null
-        }
-        return <View style={{ position: 'relative', marginTop: rpxToPx(52) }}>
-            {
-                (loaded || !user.isLogin) && <FoodConsole addItem={addItem} firstItem={tempFirst} />
-            }
-            {
-                user.isLogin && list && <FoodTimeline array={list} refresh={() => refreshData()} forceRefresh={() => getList(1)} removeIndex={removeIndex} />
-            }
-            {
-                user.isLogin && showError && <NoData refresh={() => { getList(1) }} />
-            }
-            <View style={{ height: 60 }} />
-        </View>
-    }
-
-    return <View>
-        <Layout children={detail()}
-            title={t('page.food.title')}
-            type={TemplateType.customHeader}
-            header={headerView()}
-            refresh={() => { }}
-            triggered={false}
-            titleShowStyle={NaviBarTitleShowType.scrollToShow}
-        />
-    </View>
-}

+ 0 - 0
src/features/food/FoodTimeline.scss


+ 0 - 102
src/features/food/FoodTimeline.tsx

@@ -1,102 +0,0 @@
-import { View } from '@tarojs/components'
-import './FoodTimeline.scss'
-import FoodTimelineItem from './FoodTimelineItem'
-import { useEffect, useState } from 'react'
-import { delFoodJournal } from '@/services/foodJournal'
-import Taro from '@tarojs/taro'
-
-export default function Component(props: { array: any, refresh: Function, forceRefresh: Function,removeIndex:Function }) {
-    const [list, setList] = useState(props.array)
-
-    useEffect(() => {
-        setList(props.array)
-    }, [props.array, props.array.length])
-
-    function del(index) {
-        delFoodJournal(list[index].id).then(res => {
-            props.removeIndex(index)
-            // var temps = list.splice(index, 1)
-            // setList(temps)
-            // props.refresh()
-        }).catch(e => {
-
-        })
-    }
-
-    // function preview(index){
-    //     var urls:any = []
-    //     list.map(item=>{
-    //         urls.push(item.cover)
-    //     })
-    //     Taro.previewImage({
-    //         current: list[index].cover,
-    //         urls: urls
-    //     })
-    // }
-
-    function preview(index) {
-        var urls: any = []
-        //微信限制 最多50张
-        if (list.length <= 50) {
-            list.map(item => {
-                urls.push({
-                    url: item.media[0].url,
-                    type: item.media[0].url.indexOf('mp4') != -1 ? 'video' : 'image'
-                })
-            })
-        }
-        else {
-
-            var begin = index - 20 < 0 ? 0 : index - 20
-            var end = index + 20 > list.length - 1 ? list.length - 1 : index + 20
-            for (var i = begin; i <= end; i++) {
-                var item = list[i]
-                urls.push({
-                    url: item.media[0].url,
-                    type: item.media[0].url.indexOf('mp4') != -1 ? 'video' : 'image'
-                })
-            }
-        }
-
-        var currentUrl = list[index].media[0].url
-        var page = 0;
-        for (var i = 0; i < urls.length; i++) {
-            if (currentUrl == urls[i].url) {
-                page = i
-            }
-        }
-        if (process.env.TARO_ENV=='rn'){
-            Taro.previewImage({
-                current: currentUrl,
-                urls: [currentUrl]
-            })
-        }
-        else {
-            Taro.previewMedia({
-                current: page,
-                sources: urls
-            })
-        }
-        
-    }
-
-    function updateItem(index, data) {
-        list[index] = data
-        setList(list)
-    }
-
-    return <View style={{ flexDirection: 'column', display: 'flex' }}>
-        {
-            list.map((item, index) => {
-                return <FoodTimelineItem data={item} index={index} key={index}
-                    delete={() => del(index)}
-                    preview={() => preview(index)}
-                    update={(data) => updateItem(index, data)}
-                    forceRefresh={() => props.forceRefresh()}
-                    refresh={() => { props.refresh(); }}
-                    isLast={index == list.length - 1}
-                />
-            })
-        }
-    </View>
-}

+ 0 - 160
src/features/food/FoodTimelineItem.scss

@@ -1,160 +0,0 @@
-.food_timeline_item {
-    margin-bottom: 60px;
-    display: flex;
-    flex-direction: row;
-}
-
-.tags {
-    margin-left: 45px;
-    width: 164px;
-    display: flex;
-    flex-direction: column;
-    font-size: 24px;
-    align-items: center;
-    box-sizing: border-box;
-    position: relative;
-    height: 304px;
-}
-
-.food_timeline_item_day{
-    font-size: 36px;
-    line-height: 36px;
-    color: #fff;
-    font-weight: bold;
-    // margin-bottom: 12px;
-    margin-bottom: -8px;
-}
-
-.tag-item{
-    height: 48px;
-    box-sizing: border-box;
-    border-radius: 24px;
-    border: solid 2px #ffffff66;
-    padding-left: 24px;
-    padding-right: 24px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    margin-top: 20px;
-}
-
-.more_tag{
-    position: absolute;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    height: 72px;
-    width: 100%;
-    line-height: 72px;
-    text-align: center;
-    color: #fff;
-    font-size: 20px;
-    opacity: 0.4;
-    // background-color: red;
-}
-
-.thumb_bg {
-    position: relative;
-    width: 304px;
-    height: 304px;
-    border-radius: 36px;
-    background-color: #1c1c1c;
-    overflow: hidden;
-}
-
-.thumb {
-    width: 304px;
-    height: 304px;
-    border-radius: 36px;
-}
-
-.food_desc {
-    position: absolute;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    height: 72px;
-    border-bottom-left-radius: 36px;
-    border-bottom-right-radius: 36px;
-    backdrop-filter: blur(20px);
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    justify-content: center;
-    color: #fff;
-}
-
-.food_desc_text {
-    color: #fff;
-    opacity: 0.8;
-    font-size: 24px;
-    line-height: 26px;
-    text-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
-    font-weight: bold;
-}
-
-.food_item_date {
-    color: #fff;
-}
-
-.food_share {
-    margin-top: 24px;
-    width: 72px;
-    height: 72px;
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    position: relative;
-    margin-left: 36px;
-}
-
-.food_share_btn {
-    position: absolute;
-    left: 0;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    opacity: 0;
-}
-
-.food_share_text {
-    font-size: 20px;
-    line-height: 24px;
-    color: #fff;
-    opacity: 0.4;
-    margin-top: 12px;
-}
-
-.food_item_point{
-    width: 16px;
-    height: 16px;
-    border-radius: 8px;
-    margin-left: -9px;
-    margin-right: 12px;
-}
-
-.food_item_score{
-    font-size: 28px;
-    line-height: 40px;
-    font-weight: bold;
-}
-
-.food_timeline_more{
-    position: absolute;
-    right: 22px;
-    width: 48px;
-    height: 48px;
-    top: 36px;
-
-}
-
-.center_line3{
-    position: absolute;
-    left: 374px;
-    width: 2px;
-    top: 0;
-    bottom: 0;
-    background-color: #fff;
-    opacity: 0.2;
-    z-index: -1;
-}

+ 0 - 490
src/features/food/FoodTimelineItem.tsx

@@ -1,490 +0,0 @@
-import { View, Image, Text, Button } from "@tarojs/components";
-import './FoodTimelineItem.scss'
-import Taro from "@tarojs/taro";
-import { useTranslation } from "react-i18next";
-import { editFoodJournal } from "@/services/foodJournal";
-import { useEffect, useState } from "react";
-import LimitPickers from "@/components/input/LimitPickers";
-import Modal from "@/components/layout/Modal";
-import { ColorType } from "@/context/themes/color";
-import { useSelector } from "react-redux";
-import PickerViews from "@/components/input/PickerViews";
-import { IconShare } from "@/components/basic/Icons";
-import { TimeFormatter } from "@/utils/time_format";
-import { baseUrl } from "@/services/http/api";
-import Slider from "@/components/input/Slider";
-import { rpxToPx } from "@/utils/tools";
-import showAlert from "@/components/basic/Alert";
-
-export default function Component(props: {
-    data: any, index: number,
-    delete: Function, preview: Function, update: Function,
-    forceRefresh: Function, refresh: Function,
-    isLast?: boolean
-}) {
-    const common = useSelector((state: any) => state.common);
-    const [detail, setDetail] = useState(props.data)
-    const [count, setCount] = useState(0)
-    const [showModal, setShowModal] = useState(false)
-    const [showTagModal, setShowTagModal] = useState(false)
-    const [isStart, setIsStart] = useState(false)
-    const { t } = useTranslation()
-
-    useEffect(() => {
-        setDetail(props.data)
-        if (props.index == 0) {
-            global.food_share_img_url = props.data.media[0].url
-        }
-    }, [props.data])
-
-    function preview() {
-        // Taro.previewImage({
-        //     current: props.data.cover,
-        //     urls: [props.data.cover]
-        // })
-        props.preview()
-    }
-
-    function showActionSheet() {
-        Taro.showActionSheet({
-            alertText: t('feature.food.action_sheet.edit_title'),
-            itemList: [t('feature.food.action_sheet.edit_pic'),
-            t('feature.food.action_sheet.share_pic'),
-            t('feature.common.action_sheet.delete')]
-        })
-            .then(res => {
-                switch (res.tapIndex) {
-                    case 0:
-                        editPic();
-                        break;
-                    case 1:
-                        share()
-                        break;
-                    case 2:
-                        showAlert({
-                            title: t('feature.common.modal.delete_item_title'),
-                            content: t('feature.common.modal.delete_item_content'),
-                            showCancel: true,
-                            confirm: () => {
-                                props.delete();
-                            }
-                        })
-                        break;
-                }
-            })
-            .catch(err => {
-            })
-    }
-
-    function operateActionSheet() {
-        var itemList = [t('feature.food.action_sheet.tag')]
-        var date = TimeFormatter.getMonthAndDayByDate(detail.start.date)
-        if (date == TimeFormatter.getTodayUnit() || date == TimeFormatter.getYesterdayUnit()) {
-            itemList.push(t('feature.food.action_sheet.start_time'))
-            itemList.push(t('feature.food.action_sheet.end_time'))
-        }
-
-
-        Taro.showActionSheet({
-            alertText: t('feature.food.action_sheet.alert_text'),
-            itemList: itemList
-        })
-            .then(res => {
-                switch (res.tapIndex) {
-                    case 0:
-                        setShowTagModal(true)
-                        break;
-
-                    case 1:
-                        {
-                            global.set_time = new Date().getTime() + 24 * 3600 * 1000
-                            setIsStart(true)
-                            setShowModal(true)
-                        }
-                        break;
-                    case 2:
-                        {
-                            global.set_time = new Date().getTime() + 24 * 3600 * 1000
-                            setIsStart(false)
-                            setShowModal(true)
-                        }
-                        break;
-                    case 3:
-                        {
-                            editPic();
-                        };
-                        break;
-                    case 4:
-                        share()
-                        break;
-                }
-            })
-            .catch(err => {
-                console.log(err.errMsg)
-            })
-    }
-
-    function editPic() {
-        Taro.downloadFile({
-            url: detail.media[0].url,
-            success: (res) => {
-                Taro.editImage({
-                    src: res.tempFilePath,
-                    success: (res) => {
-                        console.log(res.tempFilePath)
-                        postPic(res.tempFilePath)
-                    }
-                })
-                // Taro.showShareImageMenu({
-                //     path: res.tempFilePath
-                // })
-            }
-        })
-    }
-
-    function postPic(path) {
-        Taro.showLoading({
-            title: '加载中'
-        })
-        var dot = path.lastIndexOf('.')
-        var fileExt = dot > 0 ? path.substring(dot) : ''
-        // console.log(avatarUrl)
-        Taro.request({
-            method: 'GET',
-            url: `${baseUrl}/api/thirdparty/aliyun/oss-form-upload`,
-            header: {
-                'Authorization': 'bearer ' + global.token
-            },
-            data: {
-                type: 'FOOD_JOURNAL',
-                file_ext: fileExt
-            },
-            success: (rsp) => {
-                console.log(rsp)
-                Taro.uploadFile({
-                    url: rsp.data.upload_url,
-                    filePath: path,
-                    name: 'file',
-                    formData: rsp.data.fields,
-                    success: rlt => {
-                        console.log(rlt)
-                        updatePic(rsp.data.view_url)
-
-                        // uploadAvatar(rsp.data.view_url)
-                        // _this.changeAvatar(rsp.data.view_url);
-                    },
-                    fail: rlt => {
-                        Taro.hideLoading()
-                        Taro.showModal({
-                            content: rlt.errMsg
-                        })
-                    }
-                })
-            }
-        })
-    }
-
-    function updatePic(url) {
-        editFoodJournal({
-            media: [{
-                url: url,
-                type: url.indexOf('mp4') != -1 ? 'video' : 'image',
-                source: detail.media[0].source ? detail.media[0].source : 'album'
-            }]
-        }, detail.id).then(res => {
-            (res as any).showDate = props.data.showDate
-            setDetail(res)
-            setCount(count + 1)
-
-            props.update(res)
-            Taro.hideLoading()
-        }).catch(e => {
-            Taro.hideLoading()
-        })
-    }
-
-    function share() {
-        Taro.downloadFile({
-            url: detail.media[0].url,
-            success: (res) => {
-                Taro.showShareImageMenu({
-                    path: res.tempFilePath
-                })
-            }
-        })
-    }
-
-    function updateFeel(value, isPreMeal) {
-
-
-        var feel = isPreMeal ? { pre_meal: value } : { post_meal: value }
-        var params = {
-            feel: feel
-        }
-        if (!isPreMeal) {
-            var date = new Date()
-            var year = date.getFullYear()
-            var month = date.getMonth() + 1
-            var day = date.getDate();
-            (params as any).end = {
-                date: (year + '') + (month < 10 ? '0' + month : month) + (day < 10 ? '0' + day : day),
-                timestamp: date.getTime()
-            }
-        }
-        editFoodJournal(params, detail.id).then(res => {
-
-            if (isPreMeal) {
-                (res as any).showDate = props.data.showDate
-                setDetail(res)
-                setCount(count + 1)
-                // props.refresh()
-                props.forceRefresh()
-            }
-            else {
-                props.forceRefresh()
-            }
-        }).catch(e => {
-
-        })
-    }
-
-    function updateTag(index) {
-        var tag = common.meal_tags[index]
-        editFoodJournal({
-            meal_tag: {
-                code: tag.code
-            }
-        }, detail.id).then(res => {
-            (res as any).showDate = props.data.showDate
-
-            setDetail(res)
-            setCount(count + 1)
-
-            props.update(res)
-        }).catch(e => {
-
-        })
-    }
-
-    function updateTime(e) {
-        var date = new Date(e)
-        var year = date.getFullYear()
-        var month = date.getMonth() + 1
-        var day = date.getDate()
-        var obj: any;
-        obj = {
-            start: {
-                date: (year + '') + (month < 10 ? '0' + month : month) + (day < 10 ? '0' + day : day),
-                timestamp: e
-            }
-        }
-        if (!isStart) {
-            obj = {
-                end: {
-                    date: (year + '') + (month < 10 ? '0' + month : month) + (day < 10 ? '0' + day : day),
-                    timestamp: e
-                }
-            }
-        }
-
-        editFoodJournal({
-            ...obj
-        }, detail.id).then(res => {
-            (res as any).showDate = props.data.showDate
-            setDetail(res)
-            setCount(count + 1)
-            props.update(res)
-            if ((res as any).index_change) {
-                showRefreshAlert()
-            }
-            else {
-                props.refresh()
-            }
-
-
-        }).catch(e => {
-
-        })
-    }
-
-    function abandon() {
-        editFoodJournal({
-            status: 'PART_COMPLETED'
-        }, detail.id).then(res => {
-            props.forceRefresh()
-        }).catch(e => {
-
-        })
-    }
-
-    function showRefreshAlert() {
-        Taro.showModal({
-            title: t('feature.food.prompt'),
-            content: t('feature.food.prompt_detail'),
-            showCancel: false,
-            success: function (res) {
-                if (res.confirm) {
-                    props.forceRefresh()
-                }
-            }
-        })
-    }
-
-    function pickerTagIndex() {
-        var list = common.meal_tags
-        if (detail.meal_tag) {
-            for (var i = 0; i < list.length; i++) {
-                if (list[i].label == detail.meal_tag.label) {
-                    return i;
-                }
-            }
-        }
-
-        return 3;
-    }
-
-    function pickerTagItems() {
-        var list = common.meal_tags
-        var tags: any = []
-        list.map(item => {
-            tags.push(item.label)
-        })
-        return [tags];
-    }
-
-    function tagChanged(data) {
-        setShowTagModal(false)
-        updateTag(data[0])
-    }
-
-    function getPickerLimit() {
-        if (isStart) {
-            return new Date().getTime() - 7 * 24 * 3600 * 1000
-        }
-        else {
-            return detail.start.timestamp
-        }
-    }
-
-    function getPickerInitValue() {
-        if (isStart) {
-            return detail.start.timestamp
-        }
-        else {
-            return detail.end.timestamp ? detail.end.timestamp : detail.start.timestamp
-        }
-    }
-
-    function more() {
-        Taro.showActionSheet({
-            itemList: ['开始新记录']
-        }).then(res => {
-            if (res.tapIndex == 0) {
-                abandon()
-            }
-        })
-    }
-
-    return <View style={{ position: 'relative' }}>
-        {
-            detail.mindful_mode == 'AWARE' && detail.status == 'WAIT_FOR_POSTMEAL' &&
-            <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: rpxToPx(60), position: 'relative' }}>
-                <Slider onChanged={(value) => { updateFeel(value, false) }} value={detail.feel.pre_meal} isPreMeal={false} isPostMeal={true} />
-                <Image src={require('@assets/images/more-vertical.png')} className="food_timeline_more" onClick={more} />
-            </View>
-        }
-        {
-            detail.mindful_mode == 'AWARE' && detail.status == 'COMPLETED' &&
-            <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
-                <View style={{ width: rpxToPx(375) }} />
-                <View className="food_item_point" style={{ backgroundColor: ColorType.food }} />
-                <Text className="food_item_score" style={{ color: ColorType.food }}>{detail.feel.post_meal}
-                    <Text style={{ fontSize: rpxToPx(20) }}>分饱</Text></Text>
-            </View>
-        }
-        <View className="food_timeline_item" onLongPress={showActionSheet}>
-            <View style={{ flex: 1 }}>
-                {
-                    <View className="tags">
-                        {detail.showDate && <Text className="food_timeline_item_day">{TimeFormatter.getMonthAndDayByDate(detail.start.date)}</Text>}
-                        {
-                            props.index == 0 && !detail.meal_tag && common.meal_tags.map((item, index) => {
-                                return index <= 2 ? <View className="tag-item" onClick={() => updateTag(index)}>
-                                    <Text style={{ color: ColorType.food }}>{item.label}</Text>
-                                </View> : <View />
-
-                            })
-                        }
-                        {props.index == 0 && !detail.meal_tag && <View className="more_tag" onClick={() => { setShowTagModal(true) }}>更多标签</View>}
-                    </View>
-                }
-
-            </View>
-            <View className="thumb_bg">
-                <Image className="thumb" src={detail.media[0].url + '?x-oss-process=image/resize,w_300,limit_0'} mode="aspectFill" onClick={preview} />
-                <View className="food_desc" onClick={operateActionSheet}>
-                    <Text className="food_desc_text">{detail.meal_tag && detail.meal_tag.label}</Text>
-                    <Text className="food_desc_text">{detail.start && TimeFormatter.getTimeByTimestamp(detail.start.timestamp)}</Text>
-                    <Text className="food_desc_text">{detail.end.timestamp && '~' + TimeFormatter.getTimeByTimestamp(detail.end.timestamp)}</Text>
-                </View>
-            </View>
-            <View style={{ flex: 1 }}>
-                {
-                    props.index == 0 && <View className="food_share">
-                        <IconShare color={ColorType.food} width={20} height={17} />
-                        <Text className="food_share_text">分享</Text>
-                        <Button openType="share" className="food_share_btn" />
-                    </View>
-                }
-            </View>
-
-
-        </View>
-        {
-            detail.mindful_mode == 'AWARE' && detail.status == 'WAIT_FOR_PREMEAL' &&
-            <View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: rpxToPx(60) }}>
-                <Slider onChanged={(value) => { updateFeel(value, true) }} isPreMeal={true} />
-            </View>
-        }
-        {
-            detail.mindful_mode == 'AWARE' && (detail.status == 'WAIT_FOR_POSTMEAL' || detail.status == 'COMPLETED' || detail.status == 'PART_COMPLETED') &&
-            <View style={{
-                display: 'flex', flexDirection: 'row', alignItems: 'center',
-                marginBottom: rpxToPx(60), marginTop: -rpxToPx(60)
-            }}>
-                <View style={{ width: rpxToPx(375) }} />
-                <View className="food_item_point" style={{ backgroundColor: ColorType.fast }} />
-                <Text className="food_item_score" style={{ color: ColorType.fast }}>{detail.feel.pre_meal}
-                    <Text style={{ fontSize: rpxToPx(20) }}>分饿</Text></Text>
-            </View>
-        }
-        {
-            showModal && <Modal dismiss={() => { setShowModal(false) }} confirm={() => { setShowModal(false) }}>
-                <View className='modal_content'>
-                    <LimitPickers
-                        isRealTime={true} time={getPickerInitValue()} limit={getPickerLimit()}
-                        title={isStart ? t('feature.food.picker_start_title') : t('feature.food.picker_end_title')}
-                        themeColor={ColorType.food}
-                        limitDay={7} onCancel={() => { setShowModal(false) }}
-                        onChange={(e) => {
-                            updateTime(e)
-                            setShowModal(false)
-                        }} />
-                </View>
-            </Modal>
-        }
-        {
-            showTagModal && <Modal dismiss={() => { setShowTagModal(false) }} confirm={() => { setShowTagModal(false) }}>
-                <PickerViews title={t('feature.food.picker_tag_title')}
-                    value={[pickerTagIndex()]}
-                    items={pickerTagItems()}
-                    onChange={(e) => { tagChanged(e) }}
-                    onCancel={() => { setShowTagModal(false) }}
-                    themeColor={ColorType.food}
-
-                />
-            </Modal>
-        }
-        <View className="center_line3" style={{ bottom: props.isLast ? 50 : 0 }} />
-    </View>
-}

+ 0 - 89
src/features/food/hooks/ExtraData.tsx

@@ -1,89 +0,0 @@
-import Taro from "@tarojs/taro"
-import { async } from "q"
-
-export async function saveFoodCache(id: string, value: any) {
-    
-    var date = new Date()
-    value.timestamp = date.getTime()
-    value.date = formatDate(date)
-
-    var oldCache: any = await getFoodCache(id)
-    if (oldCache == null) {
-        oldCache = []
-    }
-    oldCache.push(value)
-    var list = await getFoodCacheList()
-    var isFound = false
-    for (var i = 0; i < list.length; i++) {
-        if (list[i].id == id) {
-            isFound = true
-            list[i].datas = oldCache
-        }
-    }
-
-    if (!isFound) {
-        list.push({
-            id: id,
-            datas: oldCache
-        })
-    }
-    Taro.setStorage({ key: 'food_extra_data', data: JSON.stringify(list) });
-}
-
-export const formatDate = (date) => {
-    const year = date.getFullYear();
-    const month = String(date.getMonth() + 1).padStart(2, '0');
-    const day = String(date.getDate()).padStart(2, '0');
-    const hours = String(date.getHours()).padStart(2, '0');
-    const minutes = String(date.getMinutes()).padStart(2, '0');
-    const seconds = String(date.getSeconds()).padStart(2, '0');
-
-    return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
-}
-
-export async function getFoodCacheList() {
-    try {
-        var key: string = 'food_extra_data'
-        var list: any = await Taro.getStorage({ key: key })
-        if (!list) {
-            return []
-        }
-        return JSON.parse(list.data)
-    }
-    catch {
-        return []
-    }
-
-}
-
-export async function getFoodCache(id: string) {
-    try {
-        var key: string = 'food_extra_data'
-        var list: any = await Taro.getStorage({ key: key });
-        if (!list.data) {
-            return null
-        }
-        list = JSON.parse(list.data)
-        for (var i = 0; i < list.length; i++) {
-            if (list[i].id == id) {
-                return list[i].datas
-            }
-        }
-        return null
-    }
-    catch {
-        return null
-    }
-
-
-}
-
-export async function clearFoodCache(id: string) {
-    var list: any = await getFoodCacheList()
-    for (var i = 0; i < list.length; i++) {
-        if (list[i].id == id) {
-            list.splice(i, 1)
-        }
-    }
-    Taro.setStorage({ key: 'food_extra_data', data: JSON.stringify(list) });
-}

+ 19 - 13
src/features/health/MainConsole.tsx

@@ -275,7 +275,7 @@ export default function MainConsole(props: { type: WindowType }) {
             // if (health.mode == 'FAST' || health.mode == 'SLEEP') {
             if (item.moment && item.moment.media && item.moment.media.length > 0) {
                 return <Image
-                    src={item.moment.media[0].url+scale}
+                    src={item.moment.media[0].url + scale}
                     mode="aspectFill"
                     className="console_item_img gray_bg" />
             }
@@ -373,20 +373,26 @@ export default function MainConsole(props: { type: WindowType }) {
         else {
             strColor = 'transparent'
         }
-        function statusView() {
-            return <StatusIndicator type={StatusType.console}
-                color={strColor}
-                fontColor={item.real ? getThemeColor(health.mode) : MainColorType.g01}
-                bold={item.real ? true : false}
-                // color={new Date().getTime()<item.target.timestamp?MainColorType.g02:getThemeColor(health.mode)}
-                text={itemTitle(item)}
-                fontSize={rpxToPx(24)}
-            >{
-                    (item.real || (health.mode == 'DAY' || health.mode == 'NIGHT')) ? processIcon(index) : <IconCircle width={rpxToPx(32)} color={MainColorType.g02} />
-                }</StatusIndicator>
+        function statusView(item) {
+            return <View style={{ display: 'flex', flexDirection: 'row' }}>
+                <StatusIndicator type={StatusType.console}
+                    color={strColor}
+                    fontColor={item.real ? getThemeColor(health.mode) : MainColorType.g01}
+                    bold={item.real ? true : false}
+                    // color={new Date().getTime()<item.target.timestamp?MainColorType.g02:getThemeColor(health.mode)}
+                    text={itemTitle(item)}
+                    fontSize={rpxToPx(24)}
+                >{
+                        (item.real || (health.mode == 'DAY' || health.mode == 'NIGHT')) ? processIcon(index) : <IconCircle width={rpxToPx(32)} color={MainColorType.g02} />
+                    }</StatusIndicator>
+                {
+                    item.reminder ? <IconNotification color={MainColorType.g02} width={rpxToPx(24)} /> : <IconNotificationOff color={MainColorType.g02} width={rpxToPx(24)} />
+                }
+            </View>
+
         }
         return <ConsoleCell
-            status={statusView()}
+            status={statusView(item)}
             title={(item.moment && item.moment.title) ? item.moment.title : item.title}
             description={item.moment ? item.moment.description : null}
             right={itemValue(item)}

+ 0 - 1
src/features/health/MainDayNightCard.tsx

@@ -14,7 +14,6 @@ import Calendar from "@/features/health/calendar";
 import { WindowStatusType, WindowType } from "@/utils/types";
 import { durationArc, isCurrentTimeInRange, startArc } from "./util";
 import { setMode } from "@/store/health";
-import { IconSwitch1, IconSwitch2 } from "@/components/basic/Icons";
 import { getScenario, getWindowStatus } from "./hooks/health_hooks";
 import { useTranslation } from "react-i18next";
 import { useRouter } from "@tarojs/taro";

+ 0 - 1
src/features/health/MainFastEatCard.tsx

@@ -21,7 +21,6 @@ import MainHistory from "./MainHistory";
 import { WindowStatusType, WindowType } from "@/utils/types";
 import { durationArc, isCurrentTimeInRange, startArc } from "./util";
 import { setMode } from "@/store/health";
-import { IconSwitch1, IconSwitch2 } from "@/components/basic/Icons";
 import { getDurationArc, getScenario, getStartArc, getWindowStatus } from "./hooks/health_hooks";
 import { useTranslation } from "react-i18next";
 import { useRouter } from "@tarojs/taro";

+ 0 - 0
src/features/payment/placeholder


+ 0 - 0
src/features/permissions/placeholder


+ 0 - 493
src/features/trackSomething/components/Metric_backup.tsx

@@ -1,493 +0,0 @@
-import { View, Text, ScrollView, PageContainer } from "@tarojs/components";
-import './Metric.scss'
-import { useDispatch, useSelector } from "react-redux";
-import { useEffect, useRef, useState } from "react";
-import Taro from "@tarojs/taro";
-import { metricCards, metricFollows, metricGroups, uploadMetric, uploadSteps } from "@/services/trackSomething";
-import { TimeFormatter } from "@/utils/time_format";
-import MetricItem from "./MetricItem";
-import Modal from "@/components/layout/Modal";
-import LimitPickers from "@/components/input/LimitPickers";
-import SlidngScale from "@/components/input/SlidngScale";
-import NoData from "@/components/view/NoData";
-import { alphaToHex } from "@/utils/tools";
-import Layout from "@/components/layout/layout";
-import { MetricModalType, ModalType, NaviBarTitleShowType, TemplateType } from "@/utils/types";
-import { useTranslation } from "react-i18next";
-import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
-import TitleView from "@/features/trackTimeDuration/components/TitleView";
-import { setTabbarStatus } from "@/store/common";
-import MetricModalChoose from "./MetricModalChoose";
-import MetricModalOrder from './MetricModalOrder';
-
-let useNavigation;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-
-
-
-export default function Component(props: any) {
-    const { t } = useTranslation()
-    const user = useSelector((state: any) => state.user);
-    const [list, setList] = useState([])
-
-    const [isModalOpen, setIsModalOpen] = useState(false);
-    const [isTimePickerOpen, setIsTimePickerOpen] = useState(false);
-    const [pickerValue, setPickerValue] = useState([]);
-    const [pickerItems, setPickerItems] = useState([]);
-    const [isPoint, setIsPoint] = useState(false)
-
-    const [metricItem, setMetricItem] = useState({})
-
-    const [strTime, setStrTime] = useState('')
-    const [time, setTime] = useState(0)
-
-    const [showErrorPage, setErrorPage] = useState(false)
-
-    const [setupTime, setSetupTime] = useState(0)
-    const [triggered, setTriggered] = useState(true)
-    const limitPickerRef = useRef<any>(null);
-    const [count, setCount] = useState(0)
-    const [showPageContainer, setShowPageContainer] = useState(false)
-    const [modalType, setModalType] = useState(MetricModalType.none)
-    const [themeColor, setThemeColor] = useState('#00ffff')
-    const [groups, setGroups] = useState([])
-    const [orignalGroups,setOrignalGroups] = useState([])
-    const [limits, setLimits] = useState(null)
-    const [orders, setOrders] = useState([])
-    const dispatch = useDispatch();
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-
-    //未登录<->已登录 状态切换时,执行一次授权检查
-    useEffect(() => {
-        getCards();
-        getGroups();
-        const now = new Date();
-        const nextMidnight = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0);
-        const timeUntilMidnight = nextMidnight.getTime() - now.getTime();
-
-        setTimeout(() => {
-            setCount(count + 1)
-        }, timeUntilMidnight);
-    }, [user.isLogin])
-
-    const openModal = () => {
-        setSetupTime(new Date().getTime())
-        setIsModalOpen(true);
-    };
-
-    const closeModal = () => {
-        setIsModalOpen(false);
-    };
-
-    global.refreshMetric = () => {
-        getCards()
-    }
-
-    function getCards() {
-        setTriggered(true)
-        metricCards().then(res => {
-            Taro.stopPullDownRefresh()
-            setErrorPage(false)
-            setList((res as any).cards)
-            setTriggered(false)
-            if ((res as any).cards.length > 0) {
-                var obj = (res as any).cards[0]
-                setThemeColor(obj.theme_color)
-            }
-            var list: any = [];
-            (res as any).cards.map(item => {
-                list.push({
-                    name: item.name,
-                    code: item.code
-                })
-            })
-            setOrders(list)
-
-        }).catch(e => {
-            Taro.stopPullDownRefresh()
-            if (list.length == 0) {
-                setErrorPage(true)
-            }
-            setTriggered(false)
-        })
-    }
-
-    function getGroups() {
-        metricGroups().then(res => {
-            var array = (res as any).groups
-            setOrignalGroups(JSON.parse(JSON.stringify(array)))
-            setGroups(array)
-            setLimits((res as any).num_options_limit)
-        })
-    }
-
-
-    //ts 把数组items: [{code: "_walk", value: 2180},{code: "_walk", value: 4444}]中的value取出来,/分割,组成字符串,如2180/4444
-    function getValues(items) {
-        var values = ''
-        items.map((item, index) => {
-            if (index == 0) {
-                values = item.value
-            }
-            else {
-                values = values + '/' + item.value
-            }
-        })
-        return values
-    }
-    function goDetail(item) {
-        if (user.isLogin) {
-            if (!item.latest_record) {
-                return
-            }
-            jumpPage('/pages/common/RecordsHistory?type=metric&refreshList=getCards&code=' + item.code + `&title=${item.name}` + '&themeColor=' + item.theme_color)
-        }
-        else {
-            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
-        }
-    }
-
-    function record(item: any) {
-
-        if (user.isLogin) {
-            var now = new Date();
-            var t = (now.getHours() < 10 ? '0' + now.getHours() : now.getHours()) + ":" + (now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes());
-            // setStrTime(t)
-            setStrTime(TimeFormatter.dateTimeFormate(now.getTime()))
-            setTime(now.getTime())
-            setMetricItem(item)
-            openModal()
-        }
-        else {
-            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
-        }
-    }
-
-    function showTimePicker() {
-
-        setIsTimePickerOpen(true)
-    }
-
-    function chooseTime(e) {
-        setTime(e);
-        setStrTime(TimeFormatter.dateTimeFormate(e))
-        setIsTimePickerOpen(false)
-    }
-
-    function cancelModal() {
-        (metricItem as any).schemas.map((item, index) => {
-            item.tempValue = ''
-        })
-        closeModal()
-    }
-
-    function confirmModal() {
-        closeModal()
-        var date = new Date(time)
-        var strDate = (date.getFullYear() + '') + (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)) + (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
-
-        var array: any[] = [];
-        (metricItem as any).schemas.map((item, index) => {
-            array.push({
-                code: item.code,
-                value: item.tempValue && item.tempValue > 0 ? item.tempValue : item.default_value
-            })
-        })
-        var params = {
-            code: (metricItem as any).code,
-            timestamp: time,
-            date: strDate,
-            items: array,
-            extra: {
-                set_time: setupTime,
-                confirm_time: new Date().getTime()
-            }
-        }
-
-        global.postBtnUpdateStatus('normal');
-        uploadMetric(params).then(res => {
-            // getCards();
-            (metricItem as any).schemas.map((item, index) => {
-                item.tempValue = ''
-            })
-
-            list.map((item, index) => {
-                if ((item as any).code == (res as any).code) {
-                    (item as any).latest_record = (res as any).latest_record;
-                    (item as any).schemas = (res as any).schemas;
-                }
-            })
-            setList(JSON.parse(JSON.stringify(list)))
-
-            global.postBtnUpdateStatus('idle');
-            setTimeout(() => {
-                setCount(count + 1)
-            }, 31000)
-
-        })
-    }
-
-    const limitDay = 500
-
-    const limit = new Date().getTime() - limitDay * 3600 * 1000 * 24;
-
-    function detail() {
-        return <View>
-
-
-            <View className="metric_container">
-                {
-                    list.map((item: any, index: number) => {
-                        var unit = ''
-                        var value = t('feature.track_something.metric.no_record')
-                        var desc = t('feature.track_something.metric.check_unlock_data')
-                        var showDetail = false;
-                        if (item.latest_record) {
-                            unit = item.schemas[0].default_unit
-                            value = getValues(item.latest_record.items)
-                            desc = TimeFormatter.dateDescription(item.latest_record.timestamp, true)
-                            showDetail = true
-                        }
-
-                        if (!user.isLogin) {
-                            value = t('feature.track_something.metric.un_login')
-                            desc = t('feature.track_something.metric.login_can_check')
-                        }
-                        return <MetricItem title={item.name}
-                            value={value}
-                            unit={unit}
-                            desc={desc}
-                            btnText={t('feature.track_something.btn_record')}
-                            isDisabled={false}
-                            showDetail={showDetail}
-                            themeColor={item.theme_color}
-                            onClickDetail={() => { goDetail(item) }}
-                            onClick={() => { record(item) }}
-                        />
-                    })
-                }
-
-
-            </View>
-            <View className="space_width" ></View>
-        </View>
-    }
-
-    function detailContent() {
-        // if (process.env.TARO_ENV=='rn'){
-        //     return <ScrollView>
-        //         {
-        //             detail()
-        //         }
-        //         <View style={{height:150}}/> 
-        //     </ScrollView>
-        // }
-        return detail()
-    }
-
-    function addBtnClick() {
-        Taro.showActionSheet({
-            itemList: [t('feature.track_something.metric.choose_metric'),
-            t('feature.track_something.metric.order')]
-        })
-            .then(res => {
-                switch (res.tapIndex) {
-                    case 0:
-                        global.metricAdd = true
-                        setModalType(MetricModalType.choose)
-                        dispatch(setTabbarStatus(false))
-                        setShowPageContainer(true)
-
-                        break;
-                    case 1:
-                        global.metricAdd = false
-                        setModalType(MetricModalType.order)
-                        dispatch(setTabbarStatus(false))
-                        setShowPageContainer(true)
-                        break;
-                }
-            })
-            .catch(err => {
-                console.log(err.errMsg)
-            })
-
-    }
-
-    function headerView() {
-        return <TitleView title={t('page.metric.title')} showAddBtn={true} onClick={addBtnClick}>
-        </TitleView>
-    }
-
-    function metricModalContent() {
-        switch (modalType) {
-            case MetricModalType.choose:
-                return <MetricModalChoose
-                    themeColor={themeColor}
-                    cancel={modalCancel}
-                    confirm={modalConfirm}
-                    array={groups}
-                    orders={orders}
-                    limit={limits}
-                />
-            case MetricModalType.order:
-                return <MetricModalOrder
-                    themeColor={themeColor}
-                    cancel={modalOrderCancel}
-                    confirm={modalOrderConfirm}
-                    array={orders} />
-        }
-        return <View />
-    }
-
-    function modalCancel() {
-        dispatch(setTabbarStatus(true))
-        setShowPageContainer(false)
-        onPageContainerCancel()
-    }
-
-    function modalConfirm(datas) {
-        setOrders(datas)
-        setModalType(MetricModalType.order)
-    }
-
-    function modalOrderCancel() {
-        if (global.metricAdd) {
-            setModalType(MetricModalType.choose)
-        }
-        else {
-            dispatch(setTabbarStatus(true))
-            setShowPageContainer(false)
-            onPageContainerCancel()
-        }
-    }
-
-    function modalOrderConfirm(datas) {
-        var array: any = []
-        datas.map(item => {
-            array.push(item.code)
-        })
-        metricFollows({ codes: array }).then(res => {
-            getCards()
-            getGroups()
-        })
-        dispatch(setTabbarStatus(true))
-        setShowPageContainer(false)
-    }
-
-    function onPageContainerCancel() {
-        if (modalType == MetricModalType.choose || modalType == MetricModalType.order) {
-            var array: any = [];
-            list.map(item => {
-                array.push({
-                    name: (item as any).name,
-                    code: (item as any).code
-                })
-            })
-            // debugger
-            setOrders(array)
-            setGroups(JSON.parse(JSON.stringify(orignalGroups)))
-            // setGroups(orignalGroups)
-        }
-    }
-
-    return <View style={{ position: 'relative' }}>
-        <Layout children={showErrorPage ? <NoData refresh={() => { getCards() }} /> : detailContent()}
-            title={t('page.metric.title')}
-            type={TemplateType.customHeader}
-            header={headerView()}
-            refresh={() => { getCards() }}
-            triggered={triggered}
-            titleShowStyle={NaviBarTitleShowType.scrollToShow}
-        />
-        <PageContainer style={{ backgroundColor: '#1c1c1c' }}
-            overlayStyle='background-color:rgba(0,0,0,0.9)'
-            custom-style='background-color:#1c1c1c'
-            closeOnSlideDown={false}
-            show={showPageContainer} round={true} overlay={true} position='bottom'
-            onClickOverlay={onPageContainerCancel}
-            onAfterLeave={() => { setShowPageContainer(false);setModalType(MetricModalType.none) }}
-            onBeforeLeave={() => { dispatch(setTabbarStatus(true)) }}
-        >
-            {
-                metricModalContent()
-            }
-        </PageContainer>
-        {
-            isModalOpen && <Modal dismiss={closeModal} title={(metricItem as any).name}
-                themeColor={(metricItem as any).theme_color}
-                confirm={confirmModal}>
-                <View style={{
-                    display: 'flex', flexDirection: 'column',
-                    width: '100%', color: '#000'
-                }}>
-                    <Text className='modal_title' style={{ color: (metricItem as any).theme_color }}>{(metricItem as any).name ? (metricItem as any).name : ''}</Text>
-                    <View style={{ position: 'relative' }}>
-                        {
-                            (metricItem as any).schemas.map((item, index) => {
-                                return <View key={index}>
-                                    {
-                                        (metricItem as any).schemas.length > 1 && <Text style={{
-                                            textAlign: 'center', width: '100%', display: 'flex',
-                                            justifyContent: 'center', color: (metricItem as any).theme_color
-                                        }}>{item.name}</Text>
-                                    }
-                                    <SlidngScale step={item.step} min={item.min} max={item.max} default_value={item.default_value}
-                                        unit={item.default_unit}
-                                        themeColor={(metricItem as any).theme_color}
-                                        changed={(e) => { item.tempValue = e }} />
-                                </View>
-                            })
-                        }
-                    </View>
-                    <View className="change_time_bg ">
-                        <View className="gray1 time_bg" onClick={showTimePicker}>
-                            <Text className="time" >{strTime}</Text>
-                        </View>
-
-                    </View>
-                    <View className='modal_operate'>
-                        <View className='modal_btn' style={{ backgroundColor: (metricItem as any).theme_color + alphaToHex(0.4) }} onClick={cancelModal}>
-                            <Text className='modal_cancel_text' style={{ color: (metricItem as any).theme_color }}>{
-                                t('feature.common.picker_cancel_btn')
-                            }</Text>
-                        </View>
-                        <View className='btn_space' />
-                        <View className='modal_btn' style={{ backgroundColor: (metricItem as any).theme_color }} onClick={confirmModal}>
-                            <Text className='modal_confirm_text' style={{ color: '#000' }}>{
-                                t('feature.common.picker_confirm_btn')
-                            }</Text>
-                        </View>
-                    </View>
-                </View>
-            </Modal>
-        }
-        {
-
-            isTimePickerOpen && <Modal
-                themeColor={(metricItem as any).theme_color}
-                dismiss={() => setIsTimePickerOpen(false)} confirm={() => {
-                    var picker = limitPickerRef.current;
-                    chooseTime((picker as any).getConfirmData());
-                    setIsTimePickerOpen(false);
-                }}>
-                <LimitPickers ref={limitPickerRef}
-                    isRealTime={true} time={time} limit={limit}
-                    title={t('feature.track_something.picker_datetime')}
-                    themeColor={(metricItem as any).theme_color}
-                    limitDay={limitDay} onCancel={() => { setIsTimePickerOpen(false) }}
-                    onChange={(e) => {
-                        chooseTime(e)
-                        //  pickerConfirm(e)
-                        //  hidePicker()
-                    }} />
-            </Modal>
-        }
-    </View>
-
-}

+ 0 - 201
src/features/trackSomething/components/MoveOrderList_backup.tsx

@@ -1,201 +0,0 @@
-import { MovableArea, MovableView, View, ScrollView } from '@tarojs/components'
-import './MoveOrderList.scss'
-import { useEffect, useRef, useState } from 'react';
-import { ColorType } from '@/context/themes/color';
-import Taro from '@tarojs/taro';
-
-export default function Component(props: { array: any, itemHeight: number }) {
-    const [list, setList] = useState(props.array)
-    const [movaleViewY, setMovaleViewY] = useState(0)
-    const [dragElement, setDragElement] = useState(null)
-    const [lastTarget, setLastTarget] = useState(null)
-    const [startOffsetY, setStartOffsetY] = useState(0)
-    const [startPageY, setStartPageY] = useState(0)
-    const [dragIndex, setDragIndex] = useState(-1)
-    const [scrollThreshold, setScrollThreshold] = useState(0.5)
-    const upperThreshold = 100
-    const lowThreshold = 100
-    const [duration, setDuration] = useState(1000)
-    const [canScroll, setCanScroll] = useState(true)
-    const [changedIndex, setChangedIndex] = useState(-1)
-    const [hiddenContent, setHiddenContent] = useState(false)
-
-    const [scrollTop, setScrollTop] = useState(0)
-    const [contentY, setContentY] = useState(0)
-    const [contentHeight, setContentHeight] = useState(0)
-    const ref = useRef(null)
-
-    useEffect(() => {
-        const query = Taro.createSelectorQuery();
-        query.select('#myScrollView').boundingClientRect();
-        query.exec((res) => {
-            setContentY(res[0].top)
-            setContentHeight(res[0].height)
-        })
-    }, [])
-
-    function longPress(e, index) {
-        setChangedIndex(index)
-        setStartOffsetY(e.target.offsetTop)
-        setStartPageY(e.touches[0].pageY)
-        setDragIndex(index)
-        setDragElement(list[index])
-        setMovaleViewY(e.target.offsetTop)
-        setCanScroll(false)
-    }
-
-    function touchMove(e) {
-        if (dragElement) {
-            let clientY = e.touches[0].clientY;
-            pageScroll(clientY);
-            let pageY = e.touches[0].pageY;
-            let targetMoveDistance = pageY - startPageY
-            let movaleViewY2 = startOffsetY + targetMoveDistance
-
-            let targetIndex = computeFutureIndex(targetMoveDistance, dragIndex)
-            if (targetIndex !== false && targetIndex != changedIndex) {
-                var temps = swapListItems(list, targetIndex, changedIndex)
-                setList(temps)
-                setChangedIndex(targetIndex)
-
-            }
-
-            if (targetIndex === false && targetIndex != changedIndex) {
-                var temps = swapListItems(list, dragIndex, changedIndex)
-                setList(temps)
-                setChangedIndex(dragIndex)
-            }
-
-            setMovaleViewY(movaleViewY2)
-            setLastTarget(targetIndex as any)
-            setHiddenContent(true)
-        }
-    }
-
-    function pageScroll(clientY) {
-        console.log(clientY,contentY,contentHeight)
-        if ((clientY - contentY) + upperThreshold >= contentHeight) {
-            // console.log('ccc',(clientY - contentY) + props.itemHeight);
-            // var scroll = ref.current
-            // debugger
-            // (ref.current as any).scrollTo({scrollTop:100})
-            // setScrollTop((clientY - contentY) + props.itemHeight)
-            setScrollTop(2200)
-            setCanScroll(true)
-        }
-        else if ((clientY - contentY) - lowThreshold <= 0) {
-            setScrollTop((clientY - contentY) - props.itemHeight)
-            setCanScroll(true)
-        }
-        else {
-            setCanScroll(true)
-        }
-    }
-
-    function swapListItems<T>(list: T[], index1: number, index2: number): T[] {
-        const newList = [...list];
-        const temp = newList[index1];
-        newList[index1] = newList[index2];
-        newList[index2] = temp;
-
-        return newList;
-    }
-
-
-    function touchEnd(e) {
-        if (dragElement) {
-            // let pageY = e.changedTouches[0].pageY
-            // let targetMoveDistance = pageY - startPageY;
-            // let dragElementIndex = dragIndex;
-            // const futrueIndex = computeFutureIndex(targetMoveDistance, dragElementIndex)
-            // if (futrueIndex !== false) {
-            //     var temps = list
-            //     temps.splice(futrueIndex, 0, temps.splice(dragIndex, 1)[0])
-
-            //     setList(temps)
-            // }
-            setDragElement(null)
-            setLastTarget(null)
-            setDragIndex(-1)
-
-        }
-        setChangedIndex(-1)
-        setCanScroll(true)
-        setHiddenContent(false)
-    }
-
-    function computeFutureIndex(targetMoveDistance, dragElementIndex) {
-        let willInsertAfter = getSwapDirection(targetMoveDistance);
-        if (willInsertAfter !== false) {
-            /** 偏移索引 */
-            let offsetElementIndex = dragElementIndex + willInsertAfter;
-            /** 移动步数 */
-            let step = targetMoveDistance / props.itemHeight;
-            /** 步数补偿,当只有移动距离超过单项 _scrollThreshold 时才算有效 */
-            if (step <= -1) {
-                step += scrollThreshold;
-            } else if (step >= 1) {
-                step -= scrollThreshold;
-            }
-            /** 目标索引 */
-            let futureIndex = parseInt(step) + offsetElementIndex;
-
-            // 避免越界
-            if (futureIndex < 0) {
-                futureIndex = 0;
-            } else if (futureIndex > list.length - 1) {
-                futureIndex = list.length - 1;
-            }
-
-            return futureIndex;
-        } else {
-            return willInsertAfter;
-        }
-    }
-
-    function getSwapDirection(targetMoveDistance) {
-        if (Math.abs(targetMoveDistance) < props.itemHeight / 2) {
-            // 轻轻拂动,滑动距离小于1/2单项高度
-            return false;
-        } else if (targetMoveDistance >= props.itemHeight / 2) {
-            // console.log('[_getSwapDirection] 👇👇👇');
-            return 1;  // 下滑
-        } else if (targetMoveDistance <= props.itemHeight / -2) {
-            // console.log('[_getSwapDirection] 👆👆👆');
-            return -1;  // 上滑
-        }
-    }
-
-    return <ScrollView id="myScrollView" ref={ref} scrollY={canScroll} style={{ height: 400 }} scrollTop={scrollTop}>
-        <MovableArea style={{ height: list.length * props.itemHeight }}>
-            {list.map((item, index) => {
-                var className = 'demo_item'
-                if (lastTarget == index) {
-                    className += ' last_item'
-                }
-
-                if (dragIndex == index) {
-                    className += ' drag_item'
-
-                    // console.log(className)
-                }
-                return <View style={{ opacity: changedIndex == index && hiddenContent ? 0 : 1, height: props.itemHeight }}
-                    className={className}
-                    onLongPress={(e) => longPress(e, index)}
-                    onTouchMove={(e) => touchMove(e)}
-                    onTouchEnd={(e) => touchEnd(e)}
-                >{item}</View>
-            })}
-            <MovableView style={{ height: props.itemHeight }}
-                direction='vertical'
-                disabled
-                animation={false}
-                y={movaleViewY}
-            >
-                <View className='demo_item' style={{ backgroundColor: ColorType.fast }}>
-                    {dragElement}
-                </View>
-            </MovableView>
-        </MovableArea>
-    </ScrollView>
-}

+ 0 - 274
src/features/trackTimeDuration/components/ClockHeader.tsx

@@ -1,274 +0,0 @@
-import { useTranslation } from "react-i18next";
-import TitleView from "./TitleView";
-import Taro from "@tarojs/taro";
-import { setScenario, setStep } from "@/store/scenario";
-import { updateScenario } from "@/store/time";
-import { jumpPage } from "../hooks/Common";
-import { useDispatch, useSelector } from "react-redux";
-import { useEffect, useRef, useState } from "react";
-import { durationDatas, durationIndex, getColor, getDurationTitle } from "../hooks/Console";
-import { PageContainer, View } from "@tarojs/components";
-import PickerViews from "@/components/input/PickerViews";
-import Modal from "@/components/layout/Modal.weapp";
-import { ColorType } from "@/context/themes/color";
-import { getPlans, updateRecord } from "@/services/trackTimeDuration";
-import showActionSheet from "@/components/basic/ActionSheet";
-import { chooseMode, initTarget, updateStep } from "@/store/set_target";
-
-
-let GradientText
-let useNavigation;
-let useActionSheet;
-
-if (process.env.TARO_ENV == 'rn') {
-    GradientText = require('@/components/basic/GradientText').default
-    useNavigation = require("@react-navigation/native").useNavigation
-    useActionSheet = require('@expo/react-native-action-sheet').useActionSheet
-}
-
-export default function ClockHeader(props: { homeData: any }) {
-    const user = useSelector((state: any) => state.user);
-    const time = useSelector((state: any) => state.time);
-    const ring = useSelector((state: any) => state.ring);
-    const [fastPickerValue, setFastPickerValue] = useState([0, 0])
-    const [sleepPickerValue, setSleepPickerValue] = useState([0, 0])
-    const [fastDuration, setFastDuration] = useState<number>(0);
-    const [sleepDuration, setSleepDuration] = useState<number>(0);
-    const [showDurationPicker, setShowDurationPicker] = useState(false)
-    const [showEditPicker, setShowEditPicker] = useState(false)
-    const [currentRecord, setCurrentRecord] = useState(null)
-    const [isFast, setIsFast] = useState(true)
-    const common = useSelector((state: any) => state.common);
-    const durationPickerRef = useRef(null)
-    const isFastFirst = true;
-
-
-    const dispatch = useDispatch();
-    const { t } = useTranslation()
-    let navigation, showActionSheetWithOptions;
-    if (useNavigation) {
-        navigation = useNavigation()
-        showActionSheetWithOptions = useActionSheet()
-    }
-
-    useEffect(() => {
-        if (props.homeData) {
-            setCurrentRecord(props.homeData.current_record)
-            getStateDetail()
-        }
-
-    }, [props.homeData])
-
-    function getStateDetail() {
-        var current_record = props.homeData.current_record
-        if (current_record.fast) {
-            var fastCount = current_record.fast.target_end_time - current_record.fast.target_start_time
-            setFastDuration(fastCount)
-            setFastPickerValue(durationIndex(current_record.fast.target_start_time, current_record.fast.target_end_time, common))
-        }
-        if (current_record.sleep) {
-            var sleepCount = current_record.sleep.target_end_time - current_record.sleep.target_start_time
-            setSleepDuration(sleepCount)
-            setSleepPickerValue(durationIndex(current_record.sleep.target_start_time, current_record.sleep.target_end_time, common))
-        }
-
-    }
-
-    function tapAddBtn() {
-        showActionSheet({
-            showActionSheetWithOptions: showActionSheetWithOptions,
-            itemList: [
-                t('feature.track_time_duration.action_sheet.switch_scenario'),
-                t('feature.track_time_duration.action_sheet.suggest_schedule'),
-                t('feature.track_time_duration.action_sheet.change_schedule')
-            ],
-            success: (res) => {
-                switch (res) {
-                    case 0:
-                        if (time.status != 'WAIT_FOR_START') {
-                            Taro.showToast({
-                                title: t('feature.common.toast.ongoing'),
-                                icon: 'none'
-                            })
-                            return;
-                        }
-                        jumpPage('/pages/clock/ChooseScenario?trigger_event=SETUP_AFTER_ACCOUNT_CREATION', 'ChooseScenario', navigation, {
-                            trigger_event: 'SETUP_AFTER_ACCOUNT_CREATION'
-                        })
-                        break;
-                    case 1:
-                        if (time.status != 'WAIT_FOR_START') {
-                            Taro.showToast({
-                                title: t('feature.common.toast.ongoing'),
-                                icon: 'none'
-                            })
-                            return;
-                        }
-                        getPlans().then(res => {
-                            const data = res as { scenarios: any[] };
-                            console.log(data)
-                            var targets: any = {}
-                            data.scenarios.forEach((item) => {
-                                if (item.name == 'FAST') {
-                                    if (item.schedule.fast.duration.prev_input) {
-                                        item.schedule.fast.duration.last_value = item.schedule.fast.duration.init_value
-                                    }
-                                    targets.fast = item
-                                }
-                                else if (item.name == 'SLEEP') {
-                                    targets.sleep = item
-                                }
-                            })
-                            dispatch(initTarget(targets))
-                            dispatch(updateStep({ step: 0 }))
-                            dispatch(chooseMode({ isMixed: ring.current_record.scenario == 'FAST_SLEEP' }))
-                            jumpPage(`/pages/clock/Suggest?trigger_event=SETUP_AFTER_ACCOUNT_CREATION`, 'Suggest', navigation, {
-                                trigger_event: 'SETUP_AFTER_ACCOUNT_CREATION'
-                            })
-                        })
-
-                        break;
-                    case 2:
-                        if (time.status != 'WAIT_FOR_START') {
-                            Taro.showToast({
-                                title: t('feature.common.toast.ongoing'),
-                                icon: 'none'
-                            })
-                            return;
-                        }
-                        getPlans().then(res => {
-                            const data = res as { scenarios: any[] };
-                            console.log(data)
-                            var targets: any = {}
-                            data.scenarios.forEach((item) => {
-                                if (item.name == 'FAST') {
-                                    if (item.schedule.fast.duration.prev_input) {
-                                        item.schedule.fast.duration.last_value = item.schedule.fast.duration.init_value
-                                    }
-                                    targets.fast = item
-                                }
-                                else if (item.name == 'SLEEP') {
-                                    targets.sleep = item
-                                }
-                            })
-                            dispatch(initTarget(targets))
-                            dispatch(updateStep({ step: 2 }))
-                            dispatch(chooseMode({ isMixed: ring.current_record.scenario == 'FAST_SLEEP' }))
-                            jumpPage(`/pages/clock/SetGoal?upgrade=true&isSelf=1&trigger_event=SETUP_AFTER_ACCOUNT_CREATION`, 'SetGoal', navigation, {
-                                trigger_event: 'SETUP_AFTER_ACCOUNT_CREATION',
-                                upgrade: true,
-                                isSelf: 1
-                            })
-                        })
-                        break;
-                }
-            }
-        })
-    }
-
-    function durationPickerContent() {
-        var color = getColor(currentRecord)
-        var title = getDurationTitle(currentRecord, 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)
-                }} />
-        </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)
-                }} />
-        </View>
-    }
-
-    function durationChange(e) {
-        // debugger
-        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)
-        }
-        else {
-            var params: any = {}
-            if (isFast) {
-                params = {
-                    fast: {
-                        target_duration: count * 60 * 1000
-                    }
-                }
-            }
-            else {
-                params = {
-                    sleep: {
-                        target_duration: count * 60 * 1000
-                    }
-                }
-            }
-            updateRecord({
-                ...params
-            }, (currentRecord as any).id).then(res => {
-                global.indexPageRefresh()
-                if (global.refreshStreaks){
-                    global.refreshStreaks()
-                }
-            }).catch(e => {
-
-            })
-        }
-        setShowDurationPicker(false)
-        setShowEditPicker(false)
-    }
-
-    function modalContent() {
-        if (showDurationPicker || showEditPicker) {
-            return <Modal
-                testInfo={null}
-                dismiss={() => {
-                    setShowDurationPicker(false)
-                    setShowEditPicker(false)
-                }}
-                confirm={() => { }}>
-                {
-                    showDurationPicker ? durationPickerContent() : editPickerContent()
-                }
-            </Modal>
-
-        }
-        return <View />
-    }
-
-    /*function headerView() {
-        return <TitleView title={t('page.metric.title')} showAddBtn={loaded && !showErrorPage ? true : false} onClick={addBtnClick}>
-        </TitleView>
-    }*/
-
-
-    return <View>
-        <TitleView title={t('page.clock.title')} onClick={tapAddBtn} showAddBtn={user.isLogin ? true : false}>
-
-        </TitleView>
-        {
-            modalContent()
-        }
-    </View>
-}

+ 0 - 36
src/features/trackTimeDuration/components/Discovery.scss

@@ -1,36 +0,0 @@
-.food_btn1{
-    // margin-left: 46px;
-    // margin-right: 46px;
-    height: 84px;
-    border-radius: 42px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    margin-bottom: 36px;
-
-}
-
-.duration_bg3 {
-    margin-left: 50px;
-    display: flex;
-    flex-direction: column;
-    // align-items: center;
-    justify-content: center;
-    flex: 1;
-}
-
-.duration_title2 {
-    font-size: 32px;
-    line-height: 32px;
-    color: #fff;
-    font-weight: 400;
-    opacity: 0.6;
-}
-
-.duration_value2 {
-    margin-top: 2px;
-    font-size: 36px;
-    line-height: 36px;
-    font-weight: 500;
-    margin-bottom: 8px;
-}

+ 0 - 559
src/features/trackTimeDuration/components/Discovery.tsx

@@ -1,559 +0,0 @@
-import { View, Text, Image, Switch } from "@tarojs/components";
-import { bigRingRadius, dotIsOuterRange, getBgRing, getCommon, getDot, getReal, getSchedule, getTarget, ringWidth, smallRingRadius, thirdRingRadius } from "@/features/trackTimeDuration/hooks/RingData";
-import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
-import { ColorType } from "@/context/themes/color";
-import { useDispatch, useSelector } from "react-redux";
-import Rings from "@/features/trackTimeDuration/components/Rings";
-import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
-import { rpxToPx } from "@/utils/tools";
-import { useEffect, useState } from "react";
-import Taro, { useDidHide, useDidShow } from "@tarojs/taro";
-import './Discovery.scss'
-import { useTranslation } from "react-i18next";
-import { TimeFormatter } from "@/utils/time_format";
-import { getPerm, uploadPerm } from "@/services/user";
-import Box from "@/components/layout/Box";
-import { getPlans, setPlan } from "@/services/trackTimeDuration";
-import DayNightCard from "@/features/daynight/DayNightCard";
-import { clearDayStore } from "@/store/day";
-import { AtActivityIndicator } from "taro-ui";
-import NoData from "@/components/view/NoData";
-import AllRings from "../../daynight/AllRings";
-import AllDayRings from "../../daynight/AllDayRings";
-import '@utils/ring_card.scss'
-// import AtActivityIndicator from "taro-ui/types/activity-indicator";
-
-
-let useNavigation;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-
-let pauseTimer = false
-
-const defaultValue = `{"scenarios":[{"name":"FAST","count":0,"schedule":{"fast":{"start_time":"15:00","end_time":"08:00"}}},{"name":"SLEEP","count":0,"schedule":{"sleep":{"start_time":"22:00","end_time":"07:00"}}},{"name":"FAST_SLEEP","count":0,"schedule":{"fast":{"start_time":"15:00","end_time":"08:00"},"sleep":{"start_time":"22:00","end_time":"07:00"}}}],"select_count":0,"theme_color":{"fast":"#00FFFF","sleep":"#8183FF"}}`
-
-export default function Discovery() {
-    const user = useSelector((state: any) => state.user);
-    const day = useSelector((state: any) => state.day);
-    const ring = useSelector((state: any) => state.ring);
-    const [schedule, setSchedule] = useState(null)
-    const [count, setCount] = useState(0)
-    const [loaded, setLoaded] = useState(false)
-    const [showErrorPage, setErrorPage] = useState(false)
-    const dispatch = useDispatch();
-    const { t } = useTranslation()
-
-    let navigation;
-    let timeStamp = new Date().getTime()
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    useEffect(() => {
-
-        setInterval(() => {
-            if (global.pauseIndexTimer || pauseTimer) {
-                return
-            }
-            setCount((prevCounter) => prevCounter + 1)
-
-        }, 1000)
-    }, [])
-
-    useDidShow(() => {
-        setCount(pre => pre + 1)
-        //resume timer
-        pauseTimer = false
-    })
-
-    useDidHide(() => {
-        //pause timer
-        pauseTimer = true
-    })
-
-    useEffect(() => {
-        if (!user.isLogin) {
-            dispatch(clearDayStore());
-        }
-    }, [user.isLogin])
-
-    // useEffect(() => {
-    //     setSchedule(global.homeData.scenarios)
-    // }, [global.homeData])
-
-    useEffect(() => {
-        getPlanData()
-        setCount(pre => pre + 1)
-    }, [user.isLogin])
-
-    function getPlanData() {
-        getPlans().then(res => {
-            setSchedule((res as any).scenarios)
-            setLoaded(true)
-            setErrorPage(false)
-        }).catch(e => {
-            setSchedule(JSON.parse(defaultValue))
-            setLoaded(true)
-            setErrorPage(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={'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={'day_small'} />
-    }
-    function dayRing() {
-        var common = getCommon(null, true)
-        common.radius = thirdRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-
-        const realRingBig: RealRing = {
-            color: ColorType.day + '66',
-            startArc: 0,
-            durationArc: 2
-        }
-        var sunRise = 6 * 60
-        var sunSet = 18 * 60
-
-
-
-        var sunRiseObj = day.dayRingSunrise
-        var sunSetObj = day.dayRingSunset
-        sunRise = parseInt(sunRiseObj.split(':')[0]) * 60 + parseInt(sunRiseObj.split(':')[1])
-        sunSet = parseInt(sunSetObj.split(':')[0]) * 60 + parseInt(sunSetObj.split(':')[1])
-
-
-        var duration = sunSet - sunRise
-
-        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)
-        var date = new Date()
-        var minutes = date.getHours() * 60 + date.getMinutes()
-        if (minutes < sunRise) {
-            minutes += 1440
-        }
-
-        currentDot.color = ColorType.day
-
-
-        var now = new Date()
-        var t = now.getHours() * 60 + now.getMinutes()
-        var duration2 = t - sunRise
-        if (duration2 < 0) {
-            duration2 += 24 * 60
-        }
-        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 (day.dayRingDate) {
-            if (new Date(day.dayRingDate).getDate() != new Date().getDate()) {
-                realRing = null;
-            }
-        }
-
-        if (!user.isLogin) {
-            currentDot = null
-            realRing = null
-        }
-
-        return <Rings common={common} bgRing={bgRing} targetRing={realRingBig} realRing={duration2 <= duration ? realRing : null} currentDot={currentDot} canvasId={'day_day'} />
-    }
-
-    function goAcitivity() {
-        if (user.isLogin) {
-            jumpPage('/pages/workout/Workout', 'Workout', navigation)
-            return
-        }
-        jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
-    }
-
-    function goFood() {
-        if (user.isLogin) {
-            jumpPage('/pages/food/Food', 'Food', navigation)
-            return
-        }
-        jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
-    }
-
-    function dayDuration() {
-        var sunRiseObj = day.dayRingSunrise
-        var sunSetObj = day.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
-
-        return TimeFormatter.calculateTimeDifference(new Date().getTime(), new Date().getTime() + duration);
-    }
-
-    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()
-                        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 rings() {
-        return <View style={{
-            position: 'relative', zIndex: 1,
-            marginLeft: day.showDayRing && false ? -6 : 0,
-        }}>
-            {
-                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>
-            }
-            {
-                day.showDayRing && false && <View style={{ display: 'flex', position: 'absolute', left: -14, top: -14, right: -14, bottom: -14 }}>
-                    {
-                        dayRing()
-                    }
-                </View>
-            }
-
-        </View>
-    }
-
-    if (!loaded) {
-        return <View style={{ width: rpxToPx(750), height: rpxToPx(900), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
-            <AtActivityIndicator size={40} color="#fff" />
-        </View>
-    }
-
-    return <View style={{ display: 'flex', flexDirection: 'column' }}>
-        <Box>
-            <View>
-                <View className="ring_full_container">
-
-                    <View style={{
-                        display: 'flex',
-                        flexDirection: 'row',
-                        marginTop: day.showDayRing && false ? -6 : 0,
-                        marginBottom: day.showDayRing && false ? -6 : 0,
-                        padding: day.showDayRing && false ? 14 : 0,
-                        alignItems: 'center'
-                    }}>
-                        {
-                            schedule && rings()
-                        }
-                        {schedule && <View className="duration_bg3"
-                            style={{ marginLeft: day.showDayRing && false ? rpxToPx(68) : rpxToPx(52), height: bigRingRadius * 2, overflow: 'visible' }}>
-                            {
-                                day.showDayRing && false && <Text className="duration_title2">{t('feature.common.day')}</Text>
-                            }
-                            {
-                                day.showDayRing && false &&
-                                <Text className="duration_value2" style={{ color: ColorType.day }}>{dayDuration()}</Text>
-                            }
-                            {
-                                ring.current_record && ring.current_record.scenario != 'SLEEP' && <Text className="duration_title2">{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">{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 className="food_btn1" style={{ backgroundColor: ColorType.food }} onClick={goFood}>
-                    <Text style={{ fontWeight: 'bold',color:'#000' }}>{t('page.food.title')}</Text>
-                </View>
-                <View className="food_btn1" style={{ backgroundColor: ColorType.activity, marginBottom: 0 }} onClick={goAcitivity}>
-                    <Text style={{ fontWeight: 'bold',color:'#000' }}>{t('page.workout.title')}</Text>
-                </View>
-
-            </View>
-        </Box>
-
-        {/* <DayNightCard isNight={false} count={count} />
-        {
-            user.isLogin && <AllDayRings schedule={schedule} />
-        } */}
-        {
-            showErrorPage && <NoData refresh={() => { getPlanData() }} />
-        }
-
-    </View>
-}

+ 0 - 109
src/features/trackTimeDuration/components/IndexItem.scss

@@ -1,109 +0,0 @@
-
-.time_operate_item1{
-    // padding-top: 40px;
-    // padding-bottom: 40px;
-    // margin-left: 46px;
-    // margin-right: 46px;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    // background-color: $boxColor;
-    // border-radius: $boxBorderRadius;
-    // padding-left: 40px;
-    // padding-right: 40px;
-    // margin-bottom: 16px;
-}
-
-.modalTitle1{
-    font-size: 40px;
-    line-height: 40px;
-}
-
-.segment_detail{
-    width: 578px;
-}
-
-
-/* #ifdef weapp */
-.top_tag_bg {
-    position: absolute;
-    right: -10px;
-    top: -24px;
-}
-
-/* #endif */
-
-/* #ifdef rn */
-.top_tag_bg {
-    //top 12 right 20
-    position: absolute;
-    // right: -30px;
-    // top: -46px;
-    top:-22px;
-    right: 10px;
-}
-/* #endif */
-
-.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;
-}
-
-.duration_bg2 {
-    margin-left: 50px;
-    display: flex;
-    flex-direction: column;
-    // align-items: center;
-    justify-content: center;
-    flex: 1;
-}
-
-.duration_title2 {
-    font-size: 32px;
-    line-height: 32px;
-    color: #fff;
-    font-weight: 400;
-    opacity: 0.6;
-}
-
-.duration_value2 {
-    margin-top: 2px;
-    font-size: 36px;
-    line-height: 36px;
-    font-weight: 500;
-    margin-bottom: 8px;
-}
-
-.arrow2 {
-    width: 40px;
-    height: 40px;
-    opacity: 0.4;
-}
-
-.recordTime {
-
-    font-size: 28px;
-    line-height: 28px;
-    height: 28px;
-    color: #ffffff;
-    opacity: 0.4;
-    font-weight: 400;
-
-}
-
-.record_arrow_bg {
-    position: absolute;
-    right: -10px;
-    bottom: -16px;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    height: 40px;
-    width: 400px;
-}

+ 0 - 520
src/features/trackTimeDuration/components/IndexItem.tsx

@@ -1,520 +0,0 @@
-import { View, Text, Image, PageContainer } from "@tarojs/components";
-import { bigRingRadius, getBgRing, getCommon, getDot, getReal, getSchedule, getTarget, ringWidth, smallRingRadius, thirdRingRadius, timeTotimestamp } from "../hooks/RingData";
-import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
-import Rings from "./Rings";
-import './IndexItem.scss'
-import { useTranslation } from "react-i18next";
-import { ColorType } from "@/context/themes/color";
-import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
-import { TimeFormatter } from "@/utils/time_format";
-import '@/utils/ring_card.scss';
-import { useSelector } from "react-redux";
-import { useEffect, useState } from "react";
-import Taro from "@tarojs/taro";
-import Modal from "@/components/layout/Modal.weapp";
-import { ModalType } from "@/utils/types";
-import TimelineStage from "./TimelineStage";
-import CircadianDetailPopup from "@/features/trackTimeDuration/components/CircadianDetailPopup";
-import { rpxToPx } from "@/utils/tools";
-import CircadianStatus from "./CircadianStatus";
-
-let useNavigation;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-}
-
-export default function Component(props: { type: string, data: any, time: any, showStage?: boolean }) {
-    const { t } = useTranslation()
-    const [record, setRecord] = useState(props.data.current_record);
-    const user = useSelector((state: any) => state.user);
-    const dayNight = useSelector((state: any) => state.night);
-    const day = useSelector((state: any) => state.day);
-    const ring = useSelector((state: any) => state.ring);
-    const [stageList, setStageList] = useState([true, false, false])
-    const [isStageMode, setIsStageMode] = useState(false)
-    const [showDetailModal, setShowDetailModal] = useState(false)
-    const [count, setCount] = useState(0)
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-    useEffect(() => {
-        setRecord(props.data.current_record)
-    }, [props.data])
-
-    useEffect(() => {
-        setCount((pre) => pre + 1)
-    }, [dayNight.nightRingSunrise, dayNight.nightRingSunset])
-
-
-    useEffect(() => {
-        if (props.type == 'FAST_SLEEP') {
-            global.updateMixItem = (data) => {
-                setStageList(data)
-            }
-
-            global.changeMixIndex = (index) => {
-                setIsStageMode(index == 1)
-            }
-        }
-    }, [])
-
-
-    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'
-
-                var detail = timeTotimestamp(scenario)
-
-                if (stageList[0]) {
-
-                    const realRingBig: RealRing = {
-                        color: global.fastColor ? global.fastColor : ColorType.fast,
-                        startArc: startArc(detail.fast.target_start_time),
-                        durationArc: durationArc(detail.fast.target_start_time, detail.sleep.target_start_time)
-                    }
-
-                    list.push(realRingBig)
-                }
-                if (stageList[1]) {
-                    const realRingBig: RealRing = {
-                        color: global.fastColor ? global.fastColor : ColorType.fast,
-                        startArc: startArc(detail.sleep.target_start_time),
-                        durationArc: durationArc(detail.sleep.target_start_time, detail.sleep.target_end_time)
-                    }
-
-                    list.push(realRingBig)
-                }
-                if (stageList[2]) {
-                    const realRingBig: RealRing = {
-                        color: global.fastColor ? global.fastColor : ColorType.fast,
-                        startArc: startArc(detail.sleep.target_end_time),
-                        durationArc: durationArc(detail.sleep.target_end_time, detail.fast.target_end_time)
-                    }
-
-                    list.push(realRingBig)
-                }
-            }
-            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={isStageMode ? null : currentDot1} stageList={list} realRing={realRing1} canvasId={props.type + 'index_big'} />
-        }
-        var realRing1 = getReal(record, true, false)
-        return <Rings common={common} bgRing={bgRing} realRing={realRing1} currentDot={currentDot1} targetRing={targetBigRing1} canvasId={props.type + '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.type == 'SLEEP' || 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={props.type + '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 == 'ONGOING1') {
-                //     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}`
-                //     }
-                // }
-
-
-                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={isStageMode ? null : currentDot} realRing={realRing} canvasId={props.type + '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={props.type + '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={props.type + 'index_small'} realRing={realRing} />
-            }
-            else if (record.sleep.status == 'ONGOING2') {
-                var currentDot = getDot(record, false)
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={props.type + 'index_small'} />
-            }
-            return <Rings common={common} bgRing={bgRing} canvasId={props.type + '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={props.type + 'index_small'} />
-            }
-            if (record.status == 'ONGOING3') {
-                currentDot.color = 'rgba(0, 255, 255, 0.5)'
-            }
-            return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={props.type + 'index_small'} />
-        }
-
-    }
-
-    function dayRing() {
-        var common = getCommon(null, true)
-        common.radius = thirdRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-
-        let realRingBig: RealRing = {
-            color: ColorType.night + '66',
-            startArc: 0,
-            durationArc: 2
-        }
-        var sunRise = 24 * 60 + 6 * 60
-        var sunSet = 18 * 60
-
-        var sunRiseObj = dayNight.nightRingSunrise
-        var sunSetObj = dayNight.nightRingSunset
-        sunRise = 24 * 60 + parseInt(sunRiseObj.split(':')[0]) * 60 + parseInt(sunRiseObj.split(':')[1])
-        sunSet = parseInt(sunSetObj.split(':')[0]) * 60 + parseInt(sunSetObj.split(':')[1])
-        if (sunSetObj.indexOf('PM') != -1) {
-            sunSet += 12 * 60
-        }
-        // }
-        var duration = sunRise - sunSet
-        realRingBig.startArc = (sunSet * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
-        realRingBig.durationArc = (duration * 60) / (24 * 3600) * 2 * Math.PI;
-
-        var currentDot = getDot(record, false)
-        currentDot.color = ColorType.night
-
-        var now = new Date()
-        var t = now.getHours() * 60 + now.getMinutes()
-        var duration2 = t - sunSet
-        if (duration2 < 0) {
-            duration2 += 24 * 60
-        }
-        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 (dayNight.nightRingDate) {
-        //     if (new Date(dayNight.nightRingDate).getDate() == new Date().getDate() && new Date().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.type + 'index_day'} />
-    }
-
-    function rings() {
-        return <View style={{
-            position: 'relative', zIndex: 1,
-            marginLeft: !props.showStage && global.showNightRing === true && false ? -6 : 0,
-        }}>
-            {
-                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>
-            }
-            {
-                !props.showStage && day.showDayRing === true && false && <View style={{ display: 'flex', position: 'absolute', left: -14, top: -14, right: -14, bottom: -14 }}>
-                    {
-                        dayRing()
-                    }
-                </View>
-            }
-
-        </View>
-    }
-
-    function getDuration(obj) {
-        if (!obj) {
-        }
-        if (obj.status == 'NOT_STARTED' || obj.status == 'NOT_COMPLETED') {
-            return ''
-        }
-        var start = obj.real_start_time
-        var end = obj.real_end_time
-        if (!end) {
-            end = (new Date()).getTime()
-        }
-        if (obj.status == 'WAIT_FOR_START') {
-            start = obj.target_start_time
-            end = obj.target_end_time
-        }
-        return TimeFormatter.durationFormate(start, end)
-        // return TimeFormatter.calculateTimeDifference(start, end)
-    }
-
-    function fastDuration() {
-        if (!record.fast) {
-            return ''
-        }
-        if (!user.isLogin && record.sleep) {
-            var count = 0
-            if (stageList[0]) {
-
-                count = record.sleep.target_start_time - record.fast.target_start_time
-            }
-            if (stageList[1]) {
-                count += record.sleep.target_end_time - record.sleep.target_start_time
-            }
-            if (stageList[2]) {
-                count += record.fast.target_end_time - record.sleep.target_end_time
-            }
-            if (count == 0) {
-                return t('feature.track_time_duration.stage.no_stage_selected')
-            }
-            global.fastDuration = TimeFormatter.durationFormate(new Date().getTime(), new Date().getTime() + count)//`${count}小时`
-            return TimeFormatter.durationFormate(new Date().getTime(), new Date().getTime() + count)//`${count}小时`
-        }
-        if (record.fast.status == 'WAIT_FOR_END') {
-            global.fastDuration = TimeFormatter.countdown(record.fast.real_start_time)
-            return TimeFormatter.countdown(record.fast.real_start_time)
-            // return TimeFormatter.formateTimeDifference(record.fast.real_start_time, new Date().getTime(), false)
-        }
-        if (isStageMode && record.scenario == 'FAST_SLEEP') {
-            if (stageList[0]) {
-                return TimeFormatter.durationFormate(record.fast.target_start_time, record.sleep.target_start_time)
-            }
-            if (stageList[1]) {
-                return TimeFormatter.durationFormate(record.sleep.target_start_time, record.sleep.target_end_time)
-            }
-            if (stageList[2]) {
-                return TimeFormatter.durationFormate(record.sleep.target_end_time, record.fast.target_end_time)
-            }
-        }
-        global.fastDuration = getDuration(record.fast)
-        return getDuration(record.fast)
-    }
-
-    function sleepDuration() {
-        if (!record.sleep) {
-            return ''
-        }
-        if (record.sleep.status == 'WAIT_FOR_END') {
-            global.sleepDuration = TimeFormatter.formateTimeDifference(record.sleep.real_start_time, new Date().getTime(), false)
-            return TimeFormatter.formateTimeDifference(record.sleep.real_start_time, new Date().getTime(), false)
-        }
-        global.sleepDuration = getDuration(record.sleep)
-        return getDuration(record.sleep)
-    }
-
-    function nightDuration() {
-
-        var sunRiseObj = dayNight.nightRingSunrise
-        var sunSetObj = dayNight.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
-
-        return TimeFormatter.calculateTimeDifference(new Date().getTime(), new Date().getTime() + duration);
-    }
-
-
-    function goDetail(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        if (!user.isLogin) {
-            jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
-            return
-        }
-        setShowDetailModal(true)
-    }
-
-    function modalContent() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                global.pauseIndexTimer = false
-                setShowDetailModal(false)
-            }}
-            confirm={() => { }}>
-            {
-                <CircadianDetailPopup
-                    record={record}
-                    schedule={props.data.scenario.schedule}
-                    onClose={() => { setShowDetailModal(false); }} />
-            }
-        </Modal>
-    }
-
-    return <View className="ring_full_container">
-
-        <View className="time_operate_item1" onClick={goDetail}>
-
-            <View className={!props.showStage && day.showDayRing === true && false ?
-                'fast_sleep_item three_ring_card_detail' : 'fast_sleep_item ring_card_detail'}>
-                {
-                    rings()
-                }
-                <View className='top_tag_bg'>
-                    <CircadianStatus data={props.data} />
-                </View>
-                <View className="duration_bg2" style={{ marginLeft: (!props.showStage && day.showDayRing === true && false) ? rpxToPx(68) : rpxToPx(52), height: bigRingRadius * 2, overflow: 'visible' }}>
-                    {
-                        !props.showStage && day.showDayRing === true && false &&
-                        <Text className="duration_title2">{t('feature.common.overnight')}</Text>
-                    }
-                    {
-                        !props.showStage && day.showDayRing === true && false &&
-                        <Text className="duration_value2" style={{ color: ColorType.night }}>{nightDuration()}</Text>
-                    }
-                    {
-                        (props.data.scenario.name == 'FAST' || props.data.scenario.name == 'FAST_SLEEP') && <Text className="duration_title2">{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" >{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>
-                <Image className="arrow2" src={require('@/assets/images/arrow3.png')} />
-
-
-            </View>
-            {
-                showDetailModal && modalContent()
-            }
-        </View>
-    </View>
-}

+ 0 - 200
src/features/trackTimeDuration/components/More.tsx

@@ -1,200 +0,0 @@
-import { View, Text } from "@tarojs/components";
-import Taro from "@tarojs/taro";
-import { forwardRef, useEffect, useRef, useState } from "react";
-import { useTranslation } from "react-i18next";
-import { useDispatch, useSelector } from "react-redux";
-import trackTimeService, { machine } from "@/store/trackTimeMachine"
-import { recordCheck } from "@/services/trackTimeDuration";
-import LimitPickers from "@/components/input/LimitPickers";
-import { endFast } from "../actions/TrackTimeActions";
-import Modal from "@/components/layout/Modal";
-import { setStep } from "@/store/scenario";
-import { TimeFormatter } from "@/utils/time_format";
-import { ColorType } from "@/context/themes/color";
-
-const Component = forwardRef((props, ref) => {
-    const isFastFirst = true;
-    const { t } = useTranslation()
-    const scenario = useSelector((state: any) => state.scenario);
-    const user = useSelector((state: any) => state.user);
-    const [isOpen, setIsOpen] = useState(false);
-    const [showModal, setShowModal] = useState(false);
-    const limitPickerRef = useRef<any>(null);
-    const dispatch = useDispatch();
-
-    useEffect(() => {
-        var value = trackTimeService.getSnapshot().value
-    }, [machine.context.currentStatus])
-
-    useEffect(() => {
-        trackTimeService.onTransition(state => {
-            var value = trackTimeService.getSnapshot().value
-        });
-    }, []);
-
-    function login() {
-        Taro.navigateTo({
-            url: '/_account/pages/ChooseAuth'
-        })
-    }
-
-    function waitActionSheet() {
-        Taro.showActionSheet({
-            itemList: [t('feature.track_time_duration.action_sheet.change_schedule'), t('feature.track_time_duration.action_sheet.switch_scenario')]
-        })
-            .then(res => {
-                switch (res.tapIndex) {
-                    case 0:
-                        if (scenario.name == 'FAST_SLEEP') {
-                            dispatch(setStep(isFastFirst ? 'fast' : 'sleep'))
-                        }
-                        else if (scenario.name == 'SLEEP') {
-                            dispatch(setStep('sleep'))
-                        }
-                        else {
-                            dispatch(setStep('fast'))
-                        }
-                        Taro.navigateTo({
-                            url: '/pages/clock/SetSchedule'
-                        })
-                        break;
-                    case 1:
-                        Taro.navigateTo({
-                            url: '/pages/clock/ChooseScenario'
-                        })
-                        break;
-                }
-            })
-            .catch(err => {
-                console.log(err.errMsg)
-            })
-    }
-
-    function endFastActionSheet() {
-        Taro.showActionSheet({
-            itemList: [t('feature.track_time_duration.action_sheet.end_fast')]
-        })
-            .then(res => {
-                console.log(res.tapIndex)
-                switch (res.tapIndex) {
-                    case 0:
-                        {
-                            setShowModal(true)
-                            setIsOpen(true)
-                            global.set_time = new Date().getTime()
-                        }
-                        break;
-                }
-            })
-            .catch(err => {
-                console.log(err.errMsg)
-            })
-    }
-
-    function checkActionSheetData() {
-        console.log('checkActionSheetData')
-        if (!user.isLogin) {
-            return login()
-        }
-        var state = trackTimeService.getSnapshot().value
-        if ((state as any).FAST_SLEEP === 'WAIT_FOR_START' ||
-            (state as any).FAST === 'WAIT_FOR_START' ||
-            (state as any).SLEEP === 'WAIT_FOR_START') {
-            waitActionSheet()
-        }
-        else if ((state as any).FAST_SLEEP === 'ONGOING1' ||
-            (state as any).FAST_SLEEP === 'ONGOING2') {
-            endFastActionSheet()
-        }
-        else if ((state as any).FAST_SLEEP === 'ONGOING3') {
-            // Taro.showToast({
-            //     title: '暂无更多操作',
-            //     icon: 'none',
-            //     duration: 2000
-            // })
-        }
-    }
-
-    global.checkActionSheetData = checkActionSheetData
-
-    function layoutContent() {
-        var limit = global.set_time - 7 * 3600 * 1000 * 24;
-        var current_record = machine.context.checkData ? (machine.context.checkData as any).current_record : null;
-        global.limit = limit
-        if (current_record && current_record.last_real_check_time) {
-            limit = current_record.last_real_check_time
-            global.limit = limit
-            
-            //当set_time秒数<=latest_record_time秒数时,最小限制时间戳需+1分钟
-            if (new Date(global.set_time).getSeconds() <= new Date(current_record.last_real_check_time).getSeconds()) {
-                limit = limit + 60 * 1000
-            }
-        }
-
-        
-        return <LimitPickers ref={limitPickerRef}
-        title = '结束断食'
-        themeColor={global.fastColor?global.fastColor:ColorType.fast}
-        limit={limit} onCancel={() => { setIsOpen(false); setShowModal(false) }} 
-        onChange={(e) => {
-            endFast(e)
-            setIsOpen(false)
-        }} />
-
-    }
-
-    function testLayout() {
-        var current_record = machine.context.checkData ? (machine.context.checkData as any).current_record : null;
-        if (current_record == null) {
-            return <View />
-        }
-        return <View style={{ color: '#fff', paddingTop: 30, paddingLeft: 30, display: 'flex', flexDirection: 'column' }}>
-            <Text>check scenario:fast</Text>
-            <Text>check type:end</Text>
-            <Text style={{ marginTop: 30 }}>picker restriction</Text>
-            <Text style={{ marginLeft: 50 }}>min:{TimeFormatter.formatTimestamp(global.limit)}</Text>
-            <Text style={{ marginLeft: 50 }}>pick:{TimeFormatter.formatTimestamp(global.picker_time)}</Text>
-            <Text style={{ marginLeft: 50 }}>max{TimeFormatter.formatTimestamp(global.set_time)}</Text>
-
-            <Text style={{ marginTop: 30 }}>now:{TimeFormatter.formatTimestamp(new Date().getTime())}</Text>
-            <Text>elapsed:{TimeFormatter.calculateTimeDifference(global.picker_time, new Date().getTime())}</Text>
-
-            <Text style={{ marginTop: 30 }}>real start:{TimeFormatter.formatTimestamp(current_record.fast.real_start_time)}</Text>
-            <Text>real duration:{TimeFormatter.calculateTimeDifference(current_record.fast.real_start_time, new Date().getTime())}</Text>
-        </View>
-    }
-
-    return (
-        <View ref={ref} style={{ width: '100%', marginTop: 20, marginBottom: 20, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
-            <Text onClick={checkActionSheetData}>More Component</Text>
-            {
-                showModal && isOpen && <Modal children={layoutContent()} dismiss={() => setIsOpen(false)}
-                    testInfo={testLayout()}
-                    confirm={() => {
-                        var picker = limitPickerRef.current;
-                        endFast((picker as any).getConfirmData());
-                        setIsOpen(false);
-                    }} />
-            }
-            {/* {
-                showModal && <AtFloatLayout
-                    isOpened={isOpen}
-                    onClose={() => {
-                        setIsOpen(false)
-                        setShowModal(false)
-                    }}
-                    title="">
-                    {
-                        layoutContent()
-                    }
-
-
-                </AtFloatLayout>
-            } */}
-
-        </View>
-    )
-}
-)
-
-export default Component;

+ 0 - 182
src/features/trackTimeDuration/components/RecordFastSleep.scss

@@ -1,182 +0,0 @@
-
-
-.time_operate_item {
-    padding-top: 40px;
-    padding-bottom: 40px;
-    margin-left: 46px;
-    margin-right: 46px;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    // background-color: $boxColor;
-    // border-radius: $boxBorderRadius;
-    padding-left: 40px;
-    padding-right: 40px;
-    margin-top: 20px;
-    position: relative;
-    overflow: hidden;
-    box-sizing: border-box;
-    // margin-bottom: 16px;
-}
-
-.btnDelete{
-    position: absolute;
-    right: 0;
-    top: 0;
-    bottom: 0;
-    width: 120px;
-    background-color: red;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    color: #fff;
-    text-align: center;
-    transition: all 0.2s;
-    transform: translateX(120px);
-}
-
-.btnDeleteAni{
-    transform: translateX(0);
-}
-
-.modalTitle1 {
-    font-size: 40px;
-    line-height: 40px;
-}
-
-.segment_detail {
-    width: 578px;
-}
-
-
-.fast_sleep_item1 {
-    // display: 'flex',position:'relative', flex-: 'row', alignItems: 'center'
-    display: flex;
-    position: relative;
-    flex-direction: row;
-    align-items: center;
-    width: 562px;
-    // padding-top: 20px;
-    // padding-bottom: 20px;
-}
-
-.duration_bg {
-    margin-left: 50px;
-    display: flex;
-    flex-direction: column;
-    flex: 1;
-}
-
-.duration_title {
-    font-size: 32px;
-    line-height: 32px;
-    color: #fff;
-    opacity: 0.6;
-    font-weight: 400;
-}
-
-.duration_value {
-    margin-top: 2px;
-    font-size: 36px;
-    line-height: 36px;
-    font-weight: 500;
-    margin-bottom: 12px;
-}
-
-.arrow2 {
-    width: 40px;
-    height: 40px;
-    opacity: 0.4;
-}
-
-.recordTime {
-
-    font-size: 28px;
-    line-height: 28px;
-    height: 28px;
-    color: #ffffff;
-    opacity: 0.4;
-    font-weight: 400;
-
-}
-
-.record_arrow_bg {
-    position: absolute;
-    right: -10px;
-    bottom: -16px;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    height: 40px;
-    width: 400px;
-}
-
-
-
-.single_check_nor {
-    margin-bottom: 16px;
-    height: 84px;
-    border-radius: 42px;
-    // border: solid 4px $fastColor;
-    box-sizing: border-box;
-    margin-left: 46px;
-    margin-right: 46px;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    padding-left: 44px;
-    padding-right: 44px;
-}
-
-.single_check_sel {
-    margin-bottom: 16px;
-    height: 84px;
-    border-radius: 42px;
-    // background-color: $fastColor;
-    margin-left: 46px;
-    margin-right: 46px;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    padding-left: 44px;
-    padding-right: 44px;
-    box-sizing: border-box;
-}
-
-.single_check_text_nor {
-    color: $fastColor;
-    font-weight: bold;
-    font-size: 32px;
-    flex: 1;
-}
-
-.single_check_text_sel {
-    color: #000;
-    font-weight: bold;
-    font-size: 32px;
-    flex: 1;
-}
-
-.single_checked {
-    width: 48px;
-    height: 48px;
-}
-
-.more_stage {
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    border-radius: 23px;
-    height: 46px;
-    padding-left: 24px;
-    padding-right: 24px;
-    background-color: #252525;
-    // margin-bottom: 20px;
-}
-
-.more_stage_text {
-    font-weight: bold;
-    color: $fastColor;
-    font-size: 20px;
-    line-height: 20px;
-}

+ 0 - 743
src/features/trackTimeDuration/components/RecordFastSleep.tsx

@@ -1,743 +0,0 @@
-import Box from "@/components/layout/Box";
-import Header from "@/components/layout/Header";
-import Modal from "@/components/layout/Modal.weapp";
-import RecordItem from "@/features/common/RecordItem";
-import { delRecord } from "@/services/trackTimeDuration";
-import { ModalType } from "@/utils/types";
-import { View, Text, Image, PageContainer } from "@tarojs/components";
-import Taro, { usePageScroll } from "@tarojs/taro";
-import { useEffect, useState, memo } from "react";
-import TimelineFastSleep from "./TimelineFastSleep";
-import { TimeFormatter } from "@/utils/time_format";
-import './RecordFastSleep.scss'
-import { bigRingRadius, getBgRing, getCommon, getDot, getReal, getTarget, ringWidth, smallRingRadius } from "../hooks/RingData";
-import Rings from "./Rings";
-import Segment from "@/components/navigation/Segment";
-import Stage from "./Stage";
-import CenterContentTitleModal from "@/features/common/CenterContentTitleModal";
-import { useTranslation } from "react-i18next";
-import { ColorType } from "@/context/themes/color";
-import TimelineStage from "./TimelineStage";
-import { jumpPage } from "../hooks/Common";
-import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
-import { getTimezone, getTimezoneId, kIsIOS, rpxToPx } from "@/utils/tools";
-import { useDispatch, useSelector } from "react-redux";
-import { setSelID } from "@/store/common";
-import CircadianDetailPopup from "./CircadianDetailPopup";
-import dayjs from 'dayjs'
-import '@/utils/ring_card.scss';
-import showAlert from "@/components/basic/Alert";
-// import { sqrt } from 'mathjs'
-
-let AppState;
-if (process.env.TARO_ENV == 'rn') {
-    AppState = require("react-native").AppState
-}
-
-let stageCanvasId = new Date().getTime()
-
-
-
-let startX = 0
-let startY = 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 disableDismiss = false
-//https://www.php.cn/faq/629819.html
-
-// export default function RecordFastSleep(props: { data: any, type: string, delSuccess?: Function, index: any }) {
-const RecordFastSleep = memo((props: { data: any, type: string, index: number, disableDelete?: boolean }) => {
-    const [count, setCount] = useState(0)
-    const [showDetailModal, setShowDetailModal] = useState(false)
-    const [segmentIndex, setSegmentIndex] = useState(0)
-    const [diffTimeZone, setDiffTimeZone] = useState(false)
-    const [multiTimeZone, setMultiTimeZone] = useState(false)
-    const [showMore, setShowMore] = useState(false)
-    const [selIndex, setSelIndex] = useState(0)
-    const [showMoreModal, setShowMoreModal] = useState(false)
-    const [showDel, setShowDel] = useState(false)
-    const [disableDismiss, setDisableDismiss] = useState(false)
-    const { t } = useTranslation()
-    var canvasId = props.data.id
-    const record = props.data;
-
-    const common = useSelector((state: any) => state.common);
-    const dispatch = useDispatch();
-
-    const handleAppStateChange = (nextAppState) => {
-        checkTimezone()
-    };
-
-    useEffect(() => {
-        checkTimezone()
-        if (process.env.TARO_ENV == 'rn') {
-            AppState.addEventListener('change', handleAppStateChange);
-        }
-        if (record.scenario != 'FAST_SLEEP') {
-            setShowMore(false)
-            setSelIndex(0)
-
-        }
-
-        if (props.index == -20000) {
-            global.refreshRecent = () => {
-                setCount((index) => index + 1)
-            }
-            setTimeout(() => {
-                setCount((index) => index + 1)
-            }, 100)
-        }
-        // console.log(sqrt(-4).toString())
-    }, [props.data])
-
-    useEffect(() => {
-        if (common.recordSelID != props.data.id) {
-            setShowDel(false)
-        }
-    }, [common.recordSelID])
-
-    function checkTimezone() {
-        var currentTZ = getTimezone()
-        var isDiff = false;
-        var isMulti = false;
-        var tempTZ = '';
-        if (props.data.fast) {
-            if (props.data.fast.real_start_timezone && props.data.fast.real_start_timezone.gmt) {
-                tempTZ = props.data.fast.real_start_timezone.gmt
-                if (props.data.fast.real_start_timezone.gmt != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-            if (props.data.fast.real_end_timezone && props.data.fast.real_end_timezone.gmt) {
-                if (tempTZ != props.data.fast.real_end_timezone.gmt) {
-                    isMulti = true
-                }
-                if (props.data.fast.real_end_timezone.gmt != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-        }
-
-        if (props.data.sleep) {
-            if (props.data.sleep.real_start_timezone && props.data.sleep.real_start_timezone.gmt) {
-                if (tempTZ == '') {
-                    tempTZ = props.data.sleep.real_start_timezone.gmt
-                }
-                else if (tempTZ != props.data.sleep.real_start_timezone.gmt) {
-                    isMulti = true
-                }
-                if (props.data.sleep.real_start_timezone.gmt != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-            if (props.data.sleep.real_end_timezone && props.data.sleep.real_end_timezone.gmt) {
-                if (tempTZ != props.data.sleep.real_end_timezone.gmt) {
-                    isMulti = true
-                }
-                if (props.data.sleep.real_end_timezone.gmt != currentTZ) {
-                    isDiff = true
-                }
-            }
-
-
-        }
-        setDiffTimeZone(isDiff)
-        setMultiTimeZone(isMulti)
-    }
-
-    function tapDel() {
-        showAlert({
-            title: t('feature.common.modal.delete_item_title'),
-            content: t('feature.common.modal.delete_item_content'),
-            showCancel: true,
-            confirm: () => {
-                del();
-            },
-            cancel: () => {
-                setShowDel(false)
-            }
-        })
-    }
-    function del() {
-        var id = props.data.id
-        delRecord(id
-        ).then(res => {
-            // global.refreshTime()
-            global.refreshStreaks()
-            global.indexPageRefresh()
-            Taro.showToast({
-                title: t('page.records_history.del_success')
-            })
-            dispatch(setSelID(-1))
-            if (global.checkAccess) {
-                const currentStatus = (res as any).access.current.qualification.status
-                const preStatus = (res as any).access.previous.qualification.status
-                if (currentStatus == 'NOT_QUALIFIED' && preStatus == 'NOT_QUALIFIED'){
-
-                }
-                else {
-                    global.checkAccess((res as any).access)
-                }
-            }
-
-            if (global.delFastSleep)
-                global.delFastSleep(props.data)
-
-            if (global.delFastSleep2)
-                global.delFastSleep2(props.data)
-            // props.delSuccess && props.delSuccess(props.data)
-            // Taro.navigateBack()
-        })
-    }
-
-    function subTitle(timestamp) {
-        if (multiTimeZone) {
-            return t('feature.common.multi_timezones')
-        }
-        if (diffTimeZone) {
-            return t('feature.common.different_timezone')
-        }
-        return TimeFormatter.getDateAndWeek(timestamp)
-    }
-
-    function schedules() {
-        var timestamp = props.data.first_real_check_time
-
-        return <View style={{ display: 'flex', flexDirection: 'column' }}>
-            <TimelineStage data={props.data} title={t('feature.track_time_duration.record_fast_sleep.pop_title')}
-                subTitle={subTitle(timestamp)} first_real_check_time={timestamp} diffTimeZone={diffTimeZone} multiTimeZone={multiTimeZone} />
-        </View>
-    }
-
-
-
-    function showDetail(e) {
-        if (showDel) {
-            setShowDel(false);
-            return
-        }
-        dispatch(setSelID(-1))
-
-        if (props.type == 'latest') {
-            setSegmentIndex(0)
-            global.segmentIndex = 0
-            setShowDetailModal(true)
-            return;
-        }
-        setShowDetailModal(true)
-    }
-
-    function getDuration(obj) {
-        if (obj.status == 'NOT_STARTED' || obj.status == 'NOT_COMPLETED') {
-            return '' 
-        }
-        var start = obj.real_start_time
-        var end = obj.real_end_time
-        if (!end) {
-            end = (new Date()).getTime()
-        }
-        return TimeFormatter.durationFormate(start, end)
-        // return TimeFormatter.calculateTimeDifference(start, end)
-    }
-
-    function getStageDuration() {
-        var start, end;
-        switch (selIndex) {
-            case 0:
-                start = record.fast.real_start_time
-                end = record.sleep.real_start_time
-                break
-            case 1:
-                start = record.sleep.real_start_time
-                end = record.sleep.real_end_time
-                break
-            case 2:
-                start = record.sleep.real_end_time
-                end = record.fast.real_end_time
-                break
-        }
-        return TimeFormatter.durationFormate(start, end)
-    }
-
-    function durationArc(start_time: number, end_time: number) {
-        var duration = (end_time - start_time) / 1000;
-        return duration / (24 * 3600) * 2 * Math.PI;
-    }
-
-    function bigRing() {
-        var common = getCommon(null, true)
-        common.radius = bigRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-
-        if (props.type == 'record' || props.type == 'latest') {
-            var realRing = getReal(record, true, true)
-            if (props.data.status == 'ONGOING3') {
-                realRing.color = 'rgba(0,0,0,0)'
-            }
-            if ((props.data.scenario == 'FAST' && props.data.fast.status == "NOT_COMPLETED") ||
-                (props.data.scenario == 'SLEEP' && props.data.sleep.status == "NOT_COMPLETED")) {
-                realRing.durationArc = 0.01
-            }
-            if (props.data.scenario == 'FAST_SLEEP' && props.data.fast.status == "NOT_COMPLETED") {
-                realRing.durationArc = 0.01
-            }
-            return <Rings common={common} bgRing={bgRing} canvasId={canvasId} realRing={realRing} />
-        }
-        else {
-            var currentDot1 = getDot(record, true)
-            var targetBigRing1 = getTarget(record, true)
-            if (record.status == 'ONGOING') {
-                var realRing1 = getReal(record, true, false)
-
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot1} realRing={realRing1} targetRing={targetBigRing1} canvasId={canvasId} />
-            }
-            if (record.status == 'WAIT_FOR_START') {
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot1} canvasId={canvasId} />
-            }
-            if (record.status == 'NOT_COMPLETED') {
-
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot1} canvasId={canvasId} />
-            }
-            var realRing1 = getReal(record, true, false)
-            return <Rings common={common} bgRing={bgRing} realRing={realRing1} currentDot={currentDot1} targetRing={targetBigRing1} canvasId={canvasId} />
-        }
-    }
-
-    function bigMoreRing() {
-        var common = getCommon(null, true)
-        common.radius = bigRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-        var realRing = getReal(record, true, true)
-        realRing.color = ColorType.fast + '66'
-
-        var list: any = []
-        if (record.scenario == 'FAST_SLEEP') {
-            if (selIndex == 0) {
-                const realRingBig: RealRing = {
-                    color: global.fastColor ? global.fastColor : ColorType.fast,
-                    startArc: startArc(record.fast.real_start_time),
-                    durationArc: durationArc(record.fast.real_start_time, record.sleep.real_start_time)
-                }
-                list.push(realRingBig)
-            }
-            if (selIndex == 1) {
-                const realRingBig: RealRing = {
-                    color: global.fastColor ? global.fastColor : ColorType.fast,
-                    startArc: startArc(record.sleep.real_start_time),
-                    durationArc: durationArc(record.sleep.real_start_time, record.sleep.real_end_time)
-                }
-                list.push(realRingBig)
-            }
-            if (selIndex == 2) {
-                const realRingBig: RealRing = {
-                    color: global.fastColor ? global.fastColor : ColorType.fast,
-                    startArc: startArc(record.sleep.real_end_time),
-                    durationArc: durationArc(record.sleep.real_end_time, record.fast.real_end_time)
-                }
-                list.push(realRingBig)
-            }
-        }
-        return <Rings common={common} bgRing={bgRing} canvasId={stageCanvasId} stageList={list} realRing={realRing} />
-    }
-
-    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 smallRing() {
-        if (record.scenario == 'FAST_SLEEP') {
-            var common = getCommon(null, false)
-            common.radius = smallRingRadius;
-            common.lineWidth = ringWidth;
-            var bgRing = getBgRing()
-            var realRing = getReal(record, false, false)
-            if (props.type == 'record' || props.type == 'latest') {
-                var showReal = false;
-                if (record.sleep.status == 'WAIT_FOR_END') {
-                    realRing.durationArc = durationArc(record.sleep.target_start_time, (new Date()).getTime())
-                    showReal = true
-                    // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                }
-                else if (record.sleep.status == 'NOT_COMPLETED') {
-                    realRing.durationArc = 0.01
-                    showReal = true
-                    // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                }
-                else if (record.sleep.status == 'COMPLETED') {
-                    realRing = getReal(record, false, true)
-                    showReal = true
-                    // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                }
-                return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={showReal ? realRing : null} />
-                // if (record.sleep.status == 'WAIT_FOR_END') {
-                //     realRing.durationArc = durationArc(record.sleep.target_start_time, (new Date()).getTime())
-                //     return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                // }
-                // else if (record.sleep.status == 'NOT_COMPLETED') {
-                //     realRing.durationArc = 0.01
-                //     return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                // }
-                // else if (record.sleep.status == 'COMPLETED') {
-                //     realRing = getReal(record, false, true)
-                //     return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
-                // }
-                // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + '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={canvasId + 'small'} />
-                }
-                if (record.status == 'ONGOING3') {
-                    currentDot.color = 'rgba(0, 255, 255, 0.5)'
-                }
-                return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={canvasId + 'small'} />
-            }
-        }
-        return null
-    }
-
-    function rings() {
-        return <View style={{ position: 'relative', zIndex: 1 }}>
-            {
-                bigRing()
-            }
-            <View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
-                {
-                    smallRing()
-                }
-            </View>
-        </View>
-    }
-
-    function recordTime() {
-        var timestamp = props.data.first_real_check_time
-        if (props.data.first_timezone && props.data.first_timezone.gmt) {
-            timestamp = TimeFormatter.transferTimestamp(timestamp, props.data.first_timezone.gmt)
-        }
-        return TimeFormatter.dateDescription(timestamp, true)
-    }
-
-    function getArrowText() {
-        var timeZoneFormatted = getTimezone()
-
-        if (multiTimeZone) {
-            if (props.data.first_timezone && props.data.first_timezone.id) {
-                if (kIsIOS) {
-                    if (props.data.first_timezone.id == getTimezoneId()) {
-                        return recordTime()
-                    }
-                }
-                else {
-                    if (props.data.first_timezone.gmt == timeZoneFormatted) {
-                        return recordTime()
-                    }
-                }
-                if (global.language == 'en') {
-                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id, 'MMM D z')
-                    // return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('MMM D z')
-                }
-                else {
-                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id, 'M月D日 z')
-                    // return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('M月D日 z')
-                }
-            }
-
-            if (props.data.first_timezone.gmt == timeZoneFormatted) {
-                return recordTime()
-            }
-            return recordTime() + ' ' + props.data.first_timezone.gmt
-            // return t('feature.common.multi_timezones')
-        }
-        if (diffTimeZone) {
-            if (props.data.first_timezone.id) {
-                if (kIsIOS) {
-                    if (props.data.first_timezone.id == getTimezoneId()) {
-                        return recordTime()
-                    }
-                }
-                else {
-                    if (props.data.first_timezone.gmt == timeZoneFormatted) {
-                        return recordTime()
-                    }
-                }
-                if (global.language == 'en') {
-                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id, 'MMM D z')
-                    // return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('MMM D z')
-                }
-                else {
-                    return TimeFormatter.tzTimeFormateLocalTime(props.data.first_real_check_time, props.data.first_timezone.id, 'M月D日 z')
-                    // return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('M月D日 z')
-                }
-            }
-            if (props.data.first_timezone.gmt == timeZoneFormatted) {
-                return recordTime()
-            }
-            return recordTime() + ' ' + props.data.first_timezone.gmt
-            // return t('feature.common.different_timezone')
-        }
-        return recordTime()
-    }
-
-    function tapStage(e, index) {
-        stageCanvasId = new Date().getTime()
-        setSelIndex(index);
-        // setCount(pre=>pre+1); 
-        e.stopPropagation()
-    }
-
-
-    function moreStage() {
-        var common = getCommon(null, false)
-        common.radius = smallRingRadius;
-        common.lineWidth = ringWidth;
-        var bgRing = getBgRing()
-        var realRing = getReal(record, false, true)
-        return <View style={{ zIndex: 10000 }}>
-            <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', position: 'relative' }}>
-                {bigMoreRing()}
-                <View style={{ display: 'flex', position: 'absolute', left: 0, width: 99, top: 0, height: 99, alignItems: 'center', justifyContent: 'center', zIndex: 10000 }}>
-                    <Rings common={common} bgRing={bgRing} canvasId={stageCanvasId + 'small'} realRing={realRing} />
-                </View>
-                <View className="duration_bg">
-                    {
-                        <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
-                    }
-                    {
-                        <Text className="duration_value" style={{ color: global.fastColor ? global.fastColor : ColorType.fast }}>{getStageDuration()}</Text>
-                    }
-                    {
-                        <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
-                    }
-                    {
-                        <Text className="duration_value" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep }}>{getDuration(record.sleep)}</Text>
-                    }
-                </View>
-            </View>
-            <View style={{ flex: 1, marginLeft: -rpxToPx(46), marginRight: -rpxToPx(46), marginTop: 20 }}>
-
-                <View className={selIndex == 0 ? "single_check_sel" : "single_check_nor"} onClick={(e) => { tapStage(e, 0) }}>
-                    <Text className={selIndex == 0 ? "single_check_text_sel" : "single_check_text_nor"}>{t('feature.track_time_duration.stage.a')}</Text>
-                    {
-                        selIndex == 0 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
-                    }
-                </View>
-                <View className={selIndex == 1 ? "single_check_sel" : "single_check_nor"} onClick={(e) => { tapStage(e, 1) }}>
-                    <Text className={selIndex == 1 ? "single_check_text_sel" : "single_check_text_nor"}>{t('feature.track_time_duration.stage.b')}</Text>
-                    {
-                        selIndex == 1 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
-                    }
-                </View>
-                <View className={selIndex == 2 ? "single_check_sel" : "single_check_nor"} onClick={(e) => { tapStage(e, 2) }}>
-                    <Text className={selIndex == 2 ? "single_check_text_sel" : "single_check_text_nor"}>{t('feature.track_time_duration.stage.c')}</Text>
-                    {
-                        selIndex == 2 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
-                    }
-                </View>
-            </View>
-        </View>
-    }
-
-    function recordDetail() {
-        var fastDuration = ''
-        var sleepDuration = ''
-        var showFast = false;
-        var showSleep = false;
-        if (record.scenario == 'FAST_SLEEP') {
-
-            fastDuration = getDuration(record.fast)
-            sleepDuration = getDuration(record.sleep)
-            if (record.status == 'ONGOING3') {
-                fastDuration = t('feature.common.wait_for_end')
-            }
-
-            if (record.status == 'COMPLETED' && record.fast.status == 'NOT_COMPLETED') {
-                fastDuration = t('feature.common.not_completed')
-            }
-
-            if (record.sleep.status == "NOT_STARTED") {
-                sleepDuration = t('feature.common.not_started')
-            }
-            else if (record.sleep.status == 'NOT_COMPLETED') {
-                sleepDuration = t('feature.common.not_completed')
-            }
-            showFast = true
-            showSleep = true
-        }
-        else if (record.scenario == 'FAST') {
-            fastDuration = getDuration(record.fast)
-            if (record.fast.status == 'NOT_COMPLETED') {
-                fastDuration = t('feature.common.not_completed')
-            }
-            showFast = true
-        }
-        else {
-            sleepDuration = getDuration(record.sleep)
-            if (record.sleep.status == 'NOT_COMPLETED') {
-                sleepDuration = t('feature.common.not_completed')
-            }
-            showSleep = true
-        }
-        return <View style={{ display: 'flex', flexDirection: 'column', margin: rpxToPx(8), boxSizing: 'border-box' }}>
-            <View className="fast_sleep_item1">
-                {
-                    rings()
-                }
-                <View className="duration_bg">
-                    {
-                        showFast && <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
-                    }
-                    {
-                        showFast && <Text className="duration_value" style={{ color: global.fastColor ? global.fastColor : ColorType.fast }}>{fastDuration}</Text>
-                    }
-                    {
-                        showSleep && <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
-                    }
-                    {
-                        showSleep && <Text className="duration_value" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep }}>{sleepDuration}</Text>
-                    }
-                </View>
-                <View className="record_arrow_bg" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>
-                    <View style={{ flex: 1 }} />
-                    <Text className='recordTime'>{getArrowText()}</Text>
-                    <Image className="arrow2" src={require('@/assets/images/arrow3.png')} />
-                </View>
-
-            </View>
-
-        </View>
-    }
-
-    function touchStart(e) {
-        if (process.env.TARO_ENV == 'rn' || props.disableDelete) {
-            return
-        }
-        startX = e.touches[0].clientX
-        startY = e.touches[0].clientY
-        setDisableDismiss(true)
-        // disableDismiss = true
-    }
-
-    function touchMove(e) {
-        if (process.env.TARO_ENV == 'rn' || props.disableDelete) {
-            return
-        }
-        let x = startX
-        let y = startY
-        let deltaX = e.touches[0].clientX - x
-        let deltaY = e.touches[0].clientY - y
-
-
-        if (Math.abs(deltaX) > Math.abs(deltaY)) {
-            if (deltaX < -80) {
-                setShowDel(true)
-
-                dispatch(setSelID(props.data.id))
-                global.selId = props.data.id
-            }
-            else if (deltaX > 80) {
-                setShowDel(false)
-                // global.selId = -1
-            }
-        }
-
-
-    }
-
-    function touchEnd(e) {
-        if (process.env.TARO_ENV == 'rn' || props.disableDelete) {
-            return
-        }
-        startX = 0
-        setDisableDismiss(false)
-    }
-
-    usePageScroll((e) => {
-        if (showDel && !disableDismiss) {
-            console.log(disableDismiss)
-            // setShowDel(false)
-        }
-    })
-
-    function modalContent() {
-        return <Modal
-            testInfo={null}
-            dismiss={() => {
-                setShowDetailModal(false)
-            }}
-            confirm={() => { }}>
-            {
-                <CircadianDetailPopup
-                    record={record}
-                    onClose={() => setShowDetailModal(false)} />
-            }
-        </Modal>
-    }
-
-    return <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
-        <View style={{ position: 'absolute', left: 0, top: 0, width: 0, height: 0, opacity: 0 }}>{count}</View>
-        <View className='time_operate_item'
-            onTouchStart={touchStart}
-            onTouchMove={touchMove}
-            onTouchEnd={touchEnd}
-        >
-            <RecordItem canDel={record.status == 'COMPLETED'}
-                delete={del}
-                disableDelete={props.disableDelete}
-                onClick={showDetail}
-            >{recordDetail()}
-            </RecordItem>
-            {
-                process.env.TARO_ENV == 'weapp' && <View className={showDel ? 'btnDelete btnDeleteAni' : 'btnDelete'} onClick={tapDel}>{t('feature.track_time_duration.record_fast_sleep.delete')}</View>
-            }
-
-
-        </View>
-        {/* {
-            (props.type == 'record' || props.type == 'latest') &&
-            record.scenario == 'FAST_SLEEP' &&
-            record.sleep.status == 'COMPLETED' &&
-            <View className="more_stage" onClick={(e) => {
-                e.stopPropagation()
-                setShowMoreModal(true)
-            }}>
-                <Text className="more_stage_text">{showMore ? '隐藏更多' : '显示更多'}</Text>
-            </View>
-        } */}
-        {
-            showDetailModal && modalContent()
-            // showDetailModal && <Modal children={schedules()}
-            //     modalType={ModalType.center}
-            //     dismiss={() => setShowDetailModal(false)}
-            //     confirm={() => { }} />
-        }
-        {
-            showMoreModal && <Modal children={moreStage()}
-                modalType={ModalType.center}
-                dismiss={() => setShowMoreModal(false)}
-                confirm={() => { }} />
-        }
-    </View>
-})
-
-export default RecordFastSleep;

+ 0 - 84
src/features/trackTimeDuration/components/Schedule.scss

@@ -1,84 +0,0 @@
-
-.duration_bg{
-    margin-left: 50px;
-    display: flex;
-    flex-direction: column;
-    flex: 1;
-}
-
-.duration_title{
-    font-size: 32px;
-    line-height: 32px;
-    color: #fff;
-    opacity: 0.6;
-    font-weight: 400;
-}
-
-.duration_value2{
-    font-size: 36px;
-    line-height: 36px;
-    font-weight: 500;
-    margin-bottom: 12px;
-}
-
-.arrow1{
-    width: 40px;
-    height: 40px;
-}
-
-.tip_bg2{
-    height: 80px;
-    width: 100%;
-    box-sizing: border-box;
-    // background-color: rgba(250, 81, 81, 0.1);
-    display: flex;
-    flex-direction: column;
-    // padding-left: 40px;
-}
-
-.tip_text2{
-    line-height: 80px;
-    color: #fff;
-    opacity: 0.8;
-    font-size: 28px;
-
-}
-
-.schedule_more{
-    display: flex;
-    flex-direction: row;
-    height: 84px;
-    align-items: center;
-    color: $fastColor;
-}
-
-.schedule_box{
-    margin-left: 46px;
-    margin-right: 46px;
-    margin-bottom: 24px;
-    // background-color: $boxColor;
-    // border-radius: $boxBorderRadius;
-    display: flex;
-    flex-direction: column;
-    padding-top: 40px;
-    padding-left: 40px;
-    padding-bottom: 34px;
-}
-
-.schedule_line{
-    margin-bottom: 30px;
-    height: 2px;
-    -webkit-transform: scaleY(0.5);
-        transform: scaleY(0.5);
-    background-color: #fff;
-    opacity: 0.1;
-}
-
-.schedule_row{
-    display: flex;
-    flex-direction: row;
-    justify-content: space-between;
-    box-sizing: border-box;
-    margin-right: 40px;
-    align-items: center;
-}

+ 0 - 326
src/features/trackTimeDuration/components/Schedule.tsx

@@ -1,326 +0,0 @@
-import { View, Text } from "@tarojs/components";
-import trackTimeService, { machine } from "@/store/trackTimeMachine"
-import { useEffect, useState } from "react";
-import Taro, { useReady } from "@tarojs/taro";
-import Box from "@/components/layout/Box";
-import './Schedule.scss'
-import { useTranslation } from "react-i18next";
-import TimelineFastSleep from "./TimelineFastSleep";
-import Switch from "@/components/input/Switch2";
-import { useDispatch, useSelector } from "react-redux";
-import { TimeFormatter } from "@/utils/time_format";
-import Buttons from "@/components/basic/Buttons";
-import { ButtonType, ModalType } from "@/utils/types";
-import { setStep } from "@/store/scenario";
-import Segment from "@/components/navigation/Segment";
-import Modal from "@/components/layout/Modal";
-import Stage from "./Stage";
-import CenterContentTitleModal from "@/features/common/CenterContentTitleModal";
-import { ColorType } from "@/context/themes/color";
-import { getThemeColor, jumpPage } from "../hooks/Common";
-import TableCell from "@/components/layout/TableCell";
-import TimelineStage from "./TimelineStage";
-import { vibrate } from "@/utils/tools";
-
-
-export default function Component(props: { type?: string, data?: any, delSuccess?: Function }) {
-    const { t } = useTranslation()
-    const permission = useSelector((state: any) => state.permission);
-    const common = useSelector((state: any) => state.common);
-    const time = useSelector((state: any) => state.time);
-    const [showModal, setShowModal] = useState(false)
-    const [pushEnable, setPushEnable] = useState(true)
-    const dispatch = useDispatch();
-
-    useEffect(() => {
-        console.log('push', global.pushEnable)
-    }, [global.pushEnable])
-
-
-    function all() {
-        if (props.type == 'latest') {
-            jumpPage('/pages/common/RecordsHistory?type=time&title=Time')
-        }
-    }
-
-    function showStage(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-        setShowModal(true)
-    }
-
-    function followWxPub() {
-        const resource = common.resources.filter((item: any) => {
-            return item.code == 'follow_wx_pub'
-        })
-
-        const title = permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.h5_followed_title') :
-            t('feature.track_time_duration.follow_wx_pub.h5_unfollowed_title')
-
-        Taro.showModal({
-            title: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_title') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_title'),
-            content: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_content') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_content'),
-            showCancel: true,
-            cancelText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_cancel_btn') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_cancel_btn'),
-            confirmText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_confirm_btn') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_confirm_btn'),
-            success(result) {
-                if (result.confirm) {
-                    global.forceRefreshWXPub = true
-                    jumpPage('/pages/common/H5?title=' + title + '&url=' + resource[0].url)
-                }
-            },
-        })
-    }
-
-    function detailHeader() {
-        var btnStyle;
-        if (props.data.scenario == 'SLEEP') {
-            btnStyle = {
-                fontSize: 14,
-                lineHeight: 18,
-                color: global.sleepColor ? global.sleepColor : ColorType.sleep
-            }
-        }
-        else if (props.data.scenario == 'FAST') {
-            btnStyle = {
-                fontSize: 14,
-                lineHeight: 18,
-                color: global.fastColor ? global.fastColor : ColorType.fast
-            }
-        }
-        else if (props.data.scenario == 'FAST_SLEEP') {
-            btnStyle = {
-                fontSize: 14,
-                lineHeight: 18,
-            }
-        }
-        return <View style={{
-            height: 18,
-            overflow: 'hidden',
-            display: 'flex', flexDirection: 'row', width: '100%',
-            justifyContent: 'space-between', alignItems: 'center',
-            marginBottom: 10, paddingRight: 10, boxSizing: 'border-box'
-        }}>
-            <Text style={{ fontSize: 18, lineHeight: 18, fontWeight: 'bold' }}>
-                {permission.wxPubFollow ? TimeFormatter.getDateAndWeek(new Date().getTime()) :
-                    t('feature.track_time_duration.schedule.unfollow_title')}</Text>
-            {
-                !permission.wxPubFollow && <View >
-                    <Switch isOn={permission.wxPubFollow} onClick={() => followWxPub()} />
-                </View>
-            }
-        </View>
-    }
-
-    function tapSchedule(e) {
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-
-        if (permission.wxPubFollow && props.data.status == 'WAIT_FOR_START') {
-            Taro.showActionSheet({
-                itemList: ["调整日程"]
-            })
-                .then(res => {
-                    switch (res.tapIndex) {
-                        case 0:
-                            if (props.data.name == 'FAST_SLEEP') {
-                                dispatch(setStep('fast'))
-                            }
-                            else if (props.data.name == 'SLEEP') {
-                                dispatch(setStep('sleep'))
-                            }
-                            else {
-                                dispatch(setStep('fast'))
-                            }
-                            jumpPage('/pages/clock/SetSchedule')
-                            break;
-                        case 1:
-
-                            break;
-                    }
-                })
-                .catch(err => {
-                    console.log(err.errMsg)
-                })
-        }
-        else {
-            vibrate()
-        }
-    }
-
-    function detailCenter() {
-        // if (!permission.wxPubFollow) {
-        //     return <View className="tip_bg2">
-        //         <Text className="tip_text2">{t('feature.track_time_duration.schedule.follow_tip')}</Text>
-        //     </View>
-        // }
-
-        var nextCheckTimestamp = 0;
-        if (time.status != 'WAIT_FOR_START') {
-            if (time.status == 'ONGOING') {
-                nextCheckTimestamp = time.scenario == 'FAST' ?
-                    time.fast.target_end_time : time.sleep.target_end_time
-            }
-            else {
-                switch (time.status) {
-                    case 'ONGOING1':
-                        nextCheckTimestamp = time.sleep.target_start_time
-                        break;
-                    case 'ONGOING2':
-                        nextCheckTimestamp = time.sleep.target_end_time
-                        break
-                    case 'ONGOING3':
-                        nextCheckTimestamp = time.fast.target_end_time
-                        break
-                }
-            }
-
-        }
-        var today = new Date();
-        today.setHours(0)
-        today.setMinutes(0)
-        today.setSeconds(0)
-        if (nextCheckTimestamp != 0 && today.getTime() > nextCheckTimestamp) {
-            return <View className="tip_bg2">
-                <Text className="tip_text2">{t('feature.track_time_duration.schedule.timeout_tip')}</Text>
-            </View >
-        }
-
-        return <View onClick={tapSchedule}>
-            <TimelineStage data={props.data} isSchedule={true} title={t('feature.track_time_duration.schedule.section_title')}
-                subTitle={TimeFormatter.getDateAndWeek(new Date().getTime(), true)}
-            />
-
-            {/* <TimelineFastSleep data={props.data} />
-            {
-                props.data.scenario == 'FAST_SLEEP' && <View className="schedule_more" onClick={showStage}>
-                    <View style={{ flex: 1 }} />
-                    {
-                        time.scenario == 'FAST_SLEEP' ? <Text className="fast_sleep_text" style={{ textAlign: 'right' }}>{
-                            props.data.status == 'WAIT_FOR_START' ?
-                                t('feature.track_time_duration.schedule.duration_goals_by_stage') :
-                                t('feature.track_time_duration.schedule.current_stage')
-                        }</Text> :
-                            <Text style={{ textAlign: 'right', color: getThemeColor(time) }}>{
-                                props.data.status == 'WAIT_FOR_START' ?
-                                    t('feature.track_time_duration.schedule.duration_goals_by_stage') :
-                                    t('feature.track_time_duration.schedule.current_stage')
-                            }</Text>
-                    }
-                </View>
-            } */}
-        </View>
-    }
-
-    function detailFooter() {
-
-    }
-
-    function detail() {
-        return <View style={{ flexDirection: 'column', display: 'flex', alignItems: 'center', position: 'relative' }} onClick={all}>
-            {/* {
-                detailHeader()
-            } */}
-            {
-                detailCenter()
-            }
-        </View >
-    }
-
-    function tapBox(e) {
-
-    }
-
-    function getSetting() {
-        // const RNBridge = require('tarojs/plugin-rn-bridge');
-        // RNBridge.NativeModules.RNBridgeModule.jumpToNotificationSettings();
-    }
-
-    // if (!permission.wxPubFollow) {
-    //     return <View className="schedule_box">
-    //         <Text className="box_title">{t('feature.track_time_duration.schedule.section_title')}</Text>
-    //         <Text className="box_subtitle">{TimeFormatter.getDateAndWeek(new Date().getTime(), true)}</Text>
-    //         <View className="schedule_line" />
-    //         <View className="schedule_row">
-    //             <Text>{t('feature.track_time_duration.schedule.follow_tip')}</Text>
-    //             <Switch isOn={permission.wxPubFollow} onClick={() => followWxPub()} />
-    //         </View>
-    //     </View>
-    // }
-
-    var nextCheckTimestamp = 0;
-    if (time.status != 'WAIT_FOR_START') {
-        if (time.status == 'ONGOING') {
-            nextCheckTimestamp = time.scenario == 'FAST' ?
-                time.fast.target_end_time : time.sleep.target_end_time
-        }
-        else {
-            switch (time.status) {
-                case 'ONGOING1':
-                    nextCheckTimestamp = time.sleep.target_start_time
-                    break;
-                case 'ONGOING2':
-                    nextCheckTimestamp = time.sleep.target_end_time
-                    break
-                case 'ONGOING3':
-                    nextCheckTimestamp = time.fast.target_end_time
-                    break
-            }
-        }
-
-    }
-    var today = new Date();
-    today.setHours(0)
-    today.setMinutes(0)
-    today.setSeconds(0)
-
-    if (nextCheckTimestamp != 0 && today.getTime() > nextCheckTimestamp) {
-        return <View className="schedule_box">
-            <View className="box_header" style={{ marginRight: 20, backgroundColor: global.isDebug ? 'red' : 'transparent' }}>
-                <Text className="box_title">{t('feature.track_time_duration.schedule.section_title')}</Text>
-                {
-                    <Switch isOn={permission.wxPubFollow} onClick={() => followWxPub()} />
-                }
-
-
-            </View>
-
-            <Text className="box_subtitle">{TimeFormatter.getDateAndWeek(new Date().getTime(), true)}</Text>
-            <View className="schedule_line" />
-            <View className="schedule_row">
-                <Text>{t('feature.track_time_duration.schedule.timeout_tip')}</Text>
-            </View>
-        </View>
-        return <TableCell title={t('feature.track_time_duration.schedule.timeout_tip')} showMarginBottom={true}>
-
-        </TableCell>
-
-    }
-
-
-    return <Box>
-        {
-            detail()
-        }
-        {
-            showModal && <Modal
-                modalType={ModalType.center}
-                confirm={() => { }}
-                dismiss={() => {
-                    setShowModal(false)
-                }}>
-                <CenterContentTitleModal title="Stage">
-                    <Stage data={time} />
-                </CenterContentTitleModal>
-            </Modal>
-        }
-    </Box>
-
-
-}

+ 0 - 33
src/features/trackTimeDuration/components/SegmentPop.tsx

@@ -1,33 +0,0 @@
-import { View } from "@tarojs/components";
-import TimelineStage from "./TimelineStage";
-import { useTranslation } from "react-i18next";
-import { useState } from "react";
-import Modal from "@/components/layout/Modal.weapp";
-import { ModalType } from "@/utils/types";
-
-export default function SegmentPop(props: { data: any }) {
-    const [showModal, setShowModal] = useState(false)
-    const { t } = useTranslation()
-
-    global.showSegmentPop = () => {
-        setShowModal(true)
-    }
-
-    function schedules() {
-        var timestamp = new Date().getTime()//props.data.first_real_check_time
-        return <View style={{ display: 'flex', flexDirection: 'column' }}>
-            <TimelineStage data={props.data.current_record} title={t('feature.track_time_duration.record_fast_sleep.pop_title')}
-                subTitle='今天' first_real_check_time={timestamp} />
-        </View>
-    }
-
-
-    return <View style={{ width: 0, height: 0 }}>
-        {
-            showModal && <Modal children={schedules()}
-                modalType={ModalType.center}
-                dismiss={() => { setShowModal(false); }}
-                confirm={() => { }} />
-        }
-    </View>
-}

+ 0 - 642
src/features/trackTimeDuration/components/SetSchedule.rn.tsx

@@ -1,642 +0,0 @@
-import Buttons from "@/components/basic/Buttons";
-import { setPlan } from "@/services/trackTimeDuration";
-import { setScenario, setStep } from "@/store/scenario";
-import { View, Text, PageContainer, Image } from "@tarojs/components";
-import "./SetSchedule.scss";
-import Taro, { useDidShow, useReady } from "@tarojs/taro";
-import { useEffect, useRef, useState } from "react";
-import { useDispatch, useSelector } from "react-redux";
-import Footer from "@/components/layout/Footer";
-import PickerViews from "@/components/input/PickerViews";
-import { durationDatas, durationIndex, durationTime, pickerDurations } from "../hooks/Console";
-import { TimeFormatter } from "@/utils/time_format";
-import Modal from "@/components/layout/Modal";
-import TimePicker from "@/features/common/TimePicker";
-import { SetScheduleBtn } from "@/features/common/SpecBtns";
-import Layout from "@/components/layout/layout";
-import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
-import { useTranslation } from "react-i18next";
-import { ColorType } from "@/context/themes/color";
-import TitleView from "./TitleView";
-import { jumpPage } from "../hooks/Common";
-import { kIsIOS, rpxToPx, vibrate } from "@/utils/tools";
-import { PixelRatio } from "react-native";
-import { clientId } from "@/services/user";
-import showAlert from "@/components/basic/Alert";
-// import { OneSignal } from 'react-native-onesignal';
-
-let useNavigation;
-
-// let JPush;
-let Linking;
-let checkNotification, uploadPermissions,PushNotification;
-if (process.env.TARO_ENV == 'rn') {
-    useNavigation = require("@react-navigation/native").useNavigation
-    Linking = require('react-native').Linking;
-    // JPush = require('jpush-react-native').default;
-    checkNotification = require('@/utils/native_permission_check').checkNotification;
-    uploadPermissions = require('@/utils/native_permission_check').uploadPermissions;
-    PushNotification = require('react-native-push-notification')
-}
-export default function Component() {
-    const isFastFirst = true;
-    const { t } = useTranslation()
-    const dispatch = useDispatch();
-    const canvasRef = useRef(null);
-    const [scenario] = useState(useSelector((state: any) => state.scenario))
-    // const scenario = useSelector((state: any) => state.scenario);
-    const common = useSelector((state: any) => state.common);
-
-    const [isOpen, setIsOpen] = useState(false)
-    const [isTimeOpen, setIsTimeOpen] = useState(false)
-    const [btnDisable, setBtnDisable] = useState(false)
-
-    const pickerRef = useRef<any>(null);
-    // const [count,setCount] = useState(0)
-    const [beginChange, setBeginChange] = useState(true)
-    const [operateType, setOperateType] = useState(0)
-    const [isModalTimePicker, setIsModalTimePicker] = useState(false)
-
-    let navigation;
-    if (useNavigation) {
-        navigation = useNavigation()
-    }
-
-
-
-    var scheduleObj: { start_time: any; end_time: any; };
-    if (scenario.name == 'FAST') {
-        scheduleObj = scenario.schedule.fast
-    }
-    else if (scenario.name == 'SLEEP') {
-        scheduleObj = scenario.schedule.sleep
-    }
-    else {
-        if (scenario.step == 'fast') {
-            scheduleObj = scenario.schedule.fast
-        }
-        else {
-            scheduleObj = scenario.schedule.sleep
-        }
-    }
-
-
-
-    const [startTime, setStartTime] = useState(scheduleObj.start_time)
-    const [endTime, setEndTime] = useState(scheduleObj.end_time)
-
-    global.startTime = startTime
-    global.endTime = endTime
-    const [pickerValue, setPickerValue] = useState(durationIndex(scheduleObj.start_time, scheduleObj.end_time, common))
-
-    const [hours, setHours] = useState(durationTime(scheduleObj.start_time, scheduleObj.end_time)[0])
-    const [minutes, setMinutes] = useState(durationTime(scheduleObj.start_time, scheduleObj.end_time)[1])
-    const [chooseStart, setChooseStart] = useState(true)
-    const [count, setCount] = useState(0)
-    const [authStatus, setAuthStatus] = useState('')
-
-
-    useEffect(() => {
-        if (global.schedule_fast && scenario.step == 'fast') {
-            scheduleObj = global.schedule_fast
-        }
-        if (global.schedule_sleep && scenario.step == 'sleep') {
-            scheduleObj = global.schedule_sleep
-        }
-        setStartTime(scheduleObj.start_time)
-        setEndTime(scheduleObj.end_time)
-        setPickerValue(durationIndex(scheduleObj.start_time, scheduleObj.end_time, common))
-        setHours(durationTime(scheduleObj.start_time, scheduleObj.end_time)[0])
-        setMinutes(durationTime(scheduleObj.start_time, scheduleObj.end_time)[1])
-
-        if (kIsIOS) {
-            var Jto = require('react-native').NativeModules.NativeBridge;
-            Jto.getNotificationAuthStatus()
-            require('react-native').NativeAppEventEmitter.addListener('notificationResult', (data) => {
-                setAuthStatus(data)
-                global.notification = data
-                uploadPermissions()
-            })
-            require('react-native').NativeAppEventEmitter.addListener('operateNotificationResult', (data) => {
-                global.notification = data
-                navigation.popToTop()
-                uploadPermissions()
-            })
-        }
-        else {
-            // OneSignal.Notifications.canRequestPermission().then((status) => {
-            //     if (status) {
-            //         OneSignal.Notifications.getPermissionAsync().then((res) => {
-            //             if (res) {
-            //                 global.notification = 'authorized'
-            //                 uploadPermissions()
-            //             }
-            //             else {
-            //                 global.notification = 'denied'
-            //                 uploadPermissions()
-            //             }
-            //         })
-            //     }
-            //     else {
-            //         global.notification = 'not_determined'
-            //         uploadPermissions()
-            //     }
-            // })
-        }
-
-    }, [])
-
-    useEffect(() => {
-        if (isOpen || isTimeOpen) {
-            global.disableCanvasGesture = true
-        }
-        else {
-            global.disableCanvasGesture = false
-        }
-    }, [isOpen, isTimeOpen])
-
-
-    useDidShow(() => {
-        setCount(count + 1)
-    })
-
-
-    function checkPermission() {
-        start()
-        // const test = require('@/utils/push').default
-        // test()
-    }
-
-    function start() {
-        if (scenario.name == 'FAST' || scenario.name == 'SLEEP') {
-            setBtnDisable(true)
-            setPlan({
-                scenario: scenario.name,
-                schedule: scenario.name == 'FAST' ? {
-                    fast: {
-                        start_time: startTime,
-                        end_time: endTime,
-                    }
-                } : {
-                    sleep: {
-                        start_time: startTime,
-                        end_time: endTime,
-                    }
-                }
-            }).then(res => {
-                setBtnDisable(false)
-                if (global.checkData) {
-                    global.checkData()
-                }
-                if (global.indexPageRefresh) {
-                    global.indexPageRefresh()
-                }
-
-                // if (process.env.TARO_ENV == 'weapp') {
-                //     Taro.navigateBack({ delta: 3 })
-                // }
-                // else {
-                //     navigation.popToTop()
-                // }
-
-                // setTimeout(() => {
-                popScheduleAlert(scenario, startTime)
-
-                // }, 1000)
-            }).catch(e => {
-                setBtnDisable(false)
-            })
-        }
-        else {
-            if ((scenario.step == 'fast' && isFastFirst) || (scenario.step == 'sleep' && !isFastFirst)) {
-                var obj = JSON.parse(JSON.stringify(scenario))
-                if (isFastFirst) {
-                    obj.schedule.fast = {
-                        start_time: startTime,
-                        end_time: endTime,
-                    }
-                    dispatch(setStep('sleep'))
-                    dispatch(setScenario(obj))
-                }
-                else {
-                    obj.schedule.sleep = {
-                        start_time: startTime,
-                        end_time: endTime,
-                    }
-                    dispatch(setStep('fast'))
-                    dispatch(setScenario(obj))
-                }
-
-                saveTempCache(startTime, endTime)
-
-                jumpPage('/pages/clock/SetSchedule', 'SetSchedule', navigation)
-            }
-            else {
-                commit()
-            }
-        }
-    }
-
-    function saveTempCache(strStart, strEnd) {
-        if (scenario.step == 'fast') {
-            global.schedule_fast = {
-                start_time: strStart,
-                end_time: strEnd,
-            }
-        }
-        if (scenario.step == 'sleep') {
-            global.schedule_sleep = {
-                start_time: strStart,
-                end_time: strEnd,
-            }
-        }
-
-    }
-
-    function commit() {
-        setBtnDisable(true)
-        setPlan({
-            scenario: scenario.name,
-            schedule: {
-                fast: {
-                    start_time: isFastFirst ? scenario.schedule.fast.start_time : startTime,
-                    end_time: isFastFirst ? scenario.schedule.fast.end_time : endTime,
-                }, sleep: {
-                    start_time: !isFastFirst ? scenario.schedule.sleep.start_time : startTime,
-                    end_time: !isFastFirst ? scenario.schedule.sleep.end_time : endTime,
-                }
-            }
-        }).then(res => {
-            setBtnDisable(false)
-            dispatch(setStep('fast'))
-            if (global.checkData) {
-                global.checkData()
-            }
-
-            if (global.indexPageRefresh) {
-                global.indexPageRefresh()
-            }
-
-            // if (process.env.TARO_ENV == 'weapp') {
-            //     Taro.navigateBack({ delta: 4 })
-            // }
-            // else {
-            //     navigation.popToTop()
-            // }
-
-            // setTimeout(() => {
-            popMixScheduleAlert(scenario.schedule.fast.start_time, startTime)
-
-            // }, 1000)
-
-        }).catch(e => {
-            setBtnDisable(false)
-        })
-    }
-
-    function popScheduleAlert(scenario, startTime) {
-        PushNotification.checkPermissions((res)=>{
-            //允许授权
-            if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
-                showAlert({
-                    title: t('feature.track_time_duration.reminders.schedule_title'),
-                    content: scenario.name == 'FAST' ?
-                        t('feature.track_time_duration.reminders.enable_schedule_fast_content', { time: startTime }) :
-                        t('feature.track_time_duration.reminders.enable_schedule_sleep_content', { time: startTime }),
-                    showCancel: false,
-                    confirmText: t('feature.track_time_duration.reminders.ok'),
-                    cancel: () => {
-                        navigation.popToTop()
-                    },
-                    confirm: () => {
-                        navigation.popToTop()
-                    },
-                })
-            }
-            else {
-                showAlert({
-                    title: t('feature.track_time_duration.reminders.schedule_title'),
-                    content: scenario.name == 'FAST' ?
-                        t('feature.track_time_duration.reminders.schedule_fast_content', { time: startTime }) :
-                        t('feature.track_time_duration.reminders.schedule_sleep_content', { time: startTime }),
-                    cancelText: t('feature.track_time_duration.reminders.later'),
-                    confirmText: t('feature.track_time_duration.reminders.open'),
-                    showCancel: true,
-                    cancel: () => {
-                        navigation.popToTop()
-                    },
-                    confirm: () => {
-                        if (authStatus != 'not_determined') {
-                            navigation.popToTop()
-                        }
-                        checkNotification()
-                        // Linking.openURL('app-settings:notifications')
-                    }
-                })
-            }
-        })
-    }
-
-    function popMixScheduleAlert(time1, time2) {
-        console.log(time1, time2)
-        PushNotification.checkPermissions((res)=>{
-            //允许授权
-            if ((kIsIOS && res.authorizationStatus == 2) || (!kIsIOS && res.alert)){
-                showAlert({
-                    title: t('feature.track_time_duration.reminders.schedule_title'),
-                    content: t('feature.track_time_duration.reminders.enable_schedule_mix_content', { time1: time1, time2: time2 }),
-                    showCancel: false,
-                    confirmText: t('feature.track_time_duration.reminders.ok'),
-                    cancel: () => {
-                        navigation.popToTop()
-                    },
-                    confirm: () => {
-                        navigation.popToTop()
-                    },
-                })
-            }
-            else {
-                showAlert({
-                    title: t('feature.track_time_duration.reminders.schedule_title'),
-                    content:
-                        t('feature.track_time_duration.reminders.schedule_mix_content'),
-                    cancelText: t('feature.track_time_duration.reminders.later'),
-                    confirmText: t('feature.track_time_duration.reminders.open'),
-                    showCancel: true,
-                    cancel: () => {
-                        navigation.popToTop()
-                    },
-                    confirm: () => {
-                        if (authStatus != 'not_determined') {
-                            navigation.popToTop()
-                        }
-                        checkNotification()
-                        // Linking.openURL('app-settings:notifications')
-                    }
-
-                })
-            }
-        })
-    }
-
-    function onStartTimeChange(e: string) {
-        setIsTimeOpen(false)
-        setBeginChange(true)
-        setStartTime(e)
-
-        setPickerValue(durationIndex(e, endTime, common))
-        setHours(durationTime(e, endTime)[0])
-        setMinutes(durationTime(e, endTime)[1])
-        saveTempCache(e, endTime);
-        if (global.updateDial)
-            global.updateDial(e, endTime)
-    }
-
-    function onEndTimeChange(e: string) {
-        setIsTimeOpen(false)
-        setBeginChange(false)
-        setEndTime(e)
-        setPickerValue(durationIndex(startTime, e, common))
-        setHours(durationTime(startTime, e)[0])
-        setMinutes(durationTime(startTime, e)[1])
-        saveTempCache(startTime, e);
-        if (global.updateDial)
-            global.updateDial(startTime, e)
-    }
-
-
-
-    function showPicker() {
-        setIsOpen(true)
-    }
-
-    function durationChange(e) {
-        var count = (e[0] + common.duration.min) * 60 + e[1] * common.duration.step
-
-        var h = parseInt(count / 60)
-        var m = count % 60
-        setHours(h)
-        setMinutes(m)
-        setPickerValue(e)
-        setIsOpen(false)
-        if (beginChange) {
-            var strEnd = TimeFormatter.calculateTimeByTimeRange(count, startTime, true)
-
-            setEndTime(strEnd);
-            saveTempCache(startTime, strEnd)
-            if (global.updateDial)
-                global.updateDial(startTime, strEnd)
-        }
-        else {
-            var strStart = TimeFormatter.calculateTimeByTimeRange(count, endTime, false)
-
-            setStartTime(strStart);
-            saveTempCache(strStart, endTime)
-            if (global.updateDial)
-                global.updateDial(strStart, endTime)
-        }
-
-    }
-
-    global.startDuration = (type) => {
-        setOperateType(type)
-    }
-
-    global.updateDuration = (start, end) => {
-        var startCount = parseInt(start.split(':')[0]) * 60 + parseInt(start.split(':')[1])
-        var endCount = parseInt(end.split(':')[0]) * 60 + parseInt(end.split(':')[1])
-        if (operateType == 1 && startCount % 30 == 0) {
-            vibrate()
-        }
-        else if (operateType == 2 && endCount % 30 == 0) {
-            vibrate()
-        }
-        else if (operateType == 3 && (startCount % 30 == 0 || endCount % 30 == 0)) {
-            vibrate()
-        }
-
-        setStartTime(start)
-        setEndTime(end)
-        setPickerValue(durationIndex(start, end, common))
-        setHours(durationTime(start, end)[0])
-        setMinutes(durationTime(start, end)[1])
-        saveTempCache(start, end)
-    }
-
-
-    global.endDuration = () => {
-        setOperateType(0)
-    }
-
-    function layoutContent() {
-        return <PickerViews ref={pickerRef}
-            onChange={durationChange}
-            items={durationDatas(common)}
-            value={pickerValue} height={200}
-            title={scenario.step == 'fast' ?
-                t('feature.track_time_duration.dial.picker_fast_schedule_duration') :
-                t('feature.track_time_duration.dial.picker_sleep_schedule_duration')}
-            themeColor={scenario.step == 'fast' ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep}
-            showBtns={true} onCancel={() => { setIsOpen(false); }} />
-    }
-
-    function pickerTitle() {
-        if (scenario.step == 'fast') {
-            if (chooseStart) {
-                return t('feature.track_time_duration.dial.picker_fast_schedule_start_time');
-            }
-            return t('feature.track_time_duration.dial.picker_fast_schedule_end_time');
-        }
-        else {
-            if (chooseStart) {
-                return t('feature.track_time_duration.dial.picker_sleep_schedule_start_time');
-            }
-            return t('feature.track_time_duration.dial.picker_sleep_schedule_end_time');
-        }
-    }
-
-
-    function timeContent() {
-        return <TimePicker time={chooseStart ? startTime : endTime}
-            color={scenario.step == 'fast' ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep}
-            title={pickerTitle()}
-            confirm={chooseStart ? onStartTimeChange : onEndTimeChange}
-            cancel={() => { setIsTimeOpen(false) }} />
-    }
-
-    function getTargetDesc() {
-        var count = 24 * 60 - (hours * 60 + minutes)
-        var leftHours = Math.floor(count / 60)
-        var leftMinutes = count % 60
-        return scenario.step == 'fast' ? t('page.set_schedule.fast_target_desc', {
-            target_time: (hours > 0 ? hours + TimeFormatter.getHoursUnit(hours) : '') + (minutes > 0 ? minutes + TimeFormatter.getMinutesUnit(minutes) : ''),
-            left_time: (leftHours > 0 ? leftHours + TimeFormatter.getHoursUnit(leftHours) : '') + (leftMinutes > 0 ? leftMinutes + TimeFormatter.getMinutesUnit(leftMinutes) : '')
-        }) :
-            t('page.set_schedule.sleep_target_desc', {
-                target_time: (hours > 0 ? hours + TimeFormatter.getHoursUnit(hours) : '') + (minutes > 0 ? minutes + TimeFormatter.getMinutesUnit(minutes) : ''),
-                left_time: (leftHours > 0 ? leftHours + TimeFormatter.getHoursUnit(leftHours) : '') + (leftMinutes > 0 ? leftMinutes + TimeFormatter.getMinutesUnit(leftMinutes) : '')
-            })
-    }
-
-    function detail() {
-        var isNextDay: boolean = parseInt(startTime.split(':')[0]) * 60 + parseInt(startTime.split(':')[1]) > parseInt(endTime.split(':')[0]) * 60 + parseInt(endTime.split(':')[1])
-
-
-        return <View style={{ height: Taro.getSystemInfoSync().screenHeight - 200, flexDirection: 'column', display: 'flex' }}>
-            {/* <Text className="subtitle">{t('page.set_schedule.fast_subtitle')}</Text> */}
-            <TitleView title={scenario.step == 'fast' ? t('page.set_schedule.fast_title') : t('page.set_schedule.sleep_title')}
-                subTitle={t('page.set_schedule.fast_subtitle')}
-                titleColor={scenario.step == 'fast' ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep}
-            />
-
-            <View style={{ color: '#fff', marginTop: rpxToPx(64) }}>
-                <Text className="cell_header">{scenario.step == 'fast' ? t('page.set_schedule.fast_target') : t('page.set_schedule.sleep_target')}</Text>
-                <View className="cell_full" style={{
-                    marginLeft: rpxToPx(46),
-                    marginRight: rpxToPx(46),
-                    paddingLeft: rpxToPx(40),
-                    paddingRight: rpxToPx(40),
-
-                }} onClick={() => { setIsModalTimePicker(false); setIsOpen(true) }}>
-                    <Text className="cell_title">{t('feature.track_time_duration.dial.duration')}</Text>
-                    <Text className="cell_value" style={{ color: scenario.step == 'fast' ? ColorType.fast : ColorType.sleep }}>{hours > 0 ? hours + TimeFormatter.getHoursUnit(hours) : ''}{minutes > 0 ? minutes + TimeFormatter.getMinutesUnit(minutes) : ''}</Text>
-                    <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />
-                </View>
-                <Text className="cell_footer">{getTargetDesc()}</Text>
-
-                <View style={{ height: rpxToPx(60) }} />
-                <Text className="cell_header">{scenario.step == 'fast' ? t('page.set_schedule.fast_schedule') : t('page.set_schedule.sleep_schedule')}</Text>
-                <View className="cell_top" onClick={() => {
-                    setIsModalTimePicker(true)
-                    setChooseStart(true)
-                    setIsTimeOpen(true)
-                }}>
-                    <Text className="cell_title">{t('feature.track_time_duration.dial.start_time')}</Text>
-                    <Text className="cell_value" style={{ color: scenario.step == 'fast' ? ColorType.fast : ColorType.sleep }}>{startTime}</Text>
-                    <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />
-                    <View className="cell_line" style={{ height: 1 / PixelRatio.get() }} />
-                </View>
-                <View className="cell_bottom" onClick={() => {
-                    setIsModalTimePicker(true)
-                    setChooseStart(false)
-                    setIsTimeOpen(true)
-                }}>
-                    <Text className="cell_title">{t('feature.track_time_duration.dial.end_time')}</Text>
-                    {
-                        isNextDay &&
-                        <Text className="next_day">{t('page.set_schedule.next_day')}</Text>
-                    }
-
-                    <Text className="cell_value" style={{ color: scenario.step == 'fast' ? ColorType.fast : ColorType.sleep }}>{endTime}</Text>
-                    <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />
-                </View>
-                <Text className="cell_footer">{scenario.step == 'fast' ? t('page.set_schedule.fast_schedule_desc', {
-                    start_time: startTime, end_time: endTime, the_next_day:
-                        isNextDay ? t('page.set_schedule.the_next_day') : ''
-                }) :
-                    t('page.set_schedule.sleep_schedule_desc', {
-                        start_time: startTime, end_time: endTime, the_next_day:
-                            isNextDay ? t('page.set_schedule.the_next_day') : ''
-                    })}</Text>
-                {/* <Text className="cell_footer">计划每日18:00开始断食,次日10:00结束断食。</Text> */}
-            </View>
-
-            <View style={{ flex: 1 }} />
-
-            <Footer>
-                <SetScheduleBtn title={(scenario.step == 'fast' && scenario.name == 'FAST_SLEEP') ? t('feature.common.btn_set_and_next') : t('feature.common.btn_set_and_done')}
-                    lowLight={operateType != 0}
-                    isFast={scenario.step == 'fast'}
-                    disable={btnDisable}
-                    onClick={() => checkPermission()} />
-            </Footer>
-
-            {
-                (isOpen || isTimeOpen) && <PageContainer style={{ backgroundColor: '#1c1c1c' }}
-                    overlayStyle={{ backgroundColor: 'rgba(0,0,0,0.9)' }}
-                    customStyle={{ backgroundColor: '#1c1c1c' }}
-                    closeOnSlideDown={false}
-                    onAfterLeave={() => { setIsOpen(false); setIsTimeOpen(false) }}
-                    show={isOpen || isTimeOpen} round={true} overlay={true} position='bottom'
-                >
-                    {
-                        isTimeOpen ? timeContent() : layoutContent()
-                    }
-                </PageContainer>
-            }
-
-            {/* <PageContainer style={{ backgroundColor: '#1c1c1c' }}
-        overlayStyle='background-color:rgba(0,0,0,0.9)'
-        custom-style='background-color:#1c1c1c'
-        closeOnSlideDown={false}
-        onAfterLeave={() => { setIsOpen(false); setIsTimeOpen(false) }}
-        show={isOpen || isTimeOpen} round={true} overlay={true} position='bottom'
-      >
-        {
-          isModalTimePicker?timeContent():layoutContent()
-        }
-      </PageContainer> */}
-            {/* {
-                isOpen && <Modal children={layoutContent()} dismiss={() => setIsOpen(false)} confirm={() => {
-                    setIsOpen(false)
-                    durationChange(pickerRef.current.getConfirmData())
-                }} />
-            }
-            {
-                isTimeOpen && <Modal children={timeContent()} dismiss={() => setIsTimeOpen(false)} confirm={() => {
-                    setIsTimeOpen(false)
-                }} />
-            } */}
-
-        </View>
-    }
-
-    return <Layout
-        titleColor={scenario.step == 'fast' ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep}
-        title={scenario.step == 'fast' ? t('page.set_schedule.fast_title') : t('page.set_schedule.sleep_title')}
-        titleShowStyle={NaviBarTitleShowType.scrollToShow} type={TemplateType.customHeader}>
-        {
-            detail()
-        }
-    </Layout>;
-}

+ 0 - 96
src/features/trackTimeDuration/components/SetSchedule.scss

@@ -1,96 +0,0 @@
-
-.box{
-    margin-left: 32px;
-    margin-right: 32px;
-    background: #1C1C1C;
-    // border-radius: $boxBorderRadius;
-    display: flex;
-    flex-direction: column;
-    // margin-top: 20px;
-}
-
-.header{
-    margin-top: 40px;
-    display: flex;
-    flex-direction: row;
-    flex-shrink: 0;
-    height: 90px;
-}
-
-.item1{
-    display: flex;
-    flex: 1;
-    align-items: center;
-    justify-content: center;
-    // background-color: pink;
-    flex-direction: column;
-    height: 90px;
-}
-
-.item_title{
-    font-size: 32px;
-    line-height: 32px;
-}
-
-.subtitle{
-
-    opacity: 0.4;
-    font-size: 36px;
-    margin-bottom: 20px;
-    margin-left:40px;
-}
-.item_text{
-    margin-top: 10px;
-    font-size: 48px;
-    line-height: 48px;
-    font-weight: bold;
-}
-
-
-
-.dial_bg{
-    margin-top: 40px;
-    margin-bottom: 40px;
-    align-items: center;
-    justify-content: center;
-    display: flex;
-}
-
-.duration_bg{
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    justify-content: center;
-    height: 90px;
-    margin-bottom: 40px;
-    margin-right: 40px;
-}
-
-.duration_title{
-    font-size: 32px;
-    line-height: 32px;
-}
-
-.duration_value{
-    font-size: 48px;
-    line-height: 48px;
-    margin-top: 10px;
-    text-align: center;
-    font-weight: bold;
-}
-
-.schedule_text_value{
-    color: #fff;
-}
-
-.schedule_text_key{
-    color: #fff;
-    opacity: 0.6;
-}
-
-.next_day{
-    margin-right: 10px;
-    font-size: 28px;
-    color: #fff;
-    opacity: 0.4;
-}

+ 0 - 527
src/features/trackTimeDuration/components/SetSchedule.weapp.tsx

@@ -1,527 +0,0 @@
-import Buttons from "@/components/basic/Buttons";
-import { setPlan } from "@/services/trackTimeDuration";
-import { setScenario, setStep } from "@/store/scenario";
-import { View, Text, PageContainer } from "@tarojs/components";
-import "./SetSchedule.scss";
-import Taro, { useDidShow, useReady } from "@tarojs/taro";
-import { useEffect, useRef, useState } from "react";
-import { useDispatch, useSelector } from "react-redux";
-import Footer from "@/components/layout/Footer";
-import PickerViews from "@/components/input/PickerViews";
-import { durationDatas, durationIndex, durationTime, pickerDurations } from "../hooks/Console";
-import { TimeFormatter } from "@/utils/time_format";
-import Modal from "@/components/layout/Modal";
-import Dial from './Dial';
-import TimePicker from "@/features/common/TimePicker";
-import { SetScheduleBtn } from "@/features/common/SpecBtns";
-import Layout from "@/components/layout/layout";
-import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
-import { useTranslation } from "react-i18next";
-import { ColorType } from "@/context/themes/color";
-import TitleView from "./TitleView";
-import { jumpPage } from "../hooks/Common";
-import { vibrate } from "@/utils/tools";
-import { wxPubFollow } from "@/services/permission";
-import { setWXFollow } from "@/store/permission";
-import showAlert from "@/components/basic/Alert";
-
-export default function Component() {
-  const isFastFirst = true;
-  const { t } = useTranslation()
-  const dispatch = useDispatch();
-  const canvasRef = useRef(null);
-  const [scenario] = useState(useSelector((state: any) => state.scenario))
-  const permission = useSelector((state: any) => state.permission);
-  // const scenario = useSelector((state: any) => state.scenario);
-  const common = useSelector((state: any) => state.common);
-
-  const [isOpen, setIsOpen] = useState(false)
-  const [isTimeOpen, setIsTimeOpen] = useState(false)
-  const [btnDisable, setBtnDisable] = useState(false)
-
-  const pickerRef = useRef<any>(null);
-  // const [count,setCount] = useState(0)
-  const [beginChange, setBeginChange] = useState(true)
-  const [operateType, setOperateType] = useState(0)
-  const [isModalTimePicker, setIsModalTimePicker] = useState(false)
-
-  var scheduleObj: { start_time: any; end_time: any; };
-  if (scenario.name == 'FAST') {
-    scheduleObj = scenario.schedule.fast
-  }
-  else if (scenario.name == 'SLEEP') {
-    scheduleObj = scenario.schedule.sleep
-  }
-  else {
-    if (scenario.step == 'fast') {
-      scheduleObj = scenario.schedule.fast
-    }
-    else {
-      scheduleObj = scenario.schedule.sleep
-    }
-  }
-
-
-
-  const [startTime, setStartTime] = useState(scheduleObj.start_time)
-  const [endTime, setEndTime] = useState(scheduleObj.end_time)
-
-  global.startTime = startTime
-  global.endTime = endTime
-  const [pickerValue, setPickerValue] = useState(durationIndex(scheduleObj.start_time, scheduleObj.end_time, common))
-
-  const [hours, setHours] = useState(durationTime(scheduleObj.start_time, scheduleObj.end_time)[0])
-  const [minutes, setMinutes] = useState(durationTime(scheduleObj.start_time, scheduleObj.end_time)[1])
-  const [chooseStart, setChooseStart] = useState(true)
-  const [count, setCount] = useState(0)
-
-  useReady(() => {
-
-    if (global.schedule_fast && scenario.step == 'fast') {
-      scheduleObj = global.schedule_fast
-    }
-    if (global.schedule_sleep && scenario.step == 'sleep') {
-      scheduleObj = global.schedule_sleep
-    }
-    setStartTime(scheduleObj.start_time)
-    setEndTime(scheduleObj.end_time)
-    setPickerValue(durationIndex(scheduleObj.start_time, scheduleObj.end_time, common))
-    setHours(durationTime(scheduleObj.start_time, scheduleObj.end_time)[0])
-    setMinutes(durationTime(scheduleObj.start_time, scheduleObj.end_time)[1])
-
-
-    // var title = scenario.step == 'fast' ? 'Fast schedule' : 'Sleep schedule'
-    // Taro.setNavigationBarTitle({
-    //   title: title
-    // })
-  })
-
-  useEffect(() => {
-    if (isOpen || isTimeOpen) {
-      global.disableCanvasGesture = true
-    }
-    else {
-      global.disableCanvasGesture = false
-    }
-  }, [isOpen, isTimeOpen])
-
-
-  useDidShow(() => {
-    setCount(count + 1)
-    wxPubFollow({ force_refresh: true }).then(res => {
-      dispatch(setWXFollow((res as any).wx_pub_followed));
-    })
-  })
-
-  function followWxPub() {
-    const resource = common.resources.filter((item: any) => {
-      return item.code == 'follow_wx_pub'
-    })
-
-
-    // Taro.showModal({
-    //   title: '提示',
-    //   content: '关注公众号后可接收提醒\n点击确定,前往关注',
-    //   showCancel: true,
-    //   success(result) {
-    //     if (result.confirm) {
-    jumpPage('/pages/common/H5?title=fast16cc 关注服务号&url=' + resource[0].url)
-    //   }
-    // },
-    // })
-  }
-
-
-  function start() {
-    if (scenario.name == 'FAST' || scenario.name == 'SLEEP') {
-      setBtnDisable(true)
-      setPlan({
-        scenario: scenario.name,
-        schedule: scenario.name == 'FAST' ? {
-          fast: {
-            start_time: startTime,
-            end_time: endTime,
-          }
-        } : {
-          sleep: {
-            start_time: startTime,
-            end_time: endTime,
-          }
-        }
-      }).then(res => {
-        setBtnDisable(false)
-        // global.checkData()
-        global.indexPageRefresh()
-
-        // popScheduleAlert(scenario, startTime)
-        // console.log('set schedule 3 navi back')
-        Taro.navigateBack({ delta: 3 }).then(res => {
-
-        })
-        setTimeout(() => {
-          global.popScheduleAlert(scenario, startTime)
-        }, 800)
-      }).catch(e => {
-        setBtnDisable(false)
-      })
-    }
-    else {
-      if ((scenario.step == 'fast' && isFastFirst) || (scenario.step == 'sleep' && !isFastFirst)) {
-        var obj = JSON.parse(JSON.stringify(scenario))
-        if (isFastFirst) {
-          obj.schedule.fast = {
-            start_time: startTime,
-            end_time: endTime,
-          }
-          dispatch(setStep('sleep'))
-          dispatch(setScenario(obj))
-        }
-        else {
-          obj.schedule.sleep = {
-            start_time: startTime,
-            end_time: endTime,
-          }
-          dispatch(setStep('fast'))
-          dispatch(setScenario(obj))
-        }
-
-        saveTempCache(startTime, endTime)
-
-        jumpPage('/pages/clock/SetSchedule')
-      }
-      else {
-        commit()
-      }
-    }
-  }
-
-  function saveTempCache(strStart, strEnd) {
-    if (scenario.step == 'fast') {
-      global.schedule_fast = {
-        start_time: strStart,
-        end_time: strEnd,
-      }
-    }
-    if (scenario.step == 'sleep') {
-      global.schedule_sleep = {
-        start_time: strStart,
-        end_time: strEnd,
-      }
-    }
-
-  }
-
-  function commit() {
-    setBtnDisable(true)
-    setPlan({
-      scenario: scenario.name,
-      schedule: {
-        fast: {
-          start_time: isFastFirst ? scenario.schedule.fast.start_time : startTime,
-          end_time: isFastFirst ? scenario.schedule.fast.end_time : endTime,
-        }, sleep: {
-          start_time: !isFastFirst ? scenario.schedule.sleep.start_time : startTime,
-          end_time: !isFastFirst ? scenario.schedule.sleep.end_time : endTime,
-        }
-      }
-    }).then(res => {
-      setBtnDisable(false)
-      // dispatch(setStep('fast'))
-      // // global.checkData()
-      Taro.navigateBack({ delta: 4 })
-      // console.log('set schedule 4 navi back')
-
-      setTimeout(() => {
-        global.popMixScheduleAlert(scenario.schedule.fast.start_time, startTime)
-      }, 800)
-
-
-
-      global.indexPageRefresh()
-    }).catch(e => {
-      setBtnDisable(false)
-    })
-  }
-
-  function popScheduleAlert(scenario, startTime) {
-    if (permission.wxPubFollow) {
-      showAlert({
-        title: t('feature.track_time_duration.reminders.schedule_title'),
-        content: scenario.name == 'FAST' ?
-          t('feature.track_time_duration.reminders.enable_schedule_fast_content', { time: startTime }) :
-          t('feature.track_time_duration.reminders.enable_schedule_sleep_content', { time: startTime }),
-        showCancel: false,
-        confirmText: t('feature.track_time_duration.reminders.ok'),
-        cancel: () => {
-          Taro.navigateBack({ delta: 3 })
-        },
-        confirm: () => {
-          Taro.navigateBack({ delta: 3 })
-        }
-      })
-    }
-    else {
-      showAlert({
-        title: t('feature.track_time_duration.reminders.schedule_title'),
-        content: scenario.name == 'FAST' ?
-          t('feature.track_time_duration.reminders.schedule_fast_content', { time: startTime }) :
-          t('feature.track_time_duration.reminders.schedule_sleep_content', { time: startTime }),
-        cancelText: t('feature.track_time_duration.reminders.later'),
-        confirmText: t('feature.track_time_duration.reminders.open'),
-        showCancel: true,
-        cancel: () => {
-          Taro.navigateBack({ delta: 3 })
-        },
-        confirm: () => {
-          // Taro.navigateBack({ delta: 3 })
-          followWxPub()
-          setTimeout(() => {
-            Taro.navigateBack({ delta: 3 })
-          }, 1000)
-        }
-      })
-    }
-  }
-
-  function popMixScheduleAlert(time1, time2) {
-    if (permission.wxPubFollow) {
-      showAlert({
-        title: t('feature.track_time_duration.reminders.schedule_title'),
-        content: t('feature.track_time_duration.reminders.enable_schedule_mix_content', { time1: time1, time2: time2 }),
-        showCancel: false,
-        confirmText: t('feature.track_time_duration.reminders.ok'),
-        cancel: () => {
-          Taro.navigateBack({ delta: 4 })
-        },
-        confirm: () => {
-          Taro.navigateBack({ delta: 4 })
-        }
-      })
-    }
-    else {
-      showAlert({
-        title: t('feature.track_time_duration.reminders.schedule_title'),
-        content:
-          t('feature.track_time_duration.reminders.schedule_mix_content'),
-        cancelText: t('feature.track_time_duration.reminders.later'),
-        confirmText: t('feature.track_time_duration.reminders.open'),
-        showCancel: true,
-        cancel: () => {
-          Taro.navigateBack({ delta: 4 })
-        },
-        confirm: () => {
-
-          followWxPub()
-          setTimeout(() => {
-            Taro.navigateBack({ delta: 4 })
-          }, 1000)
-        }
-
-      })
-
-    }
-  }
-
-  function onStartTimeChange(e: string) {
-    setIsTimeOpen(false)
-    setBeginChange(true)
-    setStartTime(e)
-
-    setPickerValue(durationIndex(e, endTime, common))
-    setHours(durationTime(e, endTime)[0])
-    setMinutes(durationTime(e, endTime)[1])
-    saveTempCache(e, endTime);
-    global.updateDial(e, endTime)
-  }
-
-  function onEndTimeChange(e: string) {
-    setIsTimeOpen(false)
-    setBeginChange(false)
-    setEndTime(e)
-    setPickerValue(durationIndex(startTime, e, common))
-    setHours(durationTime(startTime, e)[0])
-    setMinutes(durationTime(startTime, e)[1])
-    saveTempCache(startTime, e);
-    console.log(e)
-    global.updateDial(startTime, e)
-  }
-
-
-
-  function showPicker() {
-    setIsOpen(true)
-  }
-
-  function durationChange(e) {
-    var count = (e[0] + common.duration.min) * 60 + e[1] * common.duration.step
-
-    var h = parseInt(count / 60)
-    var m = count % 60
-    setHours(h)
-    setMinutes(m)
-    setPickerValue(e)
-    setIsOpen(false)
-    if (beginChange) {
-      var strEnd = TimeFormatter.calculateTimeByTimeRange(count, startTime, true)
-
-      setEndTime(strEnd);
-      saveTempCache(startTime, strEnd)
-      global.updateDial(startTime, strEnd)
-    }
-    else {
-      var strStart = TimeFormatter.calculateTimeByTimeRange(count, endTime, false)
-      setStartTime(strStart);
-      saveTempCache(strStart, endTime)
-      global.updateDial(strStart, endTime)
-    }
-
-  }
-
-  global.startDuration = (type) => {
-    setOperateType(type)
-  }
-
-  global.updateDuration = (start, end) => {
-    var startCount = parseInt(start.split(':')[0]) * 60 + parseInt(start.split(':')[1])
-    var endCount = parseInt(end.split(':')[0]) * 60 + parseInt(end.split(':')[1])
-    if (operateType == 1 && startCount % 30 == 0) {
-      vibrate()
-    }
-    else if (operateType == 2 && endCount % 30 == 0) {
-      vibrate()
-    }
-    else if (operateType == 3 && (startCount % 30 == 0 || endCount % 30 == 0)) {
-      vibrate()
-    }
-
-    setStartTime(start)
-    setEndTime(end)
-    setPickerValue(durationIndex(start, end, common))
-    setHours(durationTime(start, end)[0])
-    setMinutes(durationTime(start, end)[1])
-    saveTempCache(start, end)
-  }
-
-
-  global.endDuration = () => {
-    setOperateType(0)
-  }
-
-  function layoutContent() {
-    return <PickerViews ref={pickerRef}
-      onChange={durationChange}
-      items={durationDatas(common)}
-      value={pickerValue} height={200}
-      title={scenario.step == 'fast' ?
-        t('feature.track_time_duration.dial.picker_fast_schedule_duration') :
-        t('feature.track_time_duration.dial.picker_sleep_schedule_duration')}
-      themeColor={scenario.step == 'fast' ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep}
-      showBtns={true} onCancel={() => { setIsOpen(false) }} />
-  }
-
-  function pickerTitle() {
-    if (scenario.step == 'fast') {
-      if (chooseStart) {
-        return t('feature.track_time_duration.dial.picker_fast_schedule_start_time');
-      }
-      return t('feature.track_time_duration.dial.picker_fast_schedule_end_time');
-    }
-    else {
-      if (chooseStart) {
-        return t('feature.track_time_duration.dial.picker_sleep_schedule_start_time');
-      }
-      return t('feature.track_time_duration.dial.picker_sleep_schedule_end_time');
-    }
-  }
-
-
-  function timeContent() {
-    return <TimePicker time={chooseStart ? startTime : endTime}
-      color={scenario.step == 'fast' ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep}
-      title={pickerTitle()}
-      confirm={chooseStart ? onStartTimeChange : onEndTimeChange}
-      cancel={() => { setIsTimeOpen(false) }} />
-  }
-
-  function detail() {
-    return <View >
-      {/* <Text className="subtitle">{t('page.set_schedule.fast_subtitle')}</Text> */}
-      <TitleView title={scenario.step == 'fast' ? t('page.set_schedule.fast_title') : t('page.set_schedule.sleep_title')}
-        subTitle={t('page.set_schedule.fast_subtitle')}
-        titleColor={scenario.step == 'fast' ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep}
-      />
-
-      <View className="box">
-        <View className="header" style={{ backgroundColor: global.isDebug ? '#EEC01F' : 'transparent' }}>
-          <View className="item1" style={{ opacity: operateType == 1 || operateType == 3 ? 1 : 0.4, backgroundColor: global.isDebug ? 'pink' : 'transparent' }} onClick={() => {
-            setIsModalTimePicker(true)
-            setChooseStart(true)
-            setIsTimeOpen(true)
-          }}>
-            <Text className="item_title schedule_text_key">{t('feature.track_time_duration.dial.start_time')}</Text>
-            <Text className="item_text schedule_text_value">{startTime}</Text>
-          </View>
-          <View style={{ width: 23 }} />
-          <View className="item1" style={{ opacity: operateType == 2 || operateType == 3 ? 1 : 0.4, backgroundColor: global.isDebug ? 'pink' : 'transparent' }} onClick={() => {
-            setIsModalTimePicker(true)
-            setChooseStart(false)
-            setIsTimeOpen(true)
-          }}>
-            <Text className="item_title schedule_text_key">{t('feature.track_time_duration.dial.end_time')}</Text>
-            <Text className="item_text schedule_text_value">{endTime}</Text>
-          </View>
-
-        </View>
-        <View className="dial_bg" style={{ backgroundColor: global.isDebug ? 'pink' : 'transparent' }}>
-          <Dial ref={canvasRef} />
-        </View>
-        <View className="duration_bg" style={{ opacity: operateType == 1 || operateType == 2 ? 1 : 0.4, backgroundColor: global.isDebug ? 'pink' : 'transparent' }} onClick={() => { setIsModalTimePicker(false); setIsOpen(true) }}>
-          <Text className="duration_title schedule_text_key">{t('feature.track_time_duration.dial.duration')}</Text>
-          <Text className="duration_value schedule_text_value"  >{hours > 0 ? hours + TimeFormatter.getHoursUnit(hours) : ''}{minutes > 0 ? minutes + '分钟' : ''}</Text>
-        </View>
-
-      </View>
-
-      <Footer>
-        <SetScheduleBtn title={(scenario.step == 'fast' && scenario.name == 'FAST_SLEEP') ? t('feature.common.btn_set_and_next') : t('feature.common.btn_set_and_done')}
-          lowLight={operateType != 0}
-          isFast={scenario.step == 'fast'}
-          disable={btnDisable}
-          onClick={() => start()} />
-      </Footer>
-
-      {/* <PageContainer style={{ backgroundColor: '#1c1c1c' }}
-        overlayStyle='background-color:rgba(0,0,0,0.9)'
-        custom-style='background-color:#1c1c1c'
-        closeOnSlideDown={false}
-        onAfterLeave={() => { setIsOpen(false); setIsTimeOpen(false) }}
-        show={isOpen || isTimeOpen} round={true} overlay={true} position='bottom'
-      >
-        {
-          isModalTimePicker?timeContent():layoutContent()
-        }
-      </PageContainer> */}
-      {
-        isOpen && <Modal children={layoutContent()} dismiss={() => setIsOpen(false)} confirm={() => {
-          setIsOpen(false)
-          durationChange(pickerRef.current.getConfirmData())
-        }} />
-      }
-      {
-        isTimeOpen && <Modal children={timeContent()} dismiss={() => setIsTimeOpen(false)} confirm={() => {
-          setIsTimeOpen(false)
-        }} />
-      }
-
-    </View>
-  }
-
-  return <Layout
-    titleColor={scenario.step == 'fast' ? global.fastColor ? global.fastColor : ColorType.fast : global.sleepColor ? global.sleepColor : ColorType.sleep}
-    title={scenario.step == 'fast' ? t('page.set_schedule.fast_title') : t('page.set_schedule.sleep_title')}
-    titleShowStyle={NaviBarTitleShowType.scrollToShow} type={TemplateType.customHeader}>
-    {
-      detail()
-    }
-  </Layout>;
-}

+ 0 - 162
src/features/trackTimeDuration/components/Stage.rn.tsx

@@ -1,162 +0,0 @@
-import { View, Text, Icon } from "@tarojs/components";
-import './Stage.scss'
-import { TimeFormatter } from "@/utils/time_format";
-import { ColorType } from "@/context/themes/color";
-import { IconRadio, IconRadioCheck, IconRadioCross } from "@/components/basic/Icons";
-import { useTranslation } from "react-i18next";
-import { rpxToPx } from "@/utils/tools";
-
-export default function Component(props: { data: any }) {
-    const { t } = useTranslation()
-    function getTime(t1: number, t2: number) {
-        return TimeFormatter.formateTimeDifference(t1, t2)
-    }
-
-    function getDuration(t1: number, t2: number) {
-        return TimeFormatter.calculateTimeDifference(t1, t2)
-    }
-
-    function getStepATime(obj) {
-        if (obj.status == 'COMPLETED' && obj.sleep.status == 'NOT_STARTED') {
-            return t('feature.track_time_duration.stage.not_completed')
-        }
-
-        return obj.status == 'ONGOING1' ?
-            getTime(obj.fast.real_start_time, (new Date()).getTime()) :
-            obj.sleep.real_start_time ? getDuration(obj.sleep.real_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time) :
-                getDuration(obj.sleep.target_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time)
-    }
-
-    function getStepBTime(obj) {
-        if (obj.status == 'ONGOING1') return t('feature.track_time_duration.stage.wait_for_start')
-        if (obj.status == 'ONGOING2') return getTime(obj.sleep.real_start_time, (new Date()).getTime())
-        if (obj.status == 'WAIT_FOR_START') return getDuration(obj.sleep.target_end_time, obj.sleep.target_start_time)
-        if (obj.sleep.status == 'NOT_STARTED') return t('feature.track_time_duration.stage.not_started')
-        if (obj.sleep.status == 'NOT_COMPLETED') return t('feature.track_time_duration.stage.not_completed')
-        return getDuration(obj.sleep.real_end_time, obj.sleep.real_start_time)
-
-    }
-
-    function getStepCTime(obj) {
-        if (obj.status == 'ONGOING1') return t('feature.track_time_duration.stage.wait_for_start')
-        if (obj.status == 'ONGOING2') return t('feature.track_time_duration.stage.wait_for_start')
-        if (obj.status == 'ONGOING3') return getTime(obj.sleep.real_end_time, (new Date()).getTime())
-        if (obj.status == 'WAIT_FOR_START') return getDuration(obj.fast.target_end_time, obj.sleep.target_end_time)
-        if (obj.sleep.status == 'NOT_COMPLETED' || obj.sleep.status == 'NOT_STARTED') return t('feature.track_time_duration.stage.not_started')
-        return getDuration(obj.fast.real_end_time, obj.sleep.real_end_time)
-    }
-    function getStepAIcon(obj) {
-        if (obj.status == 'COMPLETED' && obj.sleep.status == 'NOT_STARTED') {
-            return <IconRadioCross width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />;
-        }
-        return (obj.status == 'ONGOING1' || obj.status == 'WAIT_FOR_START') ?
-            <IconRadio width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-            : <IconRadioCheck width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-    }
-
-    function getStepBIcon(obj) {
-        var sleepColor = global.sleepColor ? global.sleepColor : ColorType.sleep
-        if (obj.status == 'ONGOING1') return <IconRadio width={16} color={sleepColor} />
-        if (obj.status == 'ONGOING2') return <IconRadio width={16} color={sleepColor} />
-        if (obj.status == 'WAIT_FOR_START') return <IconRadio width={16} color={sleepColor} />
-        if (obj.sleep.status == 'NOT_STARTED') return <IconRadioCross width={16} color={sleepColor} />
-        if (obj.sleep.status == 'NOT_COMPLETED') return <IconRadioCross width={16} color={sleepColor} />
-        return <IconRadioCheck width={16} color={sleepColor} />
-    }
-
-    function getStepCIcon(obj) {
-        if (obj.status == 'ONGOING1') return <IconRadio width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-        if (obj.status == 'ONGOING2') return <IconRadio width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-        if (obj.status == 'ONGOING3') return <IconRadio width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-        if (obj.status == 'WAIT_FOR_START') return <IconRadio width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-        if (obj.sleep.status == 'NOT_COMPLETED' || obj.sleep.status == 'NOT_STARTED') return <IconRadioCross width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-        return <IconRadioCheck width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-    }
-
-    return <View className="stage">
-
-        <View className='timelineItem'>
-            <View className='timelineContentView' style={{ background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    <Icon type='circle' size='16' color='#ffffff00' />//<CheckBox type={CheckBoxType.empty} opacity={0.4} />
-                }
-                <View className='timelineContentDetail'>
-                    <View className="timeline-time" >{'  '}</View>
-                </View>
-            </View>
-            <View className="timeline-detail" style={{ color: ColorType.fast, opacity: 1,marginTop:rpxToPx(0) }}>
-
-                <Text className="scenario_name" style={{color: ColorType.fast, opacity: 1}}>
-                    {props.data.status == 'ONGOING1' ?t('feature.track_time_duration.stage.a_ing'):t('feature.track_time_duration.stage.a')}
-                    </Text>
-                <View className="timeline-date2" style={{ color: ColorType.fast, opacity: 1 }}>{getStepATime(props.data)}</View>
-
-            </View>
-            <View className='timeline_line1 line2_bottom_space' style={{ backgroundColor: props.data.status == 'ONGOING1' ? ColorType.fast : 'rgba(255,255,255,0.1)' }} />
-            <View className='timeline-line-bg' style={{ width: 16, background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    getStepAIcon(props.data)
-                }
-                <View className='timeline-line1'
-                    style={{ opacity:0 }}
-                />
-            </View>
-
-        </View>
-        <View className='timelineItem'>
-            <View className='timelineContentView' style={{ background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    <Icon type='circle' size='16' color='#ffffff00' />//<CheckBox type={CheckBoxType.empty} opacity={0.4} />
-                }
-                <View className='timelineContentDetail'>
-                    <View className="timeline-time" >{'  '}</View>
-                </View>
-            </View>
-            <View className="timeline-detail" style={{ color: ColorType.sleep, opacity: 1,marginTop:rpxToPx(0) }}>
-
-                <Text className="scenario_name" style={{color: ColorType.sleep, opacity: 1}}>
-                    {props.data.status == 'ONGOING2' ?t('feature.track_time_duration.stage.b_ing'):t('feature.track_time_duration.stage.b')}
-                    </Text>
-                <View className="timeline-date2" style={{ color: ColorType.sleep, opacity: 1 }}>{getStepBTime(props.data)}</View>
-
-            </View>
-            <View className='timeline_line1 line1_bottom_space' style={{ backgroundColor: props.data.status == 'ONGOING2' ? ColorType.sleep : 'rgba(255,255,255,0.1)' }} />
-            <View className='timeline-line-bg' style={{ width: 16, background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    getStepBIcon(props.data)
-                }
-                <View className='timeline-line1'
-                    style={{ opacity:0 }}
-                />
-            </View>
-
-        </View>
-        <View className='timelineItem'>
-            <View className='timelineContentView' style={{ background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    <Icon type='circle' size='16' color='#ffffff00' />//<CheckBox type={CheckBoxType.empty} opacity={0.4} />
-                }
-                <View className='timelineContentDetail'>
-                    <View className="timeline-time" >{'  '}</View>
-                </View>
-            </View>
-            <View className="timeline-detail" style={{ color: ColorType.fast, opacity: 1,marginTop:rpxToPx(0) }}>
-                <Text className="scenario_name" style={{color: ColorType.fast, opacity: 1}}>
-                    {props.data.status == 'ONGOING3' ?t('feature.track_time_duration.stage.c_ing'):t('feature.track_time_duration.stage.c')}
-                    </Text>
-                <View className="timeline-date2" style={{ color: ColorType.fast, opacity: 1 }}>{getStepCTime(props.data)}</View>
-
-            </View>
-            <View className={'timeline_line1 line1_bottom_zero'} style={{ backgroundColor: props.data.status == 'ONGOING3' ? ColorType.fast : 'rgba(255,255,255,0.1)' }} />
-            <View className='timeline-line-bg' style={{ width: 16, background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    getStepCIcon(props.data)
-                }
-                <View className='timeline-line1'
-                    style={{ opacity:0 }}
-                />
-            </View>
-        </View>
-
-    </View>
-}

+ 0 - 101
src/features/trackTimeDuration/components/Stage.scss

@@ -1,101 +0,0 @@
-
-@import '@/components/view/Timeline.scss';
-.stage {
-    display: flex;
-    flex-direction: column;
-    // margin-top: 16px;
-}
-
-.stage_item {
-    display: flex;
-    flex-direction: row;
-    height: 112px;
-    width: 578px;
-    padding-right: 60px;
-    box-sizing: border-box;
-    // border-bottom-style: solid;
-    // border-bottom-color: rgba(255, 255, 255, 0.1);
-    // border-bottom-width: 1px;
-    align-items: center;
-}
-
-.stage_step {
-    margin-left: 12px;
-    width: 52px;
-    font-size: 40px;
-    font-weight: 400px;
-    color: rgba(255, 255, 255, 0.4);
-    background-color: pink;
-    height: 40px;
-    line-height: 40px;
-    margin-right: 11px;
-}
-
-.stage_line{
-    width: 2px;
-    height: 56px;
-    border-radius: 1px;
-    background-color: #FFFFFF;
-}
-
-.stage_step_border {
-    border-right-style: solid;
-    border-right-color: #FFFFFF66;
-    border-right-width: 2px;
-}
-
-.stage_step_border_ing{
-    border-right-style: solid;
-    // border-right-color: $fastColor;
-    border-right-width: 2px;
-}
-
-.stage_right{
-    margin-left: 35px;
-    border-bottom-style: solid;
-    border-bottom-color: rgba(255, 255, 255, 0.1);
-    border-bottom-width: 1px;
-    height: 56px;
-    align-items: center;
-    display: flex;
-    flex-direction: row;
-    width: 406px;
-}
-
-.stage_title {
-    font-size: 32px;
-    font-weight: 400;
-    height: 32px;
-    line-height: 32px;
-    color: rgba(255, 255, 255, 0.8);
-    // margin-bottom: 16px;
-    flex: 1;
-}
-
-.stage_value {
-    font-size: 32px;
-    font-weight: 400;
-    height: 32px;
-    line-height: 32px;
-    color: rgba(255, 255, 255, 0.8);
-    // margin-bottom: 16px;
-}
-
-.stage_icon{
-    position: absolute;
-    left: -100px;
-    // background-color: yellow;
-    width: 80px;
-    display: flex;
-    flex-direction: row;
-    justify-content: flex-end;
-}
-
-.scenario_name{
-    font-size: 32px;
-    line-height: 32px;
-}
-
-.line2_bottom_space {
-    margin-bottom: 0px;
-  }

+ 0 - 200
src/features/trackTimeDuration/components/Stage.weapp.tsx

@@ -1,200 +0,0 @@
-import { View, Text, Icon } from "@tarojs/components";
-import './Stage.scss'
-import { TimeFormatter } from "@/utils/time_format";
-import { ColorType } from "@/context/themes/color";
-import { IconRadio, IconRadioCheck, IconRadioCross } from "@/components/basic/Icons";
-import { useTranslation } from "react-i18next";
-
-export default function Component(props: { data: any }) {
-    const { t } = useTranslation()
-    function getTime(t1: number, t2: number) {
-        return TimeFormatter.formateTimeDifference(t1, t2)
-    }
-
-    function getDuration(t1: number, t2: number) {
-        return TimeFormatter.calculateTimeDifference(t1, t2)
-    }
-
-    function getStepATime(obj) {
-        if (obj.status == 'COMPLETED' && obj.sleep.status == 'NOT_STARTED') {
-            return t('feature.track_time_duration.stage.not_completed')
-        }
-
-        return obj.status == 'ONGOING1' ?
-            getTime(obj.fast.real_start_time, (new Date()).getTime()) :
-            obj.sleep.real_start_time ? getDuration(obj.sleep.real_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time) :
-                getDuration(obj.sleep.target_start_time, obj.fast.real_start_time ? obj.fast.real_start_time : obj.fast.target_start_time)
-    }
-
-    function getStepBTime(obj) {
-        if (obj.status == 'ONGOING1') return t('feature.track_time_duration.stage.wait_for_start')
-        if (obj.status == 'ONGOING2') return getTime(obj.sleep.real_start_time, (new Date()).getTime())
-        if (obj.status == 'WAIT_FOR_START') return getDuration(obj.sleep.target_end_time, obj.sleep.target_start_time)
-        if (obj.sleep.status == 'NOT_STARTED') return t('feature.track_time_duration.stage.not_started')
-        if (obj.sleep.status == 'NOT_COMPLETED') return t('feature.track_time_duration.stage.not_completed')
-        return getDuration(obj.sleep.real_end_time, obj.sleep.real_start_time)
-
-    }
-
-    function getStepCTime(obj) {
-        if (obj.status == 'ONGOING1') return t('feature.track_time_duration.stage.wait_for_start')
-        if (obj.status == 'ONGOING2') return t('feature.track_time_duration.stage.wait_for_start')
-        if (obj.status == 'ONGOING3') return getTime(obj.sleep.real_end_time, (new Date()).getTime())
-        if (obj.status == 'WAIT_FOR_START') return getDuration(obj.fast.target_end_time, obj.sleep.target_end_time)
-        if (obj.sleep.status == 'NOT_COMPLETED' || obj.sleep.status == 'NOT_STARTED') return t('feature.track_time_duration.stage.not_started')
-        return getDuration(obj.fast.real_end_time, obj.sleep.real_end_time)
-    }
-    function getStepAIcon(obj) {
-        if (obj.status == 'COMPLETED' && obj.sleep.status == 'NOT_STARTED') {
-            return <IconRadioCross width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />;
-        }
-        return (obj.status == 'ONGOING1' || obj.status == 'WAIT_FOR_START') ?
-            <IconRadio width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-            : <IconRadioCheck width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-    }
-
-    function getStepBIcon(obj) {
-        var sleepColor = global.sleepColor ? global.sleepColor : ColorType.sleep
-        if (obj.status == 'ONGOING1') return <IconRadio width={16} color={sleepColor} />
-        if (obj.status == 'ONGOING2') return <IconRadio width={16} color={sleepColor} />
-        if (obj.status == 'WAIT_FOR_START') return <IconRadio width={16} color={sleepColor} />
-        if (obj.sleep.status == 'NOT_STARTED') return <IconRadioCross width={16} color={sleepColor} />
-        if (obj.sleep.status == 'NOT_COMPLETED') return <IconRadioCross width={16} color={sleepColor} />
-        return <IconRadioCheck width={16} color={sleepColor} />
-    }
-
-    function getStepCIcon(obj) {
-        if (obj.status == 'ONGOING1') return <IconRadio width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-        if (obj.status == 'ONGOING2') return <IconRadio width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-        if (obj.status == 'ONGOING3') return <IconRadio width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-        if (obj.status == 'WAIT_FOR_START') return <IconRadio width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-        if (obj.sleep.status == 'NOT_COMPLETED' || obj.sleep.status == 'NOT_STARTED') return <IconRadioCross width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-        return <IconRadioCheck width={16} color={global.fastColor ? global.fastColor : ColorType.fast} />
-    }
-
-    return <View className="stage">
-
-        <View className='timelineItem'>
-            <View className='timelineContentView' style={{ background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    <Icon type='circle' size='16' color='#ffffff00' />//<CheckBox type={CheckBoxType.empty} opacity={0.4} />
-                }
-                <View className='timelineContentDetail'>
-                    <View className="timeline-time" >{'  '}</View>
-                </View>
-            </View>
-            <View className="timeline-detail" style={{ color: ColorType.fast, opacity: 1 }}>
-
-                <Text>{t('feature.track_time_duration.stage.a')}</Text>
-                <View className="timeline-date2" style={{ color: ColorType.fast, opacity: 1 }}>{getStepATime(props.data)}</View>
-
-            </View>
-            <View className='timeline_line1 line1_bottom_space' style={{ backgroundColor: props.data.status == 'ONGOING1' ? ColorType.fast : 'rgba(255,255,255,0.1)' }} />
-            <View className='timeline-line-bg' style={{ width: 16, background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    getStepAIcon(props.data)
-                }
-                <View className='timeline-line1'
-                    style={{ background: '#ffffff00' }}
-                />
-            </View>
-
-        </View>
-        <View className='timelineItem'>
-            <View className='timelineContentView' style={{ background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    <Icon type='circle' size='16' color='#ffffff00' />//<CheckBox type={CheckBoxType.empty} opacity={0.4} />
-                }
-                <View className='timelineContentDetail'>
-                    <View className="timeline-time" >{'  '}</View>
-                </View>
-            </View>
-            <View className="timeline-detail" style={{ color: ColorType.sleep, opacity: 1 }}>
-
-                <Text>{t('feature.track_time_duration.stage.b')}</Text>
-                <View className="timeline-date2" style={{ color: ColorType.sleep, opacity: 1 }}>{getStepBTime(props.data)}</View>
-
-            </View>
-            <View className='timeline_line1 line1_bottom_space' style={{ backgroundColor: props.data.status == 'ONGOING2' ? ColorType.sleep : 'rgba(255,255,255,0.1)' }} />
-            <View className='timeline-line-bg' style={{ width: 16, background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    getStepBIcon(props.data)
-                }
-                <View className='timeline-line1'
-                    style={{ background: '#ffffff00' }}
-                />
-            </View>
-
-        </View>
-        <View className='timelineItem'>
-            <View className='timelineContentView' style={{ background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    <Icon type='circle' size='16' color='#ffffff00' />//<CheckBox type={CheckBoxType.empty} opacity={0.4} />
-                }
-                <View className='timelineContentDetail'>
-                    <View className="timeline-time" >{'  '}</View>
-                </View>
-            </View>
-            <View className="timeline-detail" style={{ color: ColorType.fast, opacity: 1 }}>
-                <Text>{t('feature.track_time_duration.stage.c')}</Text>
-                <View className="timeline-date2" style={{ color: ColorType.fast, opacity: 1 }}>{getStepCTime(props.data)}</View>
-
-            </View>
-            <View className={'timeline_line1 line1_bottom_zero'} style={{ backgroundColor: props.data.status == 'ONGOING3' ? ColorType.fast : 'rgba(255,255,255,0.1)' }} />
-            <View className='timeline-line-bg' style={{ width: 16, background: global.isDebug ? 'red' : 'transparent' }}>
-                {
-                    getStepCIcon(props.data)
-                }
-                <View className='timeline-line1'
-                    style={{ background: '#ffffff00' }}
-                />
-            </View>
-        </View>
-        {/* <View className="stage_item">
-            <Text className='stage_step'>A</Text>
-            <View className="stage_line" style={{ opacity: props.data.status == 'ONGOING1' ? 1 : 0.4 }} />
-            <View className="stage_right">
-                <Text className="stage_title" style={{
-                    color: props.data.status == 'ONGOING1' ?
-                        global.fastColor ? global.fastColor : ColorType.fast : 'rgba(255, 255, 255, 0.8)'
-                }}>睡前断食</Text>
-                <Text className="stage_value" style={{
-                    color: props.data.status == 'ONGOING1' ?
-                        global.fastColor ? global.fastColor : ColorType.fast : 'rgba(255, 255, 255, 0.8)'
-                }}>{getStepATime(props.data)}</Text>
-            </View>
-
-        </View> */}
-        {/* <View className="stage_item">
-            <Text className='stage_step'>B</Text>
-            <View className="stage_line" style={{ opacity: props.data.status == 'ONGOING2' ? 1 : 0.4 }} />
-            <View className="stage_right">
-                <Text className="stage_title" style={{
-                    color: props.data.status == 'ONGOING2' ?
-                        global.fastColor ? global.fastColor : ColorType.fast : 'rgba(255, 255, 255, 0.8)'
-                }}>睡眠中断食</Text>
-                <Text className="stage_value" style={{
-                    color: props.data.status == 'ONGOING2' ?
-                        global.fastColor ? global.fastColor : ColorType.fast : 'rgba(255, 255, 255, 0.8)'
-                }}>{getStepBTime(props.data)}</Text>
-            </View>
-
-        </View>
-        <View className="stage_item">
-            <Text className='stage_step'>C</Text>
-            <View className="stage_line" style={{ opacity: props.data.status == 'ONGOING3' ? 1 : 0.4 }} />
-            <View className="stage_right">
-                <Text className="stage_title" style={{
-                    color: props.data.status == 'ONGOING3' ?
-                        global.fastColor ? global.fastColor : ColorType.fast : 'rgba(255, 255, 255, 0.8)'
-                }}>起床后断食</Text>
-                <Text className="stage_value" style={{
-                    color: props.data.status == 'ONGOING3' ?
-                        global.fastColor ? global.fastColor : ColorType.fast : 'rgba(255, 255, 255, 0.8)'
-                }}>{getStepCTime(props.data)}</Text>
-            </View>
-
-        </View> */}
-
-    </View>
-}

+ 0 - 104
src/features/trackTimeDuration/components/StageSelector.scss

@@ -1,104 +0,0 @@
-
-
-.single_check_nor1{
-    margin-bottom: 32px;
-    height: 88px;
-    border-radius: 44px;
-    box-sizing: border-box;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    padding-left: 44px;
-    padding-right: 44px;
-
-    color: #fff;
-    border-width: 2px;
-    border-style: solid;
-    border-color: #fff;
-    opacity: 0.4;
-}
-
-.single_check_sel1{
-    margin-bottom: 32px;
-    height: 88px;
-    border-radius: 44px;
-    // border: solid 2px $fastColor;
-    display: flex;
-    flex-direction: row;
-    align-items: center;
-    padding-left: 44px;
-    padding-right: 44px;
-    box-sizing: border-box;
-    opacity: 1;
-
-    
-
-
-
-
-}
-
-.switch_stage{
-    transform: scale(0.85);
-    transform-origin: right center;
-    margin-right: -10px;
-}
-
-/*
-.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;
-}
-*/
-
-.single_check_text_nor2{
-    color: $fastColor;
-    // font-weight: bold;
-    font-size: 32px;
-    flex: 1;
-    color: #fff;
-}
-
-.single_check_text_sel2{
-    color: $fastColor;
-    // color: #000;
-    // font-weight: bold;
-    font-size: 32px;
-    flex: 1;
-}
-
-.single_checked{
-    width: 48px;
-    height: 48px;
-}
-
-.expand2 {
-    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 - 95
src/features/trackTimeDuration/components/StageSelector.tsx

@@ -1,95 +0,0 @@
-import { IconCheck, IconPlus } from "@/components/basic/Icons";
-import { ColorType } from "@/context/themes/color";
-import { View, Text, Image, Switch } from "@tarojs/components";
-import { useState } from "react";
-import './StageSelector.scss'
-import { rpxToPx } from "@/utils/tools";
-import { useTranslation } from "react-i18next";
-
-
-export default function () {
-    const [isMulti, setIsMulti] = useState(false)
-    const [selIndex, setSelIndex] = useState(0)
-    const [expand, setExpand] = useState(false)
-    const { t } = useTranslation()
-    const [multiData, setMultiData] = useState([
-        {
-            title: t('feature.track_time_duration.stage.a'),
-            checked: false
-        },
-        {
-            title: t('feature.track_time_duration.stage.b'),
-            checked: false
-        },
-        {
-            title: t('feature.track_time_duration.stage.c'),
-            checked: false
-        },
-    ])
-
-
-    return <View>
-        {
-            isMulti ? <View>
-                {
-                    multiData.map((item, index) => {
-                        return <View className={item.checked ? "single_check_sel1" : "single_check_nor1"} onClick={() => {
-                            item.checked = !item.checked
-                            global.updateMixItem([multiData[0].checked, multiData[1].checked, multiData[2].checked])
-                            setMultiData(JSON.parse(JSON.stringify(multiData)))
-                            // setCount((prevCounter) => prevCounter + 1)
-                        }}>
-                            <Text className={item.checked ? "single_check_text_sel2" : "single_check_text_nor2"}>{item.title}</Text>
-                            {
-                                item.checked ? <IconCheck width={rpxToPx(48)} height={rpxToPx(48)} color={ColorType.fast}/> :
-                                    <IconPlus color='#fff' />
-                            }
-                        </View>
-                    })
-                }
-            </View> : <View>
-
-                <View className={selIndex == 0 ? "single_check_sel1" : "single_check_nor1"} onClick={() => { setSelIndex(0); global.updateMixItem([true, false, false]); }}>
-                    <Text className={selIndex == 0 ? "single_check_text_sel2" : "single_check_text_nor2"}>{t('feature.track_time_duration.stage.a')}</Text>
-                    {
-                        selIndex == 0 && <IconCheck width={rpxToPx(48)} height={rpxToPx(48)} color={ColorType.fast}/>//<Image src={require('@assets/images/check_fast.png')} className="single_checked" />
-                    }
-                </View>
-                <View className={selIndex == 1 ? "single_check_sel1" : "single_check_nor1"} onClick={() => { setSelIndex(1); global.updateMixItem([false, true, false]); }}>
-                    <Text className={selIndex == 1 ? "single_check_text_sel2" : "single_check_text_nor2"}>{t('feature.track_time_duration.stage.b')}</Text>
-                    {
-                        selIndex == 1 && <IconCheck width={rpxToPx(48)} height={rpxToPx(48)} color={ColorType.fast}/>//<Image src={require('@assets/images/check_fast.png')} className="single_checked" />
-                    }
-                </View>
-                <View className={selIndex == 2 ? "single_check_sel1" : "single_check_nor1"} onClick={() => { setSelIndex(2); global.updateMixItem([false, false, true]); }}>
-                    <Text className={selIndex == 2 ? "single_check_text_sel2" : "single_check_text_nor2"}>{t('feature.track_time_duration.stage.c')}</Text>
-                    {
-                        selIndex == 2 && <IconCheck width={rpxToPx(48)} height={rpxToPx(48)} color={ColorType.fast}/>//<Image src={require('@assets/images/check_fast.png')} className="single_checked" />
-                    }
-                </View>
-            </View>
-        }
-        {
-            expand ? <View style={{ display: 'flex', alignItems: 'center', flexDirection: 'row', width: '100%', boxSizing: 'border-box' }}>
-                
-                <Text style={{ marginRight: 10,color:'#fff' }}>{t('feature.track_time_duration.stage.multi_selection')}</Text>
-                <View style={{ flex: 1 }} />
-                <Switch className="switch_stage" color={ColorType.fast} onChange={(e) => {
-                    setIsMulti(e.detail.value)
-                    if (e.detail.value) {
-                        multiData[0].checked = selIndex == 0
-                        multiData[1].checked = selIndex == 1
-                        multiData[2].checked = selIndex == 2
-                        global.updateMixItem([selIndex == 0, selIndex == 1, selIndex == 2])
-                        setMultiData(JSON.parse(JSON.stringify(multiData)))
-                    }
-                    else {
-                        setSelIndex(0);
-                        global.updateMixItem([true, false, false])
-                    }
-                }} />
-            </View> : <Text className='expand2' onClick={() => { setExpand(true) }}>{t('feature.common.show_more')}</Text>
-        }
-
-    </View>
-}

+ 0 - 1
src/features/trackTimeDuration/components/StreakItem.tsx

@@ -1,6 +1,5 @@
 import { View, Text, ScrollView } from '@tarojs/components'
 import './Streaks.scss'
-import { IconShare2 } from '@/components/basic/Icons'
 import { rpxToPx } from '@/utils/tools'
 import { ColorType } from '@/context/themes/color'
 import { useTranslation } from 'react-i18next'

+ 0 - 34
src/features/trackTimeDuration/components/TimelineFastSleep.scss

@@ -1,34 +0,0 @@
-.box{
-    margin-left: 32px;
-    margin-right: 32px;
-    background: #1C1C1C;
-    border-radius: 56px;
-    display: flex;
-    flex-direction: column;
-    height: 1000px;
-}
-
-.header{
-    margin-top: 40px;
-    display: flex;
-    flex-direction: row;
-}
-
-.item{
-    display: flex;
-    flex: 1;
-    align-items: center;
-    justify-content: center;
-}
-
-.duration{
-    font-size: 48px;
-    margin-bottom: 40px;
-    text-align: center;
-}
-
-.tz_note_desc{
-    opacity: 0.4;
-    color: #FA5151;
-    font-size: 24px;
-}

+ 0 - 345
src/features/trackTimeDuration/components/TimelineFastSleep.tsx

@@ -1,345 +0,0 @@
-import Timeline from "@/components/view/Timeline";
-import { TimeFormatter } from "@/utils/time_format";
-import { View, Text } from "@tarojs/components";
-import getStatus from "../hooks/Record";
-import { ColorType } from "@/context/themes/color";
-import { useTranslation } from "react-i18next";
-import { useEffect, useState } from "react";
-import { useSelector } from "react-redux";
-import './TimelineFastSleep.scss'
-import dayjs from 'dayjs'
-import { getTimezone, getTimezoneName, rpxToPx } from "@/utils/tools";
-import Taro from "@tarojs/taro";
-
-
-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)
-export default function TimelineFastSleep(props: {
-    data: any,
-    title?: string,
-    first_real_check_time?: number,
-    multiTimeZone?: boolean,
-    diffTimeZone?: boolean,
-    scenario?: any,
-}) {
-    const { t } = useTranslation()
-    const [diffTimeZone] = useState(props.diffTimeZone)
-    const [multTimeZone] = useState(props.multiTimeZone)
-    const scenario = props.scenario ? props.scenario : useSelector((state: any) => state.scenario);
-
-
-    function formateTime(obj: any, isEnd: boolean, isFastMode?: boolean) {
-        if (isEnd) {
-            if (obj.real_end_time) {
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_end_time, obj.real_end_timezone.gmt)
-                return TimeFormatter.timelineFormatTime(newTimestamp)
-                // return diffTimeZone ? TimeFormatter.timelineFullFormatTime(newTimestamp) : TimeFormatter.timelineFormatTime(obj.real_end_time)
-            }
-            else {
-
-                var real_time_zone = props.data.last_timezone ? props.data.last_timezone.gmt : ''
-
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.target_end_time, real_time_zone)
-                return TimeFormatter.timelineFormatTime(newTimestamp)
-                // return diffTimeZone ? TimeFormatter.timelineFullFormatTime(obj.target_end_time) : TimeFormatter.timelineFormatTime(obj.target_end_time)
-            }
-        }
-        else {
-
-            if (obj.real_start_time) {
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_start_time, obj.real_start_timezone.gmt)
-                return TimeFormatter.timelineFormatTime(newTimestamp)
-                // return diffTimeZone ? TimeFormatter.timelineFullFormatTime(newTimestamp) : TimeFormatter.timelineFormatTime(obj.real_start_time)
-            }
-            else {
-                var real_time_zone = props.data.last_timezone ? props.data.last_timezone.gmt : ''
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.target_start_time, real_time_zone)
-
-                return TimeFormatter.timelineFormatTime(newTimestamp)
-                // return diffTimeZone ? TimeFormatter.timelineFullFormatTime(obj.target_start_time) : TimeFormatter.timelineFormatTime(obj.target_start_time)
-            }
-        }
-
-    }
-
-    function formateDate(currentStatus: string, obj: any, isEnd: boolean, isFastMode?: boolean) {
-        if (currentStatus == 'WAIT_FOR_START') {
-            if (props.data.scenario == 'SLEEP') {
-                if (isEnd) {
-                    var count = TimeFormatter.timestringToSeconds(scenario.schedule.sleep.start_time)
-                    var count2 = TimeFormatter.timestringToSeconds(scenario.schedule.sleep.end_time)
-                    if (count2 < count) {
-                        return global.language == 'en' ? 'Tomorrow' : '明天'
-                    }
-                    return global.language == 'en' ? 'Today' : '今天'
-                }
-            }
-            else {
-                var count = TimeFormatter.timestringToSeconds(scenario.schedule.fast.start_time)
-                if (isFastMode) {
-                    if (isEnd) {
-                        var count2 = TimeFormatter.timestringToSeconds(scenario.schedule.fast.end_time)
-                        if (count2 < count) {
-                            return global.language == 'en' ? 'Tomorrow' : '明天'
-                        }
-                    }
-                    return global.language == 'en' ? 'Today' : '今天'
-                }
-                else {
-                    if (isEnd) {
-                        var count2 = TimeFormatter.timestringToSeconds(scenario.schedule.sleep.end_time)
-                        if (count2 < count) {
-                            return global.language == 'en' ? 'Tomorrow' : '明天'
-                        }
-                    }
-                    else {
-                        var count2 = TimeFormatter.timestringToSeconds(scenario.schedule.sleep.start_time)
-                        if (count2 < count) {
-                            return global.language == 'en' ? 'Tomorrow' : '明天'
-                        }
-                    }
-
-                    return global.language == 'en' ? 'Today' : '今天'
-                }
-            }
-        }
-        if (isEnd) {
-            if (obj.real_end_time) {
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_end_time, obj.real_end_timezone.gmt)
-                if (diffTimeZone || multTimeZone) {
-                    return TimeFormatter.getMonthAndDayByTimestamp(newTimestamp, true) + ' '
-                }
-                return TimeFormatter.dateDescription(newTimestamp, true, diffTimeZone || multTimeZone)
-            }
-            else {
-                var real_time_zone = props.data.last_timezone ? props.data.last_timezone.gmt : ''
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.target_end_time, real_time_zone)
-                if (diffTimeZone || multTimeZone) {
-                    return TimeFormatter.getMonthAndDayByTimestamp(newTimestamp, true) + ' '
-                }
-                return TimeFormatter.dateDescription(newTimestamp, true, diffTimeZone || multTimeZone)
-            }
-        }
-        else {
-            if (obj.real_start_time) {
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_start_time, obj.real_start_timezone.gmt)
-                if (diffTimeZone || multTimeZone) {
-                    return TimeFormatter.getMonthAndDayByTimestamp(newTimestamp, true) + ' '
-                }
-                return TimeFormatter.dateDescription(newTimestamp, true, diffTimeZone || multTimeZone)
-            }
-            else {
-                var real_time_zone = props.data.last_timezone ? props.data.last_timezone.gmt : ''
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.target_start_time, real_time_zone)
-                if (diffTimeZone || multTimeZone) {
-                    return TimeFormatter.getMonthAndDayByTimestamp(newTimestamp, true) + ' '
-                }
-                return TimeFormatter.dateDescription(obj.target_start_time, true, diffTimeZone || multTimeZone)
-            }
-        }
-
-    }
-
-    var timelineItems: any = [];
-    /*
-    attention:
-    status == 待开始时
-    timeline的时间不以时间戳进行处理,而是以target时间字符串进行显示
-    */
-    if (props.data.fast && props.data.scenario != 'SLEEP') {
-        var timeZone = ''
-        if (props.data.fast.real_start_timezone && props.data.fast.real_start_timezone.gmt) {
-            timeZone = ' ' + props.data.fast.real_start_timezone.gmt
-        }
-        var desc = props.data.status == 'WAIT_FOR_START' ? '' : multTimeZone ? timeZone : ''
-        if (props.data.status != 'WAIT_FOR_START' && props.data.status != 'COMPLETED' && diffTimeZone) {
-            desc = timeZone
-        }
-        timelineItems.push(
-            {
-                status: getStatus(true, true, props.data),
-                title: getStatus(true, true, props.data) == 'padding' ?
-                    t('feature.track_time_duration.common.start_fast') :
-                    t('feature.track_time_duration.common.started_fasting'),
-                content: props.data.status == 'WAIT_FOR_START' ? formateDate(props.data.status, props.data.fast, false, true) + ' ' + scenario.schedule.fast.start_time : formateDate(props.data.status, props.data.fast, false, true) + ' ' + formateTime(props.data.fast, false, true),
-                date: desc,
-                // (diffTimeZone ? timeZone : showDate(props.data.fast, false) ? formateDate(props.data.fast, false) : ''),
-                color: global.fastColor ? global.fastColor : ColorType.fast
-            }
-        )
-    }
-    if (props.data.sleep && props.data.scenario != 'FAST') {
-
-        var status = getStatus(false, true, props.data)
-        var strContent = props.data.status == 'WAIT_FOR_START' ? formateDate(props.data.status, props.data.sleep, false, false) + ' ' + scenario.schedule.sleep.start_time : formateDate(props.data.status, props.data.sleep, false, false) + ' ' + formateTime(props.data.sleep, false, false)
-
-
-        var timeZone = ''
-        if (props.data.sleep.real_start_timezone && props.data.sleep.real_start_timezone.gmt) {
-            timeZone = ' ' + props.data.sleep.real_start_timezone.gmt
-        }
-        var strDate = multTimeZone ? timeZone : ''
-        if (props.data.status != 'WAIT_FOR_START' && props.data.status != 'COMPLETED') {
-            if ((!timeZone || timeZone.length == 0) && (multTimeZone || diffTimeZone)) {
-                strDate = props.data.last_timezone.gmt
-            }
-        }
-
-        timelineItems.push(
-            {
-                status: status,
-                title: status == 'padding' ?
-                    t('feature.track_time_duration.common.start_sleep') :
-                    t('feature.track_time_duration.common.started_sleeping'),
-                content: status == 'un_done' ? '' : strContent,
-                date: status == 'un_done' ? '' : strDate,
-                color: global.sleepColor ? global.sleepColor : ColorType.sleep
-            }
-        )
-    }
-    if (props.data.sleep && props.data.scenario != 'FAST') {
-        var timeZone = ''
-        if (props.data.sleep.real_end_timezone && props.data.sleep.real_end_timezone.gmt) {
-            timeZone = ' ' + props.data.sleep.real_end_timezone.gmt
-        }
-        var status = getStatus(false, false, props.data)
-        var strContent: string = props.data.status == 'WAIT_FOR_START' ? formateDate(props.data.status, props.data.sleep, true, false) + ' ' + scenario.schedule.sleep.end_time : formateDate(props.data.status, props.data.sleep, true) + ' ' + formateTime(props.data.sleep, true, false)
-        var strDate = multTimeZone ? timeZone : ''
-
-        if (props.data.status != 'WAIT_FOR_START' && props.data.status != 'COMPLETED') {
-            if ((!timeZone || timeZone.length == 0) && (multTimeZone || diffTimeZone)) {
-                strDate = props.data.last_timezone.gmt
-            }
-        }
-
-
-        // (diffTimeZone ? timeZone : showDate(props.data.sleep, true) ? formateDate(props.data.sleep, true) : '')
-        timelineItems.push(
-            {
-                status: status,
-                title: status == 'padding' ?
-                    t('feature.track_time_duration.common.end_sleep') :
-                    t('feature.track_time_duration.common.ended_sleeping'),
-                content: status == 'un_done' ? '' : strContent,
-                date: status == 'un_done' ? '' : strDate,
-                color: global.sleepColor ? global.sleepColor : ColorType.sleep
-            }
-        )
-    }
-    if (props.data.fast && props.data.scenario != 'SLEEP') {
-        var timeZone = ''
-        if (props.data.fast.real_end_timezone && props.data.fast.real_end_timezone.gmt) {
-            timeZone = ' ' + props.data.fast.real_end_timezone.gmt
-        }
-        if (props.data.status != 'WAIT_FOR_START' && props.data.status != 'COMPLETED') {
-            if ((!timeZone || timeZone.length == 0) && (multTimeZone || diffTimeZone)) {
-                timeZone = props.data.last_timezone.gmt
-            }
-        }
-
-        if ((diffTimeZone && !multTimeZone) && props.data.status == 'COMPLETED') {
-            timeZone = ''
-        }
-        if (!diffTimeZone && !multTimeZone && props.data.status == 'COMPLETED') {
-            timeZone = ''
-        }
-
-        timelineItems.push(
-            {
-                status: getStatus(true, false, props.data),
-                title: getStatus(true, false, props.data) == 'padding' ?
-                    t('feature.track_time_duration.common.end_fast') :
-                    t('feature.track_time_duration.common.ended_fasting'),
-                content: props.data.status == 'WAIT_FOR_START' ? formateDate(props.data.status, props.data.fast, true, true) + ' ' + scenario.schedule.fast.end_time : formateDate(props.data.status, props.data.fast, true) + ' ' + formateTime(props.data.fast, true, true),
-                // date: multTimeZone ? timeZone : '',
-                date: timeZone,
-                // (diffTimeZone ? timeZone : showDate(props.data.fast, true) ? formateDate(props.data.fast, true) : ''),
-                color: global.fastColor ? global.fastColor : ColorType.fast
-            }
-        )
-    }
-
-    function getTZLocation() {
-        if (props.data.fast) {
-            var name = props.data.fast.real_start_timezone ? props.data.fast.real_start_timezone.gmt : ''
-            if (props.data.fast.real_start_timezone && props.data.fast.real_start_timezone.name) {
-                name = `${name} (${props.data.fast.real_start_timezone.name})`
-            }
-            return name
-        }
-        else {
-            var name = props.data.sleep.real_start_timezone ? props.data.sleep.real_start_timezone.gmt : ''
-            if (props.data.sleep.real_start_timezone && props.data.sleep.real_start_timezone.name) {
-                name = `${name} (${props.data.sleep.real_start_timezone.name})`
-            }
-            return name
-        }
-    }
-
-    function getDeviceLocation() {
-        return `${getTimezone()} (${getTimezoneName()})`
-    }
-
-    function getTZOffset() {
-
-        let offset = 0;
-
-        var current1 = dayjs()
-        var current
-        if (props.data.fast) {
-            if (props.data.fast.real_start_timezone && props.data.fast.real_start_timezone.id) {
-                current = TimeFormatter.tzLocalTime(new Date().getTime(),props.data.fast.real_start_timezone.id)//dayjs().tz(props.data.fast.real_start_timezone.id)
-                offset = current.date() * 24 * 60 + current.hour() * 60 + current.minute() - current1.date() * 24 * 60 - current1.hour() * 60 - current1.minute()
-            }
-            else {
-                offset = TimeFormatter.timeZoneOffset(props.data.fast.real_start_timezone.gmt)
-            }
-        }
-        else {
-            if (props.data.sleep.real_start_timezone && props.data.sleep.real_start_timezone.id) {
-                current = TimeFormatter.tzLocalTime(new Date().getTime(),props.data.sleep.real_start_timezone.id)//dayjs().tz(props.data.sleep.real_start_timezone.id)
-                offset = current.date() * 24 * 60 + current.hour() * 60 + current.minute() - current1.date() * 24 * 60 - current1.hour() * 60 - current1.minute()
-            }
-            else {
-                offset = TimeFormatter.timeZoneOffset(props.data.sleep.real_start_timezone.gmt)
-            }
-        }
-        // 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 })
-    }
-
-    return <View style={{ display: 'flex', flexDirection: 'column' }}>
-        <View style={{ display: 'flex', flexDirection: 'row' }}>
-            <Timeline items={timelineItems} title={props.title} width={468} />
-            <View>
-            </View>
-        </View>
-        {
-            multTimeZone && <Text className="tz_note_desc" style={{ width: rpxToPx(538) }}>{t('feature.common.multi_tz_desc')}</Text>
-        }
-        {
-            !multTimeZone && diffTimeZone && <Text className="tz_note_desc" style={{ width: rpxToPx(538) }}>{t('feature.common.diff_tz_desc', { location: getTZLocation(), offset: getTZOffset(), device_location: getDeviceLocation() })}</Text>
-        }
-    </View>
-}

+ 0 - 166
src/features/trackTimeDuration/components/TimelineStage.rn.tsx

@@ -1,166 +0,0 @@
-import { View, Text } from '@tarojs/components'
-import './TimelineStage.scss'
-import { useEffect, useState } from 'react';
-import Segment from '@/components/navigation/Segment';
-import TimelineFastSleep from './TimelineFastSleep';
-import Stage from './Stage';
-import { useTranslation } from 'react-i18next';
-import Switch from '@/components/input/Switch2';
-import { useSelector } from 'react-redux';
-import Taro from '@tarojs/taro';
-import { jumpPage } from '../hooks/Common';
-import { rpxToPx } from '@/utils/tools';
-import { AppState } from 'react-native';
-import { useFocusEffect } from '@react-navigation/native';
-import React from 'react';
-// import JPush from 'jpush-react-native';
-import { Linking } from 'react-native';
-import { uploadPerm } from '@/services/user';
-
-
-export default function Component(props: { data: any, title?: string, subTitle?: string, isSchedule?: boolean, first_real_check_time?: number }) {
-    // debugger
-    const [segmentIndex, setSegmentIndex] = useState(0)
-    const permission = useSelector((state: any) => state.permission);
-    const common = useSelector((state: any) => state.common);
-    const [pushEnable, setPushEnable] = useState(true)
-
-    const handleAppStateChange = (nextAppState) => {
-        checkPushStatus()
-    };
-
-    useEffect(() => {
-        AppState.addEventListener('change', handleAppStateChange);
-
-        // return () => {
-        //     AppState.removeEventListener('change', handleAppStateChange);
-        // };
-    }, []);
-
-    // useReady(() => {
-    //     alert('sss')
-    //     if (process.env.TARO_ENV == 'rn') {
-    //         const JPush = require('jpush-react-native')
-    //         JPush.isNotificationEnabled(obj => {
-    //             alert(obj)
-    //         })
-    //     }
-    // })
-
-    useFocusEffect(React.useCallback(() => {
-        checkPushStatus()
-    }, []))
-
-    function checkPushStatus() {
-
-        // JPush.isNotificationEnabled(obj => {
-        //     setPushEnable(obj)
-        //     uploadPerm({ push_enabled: obj })
-        // })
-    }
-
-    function goSetting() {
-        var checkNotification = require('@/utils/native_permission_check').checkNotification;
-        checkNotification()
-        
-        // Linking.openURL('app-settings:notifications')
-    }
-
-
-    const { t } = useTranslation()
-
-    function followWxPub() {
-        const resource = common.resources.filter((item: any) => {
-            return item.code == 'follow_wx_pub'
-        })
-
-        const title = permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.h5_followed_title') :
-            t('feature.track_time_duration.follow_wx_pub.h5_unfollowed_title')
-
-        Taro.showModal({
-            title: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_title') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_title'),
-            content: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_content') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_content'),
-            showCancel: true,
-            cancelText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_cancel_btn') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_cancel_btn'),
-            confirmText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_confirm_btn') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_confirm_btn'),
-            success(result) {
-                if (result.confirm) {
-                    global.forceRefreshWXPub = true
-                    jumpPage('/pages/common/H5?title=' + title + '&url=' + resource[0].url)
-                }
-            },
-        })
-    }
-
-    return <View style={{ display: 'flex', flexDirection: 'column', width: rpxToPx(578) }}>
-        {/* <Text className='box_title'>{props.title ? props.title : 'Title'}</Text> */}
-        <View className="box_header" style={{ backgroundColor: global.isDebug ? 'pink' : 'transparent' }}>
-            <Text className="box_title" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{props.title ? props.title : 'Title'}</Text>
-            {
-                props.isSchedule && process.env.TARO_ENV == 'weapp' &&
-                <Switch isOn={permission.wxPubFollow} onClick={() => followWxPub()} />
-            }
-            {
-                props.isSchedule && process.env.TARO_ENV == 'rn' &&
-                <Switch isOn={pushEnable} onClick={() => goSetting()} />
-            }
-        </View>
-        <Text className='box_subtitle'>{props.subTitle ? props.subTitle : 'subTitle'}</Text>
-        <View className="segment_detail" style={{
-            display: 'flex', alignItems: 'center',
-            flexDirection: 'column', justifyContent: 'center'
-        }}>
-            <View style={{
-                position: 'relative', width: '100%', display: 'flex', alignItems: 'center',
-                flexDirection: 'column', justifyContent: 'center'
-            }}>
-                {/* <View style={{ backgroundColor: 'pink' }}>
-                    {
-                        segmentIndex == 0 ? <TimelineFastSleep data={props.data} /> : <Stage data={props.data} />
-                    }
-                </View> */}
-
-                <View style={{ position: 'relative' }}>
-                    <View style={{ opacity: segmentIndex == 0 ? 1 : 0 }}>
-                        <TimelineFastSleep data={props.data} first_real_check_time={props.first_real_check_time} />
-                    </View>
-                    {props.data.scenario == 'FAST_SLEEP' && <View style={{
-                        opacity: segmentIndex == 1 ? 1 : 0,
-                        position: 'absolute', left: 0, top: 0, right: 0, bottom: 0,
-                    }}>
-                        <Stage data={props.data} />
-                    </View>}
-                </View>
-
-
-                {/* <View style={{ opacity: segmentIndex == 0 ? 1 : 0 }}>
-                    <TimelineFastSleep data={props.data} />
-                </View>
-                {
-                    props.data.scenario == 'FAST_SLEEP' && <View style={{
-                        position: 'absolute', left: 0, top: 0, right: 0, bottom: 0,
-                        opacity: segmentIndex == 1 ? 1 : 0
-                    }}>
-                        <Stage data={props.data} />
-                    </View>
-                } */}
-
-            </View>
-        </View>
-        {
-            props.data.scenario == 'FAST_SLEEP' &&
-            <View style={{ marginBottom: 0 }}>
-                <Segment titles={[props.isSchedule ? t('feature.track_time_duration.schedule.timeline') :
-                    t('feature.track_time_duration.record_fast_sleep.timeline'),
-                t('feature.track_time_duration.schedule.stage')]} changed={(e) => {
-                    setSegmentIndex(e);
-                    global.segmentIndex = e
-                }} />
-            </View>
-        }
-    </View>
-}

+ 0 - 0
src/features/trackTimeDuration/components/TimelineStage.scss


+ 0 - 84
src/features/trackTimeDuration/components/TimelineStage.weapp.tsx

@@ -1,84 +0,0 @@
-import { View, Text } from '@tarojs/components'
-import './TimelineStage.scss'
-import { useEffect, useState } from 'react';
-import Segment from '@/components/navigation/Segment';
-import TimelineFastSleep from './TimelineFastSleep';
-import Stage from './Stage';
-import { useTranslation } from 'react-i18next';
-import Switch from '@/components/input/Switch2';
-import { useSelector } from 'react-redux';
-import Taro from '@tarojs/taro';
-import { jumpPage } from '../hooks/Common';
-import { rpxToPx } from '@/utils/tools';
-import TotalTime from './TotalTime';
-
-
-
-export default function Component(props: { data: any, title?: string, subTitle?: string, isSchedule?: boolean, first_real_check_time?: number, multiTimeZone?: boolean, diffTimeZone?: boolean }) {
-    // debugger
-    const [segmentIndex, setSegmentIndex] = useState(0)
-    const permission = useSelector((state: any) => state.permission);
-    const common = useSelector((state: any) => state.common);
-
-
-    const { t } = useTranslation()
-
-    function followWxPub() {
-        const resource = common.resources.filter((item: any) => {
-            return item.code == 'follow_wx_pub'
-        })
-
-        const title = permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.h5_followed_title') :
-            t('feature.track_time_duration.follow_wx_pub.h5_unfollowed_title')
-
-        Taro.showModal({
-            title: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_title') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_title'),
-            content: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_content') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_content'),
-            showCancel: true,
-            cancelText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_cancel_btn') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_cancel_btn'),
-            confirmText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_confirm_btn') :
-                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_confirm_btn'),
-            success(result) {
-                if (result.confirm) {
-                    global.forceRefreshWXPub = true
-                    jumpPage('/pages/common/H5?title=' + title + '&url=' + resource[0].url)
-                }
-            },
-        })
-    }
-
-    return <View style={{ display: 'flex', flexDirection: 'column', width: rpxToPx(578), height: rpxToPx(800) }}>
-        <View style={{ marginBottom: 20 }}>
-            <Segment titles={[
-                t('feature.track_time_duration.schedule.total_time'),
-                t('feature.track_time_duration.record_fast_sleep.timeline'),
-            ]} changed={(e) => {
-                setSegmentIndex(e);
-                global.segmentIndex = e
-                console.log('segment item click',e)
-            }} />
-        </View>
-        <View className="segment_detail" style={{
-            display: 'flex', alignItems: 'center',
-            flexDirection: 'column', justifyContent: 'center'
-        }}>
-            <View style={{
-                position: 'relative', width: '100%', display: 'flex', alignItems: 'center',
-                flexDirection: 'column', justifyContent: 'center'
-            }}>
-                <View>
-                    {
-                        segmentIndex == 0 ? <TotalTime record={props.data} /> :
-                            <TimelineFastSleep data={props.data} first_real_check_time={props.first_real_check_time} diffTimeZone={props.diffTimeZone} multiTimeZone={props.multiTimeZone} />
-                    }
-                </View>
-            </View>
-        </View>
-
-
-
-    </View>
-}

+ 0 - 0
src/features/trackTimeDuration/components/TotalTime.scss


+ 0 - 198
src/features/trackTimeDuration/components/TotalTime.tsx

@@ -1,198 +0,0 @@
-import { View, Text, Image, PageContainer } from "@tarojs/components";
-import './TotalTime.scss'
-import { useTranslation } from "react-i18next";
-import { ColorType } from "@/context/themes/color";
-import { rpxToPx } from "@/utils/tools";
-import { TimeFormatter } from "@/utils/time_format";
-import { useEffect, useRef, useState } from "react";
-
-
-export default function TotalTime(props: { record: any }) {
-    const [count, setCount] = useState(0)
-    const { t } = useTranslation()
-
-    useEffect(() => {
-        setCount((pre) => pre + 1)
-    }, [props.record])
-
-
-
-    function sleepCompleteStatus() {
-        if (props.record.sleep.status == "NOT_STARTED") {
-            return t('feature.common.not_started')
-        }
-        else if (props.record.sleep.status == 'NOT_COMPLETED') {
-            return t('feature.common.not_completed')
-        }
-        return TimeFormatter.durationFormate(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
-    }
-
-    function fastGoingText() {
-        if (props.record.status == 'WAIT_FOR_START') {
-            return '00:00:00'
-        }
-        return TimeFormatter.formateTimeNow(props.record.fast.real_start_time)
-    }
-
-    function fastEndText() {
-        if (props.record.status == 'WAIT_FOR_START') {
-            return TimeFormatter.formateTimeDifference(new Date().getTime(), new Date().getTime() + props.record.fast.target_end_time - props.record.fast.target_start_time)
-        }
-        return TimeFormatter.countdown(props.record.fast.target_end_time)
-    }
-
-    function sleepGoingText() {
-        if (props.record.status == 'WAIT_FOR_START' || props.record.status == 'ONGOING1') {
-            return '00:00:00'
-        }
-        return TimeFormatter.formateTimeNow(props.record.sleep.real_start_time)
-    }
-
-    function sleepEndText() {
-        if (props.record.status == 'WAIT_FOR_START' || props.record.status == 'ONGOING1') {
-            return TimeFormatter.formateTimeDifference(new Date().getTime(), new Date().getTime() + props.record.sleep.target_end_time - props.record.sleep.target_start_time)
-        }
-        return TimeFormatter.countdown(props.record.sleep.target_end_time)
-    }
-
-    function setFastDuration(e) {
-        if (disableChange(true)) return
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-
-        global.showFastPicker()
-    }
-
-    function setSleepDuration(e) {
-        if (disableChange(false)) return
-        if (process.env.TARO_ENV == 'weapp') {
-            e.stopPropagation()
-        }
-
-        global.showSleepPicker()
-    }
-
-    function disableChange(isFastStatus) {
-        if (props.record.status == 'WAIT_FOR_START') {
-            return false;
-        }
-        if (isFastStatus) {
-            if (props.record.status != 'COMPLETED')
-                return false;
-            return true
-        }
-        else {
-            if (props.record.status == 'ONGOING3' || props.record.status == 'COMPLETED') {
-                return true
-            }
-            return false;
-        }
-    }
-
-    function fastOtherStatus() {
-        return <View>
-            <View className="cell_full" >
-                <Text className="cell_title" style={{ opacity: 0.2 }}>已进行</Text>
-                <Text className="cell_value"
-                    style={{
-                        color: props.record.status == 'WAIT_FOR_START' ?
-                            '#fff' : ColorType.fast,
-                        opacity: props.record.status == 'WAIT_FOR_START' ? 0.2 : 1
-                    }}>{fastGoingText()}</Text>
-            </View>
-            <View className="cell_line" />
-            <View className="cell_full" >
-                <Text className="cell_title" style={{ opacity: 0.2 }}>{new Date().getTime() < props.record.fast.target_end_time ? '距结束' : '已超时'}</Text>
-                <Text className="cell_value" style={{ opacity: 0.2 }}>{fastEndText()}</Text>
-            </View>
-        </View>
-    }
-
-    function sleepOtherStatus() {
-        return <View>
-            <View className="cell_full" >
-                <Text className="cell_title" style={{ opacity: 0.2 }}>已进行</Text>
-                <Text className="cell_value" style={{
-                    color: props.record.status == 'WAIT_FOR_START' || props.record.status == 'ONGOING1' ?
-                        '#fff' : ColorType.sleep,
-                    opacity: props.record.status == 'WAIT_FOR_START' || props.record.status == 'ONGOING1' ? 0.2 : 1
-                }}>{sleepGoingText()}</Text>
-            </View>
-            <View className="cell_line"  />
-            <View className="cell_full" >
-                <Text className="cell_title" style={{ opacity: 0.2 }}>{new Date().getTime() < props.record.sleep.target_end_time ? '距结束' : '已超时'}</Text>
-                <Text className="cell_value" style={{ opacity: 0.2 }}>{sleepEndText()}</Text>
-            </View>
-        </View>
-    }
-
-    return <View style={{ width: rpxToPx(600) }}>
-        {
-            props.record.fast && <View>
-                <Text className="cell_header">断食</Text>
-                <View className="cell_bg">
-                    {
-                        props.record.status == 'COMPLETED' ?
-                            <View className="cell_full" >
-                                <Text className="cell_title">{t('feature.track_time_duration.console.real_duration')}</Text>
-                                <Text className="cell_value" style={{ color: ColorType.fast }}>{TimeFormatter.durationFormate(props.record.fast.real_start_time, props.record.fast.real_end_time)}</Text>
-                                {/* <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} /> */}
-                            </View> :
-                            <View className="cell_full" onClick={setFastDuration}>
-                                <Text className="cell_title">{t('feature.track_time_duration.console.target')}</Text>
-                                <Text className="cell_value">{TimeFormatter.durationFormate(props.record.fast.target_start_time, props.record.fast.target_end_time)}</Text>
-                                {!disableChange(true) && <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />}
-                            </View>
-                    }
-                    <View className="cell_line" />
-                    {
-                        props.record.status == 'COMPLETED' ?
-                            <View className="cell_full" onClick={setFastDuration}>
-                                <Text className="cell_title" style={{ opacity: 0.2 }}>{t('feature.track_time_duration.console.target')}</Text>
-                                <Text className="cell_value" style={{ opacity: 0.2, color: '#fff' }}>{TimeFormatter.durationFormate(props.record.fast.target_start_time, props.record.fast.target_end_time)}</Text>
-                                {!disableChange(true) && <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />}
-                            </View> :
-                            fastOtherStatus()
-                    }
-                </View>
-
-            </View>
-        }
-        {
-            props.record.sleep && <View style={{ marginTop: 10 }}>
-                <Text className="cell_header">睡眠</Text>
-                <View className="cell_bg">
-                    {
-                        // props.record.status == 'COMPLETED' || props.record.status == 'ONGOING3' ?
-                        //     <View className="cell_full" >
-                        //         <Text className="cell_title">{t('feature.track_time_duration.console.real_duration')}</Text>
-                        //         <Text className="cell_value" style={{ color: ColorType.sleep }}>{sleepCompleteStatus()}</Text>
-                        //     </View> :
-                        <View className="cell_full" onClick={setSleepDuration}>
-                            <Text className="cell_title">{t('feature.track_time_duration.console.target')}</Text>
-                            <Text className="cell_value">{TimeFormatter.durationFormate(props.record.sleep.target_start_time, props.record.sleep.target_end_time)}</Text>
-                            {!disableChange(false) && <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />}
-                        </View>
-                    }
-                    <View className="cell_line" />
-                    {
-                        props.record.status == 'COMPLETED' || props.record.status == 'ONGOING3' ?
-                            // <View className="cell_full" onClick={setSleepDuration}>
-                            //     <Text className="cell_title" style={{ opacity: 0.2 }}>{t('feature.track_time_duration.console.target')}</Text>
-                            //     <Text className="cell_value" style={{ opacity: 0.2, color: '#fff' }}>{TimeFormatter.durationFormate(props.record.sleep.target_start_time, props.record.sleep.target_end_time)}</Text>
-                            //     {!disableChange(false) && <Image className="cell_arrow" src={require('@/assets/images/arrow3.png')} />}
-                            // </View> 
-                            <View className="cell_full" >
-                                <Text className="cell_title" style={{ opacity: 0.4 }}>{t('feature.track_time_duration.console.real_duration')}</Text>
-                                <Text className="cell_value" style={{ color: ColorType.sleep }}>{sleepCompleteStatus()}</Text>
-                            </View>
-                            :
-                            sleepOtherStatus()
-                    }
-                </View>
-            </View>
-        }
-
-    </View>
-}

+ 0 - 7
src/features/trackTimeDuration/components/setschedule/ActionPlan.tsx

@@ -1,7 +0,0 @@
-import { View } from "@tarojs/components";
-
-export default function ActionPlan(){
-    return <View>
-        
-    </View>
-}

+ 0 - 5
src/features/trackTimeDuration/components/setschedule/ChooseAction.tsx

@@ -1,5 +0,0 @@
-import { View } from "@tarojs/components";
-
-export default function ChooseAction(){
-    return <View></View>
-}

+ 32 - 7
src/pages/clock/ClockNew.tsx

@@ -23,6 +23,10 @@ import { IconClose } from "@/components/basic/Icons";
 import showAlert from "@/components/basic/Alert";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import CircleRing from "@/components/basic/CircleRing";
+import { wxPubFollow } from "@/services/permission";
+import { setWXFollow } from "@/store/permission";
+import { getResources } from "@/app/time_of_day/services/net";
+import { staticResources } from "@/services/common";
 
 let AppState;
 if (process.env.TARO_ENV == 'rn') {
@@ -36,6 +40,7 @@ export default function ClockNew(props: { children: any, onScroll: any }) {
     const [scrollLeft, setScrollLeft] = useState(rpxToPx(750) * 0)
     const user = useSelector((state: any) => state.user);
     const health = useSelector((state: any) => state.health);
+    const common = useSelector((state: any) => state.common);
     const [type, setType] = useState(WindowType.day)
     const [needShowAddTip, setNeedShowAddTip] = useState(false)
     const [reminderAdd, setReminderAdd] = useState(false)
@@ -74,6 +79,21 @@ export default function ClockNew(props: { children: any, onScroll: any }) {
         // }, 1000)
     })
 
+    function getFollowStatus() {
+        if (userRef.current.isLogin) {
+            wxPubFollow({ force_refresh: true }).then(res => {
+                dispatch(setWXFollow((res as any).wx_pub_followed));
+            })
+        }
+    }
+
+    global.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 refreshData() {
         global.refreshWindow()
         Taro.getStorage({
@@ -136,15 +156,13 @@ export default function ClockNew(props: { children: any, onScroll: any }) {
         userRef.current = user;
     }, [user])
 
-    useEffect(()=>{
-        console.log('外层userLogin',user.isLogin)
-        setTimeout(()=>{
-            console.log('里层userLogin',userRef.current.isLogin)
-            if (userRef.current.isLogin){
+    useEffect(() => {
+        setTimeout(() => {
+            if (userRef.current.isLogin) {
                 checkVersionUpdate()
             }
-        },1000)
-    },[user.isLogin])
+        }, 1000)
+    }, [user.isLogin])
 
     // useEffect(() => {
     //     archived()
@@ -172,7 +190,14 @@ export default function ClockNew(props: { children: any, onScroll: any }) {
 
                 }
             })
+            var time = new Date()
+            if (time.getSeconds() % 30 == 0) {
+                getFollowStatus()
+            }
         }, 1000)
+        getFollowStatus()
+
+        dispatch(staticResources() as any);
 
         // setTimeout(() => {
         //     checkVersionUpdate();

+ 0 - 2
src/services/http/request.ts

@@ -97,8 +97,6 @@ export async function request<T>(param: RequestParam): Promise<T> {
         header['X-Timestamp'] = new Date().getTime()
         if (token.length > 0) {
             header['Authorization'] = `Bearer ${token}`;
-            // header['Authorization'] = 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhY2NvdW50Iiwic3ViIjoiMTE0Nzg0NGE5NDIyODk1MmE5Zjc2OTdjYWJjYmU3Y2UiLCJpc3MiOiJmYXN0Iiwibmlja25hbWUiOiJGYXN0ZXIiLCJ0eXAiOiJCZWFyZXIiLCJzZXNzaW9uX3N0YXRlIjoiZWE5NTQ1Y2VkNThlNzgzNTA1MWRjZTY0ODEwMzQ4ZmQiLCJleHAiOjE3NDk3MDA3MTYsImlhdCI6MTcxODE2NDcxN30.yrh-xAJhmfG-CueyCsToW-X4Dx043DYhk5DiE0E4eNk';
-            // header['Authorization'] = 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhY2NvdW50Iiwic3ViIjoiMjZkOGE1YTg0MDMyYmExN2Q4NDk3MTlkNTljNGY1NzgiLCJpc3MiOiJmYXN0Iiwibmlja25hbWUiOiJCSyIsInR5cCI6IkJlYXJlciIsInNlc3Npb25fc3RhdGUiOiI1ZDU2NTkzYmNjNWFmNzM0OWNlZTMwZjlkNGYzMWIyMCIsImV4cCI6MTc0ODE3MDg5NSwiaWF0IjoxNzE2NjM0ODk1fQ.uaRm2vSNCX8fkFS63Oe-WNWIDHG_cRM-nQ5EGyUMaBg';
         }
 
 

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů