|
|
@@ -227,7 +227,7 @@ export default {
|
|
|
}
|
|
|
return b.priority - a.priority
|
|
|
})
|
|
|
- this.checkComplexTimeline()
|
|
|
+ this.checkTimeline()
|
|
|
} else {
|
|
|
clearTimeout(this.$timer)
|
|
|
this.timeline = null
|
|
|
@@ -244,18 +244,21 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- checkComplexTimeline () {
|
|
|
+ checkTimeline (current) {
|
|
|
this.loadingTimeline = false
|
|
|
const now = new Date()
|
|
|
- let current = null
|
|
|
let currentEndDate = null
|
|
|
let next = null
|
|
|
- for (let i = 0; i < this.timeline.length; i++) {
|
|
|
- const event = this.timeline[i]
|
|
|
- if (!current && isHit(event, now)) {
|
|
|
- current = event
|
|
|
- currentEndDate = getFinishDate(current, now)
|
|
|
- break
|
|
|
+ if (current) {
|
|
|
+ currentEndDate = getFinishDate(current, now)
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < this.timeline.length; i++) {
|
|
|
+ const event = this.timeline[i]
|
|
|
+ if (!current && isHit(event, now)) {
|
|
|
+ current = event
|
|
|
+ currentEndDate = getFinishDate(current, now)
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
console.log('currentEndDate', currentEndDate)
|
|
|
@@ -276,9 +279,8 @@ export default {
|
|
|
clearTimeout(this.$timer)
|
|
|
if (currentEndDate) {
|
|
|
this.$timer = setTimeout(() => {
|
|
|
- this.next = null
|
|
|
- this.checkComplexTimeline()
|
|
|
- }, currentEndDate - now)
|
|
|
+ this.checkTimeline(this.next)
|
|
|
+ }, Math.min(604800000, currentEndDate - now))
|
|
|
}
|
|
|
this.current = current && this.getEventInfo(current, getStartDate(current, now), nextStartDate > currentEndDate ? currentEndDate : nextStartDate)
|
|
|
this.next = next && this.getEventInfo(next, nextStartDate)
|