mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
feat:小屏搜索结果列表模式增加过滤按钮
This commit is contained in:
@@ -209,7 +209,7 @@ onMounted(() => {
|
|||||||
</VList>
|
</VList>
|
||||||
</VMenu>
|
</VMenu>
|
||||||
<!-- 自定义 CSS -- -->
|
<!-- 自定义 CSS -- -->
|
||||||
<VDialog v-model="cssDialog" persistent max-width="50rem" scrollable :fullscreen="!display.mdAndUp.value">
|
<VDialog v-if="cssDialog" v-model="cssDialog" persistent max-width="50rem" scrollable :fullscreen="!display.mdAndUp.value">
|
||||||
<VCard title="自定义主题风格">
|
<VCard title="自定义主题风格">
|
||||||
<DialogCloseBtn @click="cssDialog = false" />
|
<DialogCloseBtn @click="cssDialog = false" />
|
||||||
<VDivider />
|
<VDivider />
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ function onClose() {
|
|||||||
<VImg :src="filter_svg" cover class="mt-7" max-width="3rem" />
|
<VImg :src="filter_svg" cover class="mt-7" max-width="3rem" />
|
||||||
</VCardText>
|
</VCardText>
|
||||||
</VCard>
|
</VCard>
|
||||||
<VDialog v-model="ruleInfoDialog" scrollable max-width="40rem" persistent>
|
<VDialog v-if="ruleInfoDialog" v-model="ruleInfoDialog" scrollable max-width="40rem" persistent>
|
||||||
<VCard :title="`${props.rule.id} - 配置`" class="rounded-t">
|
<VCard :title="`${props.rule.id} - 配置`" class="rounded-t">
|
||||||
<DialogCloseBtn v-model="ruleInfoDialog" />
|
<DialogCloseBtn v-model="ruleInfoDialog" />
|
||||||
<VDivider />
|
<VDivider />
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ onUnmounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</VCardText>
|
</VCardText>
|
||||||
</VCard>
|
</VCard>
|
||||||
<VDialog v-model="downloaderInfoDialog" scrollable max-width="40rem" persistent>
|
<VDialog v-if="downloaderInfoDialog" v-model="downloaderInfoDialog" scrollable max-width="40rem" persistent>
|
||||||
<VCard :title="`${props.downloader.name} - 配置`" class="rounded-t">
|
<VCard :title="`${props.downloader.name} - 配置`" class="rounded-t">
|
||||||
<DialogCloseBtn v-model="downloaderInfoDialog" />
|
<DialogCloseBtn v-model="downloaderInfoDialog" />
|
||||||
<VDivider />
|
<VDivider />
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ function onClose() {
|
|||||||
<VImg :src="filter_group_svg" cover class="mt-10" max-width="3rem" />
|
<VImg :src="filter_group_svg" cover class="mt-10" max-width="3rem" />
|
||||||
</VCardText>
|
</VCardText>
|
||||||
</VCard>
|
</VCard>
|
||||||
<VDialog v-model="groupInfoDialog" scrollable max-width="80rem" persistent>
|
<VDialog v-if="groupInfoDialog" v-model="groupInfoDialog" scrollable max-width="80rem" persistent>
|
||||||
<VCard :title="`${props.group.name} - 配置`" class="rounded-t">
|
<VCard :title="`${props.group.name} - 配置`" class="rounded-t">
|
||||||
<DialogCloseBtn v-model="groupInfoDialog" />
|
<DialogCloseBtn v-model="groupInfoDialog" />
|
||||||
<VDivider />
|
<VDivider />
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ onMounted(() => {
|
|||||||
<VImg :src="getIcon" cover class="mt-7 me-3" max-width="3rem" min-width="3rem" />
|
<VImg :src="getIcon" cover class="mt-7 me-3" max-width="3rem" min-width="3rem" />
|
||||||
</VCardText>
|
</VCardText>
|
||||||
</VCard>
|
</VCard>
|
||||||
<VDialog v-model="mediaServerInfoDialog" scrollable max-width="40rem" persistent>
|
<VDialog v-if="mediaServerInfoDialog" v-model="mediaServerInfoDialog" scrollable max-width="40rem" persistent>
|
||||||
<VCard :title="`${props.mediaserver.name} - 配置`" class="rounded-t">
|
<VCard :title="`${props.mediaserver.name} - 配置`" class="rounded-t">
|
||||||
<DialogCloseBtn v-model="mediaServerInfoDialog" />
|
<DialogCloseBtn v-model="mediaServerInfoDialog" />
|
||||||
<VDivider />
|
<VDivider />
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import synologychat_image from '@images/logos/synologychat.png'
|
|||||||
import slack_image from '@images/logos/slack.webp'
|
import slack_image from '@images/logos/slack.webp'
|
||||||
import chrome_image from '@images/logos/chrome.png'
|
import chrome_image from '@images/logos/chrome.png'
|
||||||
import { useToast } from 'vue-toast-notification'
|
import { useToast } from 'vue-toast-notification'
|
||||||
import { cloneDeep } from "lodash"
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
// 定义输入
|
// 定义输入
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -132,7 +132,7 @@ function onClose() {
|
|||||||
<VImg :src="getIcon" cover class="mt-7 me-3" max-width="3rem" />
|
<VImg :src="getIcon" cover class="mt-7 me-3" max-width="3rem" />
|
||||||
</VCardText>
|
</VCardText>
|
||||||
</VCard>
|
</VCard>
|
||||||
<VDialog v-model="notificationInfoDialog" scrollable max-width="40rem" persistent>
|
<VDialog v-if="notificationInfoDialog" v-model="notificationInfoDialog" scrollable max-width="40rem" persistent>
|
||||||
<VCard :title="`${props.notification.name} - 配置`" class="rounded-t">
|
<VCard :title="`${props.notification.name} - 配置`" class="rounded-t">
|
||||||
<DialogCloseBtn v-model="notificationInfoDialog" />
|
<DialogCloseBtn v-model="notificationInfoDialog" />
|
||||||
<VDivider />
|
<VDivider />
|
||||||
|
|||||||
@@ -485,7 +485,13 @@ watch(
|
|||||||
</VHover>
|
</VHover>
|
||||||
|
|
||||||
<!-- 插件配置页面 -->
|
<!-- 插件配置页面 -->
|
||||||
<VDialog v-model="pluginConfigDialog" scrollable max-width="60rem" :fullscreen="!display.mdAndUp.value">
|
<VDialog
|
||||||
|
v-if="pluginConfigDialog"
|
||||||
|
v-model="pluginConfigDialog"
|
||||||
|
scrollable
|
||||||
|
max-width="60rem"
|
||||||
|
:fullscreen="!display.mdAndUp.value"
|
||||||
|
>
|
||||||
<VCard :title="`${props.plugin?.plugin_name} - 配置`" class="rounded-t">
|
<VCard :title="`${props.plugin?.plugin_name} - 配置`" class="rounded-t">
|
||||||
<DialogCloseBtn v-model="pluginConfigDialog" />
|
<DialogCloseBtn v-model="pluginConfigDialog" />
|
||||||
<VDivider />
|
<VDivider />
|
||||||
@@ -503,7 +509,13 @@ watch(
|
|||||||
</VDialog>
|
</VDialog>
|
||||||
|
|
||||||
<!-- 插件数据页面 -->
|
<!-- 插件数据页面 -->
|
||||||
<VDialog v-model="pluginInfoDialog" scrollable max-width="80rem" :fullscreen="!display.mdAndUp.value">
|
<VDialog
|
||||||
|
v-if="pluginInfoDialog"
|
||||||
|
v-model="pluginInfoDialog"
|
||||||
|
scrollable
|
||||||
|
max-width="80rem"
|
||||||
|
:fullscreen="!display.mdAndUp.value"
|
||||||
|
>
|
||||||
<VCard :title="`${props.plugin?.plugin_name}`" class="rounded-t">
|
<VCard :title="`${props.plugin?.plugin_name}`" class="rounded-t">
|
||||||
<DialogCloseBtn v-model="pluginInfoDialog" />
|
<DialogCloseBtn v-model="pluginInfoDialog" />
|
||||||
<VCardText class="min-h-40">
|
<VCardText class="min-h-40">
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ const sortIcon = computed(() => {
|
|||||||
</IconBtn>
|
</IconBtn>
|
||||||
</template>
|
</template>
|
||||||
</VTooltip>
|
</VTooltip>
|
||||||
<VDialog v-model="newFolderPopper" max-width="50rem">
|
<VDialog v-if="newFolderPopper" v-model="newFolderPopper" max-width="50rem">
|
||||||
<template #activator="{ props }">
|
<template #activator="{ props }">
|
||||||
<IconBtn v-bind="props">
|
<IconBtn v-bind="props">
|
||||||
<VTooltip text="新建文件夹">
|
<VTooltip text="新建文件夹">
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
defineProps<{ title: string }>()
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VListSubheader>{{ title }}</VListSubheader>
|
||||||
|
<VListItem><slot /></VListItem>
|
||||||
|
</template>
|
||||||
@@ -156,7 +156,7 @@ const userLevel = computed(() => store.state.auth.level)
|
|||||||
<!-- 用户认证对话框 -->
|
<!-- 用户认证对话框 -->
|
||||||
<UserAuthDialog v-if="siteAuthDialog" v-model="siteAuthDialog" @done="siteAuthDone" @close="siteAuthDialog = false" />
|
<UserAuthDialog v-if="siteAuthDialog" v-model="siteAuthDialog" @done="siteAuthDone" @close="siteAuthDialog = false" />
|
||||||
<!-- 重启确认对话框 -->
|
<!-- 重启确认对话框 -->
|
||||||
<VDialog v-model="restartDialog" max-width="25rem">
|
<VDialog v-if="restartDialog" v-model="restartDialog" max-width="25rem">
|
||||||
<VCard>
|
<VCard>
|
||||||
<VCardItem>
|
<VCardItem>
|
||||||
<div class="flex items-center justify-center mt-3">
|
<div class="flex items-center justify-center mt-3">
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ onDeactivated(() => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 弹窗,根据配置生成选项 -->
|
<!-- 弹窗,根据配置生成选项 -->
|
||||||
<VDialog v-model="dialog" max-width="35rem" scrollable>
|
<VDialog v-if="dialog" v-model="dialog" max-width="35rem" scrollable>
|
||||||
<VCard>
|
<VCard>
|
||||||
<VCardItem>
|
<VCardItem>
|
||||||
<VCardTitle>设置仪表板</VCardTitle>
|
<VCardTitle>设置仪表板</VCardTitle>
|
||||||
|
|||||||
@@ -607,7 +607,7 @@ onMounted(async () => {
|
|||||||
</VCard>
|
</VCard>
|
||||||
</VDialog>
|
</VDialog>
|
||||||
<!-- 安装插件进度框 -->
|
<!-- 安装插件进度框 -->
|
||||||
<VDialog v-model="progressDialog" :scrim="false" width="25rem">
|
<VDialog v-if="progressDialog" v-model="progressDialog" :scrim="false" width="25rem">
|
||||||
<VCard color="primary">
|
<VCard color="primary">
|
||||||
<VCardText class="text-center">
|
<VCardText class="text-center">
|
||||||
{{ progressText }}
|
{{ progressText }}
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<VDialog v-model="releaseDialog" width="600" scrollable>
|
<VDialog v-if="releaseDialog" v-model="releaseDialog" width="600" scrollable>
|
||||||
<VCard>
|
<VCard>
|
||||||
<VCardItem>
|
<VCardItem>
|
||||||
<DialogCloseBtn @click="releaseDialog = false" />
|
<DialogCloseBtn @click="releaseDialog = false" />
|
||||||
|
|||||||
@@ -1,39 +1,71 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { Context } from '@/api/types'
|
import type { Context } from '@/api/types'
|
||||||
import TorrentItem from '@/components/cards/TorrentItem.vue'
|
import TorrentItem from '@/components/cards/TorrentItem.vue'
|
||||||
import { list } from 'postcss'
|
import FilterOption from '@/components/misc/FilterOption.vue'
|
||||||
import { useDisplay } from 'vuetify'
|
import { useDisplay } from 'vuetify'
|
||||||
|
|
||||||
// 显示器宽度
|
// 设备模式
|
||||||
const display = useDisplay()
|
const display = useDisplay()
|
||||||
|
|
||||||
// APP
|
|
||||||
const appMode = inject('pwaMode') && display.mdAndDown.value
|
const appMode = inject('pwaMode') && display.mdAndDown.value
|
||||||
|
|
||||||
|
// 过滤弹窗
|
||||||
|
const filterDialog = ref(false)
|
||||||
|
|
||||||
// 定义输入参数
|
// 定义输入参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
// 数据列表
|
|
||||||
items: Array as PropType<Context[]>,
|
items: Array as PropType<Context[]>,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 过滤表单
|
// 过滤表单
|
||||||
const filterForm = reactive({
|
const filterForm: Record<string, string[]> = reactive({
|
||||||
// 站点
|
|
||||||
site: [] as string[],
|
site: [] as string[],
|
||||||
// 季
|
|
||||||
season: [] as string[],
|
season: [] as string[],
|
||||||
// 制作组
|
|
||||||
releaseGroup: [] as string[],
|
releaseGroup: [] as string[],
|
||||||
// 视频编码
|
|
||||||
videoCode: [] as string[],
|
videoCode: [] as string[],
|
||||||
// 促销状态
|
|
||||||
freeState: [] as string[],
|
freeState: [] as string[],
|
||||||
// 质量
|
|
||||||
edition: [] as string[],
|
edition: [] as string[],
|
||||||
// 分辨率
|
|
||||||
resolution: [] as string[],
|
resolution: [] as string[],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 过滤项映射(保持中文标题)
|
||||||
|
const filterTitles: Record<string, string> = {
|
||||||
|
site: '站点',
|
||||||
|
season: '季集',
|
||||||
|
freeState: '促销状态',
|
||||||
|
videoCode: '视频编码',
|
||||||
|
edition: '质量',
|
||||||
|
resolution: '分辨率',
|
||||||
|
releaseGroup: '制作组',
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序中文名
|
||||||
|
const sortTitles: Record<string, string> = {
|
||||||
|
default: '默认',
|
||||||
|
site: '站点',
|
||||||
|
size: '大小',
|
||||||
|
seeder: '做种数',
|
||||||
|
}
|
||||||
|
|
||||||
|
// 统一存储过滤选项
|
||||||
|
const filterOptions: Record<string, string[]> = reactive({
|
||||||
|
site: [] as string[],
|
||||||
|
season: [] as string[],
|
||||||
|
freeState: [] as string[],
|
||||||
|
edition: [] as string[],
|
||||||
|
resolution: [] as string[],
|
||||||
|
videoCode: [] as string[],
|
||||||
|
releaseGroup: [] as string[],
|
||||||
|
})
|
||||||
|
|
||||||
|
// 非空值的过滤选项
|
||||||
|
const filterOptionsNotEmpty = computed(() => {
|
||||||
|
const options: Record<string, string[]> = {}
|
||||||
|
for (const key in filterOptions) {
|
||||||
|
if (filterOptions[key].length > 0) options[key] = filterOptions[key]
|
||||||
|
}
|
||||||
|
return options
|
||||||
|
})
|
||||||
|
|
||||||
// 列表样式
|
// 列表样式
|
||||||
const listStyle = computed(() => {
|
const listStyle = computed(() => {
|
||||||
return appMode
|
return appMode
|
||||||
@@ -47,155 +79,23 @@ const sortField = ref('default')
|
|||||||
// 数据列表
|
// 数据列表
|
||||||
const dataList = ref<Array<Context>>([])
|
const dataList = ref<Array<Context>>([])
|
||||||
|
|
||||||
// 获取站点过滤选项
|
|
||||||
const siteFilterOptions = ref<Array<string>>([])
|
|
||||||
// 获取季过滤选项
|
|
||||||
const seasonFilterOptions = ref<Array<string>>([])
|
|
||||||
// 获取制作组过滤选项
|
|
||||||
const releaseGroupFilterOptions = ref<Array<string>>([])
|
|
||||||
// 获取视频编码过滤选项
|
|
||||||
const videoCodeFilterOptions = ref<Array<string>>([])
|
|
||||||
// 获取促销状态过滤选项
|
|
||||||
const freeStateFilterOptions = ref<Array<string>>([])
|
|
||||||
// 获取质量过滤选项
|
|
||||||
const editionFilterOptions = ref<Array<string>>([])
|
|
||||||
// 获取分辨率过滤选项
|
|
||||||
const resolutionFilterOptions = ref<Array<string>>([])
|
|
||||||
|
|
||||||
// 初始化过滤选项
|
// 初始化过滤选项
|
||||||
function initOptions(data: Context) {
|
function initOptions(data: Context) {
|
||||||
const { torrent_info, meta_info } = data
|
const { torrent_info, meta_info } = data
|
||||||
const optionValue = (options: Array<string>, value: string | undefined) => {
|
const optionValue = (options: Array<string>, value: string | undefined) => {
|
||||||
value && !options.includes(value) && options.push(value)
|
value && !options.includes(value) && options.push(value)
|
||||||
}
|
}
|
||||||
optionValue(siteFilterOptions.value, torrent_info?.site_name)
|
|
||||||
optionValue(seasonFilterOptions.value, meta_info?.season_episode)
|
optionValue(filterOptions.site, torrent_info?.site_name)
|
||||||
optionValue(releaseGroupFilterOptions.value, meta_info?.resource_team)
|
optionValue(filterOptions.season, meta_info?.season_episode)
|
||||||
optionValue(videoCodeFilterOptions.value, meta_info?.video_encode)
|
optionValue(filterOptions.releaseGroup, meta_info?.resource_team)
|
||||||
optionValue(freeStateFilterOptions.value, torrent_info?.volume_factor)
|
optionValue(filterOptions.videoCode, meta_info?.video_encode)
|
||||||
optionValue(editionFilterOptions.value, meta_info?.edition)
|
optionValue(filterOptions.freeState, torrent_info?.volume_factor)
|
||||||
optionValue(resolutionFilterOptions.value, meta_info?.resource_pix)
|
optionValue(filterOptions.edition, meta_info?.edition)
|
||||||
|
optionValue(filterOptions.resolution, meta_info?.resource_pix)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对季过滤选项进行排序
|
// 监听数据列表,进行排序
|
||||||
const sortSeasonFilterOptions = computed(() => {
|
|
||||||
// 预解析所有选项
|
|
||||||
const parsedOptions = seasonFilterOptions.value.map((option, index) => {
|
|
||||||
const parseSeasonEpisode = (str: string) => {
|
|
||||||
const match = str.match(/^S(\d+)(?:-S(\d+))?(?:\s*E(\d+)(?:-E(\d+))?)?$/)
|
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
// 如果字符串格式不正确,返回默认值
|
|
||||||
return {
|
|
||||||
original: str,
|
|
||||||
seasonStart: 0,
|
|
||||||
seasonEnd: 0,
|
|
||||||
episodeStart: 0,
|
|
||||||
episodeEnd: 0,
|
|
||||||
maxSeason: 0,
|
|
||||||
maxEpisode: 0,
|
|
||||||
index,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const seasonStart = match[1] ? parseInt(match[1], 10) : 0
|
|
||||||
const seasonEnd = match[2] ? parseInt(match[2], 10) : 0
|
|
||||||
const episodeStart = match[3] ? parseInt(match[3], 10) : 0
|
|
||||||
const episodeEnd = match[4] ? parseInt(match[4], 10) : 0
|
|
||||||
const maxSeason = seasonEnd > 0 ? seasonEnd : seasonStart
|
|
||||||
const maxEpisode = episodeEnd > 0 ? episodeEnd : episodeStart
|
|
||||||
|
|
||||||
return {
|
|
||||||
original: str,
|
|
||||||
seasonStart,
|
|
||||||
seasonEnd,
|
|
||||||
episodeStart,
|
|
||||||
episodeEnd,
|
|
||||||
maxSeason,
|
|
||||||
maxEpisode,
|
|
||||||
index,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return parseSeasonEpisode(option)
|
|
||||||
})
|
|
||||||
|
|
||||||
// 定义判断是否为整季或季范围的函数
|
|
||||||
const isWholeSeason = (parsed: (typeof parsedOptions)[0]) =>
|
|
||||||
parsed.seasonStart > 0 &&
|
|
||||||
(parsed.seasonEnd === 0 || parsed.seasonEnd > parsed.seasonStart) &&
|
|
||||||
parsed.episodeStart === 0 &&
|
|
||||||
parsed.episodeEnd === 0
|
|
||||||
|
|
||||||
// 定义判断是否包含集数的函数
|
|
||||||
const hasEpisodes = (parsed: (typeof parsedOptions)[0]) => parsed.episodeStart > 0 || parsed.episodeEnd > 0
|
|
||||||
|
|
||||||
// 排序逻辑
|
|
||||||
parsedOptions.sort((a, b) => {
|
|
||||||
const aIsWhole = isWholeSeason(a)
|
|
||||||
const bIsWhole = isWholeSeason(b)
|
|
||||||
const aHasEpisodes = hasEpisodes(a)
|
|
||||||
const bHasEpisodes = hasEpisodes(b)
|
|
||||||
|
|
||||||
// 优先级1:整季和季范围选项优先于带有集数的选项
|
|
||||||
if (aIsWhole && !bIsWhole) return -1
|
|
||||||
if (!aIsWhole && bIsWhole) return 1
|
|
||||||
|
|
||||||
// 优先级2:如果都是整季或季范围选项,按 maxSeason 降序排列
|
|
||||||
if (aIsWhole && bIsWhole) {
|
|
||||||
if (b.maxSeason !== a.maxSeason) {
|
|
||||||
return b.maxSeason - a.maxSeason
|
|
||||||
}
|
|
||||||
// 如果 maxSeason 相同,则按原始索引
|
|
||||||
return a.index - b.index
|
|
||||||
}
|
|
||||||
|
|
||||||
// 优先级3:如果都是带有集数的选项,先按 maxSeason 降序,再按 maxEpisode 降序
|
|
||||||
if (aHasEpisodes && bHasEpisodes) {
|
|
||||||
if (b.maxSeason !== a.maxSeason) {
|
|
||||||
return b.maxSeason - a.maxSeason
|
|
||||||
}
|
|
||||||
if (b.maxEpisode !== a.maxEpisode) {
|
|
||||||
return b.maxEpisode - a.maxEpisode
|
|
||||||
}
|
|
||||||
// 如果 maxSeason 和 maxEpisode 相同,则按原始索引
|
|
||||||
return a.index - b.index
|
|
||||||
}
|
|
||||||
|
|
||||||
// 优先级4:如果一个有集数,一个没有,优先有集数的选项
|
|
||||||
if (aHasEpisodes && !bHasEpisodes) return -1
|
|
||||||
if (!aHasEpisodes && bHasEpisodes) return 1
|
|
||||||
|
|
||||||
// 优先级5:对于没有集数且不是整季的选项,按 seasonStart 和 seasonEnd 降序排序
|
|
||||||
if (b.seasonStart !== a.seasonStart) {
|
|
||||||
return b.seasonStart - a.seasonStart
|
|
||||||
}
|
|
||||||
if (b.seasonEnd !== a.seasonEnd) {
|
|
||||||
return b.seasonEnd - a.seasonEnd
|
|
||||||
}
|
|
||||||
|
|
||||||
// 优先级6:按 episodeStart 和 episodeEnd 降序排序
|
|
||||||
if (b.episodeStart !== a.episodeStart) {
|
|
||||||
return b.episodeStart - a.episodeStart
|
|
||||||
}
|
|
||||||
if (b.episodeEnd !== a.episodeEnd) {
|
|
||||||
return b.episodeEnd - a.episodeEnd
|
|
||||||
}
|
|
||||||
|
|
||||||
// 优先级7:兜底按字母降序排列
|
|
||||||
if (a.original !== b.original) {
|
|
||||||
return b.original.localeCompare(a.original)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 优先级8:如果所有条件都相同,则按原始索引
|
|
||||||
return a.index - b.index
|
|
||||||
})
|
|
||||||
|
|
||||||
// 返回排序后的原始字符串数组
|
|
||||||
return parsedOptions.map(option => option.original)
|
|
||||||
})
|
|
||||||
|
|
||||||
// 排序
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
const list = dataList.value
|
const list = dataList.value
|
||||||
if (sortField.value === 'default') {
|
if (sortField.value === 'default') {
|
||||||
@@ -241,151 +141,122 @@ watchEffect(() => {
|
|||||||
|
|
||||||
// 初始化过滤选项
|
// 初始化过滤选项
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
props.items?.forEach(item => {
|
props.items?.forEach(initOptions)
|
||||||
initOptions(item)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VRow>
|
<div>
|
||||||
<VCol>
|
<VRow>
|
||||||
<VList v-if="dataList.length === 0" lines="three" class="rounded p-0 shadow-lg">
|
<VCol>
|
||||||
<VListItem>
|
<VList v-if="dataList.length === 0" lines="three" class="rounded p-0 shadow-lg">
|
||||||
<VListItemTitle>没有附合当前过滤条件的资源。</VListItemTitle>
|
<VListItem>
|
||||||
</VListItem>
|
<VListItemTitle>没有符合当前过滤条件的资源。</VListItemTitle>
|
||||||
</VList>
|
</VListItem>
|
||||||
<VList v-if="dataList.length !== 0" lines="three" class="rounded p-0 torrent-list-vscroll shadow-lg">
|
</VList>
|
||||||
<VVirtualScroll :items="dataList" :style="listStyle">
|
<VList v-else lines="three" class="rounded p-0 torrent-list-vscroll shadow-lg">
|
||||||
<template #default="{ item }">
|
<VVirtualScroll :items="dataList" :style="listStyle">
|
||||||
<TorrentItem :torrent="item" :key="`${item.torrent_info.page_url}`" />
|
<template #default="{ item }">
|
||||||
</template>
|
<TorrentItem :torrent="item" :key="item.torrent_info.page_url" />
|
||||||
</VVirtualScroll>
|
</template>
|
||||||
</VList>
|
</VVirtualScroll>
|
||||||
</VCol>
|
</VList>
|
||||||
<VCol xl="2" md="3" v-if="display.mdAndUp.value">
|
</VCol>
|
||||||
<VList lines="one" class="rounded shadow-lg" :style="listStyle">
|
<!-- 排序 & 过滤列表 -->
|
||||||
<VListSubheader> 排序 </VListSubheader>
|
<VCol xl="2" md="3" v-if="display.mdAndUp.value">
|
||||||
<VListItem>
|
<VList lines="one" class="rounded shadow-lg" :style="listStyle">
|
||||||
<VChipGroup column v-model="sortField">
|
<FilterOption title="排序">
|
||||||
<VChip :color="sortField == 'default' ? 'primary' : ''" filter variant="outlined" value="default">
|
<VChipGroup column v-model="sortField">
|
||||||
默认
|
<VChip
|
||||||
</VChip>
|
v-for="(title, key) in sortTitles"
|
||||||
<VChip :color="sortField == 'site' ? 'primary' : ''" filter variant="outlined" value="site"> 站点 </VChip>
|
:key="key"
|
||||||
<VChip :color="sortField == 'size' ? 'primary' : ''" filter variant="outlined" value="size">
|
:color="sortField === key ? 'primary' : ''"
|
||||||
文件大小
|
filter
|
||||||
</VChip>
|
variant="outlined"
|
||||||
<VChip :color="sortField == 'seeder' ? 'primary' : ''" filter variant="outlined" value="seeder">
|
:value="key"
|
||||||
做种数
|
>
|
||||||
</VChip>
|
{{ title }}
|
||||||
</VChipGroup>
|
</VChip>
|
||||||
</VListItem>
|
</VChipGroup>
|
||||||
<VListSubheader v-if="siteFilterOptions.length > 0"> 站点 </VListSubheader>
|
</FilterOption>
|
||||||
<VListItem>
|
<!-- 过滤选项 -->
|
||||||
<VChipGroup v-model="filterForm.site" column multiple>
|
<FilterOption v-for="(options, key) in filterOptionsNotEmpty" :key="key" :title="filterTitles[key]">
|
||||||
<VChip
|
<VChipGroup v-model="filterForm[key]" column multiple>
|
||||||
v-for="site in siteFilterOptions"
|
<VChip
|
||||||
:key="site"
|
v-for="option in options"
|
||||||
:color="filterForm.site.includes(site) ? 'primary' : ''"
|
:key="option"
|
||||||
filter
|
:color="filterForm[key].includes(option) ? 'primary' : ''"
|
||||||
variant="outlined"
|
filter
|
||||||
:value="site"
|
variant="outlined"
|
||||||
>
|
:value="option"
|
||||||
{{ site }}
|
>
|
||||||
</VChip>
|
{{ option }}
|
||||||
</VChipGroup>
|
</VChip>
|
||||||
</VListItem>
|
</VChipGroup>
|
||||||
<VListSubheader v-if="editionFilterOptions.length > 0"> 质量 </VListSubheader>
|
</FilterOption>
|
||||||
<VListItem>
|
</VList>
|
||||||
<VChipGroup v-model="filterForm.edition" column multiple>
|
</VCol>
|
||||||
<VChip
|
</VRow>
|
||||||
v-for="edition in editionFilterOptions"
|
|
||||||
:key="edition"
|
<!-- 过滤弹窗 -->
|
||||||
:color="filterForm.edition.includes(edition) ? 'primary' : ''"
|
<VDialog v-model="filterDialog" max-width="40rem">
|
||||||
filter
|
<VCard title="排序 & 过滤" class="rounded-t">
|
||||||
variant="outlined"
|
<DialogCloseBtn v-model="filterDialog" />
|
||||||
:value="edition"
|
<VDivider />
|
||||||
>
|
<VList lines="one">
|
||||||
{{ edition }}
|
<FilterOption title="排序">
|
||||||
</VChip>
|
<VChipGroup column v-model="sortField">
|
||||||
</VChipGroup>
|
<VChip
|
||||||
</VListItem>
|
v-for="(title, key) in sortTitles"
|
||||||
<VListSubheader v-if="resolutionFilterOptions.length > 0"> 分辨率 </VListSubheader>
|
:key="key"
|
||||||
<VListItem>
|
:color="sortField === key ? 'primary' : ''"
|
||||||
<VChipGroup v-model="filterForm.resolution" column multiple>
|
filter
|
||||||
<VChip
|
variant="outlined"
|
||||||
v-for="resolution in resolutionFilterOptions"
|
:value="key"
|
||||||
:key="resolution"
|
>
|
||||||
:color="filterForm.resolution.includes(resolution) ? 'primary' : ''"
|
{{ title }}
|
||||||
filter
|
</VChip>
|
||||||
variant="outlined"
|
</VChipGroup>
|
||||||
:value="resolution"
|
</FilterOption>
|
||||||
>
|
<!-- 过滤选项 -->
|
||||||
{{ resolution }}
|
<FilterOption
|
||||||
</VChip>
|
v-for="(options, key) in filterOptionsNotEmpty"
|
||||||
</VChipGroup>
|
v-show="options.length > 0"
|
||||||
</VListItem>
|
:key="key"
|
||||||
<VListSubheader v-if="releaseGroupFilterOptions.length > 0"> 制作组 </VListSubheader>
|
:title="filterTitles[key]"
|
||||||
<VListItem>
|
>
|
||||||
<VChipGroup v-model="filterForm.releaseGroup" column multiple>
|
<VChipGroup v-model="filterForm[key]" column multiple>
|
||||||
<VChip
|
<VChip
|
||||||
v-for="releaseGroup in releaseGroupFilterOptions"
|
v-for="option in options"
|
||||||
:key="releaseGroup"
|
v-show="options.length > 0"
|
||||||
:color="filterForm.releaseGroup.includes(releaseGroup) ? 'primary' : ''"
|
:key="option"
|
||||||
filter
|
:color="filterForm[key].includes(option) ? 'primary' : ''"
|
||||||
variant="outlined"
|
filter
|
||||||
:value="releaseGroup"
|
variant="outlined"
|
||||||
>
|
:value="option"
|
||||||
{{ releaseGroup }}
|
>
|
||||||
</VChip>
|
{{ option }}
|
||||||
</VChipGroup>
|
</VChip>
|
||||||
</VListItem>
|
</VChipGroup>
|
||||||
<VListSubheader v-if="videoCodeFilterOptions.length > 0"> 视频编码 </VListSubheader>
|
</FilterOption>
|
||||||
<VListItem>
|
</VList>
|
||||||
<VChipGroup v-model="filterForm.videoCode" column multiple>
|
</VCard>
|
||||||
<VChip
|
</VDialog>
|
||||||
v-for="videoCode in videoCodeFilterOptions"
|
|
||||||
:key="videoCode"
|
<!-- 底部操作按钮 -->
|
||||||
:color="filterForm.videoCode.includes(videoCode) ? 'primary' : ''"
|
<div v-if="props.items">
|
||||||
filter
|
<VFab
|
||||||
variant="outlined"
|
v-if="!display.mdAndUp.value"
|
||||||
:value="videoCode"
|
icon="mdi-filter"
|
||||||
>
|
color="info"
|
||||||
{{ videoCode }}
|
location="bottom"
|
||||||
</VChip>
|
:class="appMode ? 'mb-28' : 'mb-16'"
|
||||||
</VChipGroup>
|
size="x-large"
|
||||||
</VListItem>
|
fixed
|
||||||
<VListSubheader v-if="freeStateFilterOptions.length > 0"> 促销状态 </VListSubheader>
|
app
|
||||||
<VListItem>
|
appear
|
||||||
<VChipGroup v-model="filterForm.freeState" column multiple>
|
@click="filterDialog = true"
|
||||||
<VChip
|
/>
|
||||||
v-for="freeState in freeStateFilterOptions"
|
</div>
|
||||||
:key="freeState"
|
</div>
|
||||||
:color="filterForm.freeState.includes(freeState) ? 'primary' : ''"
|
|
||||||
filter
|
|
||||||
variant="outlined"
|
|
||||||
:value="freeState"
|
|
||||||
>
|
|
||||||
{{ freeState }}
|
|
||||||
</VChip>
|
|
||||||
</VChipGroup>
|
|
||||||
</VListItem>
|
|
||||||
<VListSubheader v-if="seasonFilterOptions.length > 0"> 季集 </VListSubheader>
|
|
||||||
<VListItem>
|
|
||||||
<VChipGroup v-model="filterForm.season" column multiple>
|
|
||||||
<VChip
|
|
||||||
v-for="season in sortSeasonFilterOptions"
|
|
||||||
:key="season"
|
|
||||||
:color="filterForm.season.includes(season) ? 'primary' : ''"
|
|
||||||
filter
|
|
||||||
variant="outlined"
|
|
||||||
:value="season"
|
|
||||||
>
|
|
||||||
{{ season }}
|
|
||||||
</VChip>
|
|
||||||
</VChipGroup>
|
|
||||||
</VListItem>
|
|
||||||
</VList>
|
|
||||||
</VCol>
|
|
||||||
</VRow>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ watch(
|
|||||||
</VRow>
|
</VRow>
|
||||||
|
|
||||||
<!-- 双重验证弹窗 -->
|
<!-- 双重验证弹窗 -->
|
||||||
<VDialog v-model="otpDialog" max-width="45rem" persistent scrollable>
|
<VDialog v-if="otpDialog" v-model="otpDialog" max-width="45rem" persistent scrollable>
|
||||||
<!-- 开启双重验证弹窗内容 -->
|
<!-- 开启双重验证弹窗内容 -->
|
||||||
<VCard>
|
<VCard>
|
||||||
<DialogCloseBtn @click="otpDialog = false" />
|
<DialogCloseBtn @click="otpDialog = false" />
|
||||||
|
|||||||
Reference in New Issue
Block a user