fix: 订阅历史记录不请求后端

This commit is contained in:
machine
2024-10-21 22:44:15 +08:00
parent ee8b57da91
commit 7a97005524
@@ -42,6 +42,7 @@ const progressText = ref('正在重新订阅...')
// 调用API查询列表 // 调用API查询列表
async function loadHistory({ done }: { done: any }) { async function loadHistory({ done }: { done: any }) {
console.log('🚀 ~ loadHistory ~ loadHistory:', loadHistory)
// 如果正在加载中,直接返回 // 如果正在加载中,直接返回
if (loading.value) { if (loading.value) {
done('ok') done('ok')
@@ -52,6 +53,15 @@ async function loadHistory({ done }: { done: any }) {
try { try {
// 设置加载中 // 设置加载中
loading.value = true loading.value = true
const url = `subscribe/history/${props.type}`
const params = {
params: {
page: currentPage.value,
count: pageSize.value,
},
}
console.log('history url:', url)
console.log('history params:', params)
currData.value = await api.get(`subscribe/history/${props.type}`, { currData.value = await api.get(`subscribe/history/${props.type}`, {
params: { params: {
page: currentPage.value, page: currentPage.value,
@@ -145,62 +155,65 @@ const dropdownItems = ref([
} }
" "
/> />
<VList lines="two" v-if="historyList.length > 0"> <!-- <VList lines="two" v-if="historyList.length > 0"> -->
<VList lines="two">
<VInfiniteScroll mode="intersect" side="end" :items="historyList" class="overflow-hidden" @load="loadHistory"> <VInfiniteScroll mode="intersect" side="end" :items="historyList" class="overflow-hidden" @load="loadHistory">
<template #loading> <template #loading>
<LoadingBanner /> <LoadingBanner />
</template> </template>
<template #empty /> <template #empty />
<template v-for="(item, i) in historyList" :key="i"> <template v-if="historyList.length > 0">
<VListItem> <template v-for="(item, i) in historyList" :key="i">
<template #prepend> <VListItem>
<VImg <template #prepend>
height="75" <VImg
width="50" height="75"
:src="item.poster" width="50"
aspect-ratio="2/3" :src="item.poster"
class="object-cover rounded shadow ring-gray-500 me-3" aspect-ratio="2/3"
cover class="object-cover rounded shadow ring-gray-500 me-3"
> cover
<template #placeholder> >
<div class="w-full h-full"> <template #placeholder>
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" /> <div class="w-full h-full">
</div> <VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
</template> </div>
</VImg> </template>
</template> </VImg>
<VListItemTitle v-if="item.type == '电视剧'"> </template>
{{ item.name }} <span class="text-sm"> {{ item.season }} </span> <VListItemTitle v-if="item.type == '电视剧'">
</VListItemTitle> {{ item.name }} <span class="text-sm"> {{ item.season }} </span>
<VListItemTitle v-else> </VListItemTitle>
{{ item.name }} <VListItemTitle v-else>
</VListItemTitle> {{ item.name }}
<VListItemSubtitle class="mt-2">{{ formatDateDifference(item.date) }}</VListItemSubtitle> </VListItemTitle>
<VListItemSubtitle class="mt-2">{{ item.description }}</VListItemSubtitle> <VListItemSubtitle class="mt-2">{{ formatDateDifference(item.date) }}</VListItemSubtitle>
<template #append> <VListItemSubtitle class="mt-2">{{ item.description }}</VListItemSubtitle>
<div class="me-n3"> <template #append>
<IconBtn> <div class="me-n3">
<VIcon icon="mdi-dots-vertical" /> <IconBtn>
<VMenu activator="parent" close-on-content-click> <VIcon icon="mdi-dots-vertical" />
<VList> <VMenu activator="parent" close-on-content-click>
<VListItem <VList>
v-for="(menu, i) in dropdownItems" <VListItem
:key="i" v-for="(menu, i) in dropdownItems"
variant="plain" :key="i"
:base-color="menu.color" variant="plain"
@click="menu.props.click(item)" :base-color="menu.color"
> @click="menu.props.click(item)"
<template #prepend> >
<VIcon :icon="menu.props.prependIcon" /> <template #prepend>
</template> <VIcon :icon="menu.props.prependIcon" />
<VListItemTitle v-text="menu.title" /> </template>
</VListItem> <VListItemTitle v-text="menu.title" />
</VList> </VListItem>
</VMenu> </VList>
</IconBtn> </VMenu>
</div> </IconBtn>
</template> </div>
</VListItem> </template>
</VListItem>
</template>
</template> </template>
</VInfiniteScroll> </VInfiniteScroll>
</VList> </VList>