diff --git a/src/components/dialog/ReorganizeDialog.vue b/src/components/dialog/ReorganizeDialog.vue
index 66aa3944..d651e86d 100644
--- a/src/components/dialog/ReorganizeDialog.vue
+++ b/src/components/dialog/ReorganizeDialog.vue
@@ -1,6 +1,6 @@
@@ -192,14 +210,26 @@ async function transfer() {
+
@@ -265,8 +295,19 @@ async function transfer() {
-
-
+
+
+
diff --git a/src/components/misc/TmdbSelector.vue b/src/components/misc/MediaIdSelector.vue
similarity index 79%
rename from src/components/misc/TmdbSelector.vue
rename to src/components/misc/MediaIdSelector.vue
index 06c782a1..b7606360 100644
--- a/src/components/misc/TmdbSelector.vue
+++ b/src/components/misc/MediaIdSelector.vue
@@ -2,10 +2,16 @@
import api from '@/api'
import type { MediaInfo } from '@/api/types'
+// 定义输入变量
+const props = defineProps({
+ type: String, // 来源 themoviedb | douban
+})
+
interface TmdbItem {
title: string
overview: string
tmdbid: number
+ doubanid: string
poster: string
}
@@ -21,25 +27,23 @@ const keyword = ref('')
const loading = ref(false)
// ref
-const tmdbKeyword = ref(null)
+const inputKeyword = ref(null)
// 选中条目
function selectMedia(item: TmdbItem) {
- emit('update:modelValue', item.tmdbid)
+ emit('update:modelValue', item.tmdbid || item.doubanid)
emit('close')
}
// TMDB图片转换为w500大小
function getW500Image(url = '') {
- if (!url)
- return ''
+ if (!url) return ''
return url.replace('original', 'w500')
}
// 搜索词条
async function searchMedias() {
- if (!keyword)
- return
+ if (!keyword) return
// 调用API搜索词条
try {
@@ -57,16 +61,17 @@ async function searchMedias() {
// 赋值
for (const item of result) {
+ if (props.type && props.type !== item.source) continue
items.value.push({
tmdbid: item.tmdb_id || 0,
+ doubanid: item.douban_id || '',
poster: getW500Image(item.poster_path),
title: `${item.title}(${item.year})`,
overview: `${item.type} ${item.overview}`,
})
}
loading.value = false
- }
- catch (e) {
+ } catch (e) {
console.error(e)
}
}
@@ -75,19 +80,16 @@ async function searchMedias() {
onMounted(() => {
// 500ms后聚焦
setTimeout(() => {
- tmdbKeyword.value?.focus()
+ inputKeyword.value?.focus()
}, 500)
})
-
+
{
@keydown.enter="searchMedias"
/>
- { emit('close') }" />
-
+ {
+ emit('close')
+ }
+ "
+ />
+
-
+