mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-07-31 02:38:26 +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) {
|
||||
end = currentNumber
|
||||
} 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
|
||||
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
|
||||
|
||||
@@ -20,6 +20,7 @@ const COLLAPSED_VISIBLE_CARD_LIMIT = COLLAPSED_DAY_CARD_LIMIT
|
||||
const DAY_GROUP_EVENT_PREFIX = 'calendar-day-group-'
|
||||
const ALL_MOBILE_FILTER_VALUE = '__all__'
|
||||
const DAY_TIME = 24 * 60 * 60 * 1000
|
||||
const MOBILE_HISTORY_DAY_LIMIT = 30
|
||||
|
||||
// 国际化
|
||||
const { t } = useI18n()
|
||||
@@ -181,6 +182,10 @@ const mobileFilteredCalendarEvents = computed(() => {
|
||||
return false
|
||||
}
|
||||
|
||||
if (isDateBeforeMobileHistoryWindow(event.start)) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (mobileHideExpired.value && isDateBeforeToday(event.start)) {
|
||||
return false
|
||||
}
|
||||
@@ -471,6 +476,13 @@ function isDateBeforeToday(date: Date | null) {
|
||||
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) {
|
||||
if (!date) return false
|
||||
@@ -531,6 +543,13 @@ function getMobileEventEpisodeTag(event: CalendarEventInfo) {
|
||||
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) {
|
||||
if (!event.runtime) return ''
|
||||
@@ -826,8 +845,8 @@ onActivated(() => {
|
||||
</template>
|
||||
</VImg>
|
||||
|
||||
<span v-if="getMobileEventEpisodeTag(calendarEvent)" class="mobile-calendar-poster-episode">
|
||||
{{ getMobileEventEpisodeTag(calendarEvent) }}
|
||||
<span v-if="getMobilePosterEpisodeTag(calendarEvent)" class="mobile-calendar-poster-episode">
|
||||
{{ getMobilePosterEpisodeTag(calendarEvent) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user