mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 15:36:49 +08:00
Merge pull request #193 from InfinityPacer/dev
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import type { MediaServerConf, MediaServerPlayItem } from '@/api/types'
|
import type { MediaServerConf, MediaServerPlayItem } from '@/api/types'
|
||||||
import PosterCard from '@/components/cards/PosterCard.vue'
|
import PosterCard from '@/components/cards/PosterCard.vue'
|
||||||
@@ -12,19 +13,23 @@ const mediaServers = ref<MediaServerConf[]>([])
|
|||||||
// 调用API查询媒体服务器设置
|
// 调用API查询媒体服务器设置
|
||||||
async function loadMediaServerSetting() {
|
async function loadMediaServerSetting() {
|
||||||
try {
|
try {
|
||||||
const result: { [key: string]: any } = await api.get('system/setting/MediaServers')
|
const response: { data: { value: MediaServerConf[] } } = await api.get('system/setting/MediaServers')
|
||||||
mediaServers.value = result.data?.value ?? []
|
mediaServers.value = response.data?.value ?? []
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log('加载媒体服务器设置失败:', error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用API查询
|
// 调用API查询最近入库
|
||||||
async function loadLatest(server: string) {
|
async function loadLatest(server: string) {
|
||||||
try {
|
try {
|
||||||
latestList.value[server] = await api.get('mediaserver/latest', { params: { server } })
|
const response: MediaServerPlayItem[] = await api.get('mediaserver/latest', { params: { server } })
|
||||||
|
// 仅在有数据时赋值
|
||||||
|
if (response && response.length > 0) {
|
||||||
|
latestList.value[server] = response
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(`加载媒体服务器 "${server}" 的最近入库失败:`, e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,20 +42,22 @@ onMounted(async () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VHover v-for="(data, name) in latestList">
|
<div>
|
||||||
<template #default="hover">
|
<VHover v-for="(data, name) in latestList" :key="name">
|
||||||
<VCard v-bind="hover.props">
|
<template #default="hover">
|
||||||
<VCardItem>
|
<VCard v-bind="hover.props">
|
||||||
<template #append>
|
<VCardItem>
|
||||||
<VIcon class="cursor-move" v-if="hover.isHovering">mdi-drag</VIcon>
|
<template #append>
|
||||||
</template>
|
<VIcon class="cursor-move" v-if="hover.isHovering">mdi-drag</VIcon>
|
||||||
<VCardTitle>最近添加 - {{ name }}</VCardTitle>
|
</template>
|
||||||
</VCardItem>
|
<VCardTitle>最近添加 - {{ name }}</VCardTitle>
|
||||||
|
</VCardItem>
|
||||||
|
|
||||||
<div class="grid gap-4 grid-media-card mx-3 mb-3" tabindex="0">
|
<div class="grid gap-4 grid-media-card mx-3 mb-3" tabindex="0">
|
||||||
<PosterCard v-for="item in data" :key="item.id" :media="item" />
|
<PosterCard v-for="item in data" :key="item.id" :media="item" />
|
||||||
</div>
|
</div>
|
||||||
</VCard>
|
</VCard>
|
||||||
</template>
|
</template>
|
||||||
</VHover>
|
</VHover>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user