mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-28 03:39:46 +08:00
feat:在媒体相关组件中添加媒体ID、标题和年份的支持
This commit is contained in:
@@ -14,6 +14,10 @@ export interface Subscribe {
|
||||
tmdbid: number
|
||||
// 豆瓣ID
|
||||
doubanid?: string
|
||||
// Bangumi ID
|
||||
bangumiid?: string
|
||||
// 其它媒体ID
|
||||
mediaid?: string
|
||||
// 季号
|
||||
season?: number
|
||||
// 海报
|
||||
|
||||
@@ -363,6 +363,8 @@ function goMediaDetail(isHovering = false) {
|
||||
path: '/media',
|
||||
query: {
|
||||
mediaid: getMediaId(),
|
||||
title: props.media?.title,
|
||||
year: props.media?.year,
|
||||
type: props.media?.type,
|
||||
},
|
||||
})
|
||||
@@ -378,6 +380,8 @@ function handleSearch() {
|
||||
keyword: getMediaId(),
|
||||
type: props.media?.type,
|
||||
area: 'title',
|
||||
title: props.media?.title,
|
||||
year: props.media?.year,
|
||||
season: props.media?.season,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -142,12 +142,22 @@ async function editSubscribeDialog() {
|
||||
subscribeEditDialog.value = true
|
||||
}
|
||||
|
||||
// 获得mediaid
|
||||
function getMediaId() {
|
||||
if (props.media?.tmdbid) return `tmdb:${props.media?.tmdbid}`
|
||||
else if (props.media?.doubanid) return `douban:${props.media?.doubanid}`
|
||||
else if (props.media?.bangumiid) return `bangumi:${props.media?.bangumiid}`
|
||||
else return props.media?.mediaid
|
||||
}
|
||||
|
||||
// 查看媒体详情
|
||||
async function viewMediaDetail() {
|
||||
router.push({
|
||||
path: '/media',
|
||||
query: {
|
||||
mediaid: `${props.media?.tmdbid ? `tmdb:${props.media?.tmdbid}` : `douban:${props.media?.doubanid}`}`,
|
||||
mediaid: getMediaId(),
|
||||
title: props.media?.name,
|
||||
year: props.media?.year,
|
||||
type: props.media?.type,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -54,12 +54,20 @@ const posterUrl = computed(() => {
|
||||
return url
|
||||
})
|
||||
|
||||
// 获得mediaid
|
||||
function getMediaId() {
|
||||
if (props.media?.tmdbid) return `tmdb:${props.media?.tmdbid}`
|
||||
else if (props.media?.doubanid) return `douban:${props.media?.doubanid}`
|
||||
}
|
||||
|
||||
// 查看媒体详情
|
||||
async function viewMediaDetail() {
|
||||
router.push({
|
||||
path: '/media',
|
||||
query: {
|
||||
mediaid: `${props.media?.tmdbid ? `tmdb:${props.media?.tmdbid}` : `douban:${props.media?.doubanid}`}`,
|
||||
mediaid: getMediaId(),
|
||||
title: props.media?.name,
|
||||
year: props.media?.year,
|
||||
type: props.media?.type,
|
||||
},
|
||||
})
|
||||
@@ -73,18 +81,16 @@ function showForkSubscribe() {
|
||||
// 完成复用订阅
|
||||
function finishForkSubscribe(subid: number) {
|
||||
subscribeId.value = subid
|
||||
forkSubscribeDialog.value=false
|
||||
forkSubscribeDialog.value = false
|
||||
subscribeEditDialog.value = true
|
||||
}
|
||||
|
||||
// 删除订阅分享时处理
|
||||
function doDelete() {
|
||||
forkSubscribeDialog.value=false
|
||||
forkSubscribeDialog.value = false
|
||||
// 通知父组件刷新
|
||||
emit('delete')
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -87,12 +87,20 @@ const posterUrl = computed(() => {
|
||||
return url
|
||||
})
|
||||
|
||||
// 获得mediaid
|
||||
function getMediaId() {
|
||||
if (props.media?.tmdbid) return `tmdb:${props.media?.tmdbid}`
|
||||
else if (props.media?.doubanid) return `douban:${props.media?.doubanid}`
|
||||
}
|
||||
|
||||
// 查看媒体详情
|
||||
async function viewMediaDetail() {
|
||||
router.push({
|
||||
path: '/media',
|
||||
query: {
|
||||
mediaid: `${props.media?.tmdbid ? `tmdb:${props.media?.tmdbid}` : `douban:${props.media?.doubanid}`}`,
|
||||
mediaid: getMediaId(),
|
||||
title: props.media?.name,
|
||||
year: props.media?.year,
|
||||
type: props.media?.type,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -9,13 +9,16 @@ const mediaid = route.query?.mediaid?.toString()
|
||||
|
||||
// 类型
|
||||
const type = route.query?.type?.toString()
|
||||
|
||||
// 标题
|
||||
const title = route.query?.title?.toString()
|
||||
|
||||
// 年份
|
||||
const year = route.query?.year?.toString()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<MediaDetailView
|
||||
:mediaid="mediaid"
|
||||
:type="type"
|
||||
/>
|
||||
<MediaDetailView :mediaid="mediaid" :type="type" :title="title" :year="year" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -22,6 +22,12 @@ const type = route.query?.type?.toString() ?? ''
|
||||
// 搜索字段
|
||||
const area = route.query?.area?.toString() ?? ''
|
||||
|
||||
// 搜索标题
|
||||
const title = route.query?.title?.toString() ?? ''
|
||||
|
||||
// 搜索年份
|
||||
const year = route.query?.year
|
||||
|
||||
// 搜索季
|
||||
const season = route.query?.season?.toString() ?? ''
|
||||
|
||||
@@ -82,12 +88,14 @@ async function fetchData() {
|
||||
} else {
|
||||
startLoadingProgress()
|
||||
let result: { [key: string]: any }
|
||||
// 优先按TMDBID精确查询
|
||||
if (keyword?.startsWith('tmdb:') || keyword?.startsWith('douban:') || keyword?.startsWith('bangumi:')) {
|
||||
// 如果keyword的格式是 xxxx:xxxxx 且:前面的xxxx为字符,则按照媒体ID格式搜索
|
||||
if (/^[a-zA-Z]+:/.test(keyword)) {
|
||||
result = await api.get(`search/media/${keyword}`, {
|
||||
params: {
|
||||
mtype: type,
|
||||
area,
|
||||
title,
|
||||
year,
|
||||
season,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -14,6 +14,8 @@ import { isNullOrEmptyObject } from '@/@core/utils'
|
||||
// 输入参数
|
||||
const mediaProps = defineProps({
|
||||
mediaid: String,
|
||||
title: String,
|
||||
year: String,
|
||||
type: String,
|
||||
})
|
||||
|
||||
@@ -68,6 +70,8 @@ async function getMediaDetail() {
|
||||
if (mediaProps.mediaid && mediaProps.type) {
|
||||
mediaDetail.value = await api.get(`media/${mediaProps.mediaid}`, {
|
||||
params: {
|
||||
title: mediaProps.title,
|
||||
year: mediaProps.year,
|
||||
type_name: mediaProps.type,
|
||||
},
|
||||
})
|
||||
@@ -402,6 +406,8 @@ function handleSearch(area: string) {
|
||||
keyword,
|
||||
type: mediaDetail.value.type,
|
||||
area,
|
||||
title: mediaDetail.value.title,
|
||||
year: mediaDetail.value.year,
|
||||
season: mediaDetail.value.season,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user