|
|
@@ -54,6 +54,7 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
latestLocation({
|
|
|
date_start: strYesterday, date_end: strTomorrow
|
|
|
}).then(data => {
|
|
|
+ debugger
|
|
|
setAuthInfo(data as any)
|
|
|
updateDate(data)
|
|
|
locationDetail = data
|
|
|
@@ -73,16 +74,14 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
var detail: any = locationDetail
|
|
|
var now = new Date()
|
|
|
if (now.getHours() == 0 && now.getMinutes() == 0 && now.getSeconds() == 0) {
|
|
|
- console.log('9527')
|
|
|
detail.daylights.splice(0, 1)
|
|
|
}
|
|
|
locationDetail = detail
|
|
|
-
|
|
|
+
|
|
|
// setLocationDetail(detail)
|
|
|
updateDate(detail)
|
|
|
}
|
|
|
else {
|
|
|
- console.log('apple')
|
|
|
}
|
|
|
}, 1000)
|
|
|
}, [])
|
|
|
@@ -92,7 +91,7 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
// })
|
|
|
|
|
|
function updateDate(data) {
|
|
|
-
|
|
|
+
|
|
|
var today = new Date()
|
|
|
// var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
|
|
|
var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000)
|
|
|
@@ -131,7 +130,6 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
}
|
|
|
//今天白天(今天出日后-日落前)
|
|
|
else if (todaySunriseDate.getTime() < today.getTime() && today.getTime() < todaySunsetDate.getTime()) {
|
|
|
- console.log('2')
|
|
|
setNightDate(today)
|
|
|
setDayDate(today)
|
|
|
if (props.isNight) {
|
|
|
@@ -155,7 +153,6 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
}
|
|
|
//今天夜晚
|
|
|
else if (today.getTime() > todaySunsetDate.getTime() && today.getTime() < tomorrowSunriseDate.getTime()) {
|
|
|
- console.log('3')
|
|
|
setNightDate(today)
|
|
|
setDayDate(tomorrow)
|
|
|
if (props.isNight) {
|
|
|
@@ -234,11 +231,11 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
return <View className='day_night_card_footer'>
|
|
|
<Text style={{ color: '#9E9E9E', fontSize: rpxToPx(20) }}>{
|
|
|
// !isMember ? t('feature.track_time_duration.third_ring.member_desc') :
|
|
|
- authInfo ? t('feature.track_time_duration.third_ring.base_location_desc') :
|
|
|
+ authInfo && (authInfo as any).lat ? t('feature.track_time_duration.third_ring.base_location_desc') :
|
|
|
t('feature.track_time_duration.third_ring.enter_location_desc')
|
|
|
}</Text>
|
|
|
{
|
|
|
- authInfo && <Text style={{ color: '#9E9E9E', fontSize: rpxToPx(20) }} onClick={(e) => {
|
|
|
+ authInfo && (authInfo as any).lat && <Text style={{ color: '#9E9E9E', fontSize: rpxToPx(20) }} onClick={(e) => {
|
|
|
e.stopPropagation()
|
|
|
auth()
|
|
|
}}>Edit Location</Text>
|
|
|
@@ -281,11 +278,12 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
success: function (res) {
|
|
|
console.log(res)
|
|
|
var today = new Date()
|
|
|
+ var yesterday = new Date(today.getTime() - 24 * 3600 * 1000)
|
|
|
var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000 * 3)
|
|
|
- var strToday = `${today.getFullYear()}-${TimeFormatter.padZero(today.getMonth() + 1)}-${TimeFormatter.padZero(today.getDate())}`
|
|
|
+ var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
|
|
|
var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
|
|
|
|
|
|
- systemLocation({ lat: res.latitude, lng: res.longitude, date_start: strToday, date_end: strTomorrow }).then(data => {
|
|
|
+ systemLocation({ lat: res.latitude, lng: res.longitude, date_start: strYesterday, date_end: strTomorrow }).then(data => {
|
|
|
console.log(data);
|
|
|
updateDate(data);
|
|
|
locationDetail = data;
|