|
@@ -1,4 +1,4 @@
|
|
|
-import { PageContainer, Switch, Text, View,Image } from '@tarojs/components'
|
|
|
|
|
|
|
+import { PageContainer, Switch, Text, View, Image } from '@tarojs/components'
|
|
|
import './DayNightCard.scss'
|
|
import './DayNightCard.scss'
|
|
|
import { ColorType } from '@/context/themes/color'
|
|
import { ColorType } from '@/context/themes/color'
|
|
|
import { useEffect, useState } from 'react'
|
|
import { useEffect, useState } from 'react'
|
|
@@ -709,8 +709,8 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
|
|
|
//`Yesterday ${sunsetTime} - Today ${sunriseTmrTime}`
|
|
//`Yesterday ${sunsetTime} - Today ${sunriseTmrTime}`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function getSunsetTime(){
|
|
|
|
|
- if (props.isNight){
|
|
|
|
|
|
|
+ function getSunsetTime() {
|
|
|
|
|
+ if (props.isNight) {
|
|
|
if (!authInfo || !(authInfo as any).lat) {
|
|
if (!authInfo || !(authInfo as any).lat) {
|
|
|
if (new Date().getHours() >= 6) {
|
|
if (new Date().getHours() >= 6) {
|
|
|
return `${t('feature.day_night.tonight')} ${sunsetTime}`
|
|
return `${t('feature.day_night.tonight')} ${sunsetTime}`
|
|
@@ -739,8 +739,8 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
|
|
|
return `${t('feature.day_night.tomorrow')} ${sunriseTime.substring(0, 5)}`
|
|
return `${t('feature.day_night.tomorrow')} ${sunriseTime.substring(0, 5)}`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function getSunriseTime(){
|
|
|
|
|
- if (props.isNight){
|
|
|
|
|
|
|
+ function getSunriseTime() {
|
|
|
|
|
+ if (props.isNight) {
|
|
|
if (!authInfo || !(authInfo as any).lat) {
|
|
if (!authInfo || !(authInfo as any).lat) {
|
|
|
if (new Date().getHours() >= 6) {
|
|
if (new Date().getHours() >= 6) {
|
|
|
return `${t('feature.day_night.tomorrow_morning')} ${sunriseTmrTime}`
|
|
return `${t('feature.day_night.tomorrow_morning')} ${sunriseTmrTime}`
|
|
@@ -960,15 +960,17 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
|
|
|
<Text className='day_night_desc'>{props.isNight ? nightDurationDesc1() : dayDurationDesc1()}</Text>
|
|
<Text className='day_night_desc'>{props.isNight ? nightDurationDesc1() : dayDurationDesc1()}</Text>
|
|
|
|
|
|
|
|
<View className='daynightsummary'>
|
|
<View className='daynightsummary'>
|
|
|
- <View style={{display:'flex',flexDirection:'column'}}>
|
|
|
|
|
- <Image className='sunicon' src={require(props.isNight?'@assets/images/sunset.png':'@assets/images/sunrise.png')}/>
|
|
|
|
|
- <Image className='sunicon' src={require(props.isNight?'@assets/images/sunrise.png':'@assets/images/sunset.png')}/>
|
|
|
|
|
|
|
+ <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
|
|
+ <Image className='sunicon' src={props.isNight ? require('@assets/images/sunset.png') :
|
|
|
|
|
+ require('@assets/images/sunrise.png')} />
|
|
|
|
|
+ <Image className='sunicon' src={props.isNight ? require('@assets/images/sunrise.png') :
|
|
|
|
|
+ require('@assets/images/sunset.png')} />
|
|
|
</View>
|
|
</View>
|
|
|
- <View style={{display:'flex',flexDirection:'column'}}>
|
|
|
|
|
- <Text className='duration_title2'>{props.isNight?'日落':'日出'}</Text>
|
|
|
|
|
- <Text style={{color:props.isNight?ColorType.night:ColorType.day}}>{props.isNight?getSunsetTime():getSunriseTime()}</Text>
|
|
|
|
|
- <Text className='duration_title2'>{!props.isNight?'日落':'日出'}</Text>
|
|
|
|
|
- <Text style={{color:!props.isNight?ColorType.night:ColorType.day}}>{!props.isNight?getSunsetTime():getSunriseTime()}</Text>
|
|
|
|
|
|
|
+ <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
|
|
+ <Text className='duration_title2'>{props.isNight ? '日落' : '日出'}</Text>
|
|
|
|
|
+ <Text style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{props.isNight ? getSunsetTime() : getSunriseTime()}</Text>
|
|
|
|
|
+ <Text className='duration_title2'>{!props.isNight ? '日落' : '日出'}</Text>
|
|
|
|
|
+ <Text style={{ color: !props.isNight ? ColorType.night : ColorType.day }}>{!props.isNight ? getSunsetTime() : getSunriseTime()}</Text>
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
{
|
|
{
|