mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-06-18 06:00:31 +08:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33599cc21d | ||
|
|
bf22a4809d | ||
|
|
4a6f7390e6 | ||
|
|
405e460ad6 | ||
|
|
18566c0e9d | ||
|
|
2c471a936f | ||
|
|
2efb07402f | ||
|
|
9434ef71e4 | ||
|
|
e06b9537ff | ||
|
|
2829e3b082 | ||
|
|
1a0fc10559 | ||
|
|
5a1aec3323 | ||
|
|
48913b8811 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "moviepilot",
|
||||
"version": "2.13.9",
|
||||
"version": "2.13.10",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"bin": "dist/service.js",
|
||||
|
||||
12
scripts/check-season-label.ts
Normal file
12
scripts/check-season-label.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import assert from 'node:assert/strict'
|
||||
|
||||
import { formatSeasonLabel } from '../src/@core/utils/season.ts'
|
||||
|
||||
assert.equal(formatSeasonLabel(0, '特别篇'), '特别篇')
|
||||
assert.equal(formatSeasonLabel('0', 'Specials'), 'Specials')
|
||||
assert.equal(formatSeasonLabel(1, '特别篇'), 'S01')
|
||||
assert.equal(formatSeasonLabel('12', '特别篇'), 'S12')
|
||||
assert.equal(formatSeasonLabel(null, '特别篇'), '')
|
||||
assert.equal(formatSeasonLabel(undefined, '特别篇'), '')
|
||||
|
||||
console.log('season label checks passed')
|
||||
15
src/@core/utils/season.ts
Normal file
15
src/@core/utils/season.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 格式化用户可见的季标签。
|
||||
*
|
||||
* TMDB 使用季号 0 表示特别季;调用方传入当前语言的特别季名称,
|
||||
* 其余季号保持 MoviePilot 现有的 Sxx 展示口径。
|
||||
*/
|
||||
export function formatSeasonLabel(
|
||||
season: number | string | null | undefined,
|
||||
specialsLabel: string,
|
||||
): string {
|
||||
if (season === null || season === undefined || season === '') return ''
|
||||
if (Number(season) === 0) return specialsLabel
|
||||
|
||||
return `S${String(season).padStart(2, '0')}`
|
||||
}
|
||||
@@ -170,6 +170,10 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
.layout-wrapper.layout-nav-type-vertical {
|
||||
--layout-navbar-block-size: calc(
|
||||
env(safe-area-inset-top, 0px) + #{variables.$layout-vertical-nav-navbar-height} + var(--navbar-tab-height)
|
||||
);
|
||||
|
||||
// TODO(v2): Check why we need height in vertical nav & min-height in horizontal nav
|
||||
min-block-size: 100%;
|
||||
|
||||
@@ -185,13 +189,16 @@ export default defineComponent({
|
||||
.layout-navbar {
|
||||
position: fixed;
|
||||
z-index: variables.$layout-vertical-nav-layout-navbar-z-index;
|
||||
// iOS Safari 在地址栏收起和惯性滚动时可能把 fixed 顶栏和页面滚动层合成到一起,
|
||||
// 单独提升顶栏图层可避免导航栏短暂上移到安全区下方。
|
||||
backface-visibility: hidden;
|
||||
block-size: var(--layout-navbar-block-size);
|
||||
inline-size: calc(100vw - variables.$layout-vertical-nav-width - 0.5rem);
|
||||
inset-block-start: 0;
|
||||
transform: translate3d(0, 0, 0);
|
||||
|
||||
.navbar-content-container {
|
||||
block-size: calc(
|
||||
env(safe-area-inset-top) + variables.$layout-vertical-nav-navbar-height + var(--navbar-tab-height)
|
||||
);
|
||||
block-size: var(--layout-navbar-block-size);
|
||||
}
|
||||
|
||||
@at-root {
|
||||
|
||||
@@ -15,7 +15,7 @@ body {
|
||||
background: rgb(var(--v-theme-background));
|
||||
overscroll-behavior-y: contain;
|
||||
|
||||
--webkit-overflow-scrolling: touch;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
body,
|
||||
|
||||
@@ -49,7 +49,7 @@ export interface Subscribe {
|
||||
// 已完成集数(普通订阅 = 已入库集数,洗版订阅 = 起始集前 + [start, total] 范围内 priority==100 命中数)
|
||||
completed_episode?: number
|
||||
// 附加信息
|
||||
note?: string
|
||||
note?: string | number[]
|
||||
// 状态:N-新建 R-订阅中 P-待定 S-暂停
|
||||
state: string
|
||||
// 最后更新时间
|
||||
|
||||
@@ -577,6 +577,7 @@ onBeforeUnmount(() => {
|
||||
<!--来源图标-->
|
||||
<VAvatar
|
||||
size="24"
|
||||
variant="plain"
|
||||
density="compact"
|
||||
class="absolute bottom-1 right-1"
|
||||
tile
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<script lang="ts" setup>
|
||||
import { useToast } from 'vue-toastification'
|
||||
import { useConfirm } from '@/composables/useConfirm'
|
||||
import { formatDateDifference, formatSeason } from '@/@core/utils/formatters'
|
||||
import { formatDateDifference } from '@/@core/utils/formatters'
|
||||
import { formatSeasonLabel } from '@/@core/utils/season'
|
||||
import api from '@/api'
|
||||
import type { Subscribe } from '@/api/types'
|
||||
import router from '@/router'
|
||||
@@ -478,7 +479,7 @@ function handleCardClick() {
|
||||
<div class="text-sm font-medium text-white sm:pt-1">{{ props.media?.year }}</div>
|
||||
<div class="mr-2 min-w-0 text-lg font-bold text-white text-ellipsis overflow-hidden line-clamp-2 ...">
|
||||
{{ props.media?.name }}
|
||||
{{ formatSeason(props.media?.season ? props.media?.season.toString() : '') }}
|
||||
{{ formatSeasonLabel(props.media?.season, t('media.specials')) }}
|
||||
</div>
|
||||
</div>
|
||||
</VCardText>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useDisplay } from 'vuetify'
|
||||
import { checkPWAStatus, isPWADisplayMode } from '@/@core/utils/navigator'
|
||||
import { checkPWAStatus, isMobileDevice, isPWADisplayMode } from '@/@core/utils/navigator'
|
||||
|
||||
// 全局PWA状态,确保只初始化一次
|
||||
const globalPwaStatus = ref<{
|
||||
@@ -34,11 +34,14 @@ async function initializePWAGlobally() {
|
||||
globalPwaStatus.value = await checkPWAStatus()
|
||||
} catch (error) {
|
||||
console.error('Failed to detect PWA status', error)
|
||||
const isStandaloneMode = isPWADisplayMode()
|
||||
|
||||
// 即使检测失败,也设置一个合理的默认值
|
||||
globalPwaStatus.value = {
|
||||
hasPWAFeatures: false,
|
||||
isStandaloneMode: isPWADisplayMode(),
|
||||
isPWAEnvironment: isPWADisplayMode(),
|
||||
isStandaloneMode,
|
||||
// iOS Safari 浏览器模式可能取不到 Service Worker 注册信息,但移动端仍应使用 App 交互。
|
||||
isPWAEnvironment: isStandaloneMode || isMobileDevice(),
|
||||
isFullPWA: false,
|
||||
}
|
||||
} finally {
|
||||
@@ -56,7 +59,8 @@ export function usePWA() {
|
||||
|
||||
// 基于新的PWA状态结构
|
||||
const pwaMode = computed(() => {
|
||||
return globalPwaStatus.value?.isPWAEnvironment ?? false
|
||||
// PWA 状态异步恢复前先用移动端特征兜底,避免 Safari 浏览器首屏阶段缺少移动端交互。
|
||||
return globalPwaStatus.value?.isPWAEnvironment ?? isMobileDevice()
|
||||
})
|
||||
|
||||
const appMode = computed(() => {
|
||||
|
||||
@@ -85,7 +85,10 @@ export function usePullDownGesture(options: PullDownOptions = {}) {
|
||||
})
|
||||
|
||||
const indicatorTransform = computed(() => {
|
||||
return `translate(-50%, ${Math.min(60 + pullDistance.value - config.SHOW_INDICATOR, 70)}px)`
|
||||
// 顶部基准位置由布局 CSS 负责,这里只让指示器跟随下拉手势轻微移动。
|
||||
const followOffset = Math.min(Math.max(pullDistance.value - config.SHOW_INDICATOR, 0), 16)
|
||||
|
||||
return `translate3d(-50%, ${followOffset}px, 0)`
|
||||
})
|
||||
|
||||
// 弹窗检测函数
|
||||
|
||||
@@ -82,14 +82,14 @@ const horizontalNavGroups = computed(() =>
|
||||
)
|
||||
|
||||
const navbarExtraHeight = computed(() => {
|
||||
const dynamicTabHeight = showDynamicHeaderTab.value ? 2.5 : 0
|
||||
const dynamicTabHeight = showDynamicHeaderTab.value ? 2.75 : 0
|
||||
const horizontalNavHeight = showHorizontalThemeNav.value ? 3.25 : 0
|
||||
|
||||
return `${dynamicTabHeight + horizontalNavHeight}rem`
|
||||
})
|
||||
|
||||
const mainContentPaddingTop = computed(() => {
|
||||
const dynamicTabPadding = showDynamicHeaderTab.value ? 3 : 0
|
||||
const dynamicTabPadding = showDynamicHeaderTab.value ? 3.25 : 0
|
||||
const horizontalNavPadding = showHorizontalThemeNav.value ? 3.5 : 0
|
||||
|
||||
return `${dynamicTabPadding + horizontalNavPadding}rem`
|
||||
@@ -320,7 +320,7 @@ function closeHorizontalNavGroup() {
|
||||
}
|
||||
|
||||
function resolveMaybeRefValue<T>(value: T | ComputedRef<T> | undefined, fallback: T): T {
|
||||
return isRef(value) ? value.value : value ?? fallback
|
||||
return isRef(value) ? value.value : (value ?? fallback)
|
||||
}
|
||||
|
||||
function resolveHeaderButtonColor(button: DynamicHeaderTabButton) {
|
||||
@@ -452,6 +452,7 @@ onMounted(async () => {
|
||||
v-if="appMode && showPullIndicator"
|
||||
class="pull-indicator"
|
||||
:style="{
|
||||
'--pull-indicator-navbar-extra-height': navbarExtraHeight,
|
||||
opacity: indicatorOpacity,
|
||||
transform: indicatorTransform,
|
||||
}"
|
||||
@@ -475,7 +476,7 @@ onMounted(async () => {
|
||||
<!-- 👉 Navbar -->
|
||||
<template #navbar="{ toggleVerticalOverlayNavActive }">
|
||||
<div
|
||||
class="theme-navbar-row d-flex h-14 align-center mx-1"
|
||||
class="theme-navbar-row d-flex h-16 align-center mx-1"
|
||||
:class="{ 'theme-navbar-row--horizontal': showHorizontalThemeNav }"
|
||||
>
|
||||
<RouterLink v-if="showHorizontalThemeNav" :to="canAdmin ? '/dashboard' : '/apps'" class="theme-horizontal-logo">
|
||||
@@ -694,6 +695,8 @@ onMounted(async () => {
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* stylelint-disable selector-pseudo-class-no-unknown */
|
||||
|
||||
.main-content-wrapper {
|
||||
backface-visibility: hidden;
|
||||
block-size: 100%;
|
||||
@@ -707,6 +710,10 @@ onMounted(async () => {
|
||||
margin-inline: 0 !important;
|
||||
}
|
||||
|
||||
:deep(.layout-dynamic-header-tab) {
|
||||
padding-block-end: 0.25rem;
|
||||
}
|
||||
|
||||
.theme-horizontal-logo {
|
||||
display: inline-flex;
|
||||
flex: 0 0 auto;
|
||||
@@ -769,10 +776,10 @@ onMounted(async () => {
|
||||
|
||||
.theme-horizontal-nav {
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
align-items: center;
|
||||
block-size: 3.25rem;
|
||||
gap: 0.25rem;
|
||||
overflow-x: auto;
|
||||
padding-block: 0.25rem 0.5rem;
|
||||
padding-inline: 0.5rem;
|
||||
scrollbar-width: none;
|
||||
@@ -801,6 +808,7 @@ onMounted(async () => {
|
||||
|
||||
.pull-indicator {
|
||||
position: fixed;
|
||||
z-index: 20;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -808,12 +816,19 @@ onMounted(async () => {
|
||||
border-radius: 50%;
|
||||
backdrop-filter: blur(20px);
|
||||
background: rgba(var(--v-theme-surface), 0.3);
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 10%), 0 1px 3px rgba(0, 0, 0, 6%);
|
||||
inset-block-start: 80px;
|
||||
box-shadow:
|
||||
0 1px 2px rgba(0, 0, 0, 10%),
|
||||
0 1px 3px rgba(0, 0, 0, 6%);
|
||||
inset-block-start: calc(
|
||||
env(safe-area-inset-top, 0px) + 4rem + var(--pull-indicator-navbar-extra-height, 0rem) + 0.75rem
|
||||
);
|
||||
inset-inline-start: 50%;
|
||||
pointer-events: none;
|
||||
transform: translateX(-50%);
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transform: translate3d(-50%, 0, 0);
|
||||
transition:
|
||||
opacity 0.2s ease,
|
||||
transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
will-change: opacity, transform;
|
||||
}
|
||||
|
||||
.indicator-icon {
|
||||
@@ -833,7 +848,9 @@ html[class*='mica'] .pull-indicator,
|
||||
html[class*='acrylic'] .pull-indicator {
|
||||
border: 1px solid rgba(255, 255, 255, 20%);
|
||||
background: rgba(255, 255, 255, 95%);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 12%), 0 4px 16px rgba(0, 0, 0, 8%);
|
||||
box-shadow:
|
||||
0 8px 32px rgba(0, 0, 0, 12%),
|
||||
0 4px 16px rgba(0, 0, 0, 8%);
|
||||
}
|
||||
|
||||
html[class*='transparent'] .indicator-icon,
|
||||
@@ -847,7 +864,9 @@ html[data-theme='dark'][class*='mica'] .pull-indicator,
|
||||
html[data-theme='dark'][class*='acrylic'] .pull-indicator {
|
||||
border: 1px solid rgba(255, 255, 255, 10%);
|
||||
background: rgba(18, 18, 18, 95%);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 30%), 0 4px 16px rgba(0, 0, 0, 20%);
|
||||
box-shadow:
|
||||
0 8px 32px rgba(0, 0, 0, 30%),
|
||||
0 4px 16px rgba(0, 0, 0, 20%);
|
||||
}
|
||||
|
||||
html[data-theme='dark'][class*='transparent'] .indicator-icon,
|
||||
|
||||
@@ -281,6 +281,8 @@ export default {
|
||||
},
|
||||
login: {
|
||||
wallpapers: 'Wallpapers',
|
||||
tagline: 'Your smart media library',
|
||||
copyright: '© {year} MoviePilot',
|
||||
username: 'Username',
|
||||
password: 'Password',
|
||||
otpCode: 'Verification Code',
|
||||
@@ -950,6 +952,7 @@ export default {
|
||||
minutes: 'minutes',
|
||||
overview: 'Overview',
|
||||
seasons: 'Seasons',
|
||||
specials: 'Specials',
|
||||
seasonNumber: 'Season {number}',
|
||||
episodeCount: '{count} Episodes',
|
||||
actions: {
|
||||
@@ -1160,6 +1163,12 @@ export default {
|
||||
},
|
||||
calendar: {
|
||||
episode: 'Episode {number}',
|
||||
libraryProgress: 'In library {completed}/{total}',
|
||||
currentEpisodeInLibrary: 'Current in library',
|
||||
currentEpisodePartiallyInLibrary: 'Partially in library',
|
||||
currentEpisodeNotInLibrary: 'Current not in library',
|
||||
libraryUpdatedAt: 'Updated {time}',
|
||||
libraryUpdatedAtShort: '{time}',
|
||||
},
|
||||
storage: {
|
||||
name: 'Name',
|
||||
@@ -1571,7 +1580,7 @@ export default {
|
||||
llmTestFailedToastWithMessage: 'LLM test call failed: {message}',
|
||||
aiAgentGlobal: 'Global AI Assistant',
|
||||
aiAgentGlobalHint:
|
||||
'Enable global AI assistant functionality, all message conversations will be answered by the AI agent without using the /ai command',
|
||||
'Global AI Assistant On: AI assistant by default. Use /noai for traditional search; Global AI Assistant Off: Traditional search by default. Use /ai for AI assistant.',
|
||||
aiAgentJobInterval: 'Scheduled Wake',
|
||||
aiAgentJobIntervalHint:
|
||||
'Set the check interval for scheduled wake. Select "Disabled" to disable scheduled tasks.',
|
||||
|
||||
@@ -280,6 +280,8 @@ export default {
|
||||
},
|
||||
login: {
|
||||
wallpapers: '壁纸',
|
||||
tagline: '你的智能影视媒体库',
|
||||
copyright: '© {year} MoviePilot',
|
||||
username: '用户名',
|
||||
password: '密码',
|
||||
otpCode: '验证码',
|
||||
@@ -946,6 +948,7 @@ export default {
|
||||
minutes: '分钟',
|
||||
overview: '简介',
|
||||
seasons: '季',
|
||||
specials: '特别篇',
|
||||
seasonNumber: '第 {number} 季',
|
||||
episodeCount: '{count}集',
|
||||
actions: {
|
||||
@@ -1155,6 +1158,12 @@ export default {
|
||||
},
|
||||
calendar: {
|
||||
episode: '第{number}集',
|
||||
libraryProgress: '已入库 {completed}/{total}',
|
||||
currentEpisodeInLibrary: '本集已入库',
|
||||
currentEpisodePartiallyInLibrary: '本集部分入库',
|
||||
currentEpisodeNotInLibrary: '本集未入库',
|
||||
libraryUpdatedAt: '最近更新 {time}',
|
||||
libraryUpdatedAtShort: '{time}',
|
||||
},
|
||||
storage: {
|
||||
name: '名称',
|
||||
@@ -1558,7 +1567,7 @@ export default {
|
||||
llmTestFailedToast: 'LLM 调用测试失败',
|
||||
llmTestFailedToastWithMessage: 'LLM 调用测试失败:{message}',
|
||||
aiAgentGlobal: '全局智能助手',
|
||||
aiAgentGlobalHint: '启用全局智能助手功能,所有消息对话均使用智能体回答而不用使用/ai命令',
|
||||
aiAgentGlobalHint: '启用全局智能助手:默认使用智能体交互,使用 /noai 临时使用传统交互;关闭全局智能助手:默认使用传统交互,使用 /ai 临时使用智能体交互',
|
||||
aiAgentJobInterval: '定时唤醒',
|
||||
aiAgentJobIntervalHint: '设置定时唤醒的检查间隔,选择"不启用"则不执行定时任务',
|
||||
aiAgentVerbose: '啰嗦模式',
|
||||
|
||||
@@ -280,6 +280,8 @@ export default {
|
||||
},
|
||||
login: {
|
||||
wallpapers: '壁紙',
|
||||
tagline: '你的智能影視媒體庫',
|
||||
copyright: '© {year} MoviePilot',
|
||||
username: '用戶名',
|
||||
password: '密碼',
|
||||
otpCode: '驗證碼',
|
||||
@@ -946,6 +948,7 @@ export default {
|
||||
minutes: '分鐘',
|
||||
overview: '簡介',
|
||||
seasons: '季',
|
||||
specials: '特別篇',
|
||||
seasonNumber: '第 {number} 季',
|
||||
episodeCount: '{count}集',
|
||||
actions: {
|
||||
@@ -1155,6 +1158,12 @@ export default {
|
||||
},
|
||||
calendar: {
|
||||
episode: '第{number}集',
|
||||
libraryProgress: '已入庫 {completed}/{total}',
|
||||
currentEpisodeInLibrary: '本集已入庫',
|
||||
currentEpisodePartiallyInLibrary: '本集部分入庫',
|
||||
currentEpisodeNotInLibrary: '本集未入庫',
|
||||
libraryUpdatedAt: '最近更新 {time}',
|
||||
libraryUpdatedAtShort: '{time}',
|
||||
},
|
||||
storage: {
|
||||
name: '名稱',
|
||||
@@ -1559,7 +1568,7 @@ export default {
|
||||
llmTestFailedToast: 'LLM 調用測試失敗',
|
||||
llmTestFailedToastWithMessage: 'LLM 調用測試失敗:{message}',
|
||||
aiAgentGlobal: '全局智能助手',
|
||||
aiAgentGlobalHint: '啟用全局智能助手功能,所有消息對話均使用智能體回答而不用使用/ai命令',
|
||||
aiAgentGlobalHint: '啟用全域智慧助手:預設使用智慧體互動,使用 /noai 暫時切換為傳統互動;停用全域智慧助手:預設使用傳統互動,使用 /ai 暫時切換為智慧體互動',
|
||||
aiAgentJobInterval: '定時喚醒',
|
||||
aiAgentJobIntervalHint: '設置定時喚醒的檢查間隔,選擇「不啟用」則不執行定時任務',
|
||||
aiAgentVerbose: '囉嗦模式',
|
||||
|
||||
@@ -20,7 +20,14 @@ import { loadRemoteComponentFromModule, type RemoteModule } from '@/utils/federa
|
||||
const LoginMfaDialog = defineAsyncComponent(() => import('@/components/dialog/LoginMfaDialog.vue'))
|
||||
|
||||
// 国际化
|
||||
const { t } = useI18n()
|
||||
const { t, te } = useI18n()
|
||||
|
||||
// 应用版本号(构建时注入,形如 v2.13.10)
|
||||
const appVersion = typeof __APP_VERSION__ !== 'undefined' ? __APP_VERSION__ : ''
|
||||
|
||||
// 版权年份
|
||||
const copyrightYear = new Date().getFullYear()
|
||||
|
||||
// 认证 Store
|
||||
const authStore = useAuthStore()
|
||||
//用户 Store
|
||||
@@ -711,53 +718,49 @@ onUnmounted(() => {
|
||||
|
||||
<template>
|
||||
<!-- 登录页面容器 -->
|
||||
<div class="relative flex min-h-screen flex-col items-center justify-center">
|
||||
<div class="login-root">
|
||||
<!-- 顶部漂浮语言切换 -->
|
||||
<VMenu v-model="langMenu" :close-on-content-click="false">
|
||||
<template #activator="{ props }">
|
||||
<VBtn variant="text" size="small" v-bind="props" class="lang-switch-btn">
|
||||
<span v-if="SUPPORTED_LOCALES[currentLocale].flag">{{ SUPPORTED_LOCALES[currentLocale].flag }}</span>
|
||||
<VIcon v-else icon="mdi-translate" />
|
||||
<span class="ms-1">{{ SUPPORTED_LOCALES[currentLocale].title }}</span>
|
||||
</VBtn>
|
||||
</template>
|
||||
<VCard min-width="180">
|
||||
<VList>
|
||||
<VListItem
|
||||
v-for="locale in locales"
|
||||
:key="locale.name"
|
||||
:value="locale.name"
|
||||
@click="switchLanguage(locale.name as SupportedLocale)"
|
||||
>
|
||||
<template #prepend>
|
||||
<span v-if="locale.flag" class="mr-2">{{ locale.flag }}</span>
|
||||
<VIcon v-else icon="mdi-translate" size="small" />
|
||||
</template>
|
||||
<VListItemTitle>{{ locale.title }}</VListItemTitle>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VCard>
|
||||
</VMenu>
|
||||
|
||||
<!-- 登录表单 -->
|
||||
<div v-if="!mfaDialog" class="auth-wrapper d-flex align-center justify-center">
|
||||
<VCard
|
||||
class="auth-card pa-7 w-full h-full"
|
||||
class="auth-card login-card pa-7 pa-sm-8 w-full h-full login-card--enter"
|
||||
:class="{ 'glass-effect': !isTransparentTheme }"
|
||||
max-width="24rem"
|
||||
border
|
||||
max-width="23rem"
|
||||
flat
|
||||
>
|
||||
<VCardItem class="justify-center">
|
||||
<template #prepend>
|
||||
<div class="d-flex pe-0">
|
||||
<VImg :src="logo" width="64" height="64" />
|
||||
</div>
|
||||
</template>
|
||||
<VCardTitle class="font-weight-bold text-3xl text-uppercase"> MoviePilot </VCardTitle>
|
||||
<!-- 卡片头部:Logo + 标题 + 标语 -->
|
||||
<div class="login-head">
|
||||
<VImg :src="logo" width="68" height="68" class="login-logo" />
|
||||
<h1 class="login-title">MoviePilot</h1>
|
||||
</div>
|
||||
|
||||
<!-- 语言切换按钮 -->
|
||||
<template #append>
|
||||
<VMenu v-model="langMenu" :close-on-content-click="false">
|
||||
<template #activator="{ props }">
|
||||
<VBtn variant="text" size="small" v-bind="props" class="lang-switch-btn">
|
||||
<span v-if="SUPPORTED_LOCALES[currentLocale].flag">{{ SUPPORTED_LOCALES[currentLocale].flag }}</span>
|
||||
<VIcon v-else icon="mdi-translate" />
|
||||
<span class="ms-1">{{ SUPPORTED_LOCALES[currentLocale].title }}</span>
|
||||
</VBtn>
|
||||
</template>
|
||||
<VCard min-width="180">
|
||||
<VList>
|
||||
<VListItem
|
||||
v-for="locale in locales"
|
||||
:key="locale.name"
|
||||
:value="locale.name"
|
||||
@click="switchLanguage(locale.name as SupportedLocale)"
|
||||
>
|
||||
<template #prepend>
|
||||
<span v-if="locale.flag" class="mr-2">{{ locale.flag }}</span>
|
||||
<VIcon v-else icon="mdi-translate" size="small" />
|
||||
</template>
|
||||
<VListItemTitle>{{ locale.title }}</VListItemTitle>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VCard>
|
||||
</VMenu>
|
||||
</template>
|
||||
</VCardItem>
|
||||
<VCardText>
|
||||
<VCardText class="login-body">
|
||||
<VForm ref="refForm" autocomplete="on" @submit.prevent="login">
|
||||
<VRow>
|
||||
<!-- username -->
|
||||
@@ -772,6 +775,8 @@ onUnmounted(() => {
|
||||
autocomplete="username"
|
||||
:rules="[requiredValidator]"
|
||||
hide-details
|
||||
variant="outlined"
|
||||
density="comfortable"
|
||||
@input="scheduleLoginAutofillSync"
|
||||
@change="scheduleLoginAutofillSync"
|
||||
/>
|
||||
@@ -788,6 +793,8 @@ onUnmounted(() => {
|
||||
:append-inner-icon="isPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'"
|
||||
:rules="[requiredValidator]"
|
||||
hide-details
|
||||
variant="outlined"
|
||||
density="comfortable"
|
||||
@click:append-inner="isPasswordVisible = !isPasswordVisible"
|
||||
@input="scheduleLoginAutofillSync"
|
||||
@change="scheduleLoginAutofillSync"
|
||||
@@ -796,17 +803,23 @@ onUnmounted(() => {
|
||||
<VCol cols="12" class="py-0">
|
||||
<!-- remember me checkbox -->
|
||||
<div class="d-flex align-center justify-space-between flex-wrap">
|
||||
<VCheckbox v-model="form.remember" :label="t('login.stayLoggedIn')" required />
|
||||
<VCheckbox
|
||||
v-model="form.remember"
|
||||
:label="t('login.stayLoggedIn')"
|
||||
required
|
||||
hide-details
|
||||
density="compact"
|
||||
/>
|
||||
</div>
|
||||
</VCol>
|
||||
<VCol cols="12">
|
||||
<!-- login button -->
|
||||
<VBtn block type="submit" prepend-icon="mdi-login" :loading="loading" size="large">
|
||||
<VBtn block type="submit" prepend-icon="mdi-login" :loading="loading" size="large" class="login-submit">
|
||||
{{ t('login.login') }}
|
||||
</VBtn>
|
||||
|
||||
<!-- or divider -->
|
||||
<div v-if="showPasskeyLogin || pluginAuthProviders.length > 0" class="or-divider my-4">
|
||||
<div v-if="showPasskeyLogin || pluginAuthProviders.length > 0" class="or-divider my-5">
|
||||
<span class="or-divider-text">{{ t('login.orDivider') }}</span>
|
||||
</div>
|
||||
|
||||
@@ -843,6 +856,12 @@ onUnmounted(() => {
|
||||
</VRow>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
|
||||
<!-- 卡片页脚:版权 + 版本 -->
|
||||
<div class="login-foot">
|
||||
<span>{{ t('login.copyright', { year: copyrightYear }) }}</span>
|
||||
<span v-if="appVersion" class="login-version">{{ appVersion }}</span>
|
||||
</div>
|
||||
</VCard>
|
||||
</div>
|
||||
<VDialog v-model="pluginAuthDialog" max-width="520" persistent>
|
||||
@@ -875,28 +894,154 @@ onUnmounted(() => {
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* stylelint-disable selector-pseudo-class-no-unknown */
|
||||
|
||||
@use '@core/scss/pages/page-auth';
|
||||
|
||||
.v-card-item__prepend {
|
||||
padding-inline-end: 0 !important;
|
||||
/* ===================== 布局根容器 ===================== */
|
||||
.login-root {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
isolation: isolate;
|
||||
min-block-size: 100vh;
|
||||
min-block-size: 100dvh;
|
||||
}
|
||||
|
||||
.auth-wrapper {
|
||||
overflow: hidden;
|
||||
block-size: auto;
|
||||
/* 登录页需要透出 App.vue 注入的壁纸层。 */
|
||||
:global(.v-application:has(.login-root)) {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
/* ===================== 浮动语言切换 ===================== */
|
||||
.lang-switch-btn {
|
||||
position: absolute;
|
||||
inset-block-start: 8px;
|
||||
inset-inline-end: 8px;
|
||||
z-index: 3;
|
||||
border: 1px solid rgba(var(--v-border-color), calc(var(--v-border-opacity) * 0.6));
|
||||
border-radius: 999px;
|
||||
backdrop-filter: blur(10px);
|
||||
background: rgba(var(--v-theme-surface), 0.55);
|
||||
inset-block-start: calc(env(safe-area-inset-top, 0px) + 16px);
|
||||
inset-inline-end: calc(env(safe-area-inset-right, 0px) + 16px);
|
||||
}
|
||||
|
||||
/* ===================== 表单容器 ===================== */
|
||||
.auth-wrapper {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
overflow: hidden;
|
||||
block-size: auto;
|
||||
inline-size: 100%;
|
||||
padding-inline: 16px;
|
||||
}
|
||||
|
||||
/* ===================== 玻璃卡片 ===================== */
|
||||
.login-card {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
border: none !important;
|
||||
border-radius: var(--app-surface-radius, 16px) !important;
|
||||
box-shadow: var(
|
||||
--app-overlay-shadow,
|
||||
0 18px 42px rgba(var(--app-shadow-rgb, 0, 0, 0), 0.14),
|
||||
0 6px 18px rgba(var(--app-shadow-rgb, 0, 0, 0), 0.08)
|
||||
) !important;
|
||||
|
||||
/* 顶部高光线,营造立体感 */
|
||||
&::before {
|
||||
position: absolute;
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 40%), transparent);
|
||||
block-size: 1px;
|
||||
content: '';
|
||||
inset-block-start: 0;
|
||||
inset-inline: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* 非透明主题:磨砂玻璃卡片 */
|
||||
.glass-effect {
|
||||
backdrop-filter: blur(10px) !important;
|
||||
background: rgba(var(--v-theme-surface), 0.7) !important;
|
||||
backdrop-filter: blur(24px) saturate(160%) !important;
|
||||
background: rgba(var(--v-theme-surface), 0.72) !important;
|
||||
}
|
||||
|
||||
/* 深色主题上叠一条更亮的描边,区分背景 */
|
||||
:deep(.v-theme--dark) .login-card,
|
||||
:deep(.v-theme--purple) .login-card,
|
||||
:deep(.v-theme--transparent) .login-card {
|
||||
border: 1px solid rgba(255, 255, 255, 8%) !important;
|
||||
}
|
||||
|
||||
:deep(.v-theme--light) .login-card {
|
||||
border: 1px solid rgba(255, 255, 255, 65%) !important;
|
||||
}
|
||||
|
||||
/* ===================== 卡片头部 ===================== */
|
||||
.login-head {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-block-end: 6px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.login-logo {
|
||||
filter: drop-shadow(0 6px 16px rgba(var(--v-theme-primary), 0.35));
|
||||
margin-block-end: 4px;
|
||||
}
|
||||
|
||||
.login-title {
|
||||
margin: 0;
|
||||
background: linear-gradient(120deg, rgb(var(--v-theme-on-surface)), rgba(var(--v-theme-primary), 1));
|
||||
background-clip: text;
|
||||
font-size: 1.8rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.025em;
|
||||
line-height: 1.2;
|
||||
-webkit-text-fill-color: transparent;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.login-tagline {
|
||||
margin: 0;
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
/* ===================== 卡片主体 ===================== */
|
||||
.login-body {
|
||||
padding-block: 8px !important;
|
||||
}
|
||||
|
||||
/* 输入框聚焦时增加主色光晕 */
|
||||
:deep(.login-body .v-field.v-field--focused) {
|
||||
box-shadow: 0 0 0 2px rgba(var(--v-theme-primary), 0.18);
|
||||
}
|
||||
|
||||
/* 登录按钮:主色 + 悬浮抬升 */
|
||||
.login-submit {
|
||||
box-shadow: 0 8px 20px rgba(var(--v-theme-primary), 0.35);
|
||||
letter-spacing: 0.02em;
|
||||
transition:
|
||||
transform var(--mp-motion-duration-overlay, 160ms) var(--mp-motion-ease-standard, ease),
|
||||
box-shadow var(--mp-motion-duration-overlay, 160ms) var(--mp-motion-ease-standard, ease);
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 12px 26px rgba(var(--v-theme-primary), 0.42);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* or 分隔线 */
|
||||
.or-divider {
|
||||
position: relative;
|
||||
display: flex;
|
||||
@@ -912,15 +1057,77 @@ onUnmounted(() => {
|
||||
|
||||
.or-divider-text {
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
||||
font-size: 0.8125rem;
|
||||
padding-inline: 12px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.08em;
|
||||
padding-inline: 14px;
|
||||
text-transform: uppercase;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.v-theme--light {
|
||||
.passkey-btn.v-btn--variant-outlined {
|
||||
color: rgb(86, 170, 0) !important;
|
||||
/* 浅色主题下 passkey 按钮保持绿色辨识度 */
|
||||
:deep(.v-theme--light) .passkey-btn.v-btn--variant-outlined {
|
||||
color: rgb(86, 170, 0) !important;
|
||||
}
|
||||
|
||||
/* ===================== 卡片页脚 ===================== */
|
||||
.login-foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: rgba(var(--v-theme-on-surface), calc(var(--v-disabled-opacity) * 1.4));
|
||||
font-size: 0.72rem;
|
||||
gap: 8px;
|
||||
letter-spacing: 0.02em;
|
||||
margin-block-start: 8px;
|
||||
}
|
||||
|
||||
.login-version {
|
||||
border-inline-start: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
|
||||
padding-inline: 6px;
|
||||
}
|
||||
|
||||
/* ===================== 入场动画 ===================== */
|
||||
.login-card--enter {
|
||||
animation: login-enter 520ms var(--mp-motion-ease-standard, cubic-bezier(0.2, 0.8, 0.2, 1)) both;
|
||||
}
|
||||
|
||||
@keyframes login-enter {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translateY(14px) scale(0.985);
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* ===================== 无障碍:尊重减少动态偏好 ===================== */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.login-card--enter {
|
||||
animation-duration: 1ms !important;
|
||||
}
|
||||
|
||||
.login-submit {
|
||||
transition: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===================== 小屏适配 ===================== */
|
||||
@media (width <= 480px) {
|
||||
.auth-wrapper {
|
||||
padding-inline: 12px;
|
||||
}
|
||||
|
||||
.login-title {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.login-card {
|
||||
padding: 1.5rem !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -7,6 +7,7 @@ import type { MediaInfo, NotExistMediaInfo, Site, Subscribe, TmdbEpisode } from
|
||||
import NoDataFound from '@/components/NoDataFound.vue'
|
||||
import { doneNProgress, startNProgress } from '@/api/nprogress'
|
||||
import { formatSeason } from '@/@core/utils/formatters'
|
||||
import { formatSeasonLabel } from '@/@core/utils/season'
|
||||
import router from '@/router'
|
||||
import { isNullOrEmptyObject } from '@/@core/utils'
|
||||
import { useUserStore } from '@/stores'
|
||||
@@ -807,8 +808,9 @@ onBeforeMount(() => {
|
||||
<template #default>
|
||||
<div class="flex flex-row items-center justify-between">
|
||||
<span class="font-weight-bold">{{
|
||||
season.season_number === 0 && season.name ?
|
||||
season.name : t('media.seasonNumber', { number: season.season_number })
|
||||
season.season_number === 0
|
||||
? season.name || formatSeasonLabel(0, t('media.specials'))
|
||||
: t('media.seasonNumber', { number: season.season_number })
|
||||
}}</span>
|
||||
<VChip size="small" class="ms-1">
|
||||
{{ t('media.episodeCount', { count: season.episode_count }) }}
|
||||
|
||||
@@ -7,8 +7,9 @@ import FullCalendar from '@fullcalendar/vue3'
|
||||
import type { Ref } from 'vue'
|
||||
import type { MediaInfo, Subscribe, TmdbEpisode } from '@/api/types'
|
||||
import api from '@/api'
|
||||
import { formatEp, parseDate } from '@/@core/utils/formatters'
|
||||
import { formatDateDifference, formatEp, parseDate } from '@/@core/utils/formatters'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useDisplay } from 'vuetify'
|
||||
import { getCurrentLocale } from '@/plugins/i18n'
|
||||
import { openSharedDialog } from '@/composables/useSharedDialog'
|
||||
|
||||
@@ -17,6 +18,9 @@ const ProgressDialog = defineAsyncComponent(() => import('@/components/dialog/Pr
|
||||
// 国际化
|
||||
const { t } = useI18n()
|
||||
|
||||
// 跟随 Vuetify 断点,MD 及以下使用小屏海报模式。
|
||||
const display = useDisplay()
|
||||
|
||||
// 加载中
|
||||
const loading = ref(false)
|
||||
|
||||
@@ -28,6 +32,25 @@ const currentLocale = getCurrentLocale().split('-')[0]
|
||||
|
||||
let progressDialogController: ReturnType<typeof openSharedDialog> | null = null
|
||||
|
||||
type CalendarLibraryState = 'none' | 'partial' | 'complete'
|
||||
|
||||
interface CalendarEventInfo {
|
||||
title: string
|
||||
subtitle: string
|
||||
start: Date | null
|
||||
allDay: boolean
|
||||
posterPath: string | undefined
|
||||
mediaType: string
|
||||
len: number
|
||||
episodeNumbers: number[]
|
||||
libraryEpisode: number
|
||||
lackEpisode: number
|
||||
totalEpisode: number
|
||||
libraryEpisodeNumbers: number[]
|
||||
libraryState: CalendarLibraryState
|
||||
libraryUpdateText: string
|
||||
}
|
||||
|
||||
// 打开订阅日历共享进度弹窗。
|
||||
function openProgressDialog() {
|
||||
progressDialogController?.close()
|
||||
@@ -62,6 +85,10 @@ const calendarOptions: Ref<CalendarOptions> = ref({
|
||||
center: 'title',
|
||||
right: 'next',
|
||||
},
|
||||
// 日历页需要完整展示每天所有订阅条目,避免折叠成 "+ more" 后隐藏关键信息。
|
||||
dayMaxEvents: false,
|
||||
dayMaxEventRows: false,
|
||||
eventDisplay: 'block',
|
||||
views: {
|
||||
week: {
|
||||
titleFormat: { day: 'numeric' },
|
||||
@@ -70,6 +97,116 @@ const calendarOptions: Ref<CalendarOptions> = ref({
|
||||
events: [],
|
||||
})
|
||||
|
||||
function clampEpisodeCount(value: number, total: number) {
|
||||
return Math.min(Math.max(value, 0), total)
|
||||
}
|
||||
|
||||
function getLibraryEpisodeCount(subscribe: Subscribe) {
|
||||
const totalEpisode = subscribe.total_episode || 0
|
||||
if (!totalEpisode) return 0
|
||||
|
||||
const libraryEpisode =
|
||||
typeof subscribe.lack_episode === 'number'
|
||||
? totalEpisode - subscribe.lack_episode
|
||||
: subscribe.completed_episode ?? 0
|
||||
|
||||
return clampEpisodeCount(libraryEpisode, totalEpisode)
|
||||
}
|
||||
|
||||
function getLackEpisodeCount(subscribe: Subscribe) {
|
||||
const totalEpisode = subscribe.total_episode || 0
|
||||
if (!totalEpisode) return 0
|
||||
|
||||
return clampEpisodeCount(subscribe.lack_episode ?? totalEpisode - getLibraryEpisodeCount(subscribe), totalEpisode)
|
||||
}
|
||||
|
||||
function normalizeEpisodeNumbers(value: unknown) {
|
||||
if (!Array.isArray(value)) return []
|
||||
|
||||
return value
|
||||
.map(number => Number(number))
|
||||
.filter(number => Number.isFinite(number) && number > 0)
|
||||
}
|
||||
|
||||
function isEnabledFlag(value: unknown) {
|
||||
return value === true || value === 1 || value === '1'
|
||||
}
|
||||
|
||||
function getLibraryEpisodeNumbers(subscribe: Subscribe) {
|
||||
if (isEnabledFlag(subscribe.best_version)) {
|
||||
return Object.entries(subscribe.episode_priority || {})
|
||||
.filter(([episode, priority]) => Number.isFinite(Number(episode)) && priority === 100)
|
||||
.map(([episode]) => Number(episode))
|
||||
}
|
||||
|
||||
return normalizeEpisodeNumbers(subscribe.note)
|
||||
}
|
||||
|
||||
function getLibraryState(
|
||||
episodeNumbers: number[],
|
||||
libraryEpisode: number,
|
||||
libraryEpisodeNumbers: number[],
|
||||
): CalendarLibraryState {
|
||||
const validEpisodeNumbers = episodeNumbers.filter(number => Number.isFinite(number) && number > 0)
|
||||
if (!validEpisodeNumbers.length || !libraryEpisode) return 'none'
|
||||
|
||||
// 后端存在具体集号时优先精确匹配;缺少明细时才按聚合进度做保守降级展示。
|
||||
const matchedEpisodeCount = libraryEpisodeNumbers.length
|
||||
? validEpisodeNumbers.filter(number => libraryEpisodeNumbers.includes(number)).length
|
||||
: validEpisodeNumbers.filter(number => number <= libraryEpisode).length
|
||||
if (!matchedEpisodeCount) return 'none'
|
||||
|
||||
return matchedEpisodeCount === validEpisodeNumbers.length ? 'complete' : 'partial'
|
||||
}
|
||||
|
||||
function buildCalendarEventInfo(
|
||||
subscribe: Subscribe,
|
||||
payload: Pick<CalendarEventInfo, 'subtitle' | 'start' | 'episodeNumbers' | 'len'>,
|
||||
): CalendarEventInfo {
|
||||
const totalEpisode = subscribe.total_episode || 0
|
||||
const libraryEpisode = getLibraryEpisodeCount(subscribe)
|
||||
const lackEpisode = getLackEpisodeCount(subscribe)
|
||||
const libraryEpisodeNumbers = getLibraryEpisodeNumbers(subscribe)
|
||||
|
||||
return {
|
||||
title: subscribe.name || '',
|
||||
allDay: false,
|
||||
posterPath: subscribe.poster,
|
||||
mediaType: subscribe.type || '',
|
||||
totalEpisode,
|
||||
libraryEpisode,
|
||||
lackEpisode,
|
||||
libraryEpisodeNumbers,
|
||||
libraryState: getLibraryState(payload.episodeNumbers, libraryEpisode, libraryEpisodeNumbers),
|
||||
libraryUpdateText: libraryEpisode > 0 && subscribe.last_update ? formatDateDifference(subscribe.last_update) : '',
|
||||
...payload,
|
||||
}
|
||||
}
|
||||
|
||||
function getCalendarEventTooltip(event: any) {
|
||||
const props = event.extendedProps as CalendarEventInfo
|
||||
const parts = [event.title]
|
||||
|
||||
if (props.subtitle) parts.push(t('calendar.episode', { number: props.subtitle }))
|
||||
if (props.totalEpisode) {
|
||||
parts.push(t('calendar.libraryProgress', { completed: props.libraryEpisode, total: props.totalEpisode }))
|
||||
}
|
||||
if (props.libraryUpdateText) parts.push(t('calendar.libraryUpdatedAt', { time: props.libraryUpdateText }))
|
||||
|
||||
return parts.filter(Boolean).join(' · ')
|
||||
}
|
||||
|
||||
function getLibraryStateText(state: CalendarLibraryState) {
|
||||
if (state === 'complete') return t('calendar.currentEpisodeInLibrary')
|
||||
if (state === 'partial') return t('calendar.currentEpisodePartiallyInLibrary')
|
||||
return t('calendar.currentEpisodeNotInLibrary')
|
||||
}
|
||||
|
||||
function getLibraryStateIcon(state: CalendarLibraryState) {
|
||||
if (state === 'none') return 'mdi-minus-circle-outline'
|
||||
return 'mdi-check-circle-outline'
|
||||
}
|
||||
|
||||
async function eventsHander(subscribe: Subscribe) {
|
||||
// 如果是电影直接返回
|
||||
if (subscribe.type === '电影') {
|
||||
@@ -78,15 +215,12 @@ async function eventsHander(subscribe: Subscribe) {
|
||||
params: { type_name: subscribe.type },
|
||||
})
|
||||
|
||||
return {
|
||||
title: subscribe.name,
|
||||
return buildCalendarEventInfo(subscribe, {
|
||||
subtitle: '',
|
||||
start: parseDate(movie.release_date || ''),
|
||||
allDay: false,
|
||||
posterPath: subscribe.poster,
|
||||
mediaType: subscribe.type,
|
||||
len: 1,
|
||||
}
|
||||
episodeNumbers: [],
|
||||
})
|
||||
} else {
|
||||
// 调用API查询集信息
|
||||
const params = subscribe.episode_group ? { episode_group: subscribe.episode_group } : undefined
|
||||
@@ -95,40 +229,35 @@ async function eventsHander(subscribe: Subscribe) {
|
||||
params ? { params } : undefined,
|
||||
)
|
||||
|
||||
interface EpisodeInfo {
|
||||
title: string
|
||||
subtitle: string
|
||||
start: Date | null
|
||||
allDay: boolean
|
||||
posterPath: string | undefined
|
||||
mediaType: string
|
||||
len: number
|
||||
}
|
||||
|
||||
interface EpisodesDictionary {
|
||||
[key: string]: EpisodeInfo
|
||||
[key: string]: CalendarEventInfo
|
||||
}
|
||||
|
||||
const dictEpisode: EpisodesDictionary = {}
|
||||
episodes.forEach((episode: TmdbEpisode) => {
|
||||
const air_date = episode.air_date ?? ''
|
||||
const episodeNumber = episode.episode_number || 0
|
||||
if (dictEpisode[air_date]) {
|
||||
dictEpisode[air_date].subtitle += `,${episode.episode_number}`
|
||||
dictEpisode[air_date].episodeNumbers.push(episodeNumber)
|
||||
dictEpisode[air_date].len++
|
||||
} else {
|
||||
dictEpisode[air_date] = {
|
||||
title: subscribe.name,
|
||||
subtitle: `${episode.episode_number}`,
|
||||
dictEpisode[air_date] = buildCalendarEventInfo(subscribe, {
|
||||
subtitle: '',
|
||||
start: parseDate(episode.air_date || ''),
|
||||
allDay: false,
|
||||
posterPath: subscribe.poster,
|
||||
mediaType: subscribe.type,
|
||||
len: 1,
|
||||
}
|
||||
episodeNumbers: [episodeNumber],
|
||||
})
|
||||
}
|
||||
})
|
||||
for (const key in dictEpisode)
|
||||
dictEpisode[key].subtitle = formatEp(dictEpisode[key].subtitle.split(',').map(Number))
|
||||
for (const key in dictEpisode) {
|
||||
const episodeNumbers = dictEpisode[key].episodeNumbers.filter(number => Number.isFinite(number) && number > 0)
|
||||
dictEpisode[key].subtitle = formatEp(episodeNumbers)
|
||||
dictEpisode[key].libraryState = getLibraryState(
|
||||
episodeNumbers,
|
||||
dictEpisode[key].libraryEpisode,
|
||||
dictEpisode[key].libraryEpisodeNumbers,
|
||||
)
|
||||
}
|
||||
|
||||
return Object.values(dictEpisode)
|
||||
}
|
||||
@@ -168,46 +297,19 @@ onActivated(() => {
|
||||
<template>
|
||||
<FullCalendar :options="calendarOptions">
|
||||
<template #eventContent="arg">
|
||||
<div class="hidden md:block">
|
||||
<VCard class="app-surface">
|
||||
<div class="d-flex justify-space-between flex-nowrap flex-row">
|
||||
<div class="ma-auto">
|
||||
<VImg
|
||||
height="75"
|
||||
width="50"
|
||||
:src="arg.event.extendedProps.posterPath"
|
||||
aspect-ratio="2/3"
|
||||
class="object-cover rounded ring-gray-500"
|
||||
cover
|
||||
>
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||
</div>
|
||||
</template>
|
||||
</VImg>
|
||||
</div>
|
||||
<div>
|
||||
<VCardSubtitle class="pa-1 px-2 font-bold break-words whitespace-break-spaces">
|
||||
{{ arg.event.title }}
|
||||
</VCardSubtitle>
|
||||
<VCardText v-if="arg.event.extendedProps.subtitle" class="pa-0 px-2 break-words">
|
||||
{{ t('calendar.episode', { number: arg.event.extendedProps.subtitle }) }}
|
||||
</VCardText>
|
||||
</div>
|
||||
</div>
|
||||
</VCard>
|
||||
</div>
|
||||
<div class="md:hidden">
|
||||
<VTooltip :text="`${arg.event.title} ${t('calendar.episode', { number: arg.event.extendedProps.subtitle })}`">
|
||||
<template #activator="{ props }">
|
||||
<div v-if="display.lgAndUp.value">
|
||||
<div
|
||||
class="calendar-event-card"
|
||||
:class="`calendar-event-card--${arg.event.extendedProps.libraryState}`"
|
||||
:title="getCalendarEventTooltip(arg.event)"
|
||||
>
|
||||
<div class="calendar-event-poster">
|
||||
<VImg
|
||||
height="60"
|
||||
width="40"
|
||||
height="74"
|
||||
width="50"
|
||||
:src="arg.event.extendedProps.posterPath"
|
||||
v-bind="props"
|
||||
aspect-ratio="2/3"
|
||||
class="object-cover rounded ring-gray-500"
|
||||
class="calendar-event-image object-cover"
|
||||
cover
|
||||
>
|
||||
<template #placeholder>
|
||||
@@ -215,18 +317,72 @@ onActivated(() => {
|
||||
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||
</div>
|
||||
</template>
|
||||
<VChip
|
||||
v-if="arg.event.extendedProps.len > 1"
|
||||
variant="elevated"
|
||||
color="primary"
|
||||
size="x-small"
|
||||
class="absolute right-0 top-0"
|
||||
>
|
||||
{{ arg.event.extendedProps.len }}
|
||||
</VChip>
|
||||
</VImg>
|
||||
<span
|
||||
v-if="arg.event.extendedProps.libraryState === 'complete'"
|
||||
class="calendar-library-check"
|
||||
>
|
||||
<VIcon icon="mdi-check" size="12" />
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="calendar-event-content">
|
||||
<div class="calendar-event-title">
|
||||
{{ arg.event.title }}
|
||||
</div>
|
||||
<div v-if="arg.event.extendedProps.subtitle" class="calendar-event-episode">
|
||||
<VIcon icon="mdi-calendar-blank-outline" size="13" />
|
||||
{{ t('calendar.episode', { number: arg.event.extendedProps.subtitle }) }}
|
||||
</div>
|
||||
<div v-if="arg.event.extendedProps.totalEpisode" class="calendar-event-library-row">
|
||||
<span
|
||||
v-if="arg.event.extendedProps.libraryState !== 'complete'"
|
||||
class="calendar-event-status"
|
||||
:class="`calendar-event-status--${arg.event.extendedProps.libraryState}`"
|
||||
>
|
||||
<VIcon :icon="getLibraryStateIcon(arg.event.extendedProps.libraryState)" size="13" />
|
||||
{{ getLibraryStateText(arg.event.extendedProps.libraryState) }}
|
||||
</span>
|
||||
<span class="calendar-event-progress">
|
||||
<VIcon icon="mdi-library" size="13" />
|
||||
{{
|
||||
t('calendar.libraryProgress', {
|
||||
completed: arg.event.extendedProps.libraryEpisode,
|
||||
total: arg.event.extendedProps.totalEpisode,
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="arg.event.extendedProps.libraryUpdateText" class="calendar-event-time">
|
||||
<VIcon icon="mdi-clock-outline" size="13" />
|
||||
{{ t('calendar.libraryUpdatedAtShort', { time: arg.event.extendedProps.libraryUpdateText }) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<VImg
|
||||
:src="arg.event.extendedProps.posterPath"
|
||||
aspect-ratio="2/3"
|
||||
class="calendar-mobile-image object-cover ring-gray-500"
|
||||
cover
|
||||
:title="getCalendarEventTooltip(arg.event)"
|
||||
>
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||
</div>
|
||||
</template>
|
||||
</VTooltip>
|
||||
<span
|
||||
v-if="arg.event.extendedProps.libraryState === 'complete'"
|
||||
class="calendar-library-check calendar-library-check--mobile"
|
||||
>
|
||||
<VIcon icon="mdi-check" size="11" />
|
||||
</span>
|
||||
<span v-if="arg.event.extendedProps.subtitle" class="calendar-mobile-episode">
|
||||
{{ arg.event.extendedProps.subtitle }}
|
||||
</span>
|
||||
</VImg>
|
||||
</div>
|
||||
</template>
|
||||
</FullCalendar>
|
||||
@@ -402,17 +558,21 @@ onActivated(() => {
|
||||
min-block-size: 40.625rem;
|
||||
}
|
||||
|
||||
.v-application .fc .fc-event {
|
||||
.v-application .fc .fc-event,
|
||||
.v-application .fc .fc-h-event,
|
||||
.v-application .fc .fc-daygrid-event {
|
||||
border-color: transparent;
|
||||
background: transparent !important;
|
||||
box-shadow: none;
|
||||
margin-block-end: 0.3rem;
|
||||
padding-inline: 0.3125rem;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.v-application .fc .fc-event-main {
|
||||
color: inherit;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
padding-inline: 0.25rem;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.v-application .fc tbody[role='rowgroup'] > tr > td[role='presentation'] {
|
||||
@@ -505,10 +665,169 @@ onActivated(() => {
|
||||
}
|
||||
|
||||
.v-application .fc-v-event {
|
||||
background-color: transparent;
|
||||
border: 0 !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
@media (width <= 776px) {
|
||||
.calendar-event-card {
|
||||
display: flex;
|
||||
gap: 0.55rem;
|
||||
align-items: flex-start;
|
||||
padding: 0.4rem;
|
||||
border-radius: 8px;
|
||||
background: rgba(var(--v-theme-surface), 0.72);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.calendar-event-poster {
|
||||
position: relative;
|
||||
flex: 0 0 56px;
|
||||
inline-size: 56px;
|
||||
}
|
||||
|
||||
.calendar-event-image {
|
||||
border-radius: 6px;
|
||||
block-size: 84px !important;
|
||||
inline-size: 56px !important;
|
||||
}
|
||||
|
||||
.calendar-library-check {
|
||||
position: absolute;
|
||||
top: 0.18rem;
|
||||
right: 0.18rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 2px solid rgb(var(--v-theme-surface));
|
||||
border-radius: 50%;
|
||||
background: rgb(var(--v-theme-success));
|
||||
block-size: 1.15rem;
|
||||
color: rgb(var(--v-theme-on-success));
|
||||
inline-size: 1.15rem;
|
||||
}
|
||||
|
||||
.calendar-library-check--mobile {
|
||||
top: 0.12rem;
|
||||
right: 0.12rem;
|
||||
block-size: 1rem;
|
||||
inline-size: 1rem;
|
||||
}
|
||||
|
||||
.calendar-event-content {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
min-inline-size: 0;
|
||||
}
|
||||
|
||||
.calendar-event-title {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-high-emphasis-opacity));
|
||||
font-size: 0.88rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.28;
|
||||
max-block-size: calc(0.88rem * 1.28 * 2);
|
||||
overflow-wrap: anywhere;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.calendar-event-episode {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
||||
column-gap: 0.2rem;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.25;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.calendar-event-episode,
|
||||
.calendar-event-time {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
||||
column-gap: 0.2rem;
|
||||
line-height: 1.25;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.calendar-event-library-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.18rem 0.3rem;
|
||||
align-items: center;
|
||||
min-inline-size: 0;
|
||||
}
|
||||
|
||||
.calendar-event-status,
|
||||
.calendar-event-progress {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
color: rgb(var(--v-theme-success));
|
||||
column-gap: 0.16rem;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.calendar-event-status--none {
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
||||
}
|
||||
|
||||
.calendar-event-progress {
|
||||
color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
||||
}
|
||||
|
||||
.calendar-event-time {
|
||||
font-size: 0.64rem;
|
||||
}
|
||||
|
||||
.calendar-event-status,
|
||||
.calendar-event-progress,
|
||||
.calendar-event-time {
|
||||
max-inline-size: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.calendar-mobile-image {
|
||||
border-radius: 6px;
|
||||
block-size: clamp(60px, 8.7vw, 96px) !important;
|
||||
inline-size: clamp(40px, 5.8vw, 64px) !important;
|
||||
}
|
||||
|
||||
.calendar-mobile-episode {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
background: rgba(0, 0, 0, 0.58);
|
||||
color: #fff;
|
||||
font-size: 0.62rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.25;
|
||||
padding-block: 0.1rem;
|
||||
padding-inline: 0.2rem;
|
||||
text-align: center;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media (width <= 1279px) {
|
||||
.fc-daygrid-event-harness {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user