mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 15:36:49 +08:00
feat:聚合搜索支持订阅
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "moviepilot",
|
"name": "moviepilot",
|
||||||
"version": "1.9.3",
|
"version": "1.9.3-1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"bin": "dist/service.js",
|
"bin": "dist/service.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ export interface Subscribe {
|
|||||||
date: string
|
date: string
|
||||||
// 编辑框设置项
|
// 编辑框设置项
|
||||||
show_edit_dialog: boolean
|
show_edit_dialog: boolean
|
||||||
|
// 编辑框打开状态
|
||||||
|
page_open?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
// 历史记录
|
// 历史记录
|
||||||
|
|||||||
@@ -133,6 +133,14 @@ const dropdownItems = ref([
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
// 监听插件窗口状态变化
|
||||||
|
watch(
|
||||||
|
() => props.media?.page_open,
|
||||||
|
(newOpenState, _) => {
|
||||||
|
if (newOpenState) editSubscribeDialog()
|
||||||
|
},
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import { SubscribeMovieTabs } from '@/router/menu'
|
|||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
|
// 订阅ID参数
|
||||||
|
const subId = ref(route.query.id as string)
|
||||||
|
|
||||||
// 当前标签
|
// 当前标签
|
||||||
const activeTab = ref(route.query.tab)
|
const activeTab = ref(route.query.tab)
|
||||||
|
|
||||||
@@ -26,12 +29,12 @@ function jumpTab(tab: string) {
|
|||||||
<VWindow v-model="activeTab" class="mt-5 disable-tab-transition" :touch="false">
|
<VWindow v-model="activeTab" class="mt-5 disable-tab-transition" :touch="false">
|
||||||
<VWindowItem value="mysub">
|
<VWindowItem value="mysub">
|
||||||
<transition name="fade-slide" appear>
|
<transition name="fade-slide" appear>
|
||||||
<SubscribeListView type="电影" />
|
<SubscribeListView type="电影" :subid="subId" />
|
||||||
</transition>
|
</transition>
|
||||||
</VWindowItem>
|
</VWindowItem>
|
||||||
<VWindowItem value="popular">
|
<VWindowItem value="popular">
|
||||||
<transition name="fade-slide" appear>
|
<transition name="fade-slide" appear>
|
||||||
<SubscribePopularView type="电影" />
|
<SubscribePopularView type="电影" :subid="subId" />
|
||||||
</transition>
|
</transition>
|
||||||
</VWindowItem>
|
</VWindowItem>
|
||||||
</VWindow>
|
</VWindow>
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ const route = useRoute()
|
|||||||
|
|
||||||
const activeTab = ref(route.query.tab)
|
const activeTab = ref(route.query.tab)
|
||||||
|
|
||||||
|
// 订阅ID参数
|
||||||
|
const subId = ref(route.query.id as string)
|
||||||
|
|
||||||
// 跳转tab
|
// 跳转tab
|
||||||
function jumpTab(tab: string) {
|
function jumpTab(tab: string) {
|
||||||
router.push('/subscribe-tv?tab=' + tab)
|
router.push('/subscribe-tv?tab=' + tab)
|
||||||
@@ -25,12 +28,12 @@ function jumpTab(tab: string) {
|
|||||||
<VWindow v-model="activeTab" class="mt-5 disable-tab-transition" :touch="false">
|
<VWindow v-model="activeTab" class="mt-5 disable-tab-transition" :touch="false">
|
||||||
<VWindowItem value="mysub">
|
<VWindowItem value="mysub">
|
||||||
<transition name="fade-slide" appear>
|
<transition name="fade-slide" appear>
|
||||||
<SubscribeListView type="电视剧" />
|
<SubscribeListView type="电视剧" :subid="subId" />
|
||||||
</transition>
|
</transition>
|
||||||
</VWindowItem>
|
</VWindowItem>
|
||||||
<VWindowItem value="popular">
|
<VWindowItem value="popular">
|
||||||
<transition name="fade-slide" appear>
|
<transition name="fade-slide" appear>
|
||||||
<SubscribePopularView type="电视剧" />
|
<SubscribePopularView type="电视剧" :subid="subId" />
|
||||||
</transition>
|
</transition>
|
||||||
</VWindowItem>
|
</VWindowItem>
|
||||||
</VWindow>
|
</VWindow>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import store from '@/store'
|
|||||||
// 输入参数
|
// 输入参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
|
subid: String,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 是否刷新过
|
// 是否刷新过
|
||||||
@@ -35,9 +36,6 @@ async function fetchData() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载时获取数据
|
|
||||||
onBeforeMount(fetchData)
|
|
||||||
|
|
||||||
// 刷新状态
|
// 刷新状态
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
@@ -56,6 +54,18 @@ const filteredDataList = computed(() => {
|
|||||||
if (superUser) return dataList.value.filter(data => data.type === props.type)
|
if (superUser) return dataList.value.filter(data => data.type === props.type)
|
||||||
else return dataList.value.filter(data => data.type === props.type && data.username === userName)
|
else return dataList.value.filter(data => data.type === props.type && data.username === userName)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await fetchData()
|
||||||
|
if (props.subid) {
|
||||||
|
// 找到这个订阅
|
||||||
|
const sub = dataList.value.find(sub => sub.id.toString() == props.subid?.toString())
|
||||||
|
if (sub) {
|
||||||
|
// 打开编辑弹窗
|
||||||
|
sub.page_open = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import type { Plugin } from '@/api/types'
|
import type { Plugin, Subscribe } from '@/api/types'
|
||||||
import {
|
import {
|
||||||
SystemNavMenus,
|
SystemNavMenus,
|
||||||
UserfulMenus,
|
UserfulMenus,
|
||||||
@@ -84,7 +84,7 @@ function getMenus(): NavMenu[] {
|
|||||||
// 匹配的菜单列表
|
// 匹配的菜单列表
|
||||||
const matchedMenuItems = computed(() => {
|
const matchedMenuItems = computed(() => {
|
||||||
if (!searchWord.value) return []
|
if (!searchWord.value) return []
|
||||||
const lowerWord = searchWord.value?.toLowerCase()
|
const lowerWord = (searchWord.value as string).toLowerCase()
|
||||||
const menuItems = getMenus()
|
const menuItems = getMenus()
|
||||||
if (menuItems)
|
if (menuItems)
|
||||||
return menuItems.filter(
|
return menuItems.filter(
|
||||||
@@ -114,13 +114,34 @@ async function fetchInstalledPlugins() {
|
|||||||
// 区配的插件列表
|
// 区配的插件列表
|
||||||
const matchedPluginItems = computed(() => {
|
const matchedPluginItems = computed(() => {
|
||||||
if (!searchWord.value) return []
|
if (!searchWord.value) return []
|
||||||
const lowerWord = searchWord.value?.toLowerCase()
|
const lowerWord = (searchWord.value as string).toLowerCase()
|
||||||
return pluginItems.value.filter((item: Plugin) => {
|
return pluginItems.value.filter((item: Plugin) => {
|
||||||
if (!item.plugin_name && !item.plugin_desc) return false
|
if (!item.plugin_name && !item.plugin_desc) return false
|
||||||
return item.plugin_name?.toLowerCase().includes(lowerWord) || item.plugin_desc?.toLowerCase().includes(lowerWord)
|
return item.plugin_name?.toLowerCase().includes(lowerWord) || item.plugin_desc?.toLowerCase().includes(lowerWord)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 所有订阅数据
|
||||||
|
const SubscribeItems = ref<Subscribe[]>([])
|
||||||
|
|
||||||
|
// 获取电影订阅列表数据
|
||||||
|
async function fetchSubscribes() {
|
||||||
|
try {
|
||||||
|
SubscribeItems.value = await api.get('subscribe/')
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 匹配的订阅列表
|
||||||
|
const matchedSubscribeItems = computed(() => {
|
||||||
|
if (!searchWord.value) return []
|
||||||
|
const lowerWord = (searchWord.value as string).toLowerCase()
|
||||||
|
return SubscribeItems.value.filter((item: Subscribe) => {
|
||||||
|
return item.name.toLowerCase().includes(lowerWord)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
// 跳转媒体搜索页面
|
// 跳转媒体搜索页面
|
||||||
function searchMedia(searchType: string) {
|
function searchMedia(searchType: string) {
|
||||||
// 搜索类型 media/person
|
// 搜索类型 media/person
|
||||||
@@ -154,15 +175,36 @@ function goPage(to: string) {
|
|||||||
emit('close')
|
emit('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 跳转订阅页面
|
||||||
|
function goSubscribe(subscribe: Subscribe) {
|
||||||
|
if (subscribe.type === '电影') {
|
||||||
|
router.push({
|
||||||
|
path: '/subscribe-movie',
|
||||||
|
query: {
|
||||||
|
id: subscribe.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/subscribe-tv',
|
||||||
|
query: {
|
||||||
|
id: subscribe.id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
searchWordInput.value?.focus()
|
searchWordInput.value?.focus()
|
||||||
}, 500)
|
}, 500)
|
||||||
fetchInstalledPlugins()
|
fetchInstalledPlugins()
|
||||||
|
fetchSubscribes()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VDialog max-width="40rem">
|
<VDialog max-width="40rem" scrollable>
|
||||||
<VCard>
|
<VCard>
|
||||||
<VCardText class="pe-12">
|
<VCardText class="pe-12">
|
||||||
<VCombobox
|
<VCombobox
|
||||||
@@ -222,6 +264,30 @@ onMounted(() => {
|
|||||||
</VListItem>
|
</VListItem>
|
||||||
</template>
|
</template>
|
||||||
</VHover>
|
</VHover>
|
||||||
|
<VListSubheader v-if="matchedSubscribeItems.length > 0"> 订阅 </VListSubheader>
|
||||||
|
<VHover
|
||||||
|
v-if="matchedSubscribeItems.length > 0"
|
||||||
|
v-for="subscribe in matchedSubscribeItems"
|
||||||
|
:key="subscribe.id"
|
||||||
|
>
|
||||||
|
<template #default="hover">
|
||||||
|
<VListItem
|
||||||
|
:prepend-icon="`${subscribe.type === '电影' ? 'mdi-movie-roll' : 'mdi-television-classic'}`"
|
||||||
|
density="compact"
|
||||||
|
link
|
||||||
|
v-bind="hover.props"
|
||||||
|
@click="goSubscribe(subscribe)"
|
||||||
|
>
|
||||||
|
<VListItemTitle>
|
||||||
|
{{ subscribe.name }}<span v-if="subscribe.season"> 第 {{ subscribe.season }} 季</span>
|
||||||
|
</VListItemTitle>
|
||||||
|
<VListItemSubtitle> {{ subscribe.type }}</VListItemSubtitle>
|
||||||
|
<template #append>
|
||||||
|
<VIcon v-if="hover.isHovering" icon="ri-corner-down-left-line" />
|
||||||
|
</template>
|
||||||
|
</VListItem>
|
||||||
|
</template>
|
||||||
|
</VHover>
|
||||||
<VListSubheader v-if="matchedMenuItems.length > 0"> 功能 </VListSubheader>
|
<VListSubheader v-if="matchedMenuItems.length > 0"> 功能 </VListSubheader>
|
||||||
<VHover v-if="matchedMenuItems.length > 0" v-for="menu in matchedMenuItems" :key="menu.title">
|
<VHover v-if="matchedMenuItems.length > 0" v-for="menu in matchedMenuItems" :key="menu.title">
|
||||||
<template #default="hover">
|
<template #default="hover">
|
||||||
|
|||||||
Reference in New Issue
Block a user