mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
fix search
This commit is contained in:
@@ -6,7 +6,6 @@ const route = useRoute();
|
|||||||
|
|
||||||
// 查询TMDBID或标题
|
// 查询TMDBID或标题
|
||||||
const keyword = route.params?.keyword?.toString() ?? "";
|
const keyword = route.params?.keyword?.toString() ?? "";
|
||||||
console.log(keyword);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -26,6 +26,13 @@ const router = createRouter({
|
|||||||
requiresAuth: true,
|
requiresAuth: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'resource',
|
||||||
|
component: () => import('../pages/resource.vue'),
|
||||||
|
meta: {
|
||||||
|
requiresAuth: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'resource/:keyword+',
|
path: 'resource/:keyword+',
|
||||||
component: () => import('../pages/resource.vue'),
|
component: () => import('../pages/resource.vue'),
|
||||||
|
|||||||
@@ -18,12 +18,18 @@ const isRefreshed = ref(false);
|
|||||||
// 获取订阅列表数据
|
// 获取订阅列表数据
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
try {
|
try {
|
||||||
// 优先按TMDBID精确查询
|
let keyword = props.keyword?.toString() ?? "";
|
||||||
if (props.keyword?.startsWith("tmdb:") || props.keyword?.startsWith("douban:")) {
|
if (!keyword) {
|
||||||
dataList.value = await api.get(`search/media/${props.keyword}`);
|
// 查询上次搜索结果
|
||||||
|
dataList.value = await api.get("search/last");
|
||||||
} else {
|
} else {
|
||||||
// 按标题模糊查询
|
// 优先按TMDBID精确查询
|
||||||
dataList.value = await api.get(`search/title/${props.keyword}`);
|
if (props.keyword?.startsWith("tmdb:") || props.keyword?.startsWith("douban:")) {
|
||||||
|
dataList.value = await api.get(`search/media/${props.keyword}`);
|
||||||
|
} else {
|
||||||
|
// 按标题模糊查询
|
||||||
|
dataList.value = await api.get(`search/title/${props.keyword}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
isRefreshed.value = true;
|
isRefreshed.value = true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user