|
@@ -1,5 +1,5 @@
|
|
|
import { View, Text, Image } from "@tarojs/components";
|
|
import { View, Text, Image } from "@tarojs/components";
|
|
|
-import { getBgRing, getCommon, getDot, getReal, getSchedule, getTarget } from "../hooks/RingData";
|
|
|
|
|
|
|
+import { dotIsOuterRange, getBgRing, getCommon, getDot, getReal, getSchedule, getTarget } from "../hooks/RingData";
|
|
|
import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
|
|
import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
|
|
|
import Rings from "./Rings";
|
|
import Rings from "./Rings";
|
|
|
import './IndexItem.scss'
|
|
import './IndexItem.scss'
|
|
@@ -9,6 +9,7 @@ import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
import { TimeFormatter } from "@/utils/time_format";
|
|
import { TimeFormatter } from "@/utils/time_format";
|
|
|
import { useSelector } from "react-redux";
|
|
import { useSelector } from "react-redux";
|
|
|
import { useEffect, useState } from "react";
|
|
import { useEffect, useState } from "react";
|
|
|
|
|
+import Taro from "@tarojs/taro";
|
|
|
|
|
|
|
|
let useNavigation;
|
|
let useNavigation;
|
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
if (process.env.TARO_ENV == 'rn') {
|
|
@@ -18,6 +19,7 @@ export default function Component(props: { type: string, data: any, time: any })
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
const record = props.data.current_record;
|
|
const record = props.data.current_record;
|
|
|
const user = useSelector((state: any) => state.user);
|
|
const user = useSelector((state: any) => state.user);
|
|
|
|
|
+ const dayNight = useSelector((state: any) => state.dayNight);
|
|
|
const [stageList, setStageList] = useState([true, false, false])
|
|
const [stageList, setStageList] = useState([true, false, false])
|
|
|
const [isStageMode, setIsStageMode] = useState(false)
|
|
const [isStageMode, setIsStageMode] = useState(false)
|
|
|
let navigation;
|
|
let navigation;
|
|
@@ -90,6 +92,10 @@ export default function Component(props: { type: string, data: any, time: any })
|
|
|
if (props.type == 'FAST_SLEEP') {
|
|
if (props.type == 'FAST_SLEEP') {
|
|
|
realRing1.color = ColorType.fast + '66'
|
|
realRing1.color = ColorType.fast + '66'
|
|
|
|
|
|
|
|
|
|
+ if (dotIsOuterRange(true, record.fast)) {
|
|
|
|
|
+ currentDot1.color = ColorType.ring
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (stageList[0]) {
|
|
if (stageList[0]) {
|
|
|
|
|
|
|
|
const realRingBig: RealRing = {
|
|
const realRingBig: RealRing = {
|
|
@@ -148,6 +154,10 @@ export default function Component(props: { type: string, data: any, time: any })
|
|
|
else if (record.status == 'WAIT_FOR_START' || record.status == 'ONGOING1') {
|
|
else if (record.status == 'WAIT_FOR_START' || record.status == 'ONGOING1') {
|
|
|
realRing = getSchedule(record, false, true)
|
|
realRing = getSchedule(record, false, true)
|
|
|
var currentDot = getDot(record, false)
|
|
var currentDot = getDot(record, false)
|
|
|
|
|
+ if (record.status == 'WAIT_FOR_START' && dotIsOuterRange(true, record.sleep)) {
|
|
|
|
|
+ currentDot.color = ColorType.ring
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return <Rings common={common} bgRing={bgRing} currentDot={isStageMode ? null : currentDot} realRing={realRing} canvasId={props.type + props.time + 'small'} />
|
|
return <Rings common={common} bgRing={bgRing} currentDot={isStageMode ? null : currentDot} realRing={realRing} canvasId={props.type + props.time + 'small'} />
|
|
|
}
|
|
}
|
|
|
else if (record.sleep.status == 'NOT_COMPLETED') {
|
|
else if (record.sleep.status == 'NOT_COMPLETED') {
|
|
@@ -194,12 +204,21 @@ export default function Component(props: { type: string, data: any, time: any })
|
|
|
startArc: 0,
|
|
startArc: 0,
|
|
|
durationArc: 2
|
|
durationArc: 2
|
|
|
}
|
|
}
|
|
|
- var sunRise = 24 * 60 + (user.test_user ? 7 * 60 : 6 * 60)
|
|
|
|
|
- var sunSet = user.test_user ? 19 * 60 : 18 * 60
|
|
|
|
|
|
|
+ var sunRise = 24 * 60 + (dayNight.gpsInfo && dayNight.isMember ? 7 * 60 : 6 * 60)
|
|
|
|
|
+ var sunSet = dayNight.gpsInfo && dayNight.isMember ? 19 * 60 : 18 * 60
|
|
|
var duration = sunRise - sunSet
|
|
var duration = sunRise - sunSet
|
|
|
realRingBig.startArc = (sunSet * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
|
|
realRingBig.startArc = (sunSet * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
|
|
|
realRingBig.durationArc = (duration * 60) / (24 * 3600) * 2 * Math.PI;
|
|
realRingBig.durationArc = (duration * 60) / (24 * 3600) * 2 * Math.PI;
|
|
|
- return <Rings common={common} bgRing={bgRing} realRing={realRingBig} canvasId={props.type + props.time + 'day'} />
|
|
|
|
|
|
|
+
|
|
|
|
|
+ var currentDot = getDot(record, false)
|
|
|
|
|
+ if (dotIsOuterRange(false, null, { sunrise: dayNight.sunRise, sunset: dayNight.sunSet })) {
|
|
|
|
|
+ currentDot.color = ColorType.ring
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ currentDot.color = ColorType.night + '66'
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return <Rings common={common} bgRing={bgRing} realRing={realRingBig} currentDot={currentDot} canvasId={props.type + props.time + 'day'} />
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function rings() {
|
|
function rings() {
|
|
@@ -290,7 +309,7 @@ export default function Component(props: { type: string, data: any, time: any })
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
|
props.type == 'FAST_SLEEP' && user.isLogin && global.showNightRing === true &&
|
|
props.type == 'FAST_SLEEP' && user.isLogin && global.showNightRing === true &&
|
|
|
- <Text className="duration_value" style={{color:ColorType.night}}>12小时</Text>
|
|
|
|
|
|
|
+ <Text className="duration_value" style={{ color: ColorType.night }}>12小时</Text>
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
|
(props.type == 'FAST' || props.type == 'FAST_SLEEP') && <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
|
|
(props.type == 'FAST' || props.type == 'FAST_SLEEP') && <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
|