mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
fix ui
This commit is contained in:
@@ -109,3 +109,41 @@ export function formatBytes(bytes: number, decimals = 2) {
|
|||||||
|
|
||||||
return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`
|
return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 格式化剧集列表
|
||||||
|
export function formatEp(nums: number[]): string {
|
||||||
|
if (!nums.length)
|
||||||
|
return ''
|
||||||
|
|
||||||
|
if (nums.length === 1)
|
||||||
|
return nums[0].toString()
|
||||||
|
|
||||||
|
// 将数组升序排序
|
||||||
|
nums.sort((a, b) => a - b)
|
||||||
|
const formattedRanges: string[] = []
|
||||||
|
let start = nums[0]
|
||||||
|
let end = nums[0]
|
||||||
|
|
||||||
|
for (let i = 1; i < nums.length; i++) {
|
||||||
|
if (nums[i] === end + 1) {
|
||||||
|
end = nums[i]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (start === end)
|
||||||
|
formattedRanges.push(start.toString())
|
||||||
|
|
||||||
|
else
|
||||||
|
formattedRanges.push(`${start.toString()}-${end.toString()}`)
|
||||||
|
|
||||||
|
start = end = nums[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (start === end)
|
||||||
|
formattedRanges.push(start.toString())
|
||||||
|
|
||||||
|
else
|
||||||
|
formattedRanges.push(`${start.toString()}-${end.toString()}`)
|
||||||
|
|
||||||
|
return formattedRanges.join('、')
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,6 +2,7 @@ import { createApp } from 'vue'
|
|||||||
import '@/@iconify/icons-bundle'
|
import '@/@iconify/icons-bundle'
|
||||||
import ToastPlugin from 'vue-toast-notification'
|
import ToastPlugin from 'vue-toast-notification'
|
||||||
import VuetifyUseDialog from 'vuetify-use-dialog'
|
import VuetifyUseDialog from 'vuetify-use-dialog'
|
||||||
|
import { removeEl } from './@core/utils/dom'
|
||||||
import App from '@/App.vue'
|
import App from '@/App.vue'
|
||||||
import vuetify from '@/plugins/vuetify'
|
import vuetify from '@/plugins/vuetify'
|
||||||
import { loadFonts } from '@/plugins/webfontloader'
|
import { loadFonts } from '@/plugins/webfontloader'
|
||||||
@@ -11,7 +12,6 @@ import '@core/scss/template/index.scss'
|
|||||||
import '@layouts/styles/index.scss'
|
import '@layouts/styles/index.scss'
|
||||||
import '@styles/styles.scss'
|
import '@styles/styles.scss'
|
||||||
import 'vue-toast-notification/dist/theme-bootstrap.css'
|
import 'vue-toast-notification/dist/theme-bootstrap.css'
|
||||||
import { removeEl } from '@/util'
|
|
||||||
|
|
||||||
loadFonts()
|
loadFonts()
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,6 @@
|
|||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
:root{
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei UI", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nprogress .bar {
|
#nprogress .bar {
|
||||||
background: rgb(var(--v-theme-primary)) !important;
|
background: rgb(var(--v-theme-primary)) !important;
|
||||||
top: env(safe-area-inset-top) !important;
|
top: env(safe-area-inset-top) !important;
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from './dom'
|
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useDefer } from '@/util'
|
|
||||||
import type { Context } from '@/api/types'
|
import type { Context } from '@/api/types'
|
||||||
import TorrentCard from '@/components/cards/TorrentCard.vue'
|
import TorrentCard from '@/components/cards/TorrentCard.vue'
|
||||||
|
import { useDefer } from '@/@core/utils/dom'
|
||||||
|
|
||||||
interface SearchTorrent extends Context {
|
interface SearchTorrent extends Context {
|
||||||
more?: Array<Context>
|
more?: Array<Context>
|
||||||
|
|||||||
@@ -106,14 +106,14 @@ onMounted(() => {
|
|||||||
<VListItemTitle>没有附合当前过滤条件的资源。</VListItemTitle>
|
<VListItemTitle>没有附合当前过滤条件的资源。</VListItemTitle>
|
||||||
</VListItem>
|
</VListItem>
|
||||||
</VList>
|
</VList>
|
||||||
<v-virtual-scroll lines="three" class="rounded" :items="dataList" height="calc(100vh - 156px)">
|
<TorrentItem
|
||||||
<template #default="{ item }">
|
v-for="(item, index) in dataList"
|
||||||
<TorrentItem :torrent="item" />
|
:key="`${index}_${item.torrent_info.title}_${item.torrent_info.site}`"
|
||||||
</template>
|
:torrent="item"
|
||||||
</v-virtual-scroll>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
<VCol xl="2" md="3" class="d-none d-md-block">
|
<VCol xl="2" md="3" class="d-none d-md-block">
|
||||||
<VList lines="one" class="rounded" height="calc(100vh - 156px)">
|
<VList lines="one" class="rounded">
|
||||||
<VListSubheader v-if="siteFilterOptions.length > 0">
|
<VListSubheader v-if="siteFilterOptions.length > 0">
|
||||||
站点
|
站点
|
||||||
</VListSubheader>
|
</VListSubheader>
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import interactionPlugin from '@fullcalendar/interaction'
|
|||||||
import timeGridPlugin from '@fullcalendar/timegrid'
|
import timeGridPlugin from '@fullcalendar/timegrid'
|
||||||
import FullCalendar from '@fullcalendar/vue3'
|
import FullCalendar from '@fullcalendar/vue3'
|
||||||
import type { Ref } from 'vue'
|
import type { Ref } from 'vue'
|
||||||
import type { MediaInfo, Rss, Subscribe, TmdbEpisode } from '@/api/types'
|
import type { MediaInfo, Subscribe, TmdbEpisode } from '@/api/types'
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import { parseDate } from '@/@core/utils/formatters'
|
import { formatEp, parseDate } from '@/@core/utils/formatters'
|
||||||
|
|
||||||
// 日历属性
|
// 日历属性
|
||||||
const calendarOptions: Ref<CalendarOptions> = ref({
|
const calendarOptions: Ref<CalendarOptions> = ref({
|
||||||
@@ -33,7 +33,7 @@ const calendarOptions: Ref<CalendarOptions> = ref({
|
|||||||
events: [],
|
events: [],
|
||||||
})
|
})
|
||||||
|
|
||||||
async function eventsHander(subscribe: Subscribe | Rss) {
|
async function eventsHander(subscribe: Subscribe) {
|
||||||
// 如果是电影直接返回
|
// 如果是电影直接返回
|
||||||
if (subscribe.type === '电影') {
|
if (subscribe.type === '电影') {
|
||||||
// 调用API查询TMDB详情
|
// 调用API查询TMDB详情
|
||||||
@@ -62,7 +62,7 @@ async function eventsHander(subscribe: Subscribe | Rss) {
|
|||||||
subtitle: string
|
subtitle: string
|
||||||
start: Date | null
|
start: Date | null
|
||||||
allDay: boolean
|
allDay: boolean
|
||||||
posterPath: string
|
posterPath: string | undefined
|
||||||
mediaType: string
|
mediaType: string
|
||||||
len: number
|
len: number
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ async function eventsHander(subscribe: Subscribe | Rss) {
|
|||||||
else {
|
else {
|
||||||
dictEpisode[air_date] = {
|
dictEpisode[air_date] = {
|
||||||
title: subscribe.name,
|
title: subscribe.name,
|
||||||
subtitle: `第${episode.episode_number}`,
|
subtitle: `${episode.episode_number}`,
|
||||||
start: parseDate(episode.air_date || ''),
|
start: parseDate(episode.air_date || ''),
|
||||||
allDay: false,
|
allDay: false,
|
||||||
posterPath: subscribe.poster,
|
posterPath: subscribe.poster,
|
||||||
@@ -90,10 +90,8 @@ async function eventsHander(subscribe: Subscribe | Rss) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
for (const key in dictEpisode) {
|
for (const key in dictEpisode)
|
||||||
if (dictEpisode.hasOwnProperty(key))
|
dictEpisode[key].subtitle = formatEp(dictEpisode[key].subtitle.split(',').map(Number))
|
||||||
dictEpisode[key].subtitle += '集'
|
|
||||||
}
|
|
||||||
|
|
||||||
return Object.values(dictEpisode)
|
return Object.values(dictEpisode)
|
||||||
}
|
}
|
||||||
@@ -148,11 +146,8 @@ onMounted(() => {
|
|||||||
<VCardSubtitle class="pa-1 px-2 font-bold break-words whitespace-break-spaces">
|
<VCardSubtitle class="pa-1 px-2 font-bold break-words whitespace-break-spaces">
|
||||||
{{ arg.event.title }}
|
{{ arg.event.title }}
|
||||||
</VCardSubtitle>
|
</VCardSubtitle>
|
||||||
<VCardText class="pa-0 px-2">
|
<VCardText v-if="arg.event.extendedProps.subtitle" class="pa-0 px-2 break-words">
|
||||||
{{ arg.event.extendedProps.len }}集
|
第{{ arg.event.extendedProps.subtitle }}集
|
||||||
</VCardText>
|
|
||||||
<VCardText class="pa-0 px-2 break-words">
|
|
||||||
{{ arg.event.extendedProps.subtitle }}
|
|
||||||
</VCardText>
|
</VCardText>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -178,8 +173,9 @@ onMounted(() => {
|
|||||||
<VChip
|
<VChip
|
||||||
v-if="arg.event.extendedProps.len > 1"
|
v-if="arg.event.extendedProps.len > 1"
|
||||||
variant="elevated"
|
variant="elevated"
|
||||||
size="mini"
|
color="primary"
|
||||||
class="absolute right-0.5 top-0.5 bg-opacity-80 shadow-md text-white font-bold border-purple-600 bg-purple-600"
|
size="x-small"
|
||||||
|
class="absolute right-0 top-0"
|
||||||
>
|
>
|
||||||
{{ arg.event.extendedProps.len }}
|
{{ arg.event.extendedProps.len }}
|
||||||
</VChip>
|
</VChip>
|
||||||
|
|||||||
Reference in New Issue
Block a user