revert 解决冲突
This commit is contained in:
2025-11-27 15:38:24 +08:00
parent 3da220526b
commit 64abd3d4ab
28 changed files with 1059 additions and 705 deletions

View File

@@ -70,8 +70,14 @@ onLoad((options: any) => {
* 获取VIP信息
*/
const getVipInfo = async () => {
const res = await homeApi.getVipInfo()
vipInfo.value = res.vipInfo
try {
const res = await homeApi.getVipInfo()
if (res.vipInfo) {
vipInfo.value = res.vipInfo
}
} catch (error) {
console.error('获取VIP信息失败:', error)
}
}
/**
@@ -85,19 +91,26 @@ const handleSearch = async () => {
loading.value = true
isEmpty.value = false
const res = await homeApi.searchBooks({
title: keyword.value.trim(),
page: 1,
limit: 10,
})
if (res.bookList && res.bookList.length > 0) {
searchResults.value = res.bookList
isEmpty.value = false
} else {
try {
const res = await homeApi.searchBooks({
title: keyword.value.trim(),
page: 1,
limit: 10,
})
if (res.bookList && res.bookList.length > 0) {
searchResults.value = res.bookList
isEmpty.value = false
} else {
searchResults.value = []
isEmpty.value = true
}
} catch (error) {
console.error('搜索失败:', error)
searchResults.value = []
isEmpty.value = true
} finally {
loading.value = false
}
loading.value = false
}
/**