mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-08 01:06:41 +08:00
重构 credits.vue 和 media.vue 组件,简化 API 路径处理,移除不必要的路由参数,同时优化 PersonCardListView 组件的样式。
This commit is contained in:
+16
-12
@@ -1,24 +1,28 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import PersonCardListView from '@/views/discover/PersonCardListView.vue'
|
import PersonCardListView from '@/views/discover/PersonCardListView.vue'
|
||||||
|
|
||||||
|
// 输入参数
|
||||||
|
const props = defineProps({
|
||||||
|
// API路径
|
||||||
|
paths: Array as PropType<string[]> | PropType<string>,
|
||||||
|
})
|
||||||
|
|
||||||
// 路由参数
|
// 路由参数
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const id = route.query?.id?.toString()
|
|
||||||
const title = route.query?.title?.toString()
|
// 标题
|
||||||
const source = route.query?.source?.toString()
|
let title = route.query?.title?.toString()
|
||||||
const type = route.query?.type?.toString()
|
|
||||||
const apipath = route.query?.apipath?.toString()
|
// 计算API路径
|
||||||
|
function getApiPath(paths: string[] | string) {
|
||||||
|
if (Array.isArray(paths)) return paths.join('/')
|
||||||
|
else return paths
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<VPageContentTitle :title="title" />
|
<VPageContentTitle :title="title" />
|
||||||
<PersonCardListView
|
<PersonCardListView :apipath="getApiPath(props.paths || '')" />
|
||||||
:credits-id="id"
|
|
||||||
:credits-name="title"
|
|
||||||
:credits-source="source"
|
|
||||||
:credits-type="type"
|
|
||||||
:credits-apipath="apipath"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+1
-7
@@ -14,12 +14,6 @@ const mediaid = route.query?.mediaid?.toString()
|
|||||||
// 类型:电影、电视剧
|
// 类型:电影、电视剧
|
||||||
const type = route.query?.type?.toString()
|
const type = route.query?.type?.toString()
|
||||||
|
|
||||||
// 媒体信息来源:TMDB、豆瓣
|
|
||||||
const source = route.query?.source?.toString() || 'themoviedb'
|
|
||||||
|
|
||||||
// TMDB ID
|
|
||||||
const page = route.query?.page?.toString() || '1'
|
|
||||||
|
|
||||||
// 标题
|
// 标题
|
||||||
const title = route.query?.title?.toString()
|
const title = route.query?.title?.toString()
|
||||||
|
|
||||||
@@ -29,6 +23,6 @@ const year = route.query?.year?.toString()
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<MediaDetailView :mediaid="mediaid" :type="type" :source="source" :page="page" :title="title" :year="year" />
|
<MediaDetailView :mediaid="mediaid" :type="type" :title="title" :year="year" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ async function fetchData({ done }: { done: any }) {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<LoadingBanner v-if="!isRefreshed" class="mt-12" />
|
<LoadingBanner v-if="!isRefreshed" class="mt-12" />
|
||||||
<VInfiniteScroll mode="intersect" side="end" :items="dataList" class="overflow-visible" @load="fetchData">
|
<VInfiniteScroll mode="intersect" side="end" :items="dataList" class="overflow-visible px-3" @load="fetchData">
|
||||||
<template #loading />
|
<template #loading />
|
||||||
<template #empty />
|
<template #empty />
|
||||||
<div v-if="dataList.length > 0" class="grid gap-4 grid-media-card" tabindex="0">
|
<div v-if="dataList.length > 0" class="grid gap-4 grid-media-card" tabindex="0">
|
||||||
|
|||||||
Reference in New Issue
Block a user