|
|
@@ -2,7 +2,7 @@ import { View, Text, Image } from "@tarojs/components";
|
|
|
import './index_time.scss';
|
|
|
import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
|
|
|
import { getCommon, getDot } from "@/features/trackTimeDuration/hooks/RingData";
|
|
|
-import Rings, { RingCommon, BgRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
|
|
|
+import Rings, { RingCommon, BgRing,TargetRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
|
|
|
import { useEffect, useState } from "react";
|
|
|
import DeviceInfo from 'react-native-device-info';
|
|
|
import dayjs from "dayjs";
|
|
|
@@ -71,6 +71,13 @@ export default function IndexTimePage() {
|
|
|
setShowLanguage(false)
|
|
|
dayjs.locale(isEnglish ? 'en' : 'zh-cn');
|
|
|
moment.locale(isEnglish ? 'en' : 'zh-cn');
|
|
|
+
|
|
|
+ if (current) {
|
|
|
+ chooseLocation({
|
|
|
+ lat: current.geo.lat,
|
|
|
+ lng: current.geo.lng
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function login() {
|
|
|
@@ -130,6 +137,21 @@ export default function IndexTimePage() {
|
|
|
color: '#EAE9E9'
|
|
|
}
|
|
|
|
|
|
+ function getArc(){
|
|
|
+ var hour = new Date().getHours()
|
|
|
+ var minute = new Date().getMinutes()
|
|
|
+ var second = new Date().getSeconds()
|
|
|
+ if (current) {
|
|
|
+ var strHour = moment().tz(current.time.timezone.id).format('H')
|
|
|
+ hour = parseInt(strHour)
|
|
|
+ var strMin = moment().tz(current.time.timezone.id).format('m')
|
|
|
+ minute = parseInt(strMin)
|
|
|
+ var strSecond = moment().tz(current.time.timezone.id).format('s')
|
|
|
+ second = parseInt(strSecond)
|
|
|
+ }
|
|
|
+
|
|
|
+ return (hour*3600+minute*60+second)/(24*3600)*2*Math.PI
|
|
|
+ }
|
|
|
|
|
|
function ring() {
|
|
|
const currentDot: CurrentDot = {
|
|
|
@@ -138,7 +160,13 @@ export default function IndexTimePage() {
|
|
|
borderColor: '#ffffff',
|
|
|
offset: 0
|
|
|
}
|
|
|
- return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={'smal11l'} />
|
|
|
+ const targetRing: TargetRing = {
|
|
|
+ color: '#CACACA',
|
|
|
+ startArc: -Math.PI/2,
|
|
|
+ durationArc: getArc()
|
|
|
+ }
|
|
|
+
|
|
|
+ return <Rings common={common} bgRing={bgRing} targetRing={targetRing} currentDot={currentDot} canvasId={'smal11l'} />
|
|
|
}
|
|
|
|
|
|
function languageModalContent() {
|
|
|
@@ -194,22 +222,22 @@ export default function IndexTimePage() {
|
|
|
return t('time_of_day.index.winter_starts')
|
|
|
}
|
|
|
|
|
|
- function dstNote(item:any){
|
|
|
+ function dstNote(item: any) {
|
|
|
var str = moment(item.timestamp).tz(current.time.timezone.id).format('YYYY-MM-DDTHH:mm:ss')
|
|
|
- var str2 = moment(item.timestamp-1).tz(current.time.timezone.id).format('YYYY-MM-DDTHH:mm:ss')
|
|
|
- console.log(str,str2)
|
|
|
+ var str2 = moment(item.timestamp - 1).tz(current.time.timezone.id).format('YYYY-MM-DDTHH:mm:ss')
|
|
|
+ console.log(str, str2)
|
|
|
debugger
|
|
|
return 'Time was set forward 1 hour from 02:00 to 03:00.\nTime zone changed to UTC-7, Pacific Daylight Time (PDT).'
|
|
|
}
|
|
|
|
|
|
- function isNight(){
|
|
|
+ function isNight() {
|
|
|
var hour = new Date().getHours()
|
|
|
if (current) {
|
|
|
var strHour = moment().tz(current.time.timezone.id).format('H')
|
|
|
hour = parseInt(strHour)
|
|
|
}
|
|
|
-
|
|
|
- if (hour>=18 || hour<6){
|
|
|
+
|
|
|
+ if (hour >= 18 || hour < 6) {
|
|
|
return true
|
|
|
}
|
|
|
return false
|
|
|
@@ -246,7 +274,7 @@ export default function IndexTimePage() {
|
|
|
ring()
|
|
|
}
|
|
|
<View className="ring_center">
|
|
|
- <Image className="sun" src={isNight()?require('@assets/index_time/moon.png'):require('@assets/index_time/sun.png')} />
|
|
|
+ <Image className="sun" src={isNight() ? require('@assets/index_time/moon.png') : require('@assets/index_time/sun.png')} />
|
|
|
<Text className="time">{formatTime('HH:mm:ss')}</Text>
|
|
|
<Text className="date">{global.language == 'en' ? formatTime('dddd, MMM DD') : formatTime('MMMD dddd')}</Text>
|
|
|
</View>
|