mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-08 01:06:41 +08:00
fix calendar
This commit is contained in:
@@ -5,7 +5,7 @@ import interactionPlugin from '@fullcalendar/interaction'
|
||||
import timeGridPlugin from '@fullcalendar/timegrid'
|
||||
import FullCalendar from '@fullcalendar/vue3'
|
||||
import type { Ref } from 'vue'
|
||||
import type { MediaInfo, Subscribe, TmdbEpisode } from '@/api/types'
|
||||
import type { MediaInfo, Rss, Subscribe, TmdbEpisode } from '@/api/types'
|
||||
import api from '@/api'
|
||||
import { parseDate } from '@/@core/utils/formatters'
|
||||
|
||||
@@ -33,13 +33,7 @@ const calendarOptions: Ref<CalendarOptions> = ref({
|
||||
events: [],
|
||||
})
|
||||
|
||||
// 调用API查询所有订阅
|
||||
async function getSubscribes() {
|
||||
try {
|
||||
const subscribes: Subscribe[] = await api.get('subscribe')
|
||||
|
||||
const events = await Promise.all(
|
||||
subscribes.map(async (subscribe) => {
|
||||
async function eventsHander(subscribe: any) {
|
||||
// 如果是电影直接返回
|
||||
if (subscribe.type === '电影') {
|
||||
// 调用API查询TMDB详情
|
||||
@@ -73,9 +67,28 @@ async function getSubscribes() {
|
||||
}
|
||||
})
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
||||
// 调用API查询所有订阅
|
||||
async function getSubscribes() {
|
||||
try {
|
||||
// 订阅
|
||||
const subscribes: Subscribe[] = await api.get('subscribe')
|
||||
|
||||
const subEvents = await Promise.all(
|
||||
subscribes.map(async sub => eventsHander(sub)),
|
||||
)
|
||||
|
||||
// 自定义订阅
|
||||
const rsses: Rss[] = await api.get('rss')
|
||||
|
||||
const rssEvents = await Promise.all(
|
||||
rsses.map(async rss => eventsHander(rss)),
|
||||
)
|
||||
|
||||
// 合并事件
|
||||
const events = [...subEvents, ...rssEvents]
|
||||
|
||||
calendarOptions.value.events = events.flat()
|
||||
}
|
||||
catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user