|
|
@@ -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;
|