Leon 1 gadu atpakaļ
vecāks
revīzija
def9b32dfd

+ 15 - 10
src/features/trackTimeDuration/components/RecordFastSleep.tsx

@@ -6,7 +6,7 @@ import { delRecord } from "@/services/trackTimeDuration";
 import { ModalType } from "@/utils/types";
 import { View, Text, Image } from "@tarojs/components";
 import Taro from "@tarojs/taro";
-import { useEffect, useState } from "react";
+import { useEffect, useState, memo } from "react";
 import TimelineFastSleep from "./TimelineFastSleep";
 import { TimeFormatter } from "@/utils/time_format";
 import './RecordFastSleep.scss'
@@ -29,7 +29,13 @@ if (process.env.TARO_ENV == 'rn') {
 }
 
 let stageCanvasId = new Date().getTime()
-export default function RecordFastSleep(props: { data: any, type: string, delSuccess?: Function, index: any }) {
+
+
+
+
+
+// export default function RecordFastSleep(props: { data: any, type: string, delSuccess?: Function, index: any }) {
+const RecordFastSleep = memo((props: { data: any, type: string }) => {
     const [count, setCount] = useState(0)
     const [showDetailModal, setShowDetailModal] = useState(false)
     const [segmentIndex, setSegmentIndex] = useState(0)
@@ -119,7 +125,7 @@ export default function RecordFastSleep(props: { data: any, type: string, delSuc
             Taro.showToast({
                 title: t('page.records_history.del_success')
             })
-            props.delSuccess && props.delSuccess(props.data)
+            // props.delSuccess && props.delSuccess(props.data)
             // Taro.navigateBack()
         })
     }
@@ -203,7 +209,7 @@ export default function RecordFastSleep(props: { data: any, type: string, delSuc
             if (props.data.status == 'ONGOING3') {
                 realRing.color = 'rgba(0,0,0,0)'
             }
-            return <Rings common={common} bgRing={bgRing} canvasId={props.index} realRing={realRing} />
+            return <Rings common={common} bgRing={bgRing} canvasId={canvasId} realRing={realRing} />
         }
         else {
             var currentDot1 = getDot(record, true)
@@ -267,10 +273,7 @@ export default function RecordFastSleep(props: { data: any, type: string, delSuc
         return (hour * 3600 + minute * 60 + second) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
     }
 
-    function smallRing(canvas_id = props.index) {
-        if (canvas_id != props.index) {
-            debugger
-        }
+    function smallRing() {
         if (record.scenario == 'FAST_SLEEP') {
             var common = getCommon(null, false)
             common.radius = 28;
@@ -294,7 +297,7 @@ export default function RecordFastSleep(props: { data: any, type: string, delSuc
                     showReal = true
                     // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
                 }
-                return <Rings common={common} bgRing={bgRing} canvasId={canvas_id + 'small'} realRing={showReal ? realRing : null} />
+                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} />
@@ -546,4 +549,6 @@ export default function RecordFastSleep(props: { data: any, type: string, delSuc
                 confirm={() => { }} />
         }
     </View>
-}
+})
+
+export default RecordFastSleep;

+ 2 - 2
src/features/trackTimeDuration/components/Rings.weapp.tsx

@@ -62,15 +62,15 @@ export default function Rings(props: {
     const user = useSelector((state: any) => state.user);
 
     useEffect(()=>{
-        
+        console.log('ssss')
         // drawCircle()
     },[])
 
     useReady(() => {
         drawCircle()
     })
-
     useEffect(() => {
+        
         if (props.ctx){
             drawContent(props.ctx)
         }

+ 0 - 3
src/features/trackTimeDuration/components/WeekCalendar.tsx

@@ -13,9 +13,6 @@ let scrollTimer;
 let isScrolling;
 let fingerDrag = false;
 
-const MyPage = memo(()=>{
-    return <View />
-})
 const WeekCalendar = memo(()=>{
     const [calendars, setCalendars] = useState<any>([])
     const [current, setCurrent] = useState(0)

+ 7 - 0
src/pages/clock/Index.tsx

@@ -33,6 +33,7 @@ import ClockHeader from "@/features/trackTimeDuration/components/ClockHeader";
 
 let GradientText
 let useNavigation;
+let isPause = false;
 
 if (process.env.TARO_ENV == 'rn') {
     GradientText = require('@/components/basic/GradientText').default
@@ -89,6 +90,9 @@ export default function Page() {
     useEffect(() => {
         global.showNightRing = false;
         setInterval(() => {
+            if (isPause){
+                return
+            }
             setCount((prevCounter) => prevCounter + 1)
         }, 1000)
     }, [])
@@ -137,6 +141,7 @@ export default function Page() {
             global.homeData = res
 
             if (user.isLogin) {
+                isPause = (res as any).fast_sleep.current_record.status=='WAIT_FOR_START'
                 dispatch(updateScenario((res as any).fast_sleep.current_record))
 
                 dispatch(setScenario((res as any).fast_sleep.scenario));
@@ -355,6 +360,8 @@ export default function Page() {
 
     var timestamp = new Date().getTime()
 
+    console.log('page')
+
     function render() {
         return <Layout type={TemplateType.customHeader} header={headerView()} title={t('page.clock.title')} titleShowStyle={NaviBarTitleShowType.scrollToShow}>
 

+ 6 - 1
src/pages/common/RecordsHistory.tsx

@@ -359,7 +359,12 @@ export default function Page() {
                 {
                     records.map((item, index) => {
                         return <View className="fast_sleep_item_bg">
-                            <RecordFastSleep key={index} data={item} index={index+scenario} type='record' delSuccess={(item) => removeItem(item)} />
+                            <RecordFastSleep key={index} 
+                            data={item} 
+                            // index={index+scenario} 
+                            type='record' 
+                            // delSuccess={(item) => removeItem(item)} 
+                            />
                         </View>
                         // return <Schedule key={index} data={item} type="record" delSuccess={(item) => removeItem(item)} />
                     })

+ 11 - 6
yarn.lock

@@ -5401,11 +5401,16 @@ class-utils@^0.3.5:
     isobject "^3.0.0"
     static-extend "^0.1.1"
 
-classnames@^2.2.1, classnames@^2.2.5, classnames@^2.2.6:
+classnames@^2.2.1, classnames@^2.2.5:
   version "2.3.2"
   resolved "https://registry.npmmirror.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924"
   integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==
 
+classnames@^2.2.6:
+  version "2.5.1"
+  resolved "https://registry.npmmirror.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b"
+  integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==
+
 clean-css@^4.2.1:
   version "4.2.4"
   resolved "https://registry.npmmirror.com/clean-css/-/clean-css-4.2.4.tgz#733bf46eba4e607c6891ea57c24a989356831178"
@@ -13687,7 +13692,7 @@ react-lifecycles-compat@^3.0.4:
 
 react-native-animatable@1.3.3:
   version "1.3.3"
-  resolved "https://registry.yarnpkg.com/react-native-animatable/-/react-native-animatable-1.3.3.tgz#a13a4af8258e3bb14d0a9d839917e9bb9274ec8a"
+  resolved "https://registry.npmmirror.com/react-native-animatable/-/react-native-animatable-1.3.3.tgz#a13a4af8258e3bb14d0a9d839917e9bb9274ec8a"
   integrity sha512-2ckIxZQAsvWn25Ho+DK3d1mXIgj7tITkrS4pYDvx96WyOttSvzzFeQnM2od0+FUMzILbdHDsDEqZvnz1DYNQ1w==
   dependencies:
     prop-types "^15.7.2"
@@ -13788,7 +13793,7 @@ react-native-modal-popover@^2.0.1:
 
 react-native-modal@^13.0.0:
   version "13.0.1"
-  resolved "https://registry.yarnpkg.com/react-native-modal/-/react-native-modal-13.0.1.tgz#691f1e646abb96fa82c1788bf18a16d585da37cd"
+  resolved "https://registry.npmmirror.com/react-native-modal/-/react-native-modal-13.0.1.tgz#691f1e646abb96fa82c1788bf18a16d585da37cd"
   integrity sha512-UB+mjmUtf+miaG/sDhOikRfBOv0gJdBU2ZE1HtFWp6UixW9jCk/bhGdHUgmZljbPpp0RaO/6YiMmQSSK3kkMaw==
   dependencies:
     prop-types "^15.6.2"
@@ -15876,9 +15881,9 @@ taro-css-to-react-native@3.6.19:
     postcss-value-parser "^3.3.0"
 
 taro-ui@^3.1.1:
-  version "3.1.1"
-  resolved "https://registry.yarnpkg.com/taro-ui/-/taro-ui-3.1.1.tgz#526dafcf9b0f24b4551080cbd2e0b31d9c0ab84d"
-  integrity sha512-mbVeBhguyVPr+FLyrlT+ABnpQIuqRB/xpKKZxbnpaCg8W2RDM7CKQW7VPehfzqD+jW57X21b0bcD2ALYBhQSQg==
+  version "3.3.0"
+  resolved "https://registry.npmmirror.com/taro-ui/-/taro-ui-3.3.0.tgz#2d10e6f53baeacacf1990a07107fab3d65da13f8"
+  integrity sha512-M4tf2OEy1BzmeFyvF0kFOgzzW1Lc86TlQ5UwZh4cNMkuViqGId/DLqY0iMlqAjfXstRn0x4HaFFw91xfLqkPzg==
   dependencies:
     classnames "^2.2.6"
     dayjs "^1.7.7"