mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-06 16:16:42 +08:00
Limit mobile calendar history and simplify episode tags
This commit is contained in:
@@ -92,15 +92,15 @@ export function formatSeasonEpisode(
|
|||||||
if (currentNumber === end + 1) {
|
if (currentNumber === end + 1) {
|
||||||
end = currentNumber
|
end = currentNumber
|
||||||
} else {
|
} else {
|
||||||
ranges.push(start === end ? `${seasonText}${formatEpisode(start)}` : `${seasonText}${formatEpisode(start)}-${formatEpisode(end)}`)
|
ranges.push(start === end ? formatEpisode(start) : `${formatEpisode(start)}-${formatEpisode(end)}`)
|
||||||
start = currentNumber
|
start = currentNumber
|
||||||
end = currentNumber
|
end = currentNumber
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ranges.push(start === end ? `${seasonText}${formatEpisode(start)}` : `${seasonText}${formatEpisode(start)}-${formatEpisode(end)}`)
|
ranges.push(start === end ? formatEpisode(start) : `${formatEpisode(start)}-${formatEpisode(end)}`)
|
||||||
|
|
||||||
return ranges.join('、')
|
return `${seasonText}${ranges.join('、')}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化为xx[TGMK]B
|
// 格式化为xx[TGMK]B
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const COLLAPSED_VISIBLE_CARD_LIMIT = COLLAPSED_DAY_CARD_LIMIT
|
|||||||
const DAY_GROUP_EVENT_PREFIX = 'calendar-day-group-'
|
const DAY_GROUP_EVENT_PREFIX = 'calendar-day-group-'
|
||||||
const ALL_MOBILE_FILTER_VALUE = '__all__'
|
const ALL_MOBILE_FILTER_VALUE = '__all__'
|
||||||
const DAY_TIME = 24 * 60 * 60 * 1000
|
const DAY_TIME = 24 * 60 * 60 * 1000
|
||||||
|
const MOBILE_HISTORY_DAY_LIMIT = 30
|
||||||
|
|
||||||
// 国际化
|
// 国际化
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@@ -181,6 +182,10 @@ const mobileFilteredCalendarEvents = computed(() => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDateBeforeMobileHistoryWindow(event.start)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if (mobileHideExpired.value && isDateBeforeToday(event.start)) {
|
if (mobileHideExpired.value && isDateBeforeToday(event.start)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -471,6 +476,13 @@ function isDateBeforeToday(date: Date | null) {
|
|||||||
return date.getTime() < getTodayStart().getTime()
|
return date.getTime() < getTodayStart().getTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断日期是否早于移动端允许展示的历史窗口。
|
||||||
|
function isDateBeforeMobileHistoryWindow(date: Date | null) {
|
||||||
|
if (!date) return false
|
||||||
|
|
||||||
|
return date.getTime() < getTodayStart().getTime() - MOBILE_HISTORY_DAY_LIMIT * DAY_TIME
|
||||||
|
}
|
||||||
|
|
||||||
// 判断日期是否是今天。
|
// 判断日期是否是今天。
|
||||||
function isDateToday(date: Date | null) {
|
function isDateToday(date: Date | null) {
|
||||||
if (!date) return false
|
if (!date) return false
|
||||||
@@ -531,6 +543,13 @@ function getMobileEventEpisodeTag(event: CalendarEventInfo) {
|
|||||||
return formatSeasonEpisode(event.season, event.episodeNumbers)
|
return formatSeasonEpisode(event.season, event.episodeNumbers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取移动端海报角标集号。
|
||||||
|
function getMobilePosterEpisodeTag(event: CalendarEventInfo) {
|
||||||
|
if (event.mediaType === '电影' || !event.episodeNumbers.length) return ''
|
||||||
|
|
||||||
|
return formatSeasonEpisode(undefined, event.episodeNumbers)
|
||||||
|
}
|
||||||
|
|
||||||
// 获取移动端时长标识。
|
// 获取移动端时长标识。
|
||||||
function getMobileEventRuntimeTag(event: CalendarEventInfo) {
|
function getMobileEventRuntimeTag(event: CalendarEventInfo) {
|
||||||
if (!event.runtime) return ''
|
if (!event.runtime) return ''
|
||||||
@@ -826,8 +845,8 @@ onActivated(() => {
|
|||||||
</template>
|
</template>
|
||||||
</VImg>
|
</VImg>
|
||||||
|
|
||||||
<span v-if="getMobileEventEpisodeTag(calendarEvent)" class="mobile-calendar-poster-episode">
|
<span v-if="getMobilePosterEpisodeTag(calendarEvent)" class="mobile-calendar-poster-episode">
|
||||||
{{ getMobileEventEpisodeTag(calendarEvent) }}
|
{{ getMobilePosterEpisodeTag(calendarEvent) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user