+
{{ personInfo?.character }}
diff --git a/src/layouts/components/SearchBar.vue b/src/layouts/components/SearchBar.vue
index 8e6dd33a..f7f6aa71 100644
--- a/src/layouts/components/SearchBar.vue
+++ b/src/layouts/components/SearchBar.vue
@@ -11,20 +11,28 @@ const searchDialog = ref(false)
// ref
const searchWordInput = ref
(null)
+// 当前的搜索类型 media/person
+const searchType = ref('media')
+
// Search
function search() {
- if (!searchWord.value)
- return
+ if (!searchWord.value) return
searchDialog.value = false
router.push({
path: '/browse/media/search',
query: {
title: searchWord.value,
+ type: searchType.value,
},
})
}
+// 切换搜索类型
+function switchSearchType() {
+ searchType.value = searchType.value === 'media' ? 'person' : 'media'
+}
+
// 打开搜索弹窗
function openSearchDialog() {
searchDialog.value = true
@@ -36,15 +44,8 @@ function openSearchDialog() {
-
-
+
+
@@ -53,8 +54,10 @@ function openSearchDialog() {
@@ -62,21 +65,13 @@ function openSearchDialog() {
-
- 搜索
-
+ 搜索
-
+
@@ -87,20 +82,22 @@ function openSearchDialog() {
class="d-none d-lg-block text-disabled search-box"
density="compact"
variant="solo"
- label="搜索电影、电视剧"
+ :prepend-inner-icon="searchType == 'person' ? 'mdi-account' : 'mdi-movie-roll'"
+ :label="searchType == 'person' ? '演员名称' : '电影、电视剧名称'"
append-inner-icon="mdi-magnify"
single-line
hide-details
flat
rounded
@click:append-inner="search"
+ @click:prepend-inner="switchSearchType"
@keydown.enter="search"
/>
diff --git a/src/pages/browse.vue b/src/pages/browse.vue
index 31c7cf89..b9b5e576 100644
--- a/src/pages/browse.vue
+++ b/src/pages/browse.vue
@@ -1,5 +1,6 @@
@@ -26,14 +30,20 @@ function getApiPath(paths: string[] | string) {
diff --git a/src/views/discover/MediaCardListView.vue b/src/views/discover/MediaCardListView.vue
index 1992c54a..158f5658 100644
--- a/src/views/discover/MediaCardListView.vue
+++ b/src/views/discover/MediaCardListView.vue
@@ -12,11 +12,7 @@ const props = defineProps({
// 判断是否有滚动条
function hasScroll() {
- return (
- document.body.scrollHeight
- - (window.innerHeight || document.documentElement.clientHeight)
- > 2
- )
+ return document.body.scrollHeight - (window.innerHeight || document.documentElement.clientHeight) > 2
}
// 当前页码
@@ -37,8 +33,7 @@ function getParams() {
let params = {
page: page.value,
}
- if (props.params)
- params = { ...params, ...props.params }
+ if (props.params) params = { ...params, ...props.params }
return params
}
@@ -46,8 +41,7 @@ function getParams() {
// 获取列表数据
async function fetchData({ done }: { done: any }) {
try {
- if (!props.apipath)
- return
+ if (!props.apipath) return
// 如果正在加载中,直接返回
if (loading.value) {
@@ -81,8 +75,7 @@ async function fetchData({ done }: { done: any }) {
// 返回加载成功
done('ok')
}
- }
- else {
+ } else {
// 加载一次
// 设置加载中
loading.value = true
@@ -106,8 +99,7 @@ async function fetchData({ done }: { done: any }) {
}
// 取消加载中
loading.value = false
- }
- catch (error) {
+ } catch (error) {
console.error(error)
// 返回加载失败
done('error')
@@ -116,29 +108,12 @@ async function fetchData({ done }: { done: any }) {
-
-
+
+
-