fix fullcalcndar

This commit is contained in:
jxxghp
2023-07-12 21:17:24 +08:00
parent 538321338b
commit f2fe3c2f74

View File

@@ -9,6 +9,7 @@ import FullCalendar from "@fullcalendar/vue3";
// 日历属性 // 日历属性
const calendarOptions = ref({ const calendarOptions = ref({
height: "auto",
locale: "zh-cn", locale: "zh-cn",
themeSystem: "standard", themeSystem: "standard",
buttonText: { buttonText: {
@@ -26,9 +27,9 @@ const calendarOptions = ref({
initialView: "dayGridMonth", initialView: "dayGridMonth",
weekends: false, weekends: false,
headerToolbar: { headerToolbar: {
left: "prev,next", left: "prev",
center: "title", center: "title",
right: "", right: "next",
}, },
views: { views: {
week: { week: {
@@ -55,6 +56,7 @@ const getSubscribes = async () => {
start: parseDate(movie.release_date || ""), start: parseDate(movie.release_date || ""),
allDay: false, allDay: false,
posterPath: subscribe.poster, posterPath: subscribe.poster,
mediaType: subscribe.type,
}; };
} else { } else {
// 调用API查询集信息 // 调用API查询集信息
@@ -67,6 +69,7 @@ const getSubscribes = async () => {
start: parseDate(episode.air_date || ""), start: parseDate(episode.air_date || ""),
allDay: false, allDay: false,
posterPath: subscribe.poster, posterPath: subscribe.poster,
mediaType: subscribe.type,
}; };
}); });
} }
@@ -78,6 +81,17 @@ const getSubscribes = async () => {
} }
}; };
// 根据 type 返回不同的图标
const getIcon = (type: string) => {
if (type === "电影") {
return "mdi-movie-roll";
} else if (type === "电视剧") {
return "mdi-television-box";
} else {
return "mdi-help-circle";
}
};
// 页面加载时调用API查询所有订阅 // 页面加载时调用API查询所有订阅
onMounted(() => { onMounted(() => {
getSubscribes(); getSubscribes();
@@ -85,12 +99,13 @@ onMounted(() => {
</script> </script>
<template> <template>
<FullCalendar :options="calendarOptions" class="w-full h-full"> <FullCalendar :options="calendarOptions">
<template #eventContent="arg"> <template #eventContent="arg">
<div class="hidden md:block"> <div class="hidden md:block overflow-hidden">
<VTooltip :text="arg.event.title"> <VTooltip :text="arg.event.title">
<template #activator="{ props }"> <template #activator="{ props }">
<VChip v-bind="props"> <VChip v-bind="props" label>
<v-icon start :icon="getIcon(arg.event.extendedProps.mediaType)"></v-icon>
{{ arg.event.title }} {{ arg.event.title }}
</VChip> </VChip>
</template> </template>
@@ -100,6 +115,7 @@ onMounted(() => {
<VTooltip :text="arg.event.title"> <VTooltip :text="arg.event.title">
<template #activator="{ props }"> <template #activator="{ props }">
<VImg <VImg
height="80"
:src="arg.event.extendedProps.posterPath" :src="arg.event.extendedProps.posterPath"
v-bind="props" v-bind="props"
aspect-ratio="2/3" aspect-ratio="2/3"
@@ -400,4 +416,25 @@ onMounted(() => {
.v-application .fc-v-event { .v-application .fc-v-event {
background-color: transparent; background-color: transparent;
} }
.v-application .fc .fc-button-primary {
background-color: transparent;
border: none;
outline: none;
color: var(--v-theme-on-surface);
}
.v-application .fc .fc-button-primary:hover {
background-color: transparent;
color: rgb(var(--v-theme-primary));
}
@media (max-width: 776px) {
.fc-daygrid-event-harness {
display: flex;
align-items: center;
justify-content: center;
}
}
</style> </style>