fix person cards

This commit is contained in:
jxxghp
2024-04-27 08:44:39 +08:00
parent 9745c2ea1a
commit 58ab1599db
3 changed files with 45 additions and 30 deletions
+26 -2
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import api from '@/api'
import MediaCardListView from '@/views/discover/MediaCardListView.vue'
import PersonCardListView from '@/views/discover/PersonCardListView.vue'
@@ -16,14 +17,37 @@ let title = route.query?.title?.toString()
// 类型
const type = route.query?.type?.toString()
if (type === 'person') title = '演员:' + title
// 识别类型
const RecognizeType = ref('themoviedb')
// 计算人物类型
const PersonType = computed(() => {
if (RecognizeType.value === 'douban') return 'douban'
else if (RecognizeType.value === 'bangumi') return 'bangumi'
else return 'tmdb'
})
// 计算API路径
function getApiPath(paths: string[] | string) {
if (Array.isArray(paths)) return paths.join('/')
else return paths
}
// 加载系统设计
async function loadSystemSettings() {
try {
const result: { [key: string]: any } = await api.get('system/env')
if (result.success) RecognizeType.value = result.data?.RECOGNIZE_SOURCE
} catch (error) {
console.error(error)
}
}
onMounted(async () => {
if (type === 'person') await loadSystemSettings()
})
</script>
<template>
@@ -41,7 +65,7 @@ function getApiPath(paths: string[] | string) {
<PersonCardListView
v-if="type === 'person'"
:apipath="getApiPath(props.paths || '')"
type="tmdb"
:type="PersonType"
:params="route.query"
/>
<MediaCardListView v-else :apipath="getApiPath(props.paths || '')" :params="route.query" />