|
@@ -20,6 +20,25 @@ if (process.env.TARO_ENV == 'rn') {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
let locationDetail;
|
|
let locationDetail;
|
|
|
|
|
+
|
|
|
|
|
+let sunriseA = new Date()
|
|
|
|
|
+sunriseA.setHours(6)
|
|
|
|
|
+sunriseA.setMinutes(0)
|
|
|
|
|
+sunriseA.setSeconds(0)
|
|
|
|
|
+sunriseA.setMilliseconds(0)
|
|
|
|
|
+const sunsetA = new Date()
|
|
|
|
|
+sunsetA.setHours(18)
|
|
|
|
|
+sunsetA.setMinutes(0)
|
|
|
|
|
+sunsetA.setSeconds(0)
|
|
|
|
|
+sunsetA.setMilliseconds(0)
|
|
|
|
|
+
|
|
|
|
|
+const sunriseB = new Date()
|
|
|
|
|
+sunriseB.setHours(6)
|
|
|
|
|
+sunriseB.setMinutes(0)
|
|
|
|
|
+sunriseB.setSeconds(0)
|
|
|
|
|
+sunriseB.setMilliseconds(0)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
export default function DayNightCard(props: { isNight: boolean, switchChanged: Function }) {
|
|
export default function DayNightCard(props: { isNight: boolean, switchChanged: Function }) {
|
|
|
const [expand, setExpand] = useState(false)
|
|
const [expand, setExpand] = useState(false)
|
|
|
const user = useSelector((state: any) => state.user);
|
|
const user = useSelector((state: any) => state.user);
|
|
@@ -28,6 +47,14 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
const [sunriseTime, setSunriseTime] = useState('06:00')
|
|
const [sunriseTime, setSunriseTime] = useState('06:00')
|
|
|
const [sunriseTmrTime, setSunriseTmrTime] = useState('06:00')
|
|
const [sunriseTmrTime, setSunriseTmrTime] = useState('06:00')
|
|
|
const [sunsetTime, setSunsetTime] = useState('18:00')
|
|
const [sunsetTime, setSunsetTime] = useState('18:00')
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ const [sunriseDate, setSunriseDate] = useState<any>(sunriseA)
|
|
|
|
|
+ const [sunriseTmrDate, setSunriseTmrDate] = useState<any>(new Date(sunriseB.getTime() + 24 * 3600 * 1000))
|
|
|
|
|
+ const [sunsetDate, setSunsetDate] = useState<any>(sunsetA)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
const [showDetailModal, setShowDetailModal] = useState(false)
|
|
const [showDetailModal, setShowDetailModal] = useState(false)
|
|
|
// const [locationDetail, setLocationDetail] = useState(null)
|
|
// const [locationDetail, setLocationDetail] = useState(null)
|
|
|
|
|
|
|
@@ -67,6 +94,16 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
}, [user.isLogin])
|
|
}, [user.isLogin])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
|
|
+ if (props.isNight) {
|
|
|
|
|
+ global.clearNightLocation = () => {
|
|
|
|
|
+ clearCacheData()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ global.clearDayLocation = () => {
|
|
|
|
|
+ clearCacheData()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
setInterval(() => {
|
|
setInterval(() => {
|
|
|
setCount((prevCounter) => prevCounter + 1)
|
|
setCount((prevCounter) => prevCounter + 1)
|
|
|
|
|
|
|
@@ -97,11 +134,12 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000)
|
|
var tomorrow = new Date(today.getTime() + 24 * 3600 * 1000)
|
|
|
// var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.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())}`
|
|
// var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
|
|
|
- if (data.daylights.length > 0) {
|
|
|
|
|
|
|
+ if (data && data.daylights && data.daylights.length > 0) {
|
|
|
var yesterdayDate = new Date(data.daylights[0].date + 'T' + data.daylights[0].sunset)
|
|
var yesterdayDate = new Date(data.daylights[0].date + 'T' + data.daylights[0].sunset)
|
|
|
var todaySunriseDate = new Date(data.daylights[1].date + 'T' + data.daylights[1].sunrise)
|
|
var todaySunriseDate = new Date(data.daylights[1].date + 'T' + data.daylights[1].sunrise)
|
|
|
var todaySunsetDate = new Date(data.daylights[1].date + 'T' + data.daylights[1].sunset)
|
|
var todaySunsetDate = new Date(data.daylights[1].date + 'T' + data.daylights[1].sunset)
|
|
|
var tomorrowSunriseDate = new Date(data.daylights[2].date + 'T' + data.daylights[2].sunrise)
|
|
var tomorrowSunriseDate = new Date(data.daylights[2].date + 'T' + data.daylights[2].sunrise)
|
|
|
|
|
+ var tomorrowSunsetDate = new Date(data.daylights[2].date + 'T' + data.daylights[2].sunset)
|
|
|
|
|
|
|
|
// var tomorrowSunsetDate = new Date(data.daylights[2].date + 'T' + data.daylights[2].sunset)
|
|
// var tomorrowSunsetDate = new Date(data.daylights[2].date + 'T' + data.daylights[2].sunset)
|
|
|
//今天凌晨日出前
|
|
//今天凌晨日出前
|
|
@@ -111,10 +149,15 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
if (props.isNight) {
|
|
if (props.isNight) {
|
|
|
setSunsetTime(data.daylights[0].sunset)
|
|
setSunsetTime(data.daylights[0].sunset)
|
|
|
setSunriseTmrTime(data.daylights[1].sunrise)
|
|
setSunriseTmrTime(data.daylights[1].sunrise)
|
|
|
|
|
+ setSunsetDate(yesterdayDate)
|
|
|
|
|
+ setSunriseTmrDate(todaySunriseDate)
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
setSunriseTime(data.daylights[1].sunrise)
|
|
setSunriseTime(data.daylights[1].sunrise)
|
|
|
setSunsetTime(data.daylights[1].sunset)
|
|
setSunsetTime(data.daylights[1].sunset)
|
|
|
|
|
+ setSunriseDate(todaySunriseDate)
|
|
|
|
|
+ setSunsetDate(todaySunsetDate)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
dispatch(setNightRingData({
|
|
dispatch(setNightRingData({
|
|
@@ -130,15 +173,19 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
}
|
|
}
|
|
|
//今天白天(今天出日后-日落前)
|
|
//今天白天(今天出日后-日落前)
|
|
|
else if (todaySunriseDate.getTime() < today.getTime() && today.getTime() < todaySunsetDate.getTime()) {
|
|
else if (todaySunriseDate.getTime() < today.getTime() && today.getTime() < todaySunsetDate.getTime()) {
|
|
|
- setNightDate(today)
|
|
|
|
|
- setDayDate(today)
|
|
|
|
|
|
|
+ setNightDate(todaySunsetDate)
|
|
|
|
|
+ setDayDate(todaySunriseDate)
|
|
|
if (props.isNight) {
|
|
if (props.isNight) {
|
|
|
setSunsetTime(data.daylights[1].sunset)
|
|
setSunsetTime(data.daylights[1].sunset)
|
|
|
setSunriseTmrTime(data.daylights[2].sunrise)
|
|
setSunriseTmrTime(data.daylights[2].sunrise)
|
|
|
|
|
+ setSunsetDate(todaySunsetDate)
|
|
|
|
|
+ setSunriseTmrDate(tomorrowSunriseDate)
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
setSunriseTime(data.daylights[1].sunrise)
|
|
setSunriseTime(data.daylights[1].sunrise)
|
|
|
setSunsetTime(data.daylights[1].sunset)
|
|
setSunsetTime(data.daylights[1].sunset)
|
|
|
|
|
+ setSunsetDate(todaySunsetDate)
|
|
|
|
|
+ setSunriseDate(todaySunriseDate)
|
|
|
}
|
|
}
|
|
|
dispatch(setNightRingData({
|
|
dispatch(setNightRingData({
|
|
|
date: today.getTime(),
|
|
date: today.getTime(),
|
|
@@ -153,15 +200,19 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
}
|
|
}
|
|
|
//今天夜晚
|
|
//今天夜晚
|
|
|
else if (today.getTime() > todaySunsetDate.getTime() && today.getTime() < tomorrowSunriseDate.getTime()) {
|
|
else if (today.getTime() > todaySunsetDate.getTime() && today.getTime() < tomorrowSunriseDate.getTime()) {
|
|
|
- setNightDate(today)
|
|
|
|
|
- setDayDate(tomorrow)
|
|
|
|
|
|
|
+ setNightDate(todaySunsetDate)
|
|
|
|
|
+ setDayDate(tomorrowSunriseDate)
|
|
|
if (props.isNight) {
|
|
if (props.isNight) {
|
|
|
setSunsetTime(data.daylights[1].sunset)
|
|
setSunsetTime(data.daylights[1].sunset)
|
|
|
setSunriseTmrTime(data.daylights[2].sunrise)
|
|
setSunriseTmrTime(data.daylights[2].sunrise)
|
|
|
|
|
+ setSunsetDate(todaySunsetDate)
|
|
|
|
|
+ setSunriseTmrDate(tomorrowSunriseDate)
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
setSunriseTime(data.daylights[2].sunrise)
|
|
setSunriseTime(data.daylights[2].sunrise)
|
|
|
setSunsetTime(data.daylights[2].sunset)
|
|
setSunsetTime(data.daylights[2].sunset)
|
|
|
|
|
+ setSunriseDate(tomorrowSunriseDate)
|
|
|
|
|
+ setSunsetDate(tomorrowSunsetDate)
|
|
|
}
|
|
}
|
|
|
dispatch(setNightRingData({
|
|
dispatch(setNightRingData({
|
|
|
date: today.getTime(),
|
|
date: today.getTime(),
|
|
@@ -175,19 +226,9 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
}))
|
|
}))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- // for (var i=0;i<data.daylights.length;i++){
|
|
|
|
|
- // var obj = data[i]
|
|
|
|
|
- // var str = obj.date+' '+obj.sunrise
|
|
|
|
|
- // var date = new Date(str)
|
|
|
|
|
- // var str2 = obj.date+' '+obj.sunset
|
|
|
|
|
- // var date2 = new Date(str2)
|
|
|
|
|
- // if (date2)
|
|
|
|
|
- // }
|
|
|
|
|
- // data.daylights.map(item=>{
|
|
|
|
|
- // var str = item.date+' '+item.sunrise
|
|
|
|
|
- // var date = new Date(str)
|
|
|
|
|
- // debugger
|
|
|
|
|
- // })
|
|
|
|
|
|
|
+ else {
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function getContent() {
|
|
async function getContent() {
|
|
@@ -329,58 +370,17 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
function timeCount() {
|
|
function timeCount() {
|
|
|
var now = new Date()
|
|
var now = new Date()
|
|
|
if (props.isNight) {
|
|
if (props.isNight) {
|
|
|
- var list = sunsetTime.split(':')
|
|
|
|
|
- var hour = parseInt(list[0])
|
|
|
|
|
- var min = parseInt(list[1])
|
|
|
|
|
- var second = list.length == 3 ? parseInt(list[2]) : 0
|
|
|
|
|
- now.setHours(hour)
|
|
|
|
|
- now.setMinutes(min)
|
|
|
|
|
- now.setSeconds(second)
|
|
|
|
|
-
|
|
|
|
|
- var sunriseDate = new Date()
|
|
|
|
|
- var list2 = sunriseTmrTime.split(':')
|
|
|
|
|
- var hour2 = parseInt(list2[0])
|
|
|
|
|
- var min2 = parseInt(list2[1])
|
|
|
|
|
- var second2 = list2.length == 3 ? parseInt(list2[2]) : 0
|
|
|
|
|
- sunriseDate.setHours(hour2)
|
|
|
|
|
- sunriseDate.setMinutes(min2)
|
|
|
|
|
- sunriseDate.setSeconds(second2)
|
|
|
|
|
-
|
|
|
|
|
- if (new Date().getTime() < sunriseDate.getTime()) {
|
|
|
|
|
- return TimeFormatter.countdown(now.getTime() - 24 * 3600 * 1000)
|
|
|
|
|
|
|
+ if (now.getTime() < sunriseTmrDate.getTime()) {
|
|
|
|
|
+ return TimeFormatter.countdown(sunsetDate.getTime())
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return TimeFormatter.countdown(now.getTime())
|
|
|
|
|
|
|
+ return TimeFormatter.countdown(sunsetDate.getTime())
|
|
|
} else {
|
|
} else {
|
|
|
- var list = sunriseTime.split(':')
|
|
|
|
|
- var hour = parseInt(list[0])
|
|
|
|
|
- var min = parseInt(list[1])
|
|
|
|
|
- var second = list.length == 3 ? parseInt(list[2]) : 0
|
|
|
|
|
- now.setHours(hour)
|
|
|
|
|
- now.setMinutes(min)
|
|
|
|
|
- now.setSeconds(second)
|
|
|
|
|
|
|
|
|
|
- var sunsetDate = new Date()
|
|
|
|
|
- var list2 = sunsetTime.split(':')
|
|
|
|
|
- var hour2 = parseInt(list2[0])
|
|
|
|
|
- var min2 = parseInt(list2[1])
|
|
|
|
|
- var second2 = list2.length == 3 ? parseInt(list2[2]) : 0
|
|
|
|
|
- sunsetDate.setHours(hour2)
|
|
|
|
|
- sunsetDate.setMinutes(min2)
|
|
|
|
|
- sunsetDate.setSeconds(second2)
|
|
|
|
|
- if (new Date().getTime() < sunsetDate.getTime()) {
|
|
|
|
|
- return TimeFormatter.countdown(now.getTime())
|
|
|
|
|
|
|
+ if (now.getTime() < sunsetDate.getTime()) {
|
|
|
|
|
+ return TimeFormatter.countdown(sunriseDate.getTime())
|
|
|
}
|
|
}
|
|
|
|
|
+ return TimeFormatter.countdown(sunriseTmrDate.getTime())
|
|
|
|
|
|
|
|
- var sunriseTDate = new Date()
|
|
|
|
|
- var list3 = sunriseTmrTime.split(':')
|
|
|
|
|
- var hour3 = parseInt(list3[0])
|
|
|
|
|
- var min3 = parseInt(list3[1])
|
|
|
|
|
- var second3 = list3.length == 3 ? parseInt(list3[2]) : 0
|
|
|
|
|
- sunriseTDate.setHours(hour3)
|
|
|
|
|
- sunriseTDate.setMinutes(min3)
|
|
|
|
|
- sunriseTDate.setSeconds(second3)
|
|
|
|
|
- return TimeFormatter.countdown(sunriseTDate.getTime() + 24 * 3600 * 1000)
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -388,86 +388,27 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
function timeCount2() {
|
|
function timeCount2() {
|
|
|
var now = new Date()
|
|
var now = new Date()
|
|
|
if (props.isNight) {
|
|
if (props.isNight) {
|
|
|
- var list = sunriseTmrTime.split(':')
|
|
|
|
|
- var hour = parseInt(list[0])
|
|
|
|
|
- var min = parseInt(list[1])
|
|
|
|
|
- var second = list.length == 3 ? parseInt(list[2]) : 0
|
|
|
|
|
- now.setHours(hour)
|
|
|
|
|
- now.setMinutes(min)
|
|
|
|
|
- now.setSeconds(second)
|
|
|
|
|
|
|
|
|
|
- var sunsetDate = new Date()
|
|
|
|
|
- var list2 = sunsetTime.split(':')
|
|
|
|
|
- var hour2 = parseInt(list2[0])
|
|
|
|
|
- var min2 = parseInt(list2[1])
|
|
|
|
|
- var second2 = list2.length == 3 ? parseInt(list2[2]) : 0
|
|
|
|
|
- sunsetDate.setHours(hour2)
|
|
|
|
|
- sunsetDate.setMinutes(min2)
|
|
|
|
|
- sunsetDate.setSeconds(second2)
|
|
|
|
|
- if (new Date().getTime() < sunsetDate.getTime()) {
|
|
|
|
|
- return TimeFormatter.countdown(now.getTime())
|
|
|
|
|
|
|
+ if (now.getTime() < sunsetDate.getTime()) {
|
|
|
|
|
+ return TimeFormatter.countdown(sunriseTmrDate.getTime())
|
|
|
}
|
|
}
|
|
|
|
|
+ return TimeFormatter.countdown(sunriseTmrDate.getTime())
|
|
|
|
|
|
|
|
- return TimeFormatter.countdown(now.getTime() + 24 * 3600 * 1000)
|
|
|
|
|
} else {
|
|
} else {
|
|
|
- var list = sunsetTime.split(':')
|
|
|
|
|
- var hour = parseInt(list[0])
|
|
|
|
|
- var min = parseInt(list[1])
|
|
|
|
|
- var second = list.length == 3 ? parseInt(list[2]) : 0
|
|
|
|
|
- now.setHours(hour)
|
|
|
|
|
- now.setMinutes(min)
|
|
|
|
|
- now.setSeconds(second)
|
|
|
|
|
- return TimeFormatter.countdown(now.getTime())
|
|
|
|
|
|
|
+ return TimeFormatter.countdown(sunsetDate.getTime())
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function showExtraData() {
|
|
function showExtraData() {
|
|
|
var now = new Date()
|
|
var now = new Date()
|
|
|
if (props.isNight) {
|
|
if (props.isNight) {
|
|
|
- var list = sunsetTime.split(':')
|
|
|
|
|
- var hour = parseInt(list[0])
|
|
|
|
|
- var min = parseInt(list[1])
|
|
|
|
|
- var second = list.length == 3 ? parseInt(list[2]) : 0
|
|
|
|
|
- now.setHours(hour)
|
|
|
|
|
- now.setMinutes(min)
|
|
|
|
|
- now.setSeconds(second)
|
|
|
|
|
-
|
|
|
|
|
- var sunriseDate = new Date()
|
|
|
|
|
- var list2 = sunriseTmrTime.split(':')
|
|
|
|
|
- var hour2 = parseInt(list2[0])
|
|
|
|
|
- var min2 = parseInt(list2[1])
|
|
|
|
|
- var second2 = list2.length == 3 ? parseInt(list2[2]) : 0
|
|
|
|
|
- sunriseDate.setHours(hour2)
|
|
|
|
|
- sunriseDate.setMinutes(min2)
|
|
|
|
|
- sunriseDate.setSeconds(second2)
|
|
|
|
|
- if (sunriseDate.getTime() > new Date().getTime()) {
|
|
|
|
|
- return true
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (now.getTime() > new Date().getTime()) {
|
|
|
|
|
|
|
+ if (sunsetDate.getTime() > now.getTime()) {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
- var list = sunriseTime.split(':')
|
|
|
|
|
- var hour = parseInt(list[0])
|
|
|
|
|
- var min = parseInt(list[1])
|
|
|
|
|
- var second = list.length == 3 ? parseInt(list[2]) : 0
|
|
|
|
|
- now.setHours(hour)
|
|
|
|
|
- now.setMinutes(min)
|
|
|
|
|
- now.setSeconds(second)
|
|
|
|
|
-
|
|
|
|
|
- var sunsetDate = new Date()
|
|
|
|
|
- var list2 = sunsetTime.split(':')
|
|
|
|
|
- var hour2 = parseInt(list2[0])
|
|
|
|
|
- var min2 = parseInt(list2[1])
|
|
|
|
|
- var second2 = list2.length == 3 ? parseInt(list2[2]) : 0
|
|
|
|
|
- sunsetDate.setHours(hour2)
|
|
|
|
|
- sunsetDate.setMinutes(min2)
|
|
|
|
|
- sunsetDate.setSeconds(second2)
|
|
|
|
|
-
|
|
|
|
|
- if (now.getTime() < new Date().getTime() && new Date().getTime() < sunsetDate.getTime()) {
|
|
|
|
|
- return true
|
|
|
|
|
|
|
+ if (sunriseDate.getTime() < now.getTime() && now.getTime() < sunsetDate.getTime()) {
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
@@ -542,13 +483,12 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
success: function (res) {
|
|
success: function (res) {
|
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
|
clearLocation().then(res => {
|
|
clearLocation().then(res => {
|
|
|
- locationDetail = null
|
|
|
|
|
- Taro.removeStorage({ key: 'gps' })
|
|
|
|
|
- setAuthInfo(null)
|
|
|
|
|
- setSunriseTime('06:00')
|
|
|
|
|
- setSunriseTmrTime('06:00')
|
|
|
|
|
- setSunsetTime('18:00')
|
|
|
|
|
- dispatch(updateMember({ isMember: user.test_user, gpsInfo: null }))
|
|
|
|
|
|
|
+ if (global.clearNightLocation) {
|
|
|
|
|
+ global.clearNightLocation()
|
|
|
|
|
+ }
|
|
|
|
|
+ if (global.clearDayLocation) {
|
|
|
|
|
+ global.clearDayLocation()
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
} else if (res.cancel) {
|
|
} else if (res.cancel) {
|
|
|
console.log('用户点击取消')
|
|
console.log('用户点击取消')
|
|
@@ -557,12 +497,38 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ function clearCacheData() {
|
|
|
|
|
+ locationDetail = null
|
|
|
|
|
+ Taro.removeStorage({ key: 'gps' })
|
|
|
|
|
+ setAuthInfo(null)
|
|
|
|
|
+ setSunriseTime('06:00')
|
|
|
|
|
+ setSunriseTmrTime('06:00')
|
|
|
|
|
+ setSunsetTime('18:00')
|
|
|
|
|
+ dispatch(updateMember({ isMember: user.test_user, gpsInfo: null }))
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ dispatch(setDayRingData({
|
|
|
|
|
+ date: new Date().getTime(),
|
|
|
|
|
+ sunrise: '06:00',
|
|
|
|
|
+ sunset: '18:00'
|
|
|
|
|
+ }))
|
|
|
|
|
+ dispatch(setNightRingData({
|
|
|
|
|
+ date: new Date().getTime(),
|
|
|
|
|
+ sunrise: '06:00',
|
|
|
|
|
+ sunset: '18:00'
|
|
|
|
|
+ }))
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function detailModalContent() {
|
|
function detailModalContent() {
|
|
|
var split = new Date().toString().split(' ');
|
|
var split = new Date().toString().split(' ');
|
|
|
var timezone = split[split.length - 2];
|
|
var timezone = split[split.length - 2];
|
|
|
- if (!authInfo) {
|
|
|
|
|
|
|
+ if (!authInfo || !(authInfo as any).lat) {
|
|
|
return <View style={{ height: 100, display: 'flex', alignItems: 'center', justifyContent: 'center', width: rpxToPx(750) }}>
|
|
return <View style={{ height: 100, display: 'flex', alignItems: 'center', justifyContent: 'center', width: rpxToPx(750) }}>
|
|
|
- <Text>暂时位置信息</Text>
|
|
|
|
|
|
|
+ <Text>暂无位置信息</Text>
|
|
|
</View>
|
|
</View>
|
|
|
}
|
|
}
|
|
|
return <View>
|
|
return <View>
|
|
@@ -647,6 +613,12 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function nightDurationDesc() {
|
|
function nightDurationDesc() {
|
|
|
|
|
+ if (!authInfo || !(authInfo as any).lat) {
|
|
|
|
|
+ if (new Date().getHours() >= 6) {
|
|
|
|
|
+ return `Today ${sunsetTime} - Tomorrow ${sunriseTmrTime}`
|
|
|
|
|
+ }
|
|
|
|
|
+ return `Yesterday ${sunsetTime} - Today ${sunriseTmrTime}`
|
|
|
|
|
+ }
|
|
|
if (nightDate.getDate() == new Date().getDate()) {
|
|
if (nightDate.getDate() == new Date().getDate()) {
|
|
|
return `Today ${sunsetTime} - Tomorrow ${sunriseTmrTime}`
|
|
return `Today ${sunsetTime} - Tomorrow ${sunriseTmrTime}`
|
|
|
}
|
|
}
|
|
@@ -654,10 +626,16 @@ export default function DayNightCard(props: { isNight: boolean, switchChanged: F
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function dayDurationDesc() {
|
|
function dayDurationDesc() {
|
|
|
|
|
+ if (!authInfo || !(authInfo as any).lat) {
|
|
|
|
|
+ if (new Date().getHours() >= 18) {
|
|
|
|
|
+ return `Tomorrow ${sunriseTime} - ${sunsetTime}`
|
|
|
|
|
+ }
|
|
|
|
|
+ return `Today ${sunriseTime} - ${sunsetTime}`
|
|
|
|
|
+ }
|
|
|
if (dayDate.getDate() == new Date().getDate()) {
|
|
if (dayDate.getDate() == new Date().getDate()) {
|
|
|
- return `${sunriseTime} - ${sunsetTime}`
|
|
|
|
|
|
|
+ return `Today ${sunriseTime} - ${sunsetTime}`
|
|
|
}
|
|
}
|
|
|
- return `Tomorrow ${sunriseTime} - Tomorrow ${sunsetTime}`
|
|
|
|
|
|
|
+ return `Tomorrow ${sunriseTime} - ${sunsetTime}`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|