Skip to content

Commit 4491e80

Browse files
committed
feat 详情页支持IMDBID搜索
1 parent 55abc47 commit 4491e80

5 files changed

Lines changed: 35 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "moviepilot",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"private": true,
55
"scripts": {
66
"dev": "vite --host",

src/components/cards/MediaCard.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ function handleSearch() {
349349
: `douban:${props.media?.douban_id}`
350350
}`,
351351
type: props.media?.type,
352+
area: 'title',
352353
},
353354
})
354355
}

src/pages/resource.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ const keyword = route.query?.keyword?.toString() ?? ''
99
1010
// 查询类型
1111
const type = route.query?.type?.toString() ?? ''
12+
13+
// 搜索字段
14+
const area = route.query?.area?.toString() ?? ''
1215
</script>
1316

1417
<template>
1518
<div>
1619
<TorrentCardListView
1720
:keyword="keyword"
1821
:type="type"
22+
:area="area"
1923
/>
2024
</div>
2125
</template>

src/views/discover/MediaDetailView.vue

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,13 @@ function joinArray(arr: string[]) {
379379
}
380380
381381
// 开始搜索
382-
function handleSearch() {
382+
function handleSearch(area: string) {
383383
router.push({
384384
path: '/resource',
385385
query: {
386386
keyword: `tmdb:${mediaDetail.value.tmdb_id}`,
387387
type: mediaDetail.value.type,
388+
area,
388389
},
389390
})
390391
}
@@ -440,11 +441,31 @@ onBeforeMount(() => {
440441
</span>
441442
</div>
442443
<div class="media-actions">
443-
<VBtn v-if="mediaDetail.tmdb_id" variant="tonal" color="info" @click="handleSearch">
444+
<VBtn v-if="mediaDetail.tmdb_id" variant="tonal" color="info">
444445
<template #prepend>
445446
<VIcon icon="mdi-magnify" />
446447
</template>
447-
搜索
448+
搜索资源
449+
<VMenu
450+
activator="parent"
451+
close-on-content-click
452+
>
453+
<VList>
454+
<VListItem
455+
variant="plain"
456+
@click="handleSearch('title')"
457+
>
458+
<VListItemTitle>标题</VListItemTitle>
459+
</VListItem>
460+
<VListItem
461+
v-show="mediaDetail.imdb_id"
462+
variant="plain"
463+
@click="handleSearch('imdbid')"
464+
>
465+
<VListItemTitle>IMDB链接</VListItemTitle>
466+
</VListItem>
467+
</VList>
468+
</VMenu>
448469
</VBtn>
449470
<VBtn v-if="mediaDetail.type === '电影'" class="ms-2" :color="getSubscribeColor" variant="tonal" @click="handleSubscribe(0)">
450471
<template #prepend>

src/views/discover/TorrentCardListView.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const props = defineProps({
1313
1414
// 类型
1515
type: String,
16+
17+
// 搜索字段
18+
area: String,
1619
})
1720
1821
interface SearchTorrent extends Context {
@@ -124,6 +127,7 @@ async function fetchData(): Promise<Array<Context>> {
124127
let searchData: Array<Context>
125128
const keyword = props.keyword ?? ''
126129
const mtype = props.type ?? ''
130+
const area = props.area ?? ''
127131
if (!keyword) {
128132
// 查询上次搜索结果
129133
searchData = await api.get('search/last')
@@ -136,6 +140,7 @@ async function fetchData(): Promise<Array<Context>> {
136140
searchData = await api.get(`search/media/${props.keyword}`, {
137141
params: {
138142
mtype,
143+
area,
139144
},
140145
})
141146
}

0 commit comments

Comments
 (0)