fix search

This commit is contained in:
jxxghp
2024-04-09 13:20:54 +08:00
parent a81becd77b
commit f377ac3fcc
+14 -4
View File
@@ -36,6 +36,12 @@ const progressValue = ref(0)
// 加载进度SSE // 加载进度SSE
const progressEventSource = ref<EventSource>() const progressEventSource = ref<EventSource>()
// 错误标题
const errorTitle = ref('没有数据')
// 错误描述
const errorDescription = ref('未搜索到任何资源')
// 使用SSE监听加载进度 // 使用SSE监听加载进度
function startLoadingProgress() { function startLoadingProgress() {
progressText.value = '正在搜索,请稍候...' progressText.value = '正在搜索,请稍候...'
@@ -76,12 +82,17 @@ async function fetchData() {
startLoadingProgress() startLoadingProgress()
// 优先按TMDBID精确查询 // 优先按TMDBID精确查询
if (keyword?.startsWith('tmdb:') || keyword?.startsWith('douban:') || keyword?.startsWith('bangumi:')) { if (keyword?.startsWith('tmdb:') || keyword?.startsWith('douban:') || keyword?.startsWith('bangumi:')) {
dataList.value = await api.get(`search/media/${keyword}`, { const result: {[key: string]: any} = await api.get(`search/media/${keyword}`, {
params: { params: {
mtype: type, mtype: type,
area, area,
}, },
}) })
if (result.success){
dataList.value = result.data
} else {
errorDescription.value = result.message
}
} }
else { else {
// 按标题模糊查询 // 按标题模糊查询
@@ -112,9 +123,8 @@ onMounted(() => {
</div> </div>
<NoDataFound <NoDataFound
v-if="dataList.length === 0 && isRefreshed" v-if="dataList.length === 0 && isRefreshed"
error-code="404" :error-title="errorTitle"
error-title="没有资源" :error-description="errorDescription"
error-description="没有搜索到符合条件的资源"
/> />
<div v-if="dataList.length > 0"> <div v-if="dataList.length > 0">
<TorrentRowListView <TorrentRowListView