mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-07 08:46:40 +08:00
fix:季集判断
This commit is contained in:
@@ -290,6 +290,8 @@ export interface MediaInfo {
|
|||||||
next_episode_to_air?: object
|
next_episode_to_air?: object
|
||||||
// 别名
|
// 别名
|
||||||
names?: string[]
|
names?: string[]
|
||||||
|
// 剧集组
|
||||||
|
episode_group?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 季信息
|
// 季信息
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const siteFilter = ref('')
|
|||||||
const selectedSites = ref<any[]>(props.selected || [])
|
const selectedSites = ref<any[]>(props.selected || [])
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (!selectedSites.value && props.selected){
|
if (selectedSites.value.length == 0 && props.selected) {
|
||||||
selectedSites.value = props.selected
|
selectedSites.value = props.selected
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -52,7 +52,7 @@ const filteredSites = computed(() => {
|
|||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<!-- 手动整理进度框 -->
|
<!-- 手动整理进度框 -->
|
||||||
<VDialog max-width="40rem" persistent fullscreen-mobile>
|
<VDialog max-width="40rem" fullscreen-mobile>
|
||||||
<VCard class="site-dialog">
|
<VCard class="site-dialog">
|
||||||
<VCardTitle class="d-flex align-center pa-4">
|
<VCardTitle class="d-flex align-center pa-4">
|
||||||
<span class="text-h6 font-weight-medium">选择搜索站点</span>
|
<span class="text-h6 font-weight-medium">选择搜索站点</span>
|
||||||
|
|||||||
@@ -10,10 +10,6 @@ const emit = defineEmits(['subscribe', 'close'])
|
|||||||
// 定义输入
|
// 定义输入
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
media: Object as PropType<MediaInfo>,
|
media: Object as PropType<MediaInfo>,
|
||||||
noexists: {
|
|
||||||
type: Object as PropType<{ [key: number]: number }>,
|
|
||||||
default: {},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 从 provide 中获取全局设置
|
// 从 provide 中获取全局设置
|
||||||
@@ -35,7 +31,7 @@ const isRefreshed = ref(false)
|
|||||||
const episodeGroups = ref<{ [key: string]: any }[]>([])
|
const episodeGroups = ref<{ [key: string]: any }[]>([])
|
||||||
|
|
||||||
// 当前选择剧集组
|
// 当前选择剧集组
|
||||||
const episodeGroup = ref(0)
|
const episodeGroup = ref('')
|
||||||
|
|
||||||
// 剧集组选项属性
|
// 剧集组选项属性
|
||||||
function episodeGroupItemProps(item: { title: string; subtitle: string }) {
|
function episodeGroupItemProps(item: { title: string; subtitle: string }) {
|
||||||
@@ -47,7 +43,7 @@ function episodeGroupItemProps(item: { title: string; subtitle: string }) {
|
|||||||
|
|
||||||
// 剧集组选项
|
// 剧集组选项
|
||||||
const episodeGroupOptions = computed(() => {
|
const episodeGroupOptions = computed(() => {
|
||||||
let options = (episodeGroups.value as { id: number; name: string; group_count: number; episode_count: number }[]).map(
|
let options = (episodeGroups.value as { id: string; name: string; group_count: number; episode_count: number }[]).map(
|
||||||
item => {
|
item => {
|
||||||
return {
|
return {
|
||||||
title: item.name,
|
title: item.name,
|
||||||
@@ -60,7 +56,7 @@ const episodeGroupOptions = computed(() => {
|
|||||||
options.unshift({
|
options.unshift({
|
||||||
title: '默认',
|
title: '默认',
|
||||||
subtitle: `${seasonInfos.value.length} 季`,
|
subtitle: `${seasonInfos.value.length} 季`,
|
||||||
value: 0,
|
value: '',
|
||||||
})
|
})
|
||||||
return options
|
return options
|
||||||
})
|
})
|
||||||
@@ -115,7 +111,10 @@ async function getGroupSeasons() {
|
|||||||
async function checkSeasonsNotExists() {
|
async function checkSeasonsNotExists() {
|
||||||
// 开始处理
|
// 开始处理
|
||||||
try {
|
try {
|
||||||
const result: NotExistMediaInfo[] = await api.post('mediaserver/notexists', props.media)
|
let tmpMedia = props.media ?? { episode_group: '' }
|
||||||
|
if (episodeGroup.value) tmpMedia.episode_group = episodeGroup.value
|
||||||
|
else tmpMedia.episode_group = ''
|
||||||
|
const result: NotExistMediaInfo[] = await api.post('mediaserver/notexists', tmpMedia)
|
||||||
if (result) {
|
if (result) {
|
||||||
result.forEach(item => {
|
result.forEach(item => {
|
||||||
// 0-已入库 1-部分缺失 2-全部缺失
|
// 0-已入库 1-部分缺失 2-全部缺失
|
||||||
@@ -132,7 +131,7 @@ async function checkSeasonsNotExists() {
|
|||||||
|
|
||||||
// 计算存在状态的颜色
|
// 计算存在状态的颜色
|
||||||
function getExistColor(season: number) {
|
function getExistColor(season: number) {
|
||||||
const state = props.noexists[season]
|
const state = seasonsNotExisted.value[season]
|
||||||
if (!state) return 'success'
|
if (!state) return 'success'
|
||||||
|
|
||||||
if (state === 1) return 'warning'
|
if (state === 1) return 'warning'
|
||||||
@@ -142,7 +141,7 @@ function getExistColor(season: number) {
|
|||||||
|
|
||||||
// 计算存在状态的文本
|
// 计算存在状态的文本
|
||||||
function getExistText(season: number) {
|
function getExistText(season: number) {
|
||||||
const state = props.noexists[season]
|
const state = seasonsNotExisted.value[season]
|
||||||
if (!state) return '已入库'
|
if (!state) return '已入库'
|
||||||
|
|
||||||
if (state === 1) return '部分缺失'
|
if (state === 1) return '部分缺失'
|
||||||
@@ -177,6 +176,7 @@ function subscribeSeasons() {
|
|||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (episodeGroup.value) getGroupSeasons()
|
if (episodeGroup.value) getGroupSeasons()
|
||||||
else getMediaSeasons()
|
else getMediaSeasons()
|
||||||
|
checkSeasonsNotExists()
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
@@ -233,7 +233,12 @@ onMounted(async () => {
|
|||||||
《{{ media?.title }}》第 {{ item.season_number }} 季于 {{ formatAirDate(item.air_date || '') }} 首播。
|
《{{ media?.title }}》第 {{ item.season_number }} 季于 {{ formatAirDate(item.air_date || '') }} 首播。
|
||||||
</VListItemSubtitle>
|
</VListItemSubtitle>
|
||||||
<VListItemSubtitle>
|
<VListItemSubtitle>
|
||||||
<VChip v-if="noexists" class="mt-2" size="small" :color="getExistColor(item.season_number || 0)">
|
<VChip
|
||||||
|
v-if="seasonsNotExisted"
|
||||||
|
class="mt-2"
|
||||||
|
size="small"
|
||||||
|
:color="getExistColor(item.season_number || 0)"
|
||||||
|
>
|
||||||
{{ getExistText(item.season_number || 0) }}
|
{{ getExistText(item.season_number || 0) }}
|
||||||
</VChip>
|
</VChip>
|
||||||
</VListItemSubtitle>
|
</VListItemSubtitle>
|
||||||
|
|||||||
Reference in New Issue
Block a user