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