mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-06-06 08:10:21 +08:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d3b69ca34 | ||
|
|
fdcc4a44c8 | ||
|
|
5de0494538 | ||
|
|
2045f833e4 | ||
|
|
cc4f89aac1 | ||
|
|
1c2f2c17d4 | ||
|
|
ace7a6621f | ||
|
|
d02fe55a1e | ||
|
|
9b753a8f5b | ||
|
|
11e82582b8 | ||
|
|
419358863e | ||
|
|
1d0d7f9975 | ||
|
|
c5f564372b | ||
|
|
a50f0cd727 | ||
|
|
96f6f55138 | ||
|
|
6a45c8b358 | ||
|
|
165937596e | ||
|
|
fb976f043b | ||
|
|
ecb9c4e51a | ||
|
|
9e8c3b495c | ||
|
|
24a37fc33c | ||
|
|
d09a21114d | ||
|
|
6e2b12501f | ||
|
|
2a56e116cf | ||
|
|
6de4f238d8 | ||
|
|
1b426c5957 | ||
|
|
82454a650c | ||
|
|
227b6bd7ef | ||
|
|
9554025daf |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "moviepilot",
|
"name": "moviepilot",
|
||||||
"version": "1.5.6",
|
"version": "1.5.8",
|
||||||
"private": true,
|
"private": true,
|
||||||
"bin": "dist/service.js",
|
"bin": "dist/service.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -28,7 +28,12 @@ app.use(
|
|||||||
|
|
||||||
// 处理根路径的请求
|
// 处理根路径的请求
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
res.sendFile(path.join(__dirname, 'index.html')) // 指向你的前端入口文件
|
res.sendFile(path.join(__dirname, 'index.html'))
|
||||||
|
})
|
||||||
|
|
||||||
|
// 处理所有其他请求,重定向到前端入口文件
|
||||||
|
app.get('*', (req, res) => {
|
||||||
|
res.sendFile(path.join(__dirname, 'index.html'))
|
||||||
})
|
})
|
||||||
|
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useTheme } from 'vuetify'
|
import { useTheme } from 'vuetify'
|
||||||
import type { ThemeSwitcherTheme } from '@layouts/types'
|
import type { ThemeSwitcherTheme } from '@layouts/types'
|
||||||
|
|
||||||
@@ -20,26 +20,30 @@ const {
|
|||||||
{ initialValue: savedTheme.value },
|
{ initialValue: savedTheme.value },
|
||||||
)
|
)
|
||||||
|
|
||||||
function changeTheme() {
|
function updateTheme() {
|
||||||
const nextTheme = getNextThemeName()
|
const autoTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
||||||
|
const theme = currentThemeName.value === 'auto' ? autoTheme : currentThemeName.value
|
||||||
globalTheme.name.value = nextTheme
|
globalTheme.name.value = theme
|
||||||
savedTheme.value = nextTheme
|
savedTheme.value = theme
|
||||||
localStorage.setItem('theme', nextTheme)
|
|
||||||
// 修改载入时背景色
|
// 修改载入时背景色
|
||||||
localStorage.setItem('materio-initial-loader-bg', globalTheme.current.value.colors.background)
|
localStorage.setItem('materio-initial-loader-bg', globalTheme.current.value.colors.background)
|
||||||
|
|
||||||
themeTransition()
|
themeTransition()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update icon if theme is changed from other sources
|
// 监听系统主题变化
|
||||||
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', updateTheme)
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => globalTheme.name.value,
|
() => currentThemeName.value,
|
||||||
(val) => {
|
() => updateTheme(),
|
||||||
currentThemeName.value = val
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function changeTheme() {
|
||||||
|
const nextTheme = getNextThemeName()
|
||||||
|
currentThemeName.value = nextTheme
|
||||||
|
localStorage.setItem('theme', nextTheme)
|
||||||
|
}
|
||||||
|
|
||||||
// Apply saved theme on page load
|
// Apply saved theme on page load
|
||||||
// onMounted(() => {
|
// onMounted(() => {
|
||||||
// globalTheme.name.value = savedTheme.value
|
// globalTheme.name.value = savedTheme.value
|
||||||
|
|||||||
10
src/App.vue
10
src/App.vue
@@ -3,9 +3,15 @@ import { useToast } from 'vue-toast-notification'
|
|||||||
import { useTheme } from 'vuetify'
|
import { useTheme } from 'vuetify'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
|
|
||||||
|
function setTheme() {
|
||||||
|
const { global: globalTheme } = useTheme()
|
||||||
|
let theme = localStorage.getItem('theme') || 'light'
|
||||||
|
if (theme === 'auto')
|
||||||
|
theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
||||||
|
globalTheme.name.value = theme
|
||||||
|
}
|
||||||
// 第一时间应用主题
|
// 第一时间应用主题
|
||||||
const { global: globalTheme } = useTheme()
|
setTheme()
|
||||||
globalTheme.name.value = localStorage.getItem('theme') || 'light'
|
|
||||||
|
|
||||||
// 提示框
|
// 提示框
|
||||||
const $toast = useToast()
|
const $toast = useToast()
|
||||||
|
|||||||
@@ -924,3 +924,26 @@ export interface FileItem {
|
|||||||
children: FileItem[]
|
children: FileItem[]
|
||||||
modify_time: number
|
modify_time: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 媒体服务器播放条目
|
||||||
|
export interface MediaServerPlayItem {
|
||||||
|
id?: string | number
|
||||||
|
title: string
|
||||||
|
subtitle?: string
|
||||||
|
type?: string
|
||||||
|
image?: string
|
||||||
|
link?: string
|
||||||
|
percent?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
// 媒体服务器媒体库
|
||||||
|
export interface MediaServerLibrary {
|
||||||
|
server: string
|
||||||
|
id?: string | number
|
||||||
|
name: string
|
||||||
|
path?: string
|
||||||
|
type?: string
|
||||||
|
image?: string
|
||||||
|
image_list?: string[]
|
||||||
|
link?: string
|
||||||
|
}
|
||||||
|
|||||||
BIN
src/assets/images/misc/emby.png
Normal file
BIN
src/assets/images/misc/emby.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
src/assets/images/misc/jellyfin.png
Normal file
BIN
src/assets/images/misc/jellyfin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
src/assets/images/misc/plex.png
Normal file
BIN
src/assets/images/misc/plex.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
89
src/components/cards/BackdropCard.vue
Normal file
89
src/components/cards/BackdropCard.vue
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import type { MediaServerPlayItem } from '@/api/types'
|
||||||
|
|
||||||
|
// 输入参数
|
||||||
|
const props = defineProps({
|
||||||
|
media: Object as PropType<MediaServerPlayItem>,
|
||||||
|
width: String,
|
||||||
|
height: String,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 图片是否加载完成
|
||||||
|
const imageLoaded = ref(false)
|
||||||
|
|
||||||
|
// 图片加载完成响应
|
||||||
|
function imageLoadHandler() {
|
||||||
|
imageLoaded.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 跳转播放
|
||||||
|
function goPlay() {
|
||||||
|
if (props.media?.link)
|
||||||
|
window.open(props.media?.link, '_blank')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算图片地址
|
||||||
|
const getImgUrl = computed(() => {
|
||||||
|
const image = props.media?.image || ''
|
||||||
|
return `${import.meta.env.VITE_API_BASE_URL}system/img/${encodeURIComponent(image)}`
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VHover
|
||||||
|
v-bind="props"
|
||||||
|
:height="props.height"
|
||||||
|
:width="props.width"
|
||||||
|
>
|
||||||
|
<template #default="hover">
|
||||||
|
<VCard
|
||||||
|
v-bind="hover.props"
|
||||||
|
:height="props.height"
|
||||||
|
:width="props.width"
|
||||||
|
class="ring-gray-500"
|
||||||
|
:class="{
|
||||||
|
'transition transform-cpu duration-300 scale-105 shadow-lg': hover.isHovering,
|
||||||
|
'ring-1': imageLoaded,
|
||||||
|
}"
|
||||||
|
@click="goPlay"
|
||||||
|
>
|
||||||
|
<template #image>
|
||||||
|
<VImg
|
||||||
|
:src="getImgUrl"
|
||||||
|
aspect-ratio="2/3"
|
||||||
|
cover
|
||||||
|
@load="imageLoadHandler"
|
||||||
|
>
|
||||||
|
<template #placeholder>
|
||||||
|
<div class="w-full h-full">
|
||||||
|
<VSkeletonLoader class="object-cover aspect-w-3 aspect-h-2" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<VCardText
|
||||||
|
class="w-full flex flex-col flex-wrap justify-end align-left text-white absolute bottom-0 cursor-pointer pa-2"
|
||||||
|
>
|
||||||
|
<h1 class="mb-1 text-white text-shadow font-extrabold text-xl line-clamp-2 overflow-hidden text-ellipsis ...">
|
||||||
|
{{ props.media?.title }}
|
||||||
|
</h1>
|
||||||
|
<span class="text-shadow">{{ props.media?.subtitle }}</span>
|
||||||
|
</VCardText>
|
||||||
|
</VImg>
|
||||||
|
</template>
|
||||||
|
<div class="w-full absolute bottom-0">
|
||||||
|
<VProgressLinear
|
||||||
|
v-if="props.media?.percent"
|
||||||
|
:model-value="props.media?.percent"
|
||||||
|
bg-color="success"
|
||||||
|
color="success"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VCard>
|
||||||
|
</template>
|
||||||
|
</VHover>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.text-shadow{
|
||||||
|
text-shadow:1px 1px #777;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
202
src/components/cards/LibraryCard.vue
Normal file
202
src/components/cards/LibraryCard.vue
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import type { MediaServerLibrary } from '@/api/types'
|
||||||
|
import plex from '@images/misc/plex.png'
|
||||||
|
import emby from '@images/misc/emby.png'
|
||||||
|
import jellyfin from '@images/misc/jellyfin.png'
|
||||||
|
|
||||||
|
// 输入参数
|
||||||
|
const props = defineProps({
|
||||||
|
media: Object as PropType<MediaServerLibrary>,
|
||||||
|
width: String,
|
||||||
|
height: String,
|
||||||
|
})
|
||||||
|
|
||||||
|
// canvas
|
||||||
|
const canvasRef = ref<HTMLCanvasElement>()
|
||||||
|
|
||||||
|
// 图片地址
|
||||||
|
const imgUrl = ref('')
|
||||||
|
|
||||||
|
// 图片是否加载完成
|
||||||
|
const imageLoaded = ref(false)
|
||||||
|
|
||||||
|
// 图片是否加载错误
|
||||||
|
const imageError = ref(false)
|
||||||
|
|
||||||
|
// 图片加载完成响应
|
||||||
|
function imageLoadHandler() {
|
||||||
|
imageLoaded.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 图片加载错误
|
||||||
|
function imageErrorHandler() {
|
||||||
|
imageError.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 默认图片
|
||||||
|
function getDefaultImage() {
|
||||||
|
if (props.media?.server === 'plex')
|
||||||
|
return plex
|
||||||
|
else if (props.media?.server === 'emby')
|
||||||
|
return emby
|
||||||
|
else if (props.media?.server === 'jellyfin')
|
||||||
|
return jellyfin
|
||||||
|
else
|
||||||
|
return plex
|
||||||
|
}
|
||||||
|
|
||||||
|
// 跳转播放
|
||||||
|
function goPlay() {
|
||||||
|
if (props.media?.link)
|
||||||
|
window.open(props.media?.link, '_blank')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成图片代理路径
|
||||||
|
function getImgUrl(url: string) {
|
||||||
|
if (!url)
|
||||||
|
return getDefaultImage()
|
||||||
|
else
|
||||||
|
return `${import.meta.env.VITE_API_BASE_URL}system/img/${encodeURIComponent(url)}`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据多张图片生成媒体库封面
|
||||||
|
async function drawImages(imageList: string[]) {
|
||||||
|
// 图片
|
||||||
|
const IMAGES = imageList
|
||||||
|
if (IMAGES.length === 0)
|
||||||
|
return getDefaultImage()
|
||||||
|
|
||||||
|
// 为所有图片添加system/img前缀
|
||||||
|
for (let i = 0; i < IMAGES.length; i++)
|
||||||
|
IMAGES[i] = `${import.meta.env.VITE_API_BASE_URL}system/img/${encodeURIComponent(IMAGES[i])}`
|
||||||
|
|
||||||
|
// canvas
|
||||||
|
const canvas = canvasRef.value
|
||||||
|
if (!canvas)
|
||||||
|
return getDefaultImage()
|
||||||
|
|
||||||
|
// 画布参数
|
||||||
|
const POSTER_WIDTH = (canvas.width - 32) / 4
|
||||||
|
const POSTER_HEIGHT = canvas.height * 0.75 - 8
|
||||||
|
const MARGIN_WIDTH = 4
|
||||||
|
const MARGIN_HEIGHT = 4
|
||||||
|
const REFLECTION_HEIGHT = POSTER_HEIGHT / 2
|
||||||
|
const REFLECTION_SHOW_HEIGHT = canvas.height / 4
|
||||||
|
|
||||||
|
// 获取画布上下文
|
||||||
|
const ctx = canvas.getContext('2d')
|
||||||
|
if (!ctx)
|
||||||
|
return getDefaultImage()
|
||||||
|
|
||||||
|
// 设置背景色为黑色
|
||||||
|
ctx.fillStyle = '#000000'
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height)
|
||||||
|
|
||||||
|
// 绘制图片
|
||||||
|
async function drawImageWithReflection(imgSrc: string, index: number) {
|
||||||
|
if (!canvas)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (!ctx)
|
||||||
|
return
|
||||||
|
|
||||||
|
const img = new Image()
|
||||||
|
img.setAttribute('crossorigin', 'anonymous')
|
||||||
|
img.src = imgSrc
|
||||||
|
await new Promise(resolve => img.onload = resolve)
|
||||||
|
|
||||||
|
const x = MARGIN_WIDTH * index + POSTER_WIDTH * (index - 1)
|
||||||
|
const y = MARGIN_HEIGHT
|
||||||
|
|
||||||
|
ctx.drawImage(img, x, y, POSTER_WIDTH, POSTER_HEIGHT)
|
||||||
|
|
||||||
|
ctx.save()
|
||||||
|
ctx.translate(0, canvas.height)
|
||||||
|
ctx.scale(1, -1)
|
||||||
|
ctx.drawImage(
|
||||||
|
img,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
img.width,
|
||||||
|
img.height,
|
||||||
|
x,
|
||||||
|
REFLECTION_SHOW_HEIGHT - REFLECTION_HEIGHT,
|
||||||
|
POSTER_WIDTH,
|
||||||
|
REFLECTION_HEIGHT,
|
||||||
|
)
|
||||||
|
|
||||||
|
const gradient = ctx.createLinearGradient(
|
||||||
|
0,
|
||||||
|
REFLECTION_SHOW_HEIGHT - REFLECTION_HEIGHT,
|
||||||
|
0,
|
||||||
|
REFLECTION_HEIGHT,
|
||||||
|
)
|
||||||
|
|
||||||
|
gradient.addColorStop(0, 'rgba(0, 0, 0, 1)')
|
||||||
|
gradient.addColorStop(1, 'rgba(0, 0, 0, 0.3)')
|
||||||
|
ctx.fillStyle = gradient
|
||||||
|
ctx.fillRect(x, 0, POSTER_WIDTH, REFLECTION_SHOW_HEIGHT)
|
||||||
|
|
||||||
|
ctx.restore()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绘制多张图片
|
||||||
|
const loopCount = Math.min(4, IMAGES.length)
|
||||||
|
for (let i = 0; i < loopCount; i++)
|
||||||
|
await drawImageWithReflection(IMAGES[i], i + 1)
|
||||||
|
|
||||||
|
// 转换为图片地址
|
||||||
|
return canvas.toDataURL('image/png')
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
if (props.media?.image_list && props.media?.image_list.length > 0)
|
||||||
|
imgUrl.value = await drawImages(props.media?.image_list || [])
|
||||||
|
else
|
||||||
|
imgUrl.value = getImgUrl(props.media?.image || '')
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VHover
|
||||||
|
v-bind="props"
|
||||||
|
:height="props.height"
|
||||||
|
:width="props.width"
|
||||||
|
>
|
||||||
|
<template #default="hover">
|
||||||
|
<VCard
|
||||||
|
v-bind="hover.props"
|
||||||
|
:height="props.height"
|
||||||
|
:width="props.width"
|
||||||
|
:class="{
|
||||||
|
'transition transform-cpu duration-300 scale-105 shadow-lg': hover.isHovering,
|
||||||
|
}"
|
||||||
|
@click="goPlay"
|
||||||
|
>
|
||||||
|
<template #image>
|
||||||
|
<canvas ref="canvasRef" class="w-full h-full hidden" />
|
||||||
|
<VImg
|
||||||
|
:src="imgUrl"
|
||||||
|
aspect-ratio="2/3"
|
||||||
|
cover
|
||||||
|
@load="imageLoadHandler"
|
||||||
|
@error="imageErrorHandler"
|
||||||
|
>
|
||||||
|
<template #placeholder>
|
||||||
|
<div class="w-full h-full">
|
||||||
|
<VSkeletonLoader class="object-cover aspect-w-3 aspect-h-2" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<VCardText
|
||||||
|
class="w-full flex flex-col flex-wrap justify-end align-center text-white absolute bottom-0 cursor-pointer pa-2"
|
||||||
|
>
|
||||||
|
<h1 class="mb-1 text-white font-bold line-clamp-2 overflow-hidden text-ellipsis ...">
|
||||||
|
{{ props.media?.name }}
|
||||||
|
</h1>
|
||||||
|
</VCardText>
|
||||||
|
</VImg>
|
||||||
|
</template>
|
||||||
|
</VCard>
|
||||||
|
</template>
|
||||||
|
</VHover>
|
||||||
|
</template>
|
||||||
@@ -16,6 +16,11 @@ const props = defineProps({
|
|||||||
height: String,
|
height: String,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 订阅规则
|
||||||
|
const subscribeRules = ref({
|
||||||
|
show_edit_dialog: false,
|
||||||
|
})
|
||||||
|
|
||||||
// 提示框
|
// 提示框
|
||||||
const $toast = useToast()
|
const $toast = useToast()
|
||||||
|
|
||||||
@@ -146,7 +151,7 @@ async function addSubscribe(season = 0) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// 弹出订阅编辑弹窗
|
// 弹出订阅编辑弹窗
|
||||||
if (result.success && seasonsSelected.value.length <= 1) {
|
if (result.success && seasonsSelected.value.length <= 1 && subscribeRules.value.show_edit_dialog) {
|
||||||
subscribeId.value = result.data.id
|
subscribeId.value = result.data.id
|
||||||
subscribeEditDialog.value = true
|
subscribeEditDialog.value = true
|
||||||
}
|
}
|
||||||
@@ -223,7 +228,7 @@ async function handleCheckSubscribe() {
|
|||||||
// 查询当前媒体是否已入库
|
// 查询当前媒体是否已入库
|
||||||
async function handleCheckExists() {
|
async function handleCheckExists() {
|
||||||
try {
|
try {
|
||||||
const result: { [key: string]: any } = await api.get('media/exists', {
|
const result: { [key: string]: any } = await api.get('mediaserver/exists', {
|
||||||
params: {
|
params: {
|
||||||
tmdbid: props.media?.tmdb_id,
|
tmdbid: props.media?.tmdb_id,
|
||||||
title: props.media?.title,
|
title: props.media?.title,
|
||||||
@@ -269,7 +274,7 @@ async function checkSeasonsNotExists() {
|
|||||||
// 开始处理
|
// 开始处理
|
||||||
startNProgress()
|
startNProgress()
|
||||||
try {
|
try {
|
||||||
const result: NotExistMediaInfo[] = await api.post('download/notexists', props.media)
|
const result: NotExistMediaInfo[] = await api.post('mediaserver/notexists', props.media)
|
||||||
if (result) {
|
if (result) {
|
||||||
result.forEach((item) => {
|
result.forEach((item) => {
|
||||||
// 0-已入库 1-部分缺失 2-全部缺失
|
// 0-已入库 1-部分缺失 2-全部缺失
|
||||||
@@ -302,6 +307,20 @@ async function getMediaSeasons() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询订阅弹窗规则
|
||||||
|
async function querySubscribeRules() {
|
||||||
|
try {
|
||||||
|
const result: { [key: string]: any } = await api.get(
|
||||||
|
'system/setting/DefaultFilterRules',
|
||||||
|
)
|
||||||
|
if (result.data?.value)
|
||||||
|
subscribeRules.value = result.data?.value
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 爱心订阅按钮响应
|
// 爱心订阅按钮响应
|
||||||
function handleSubscribe() {
|
function handleSubscribe() {
|
||||||
if (isSubscribed.value)
|
if (isSubscribed.value)
|
||||||
@@ -373,6 +392,7 @@ function handleSearch() {
|
|||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
handleCheckSubscribe()
|
handleCheckSubscribe()
|
||||||
handleCheckExists()
|
handleCheckExists()
|
||||||
|
querySubscribeRules()
|
||||||
})
|
})
|
||||||
|
|
||||||
// 计算图片地址
|
// 计算图片地址
|
||||||
|
|||||||
102
src/components/cards/PosterCard.vue
Normal file
102
src/components/cards/PosterCard.vue
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import type { PropType } from 'vue'
|
||||||
|
import type { MediaServerPlayItem } from '@/api/types'
|
||||||
|
import noImage from '@images/no-image.jpeg'
|
||||||
|
|
||||||
|
// 输入参数
|
||||||
|
const props = defineProps({
|
||||||
|
media: Object as PropType<MediaServerPlayItem>,
|
||||||
|
width: String,
|
||||||
|
height: String,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 图片加载状态
|
||||||
|
const isImageLoaded = ref(false)
|
||||||
|
|
||||||
|
// 图片加载失败
|
||||||
|
const imageLoadError = ref(false)
|
||||||
|
|
||||||
|
// 角标颜色
|
||||||
|
function getChipColor(type: string) {
|
||||||
|
if (type === '电影')
|
||||||
|
return 'border-blue-500 bg-blue-600'
|
||||||
|
else if (type === '电视剧')
|
||||||
|
return ' bg-indigo-500 border-indigo-600'
|
||||||
|
else
|
||||||
|
return 'border-purple-600 bg-purple-600'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算图片地址
|
||||||
|
const getImgUrl = computed(() => {
|
||||||
|
if (imageLoadError.value)
|
||||||
|
return noImage
|
||||||
|
const image = props.media?.image || ''
|
||||||
|
return `${import.meta.env.VITE_API_BASE_URL}system/img/${encodeURIComponent(image)}`
|
||||||
|
})
|
||||||
|
|
||||||
|
// 跳转播放
|
||||||
|
function goPlay() {
|
||||||
|
if (props.media?.link)
|
||||||
|
window.open(props.media?.link, '_blank')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VHover v-bind="props">
|
||||||
|
<template #default="hover">
|
||||||
|
<VCard
|
||||||
|
v-bind="hover.props"
|
||||||
|
:height="props.height"
|
||||||
|
:width="props.width"
|
||||||
|
class="outline-none shadow ring-gray-500 rounded-lg"
|
||||||
|
:class="{
|
||||||
|
'transition transform-cpu duration-300 scale-105 shadow-lg': hover.isHovering,
|
||||||
|
'ring-1': isImageLoaded,
|
||||||
|
}"
|
||||||
|
@click.stop="goPlay"
|
||||||
|
>
|
||||||
|
<VImg
|
||||||
|
aspect-ratio="2/3"
|
||||||
|
:src="getImgUrl"
|
||||||
|
class="object-cover aspect-w-2 aspect-h-3"
|
||||||
|
:class="hover.isHovering ? 'on-hover' : ''"
|
||||||
|
cover
|
||||||
|
@load="isImageLoaded = true"
|
||||||
|
@error="imageLoadError = true"
|
||||||
|
>
|
||||||
|
<template #placeholder>
|
||||||
|
<div class="w-full h-full">
|
||||||
|
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<!-- 类型角标 -->
|
||||||
|
<VChip
|
||||||
|
v-show="isImageLoaded"
|
||||||
|
variant="elevated"
|
||||||
|
size="small"
|
||||||
|
:class="getChipColor(props.media?.type || '')"
|
||||||
|
class="absolute left-2 top-2 bg-opacity-80 shadow-md text-white font-bold"
|
||||||
|
>
|
||||||
|
{{ props.media?.type }}
|
||||||
|
</VChip>
|
||||||
|
<!-- 详情 -->
|
||||||
|
<VCardText
|
||||||
|
v-show="hover.isHovering || imageLoadError"
|
||||||
|
class="w-full flex flex-col flex-wrap justify-end align-left text-white absolute bottom-0 cursor-pointer pa-2"
|
||||||
|
>
|
||||||
|
<span class="font-bold">{{ props.media?.subtitle }}</span>
|
||||||
|
<h1 class="mb-1 text-white font-extrabold text-xl line-clamp-2 overflow-hidden text-ellipsis ...">
|
||||||
|
{{ props.media?.title }}
|
||||||
|
</h1>
|
||||||
|
</VCardText>
|
||||||
|
</VImg>
|
||||||
|
</VCard>
|
||||||
|
</template>
|
||||||
|
</VHover>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.on-hover img {
|
||||||
|
@apply brightness-50;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -14,6 +14,10 @@ const themes: ThemeSwitcherTheme[] = [
|
|||||||
name: 'purple',
|
name: 'purple',
|
||||||
icon: 'mdi-brightness-4',
|
icon: 'mdi-brightness-4',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'auto',
|
||||||
|
icon: 'mdi-brightness-auto',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,57 @@ import AnalyticsStorage from '@/views/dashboard/AnalyticsStorage.vue'
|
|||||||
import AnalyticsWeeklyOverview from '@/views/dashboard/AnalyticsWeeklyOverview.vue'
|
import AnalyticsWeeklyOverview from '@/views/dashboard/AnalyticsWeeklyOverview.vue'
|
||||||
import AnalyticsCpu from '@/views/dashboard/AnalyticsCpu.vue'
|
import AnalyticsCpu from '@/views/dashboard/AnalyticsCpu.vue'
|
||||||
import AnalyticsMemory from '@/views/dashboard/AnalyticsMemory.vue'
|
import AnalyticsMemory from '@/views/dashboard/AnalyticsMemory.vue'
|
||||||
|
import MediaServerLatest from '@/views/dashboard/MediaServerLatest.vue'
|
||||||
|
import MediaServerLibrary from '@/views/dashboard/MediaServerLibrary.vue'
|
||||||
|
import MediaServerPlaying from '@/views/dashboard/MediaServerPlaying.vue'
|
||||||
|
|
||||||
|
// 仪表盘配置
|
||||||
|
const dashboard_names = {
|
||||||
|
storage: '存储空间',
|
||||||
|
mediaStatistic: '媒体统计',
|
||||||
|
weeklyOverview: '最近入库',
|
||||||
|
speed: '实时速率',
|
||||||
|
scheduler: '后台任务',
|
||||||
|
cpu: 'CPU',
|
||||||
|
memory: '内存',
|
||||||
|
library: '我的媒体库',
|
||||||
|
playing: '继续观看',
|
||||||
|
latest: '最近添加',
|
||||||
|
}
|
||||||
|
|
||||||
|
// 弹窗
|
||||||
|
const dialog = ref(false)
|
||||||
|
|
||||||
|
// 从localStorage中获取数据
|
||||||
|
const default_config = {
|
||||||
|
mediaStatistic: true,
|
||||||
|
scheduler: false,
|
||||||
|
speed: false,
|
||||||
|
storage: true,
|
||||||
|
weeklyOverview: false,
|
||||||
|
cpu: false,
|
||||||
|
memory: false,
|
||||||
|
library: true,
|
||||||
|
playing: true,
|
||||||
|
latest: true,
|
||||||
|
}
|
||||||
|
const config = ref(JSON.parse(localStorage.getItem('MP_DASHBOARD') || '{}'))
|
||||||
|
if (Object.keys(config.value).length === 0) {
|
||||||
|
config.value = default_config
|
||||||
|
localStorage.setItem('MP_DASHBOARD', JSON.stringify(config.value))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置项目
|
||||||
|
function setDashboardConfig() {
|
||||||
|
localStorage.setItem('MP_DASHBOARD', JSON.stringify(config.value))
|
||||||
|
dialog.value = false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VRow class="match-height">
|
<VRow class="match-height">
|
||||||
<VCol
|
<VCol
|
||||||
|
v-if="config.storage"
|
||||||
cols="12"
|
cols="12"
|
||||||
md="4"
|
md="4"
|
||||||
>
|
>
|
||||||
@@ -18,6 +64,7 @@ import AnalyticsMemory from '@/views/dashboard/AnalyticsMemory.vue'
|
|||||||
</VCol>
|
</VCol>
|
||||||
|
|
||||||
<VCol
|
<VCol
|
||||||
|
v-if="config.mediaStatistic"
|
||||||
cols="12"
|
cols="12"
|
||||||
md="8"
|
md="8"
|
||||||
>
|
>
|
||||||
@@ -25,6 +72,7 @@ import AnalyticsMemory from '@/views/dashboard/AnalyticsMemory.vue'
|
|||||||
</VCol>
|
</VCol>
|
||||||
|
|
||||||
<VCol
|
<VCol
|
||||||
|
v-if="config.weeklyOverview"
|
||||||
cols="12"
|
cols="12"
|
||||||
md="4"
|
md="4"
|
||||||
>
|
>
|
||||||
@@ -32,6 +80,7 @@ import AnalyticsMemory from '@/views/dashboard/AnalyticsMemory.vue'
|
|||||||
</VCol>
|
</VCol>
|
||||||
|
|
||||||
<VCol
|
<VCol
|
||||||
|
v-if="config.speed"
|
||||||
cols="12"
|
cols="12"
|
||||||
md="4"
|
md="4"
|
||||||
>
|
>
|
||||||
@@ -39,6 +88,7 @@ import AnalyticsMemory from '@/views/dashboard/AnalyticsMemory.vue'
|
|||||||
</VCol>
|
</VCol>
|
||||||
|
|
||||||
<VCol
|
<VCol
|
||||||
|
v-if="config.scheduler"
|
||||||
cols="12"
|
cols="12"
|
||||||
md="4"
|
md="4"
|
||||||
>
|
>
|
||||||
@@ -46,6 +96,7 @@ import AnalyticsMemory from '@/views/dashboard/AnalyticsMemory.vue'
|
|||||||
</VCol>
|
</VCol>
|
||||||
|
|
||||||
<VCol
|
<VCol
|
||||||
|
v-if="config.cpu"
|
||||||
cols="12"
|
cols="12"
|
||||||
md="6"
|
md="6"
|
||||||
>
|
>
|
||||||
@@ -53,10 +104,75 @@ import AnalyticsMemory from '@/views/dashboard/AnalyticsMemory.vue'
|
|||||||
</VCol>
|
</VCol>
|
||||||
|
|
||||||
<VCol
|
<VCol
|
||||||
|
v-if="config.memory"
|
||||||
cols="12"
|
cols="12"
|
||||||
md="6"
|
md="6"
|
||||||
>
|
>
|
||||||
<AnalyticsMemory />
|
<AnalyticsMemory />
|
||||||
</VCol>
|
</VCol>
|
||||||
|
|
||||||
|
<VCol
|
||||||
|
v-if="config.library"
|
||||||
|
cols="12"
|
||||||
|
>
|
||||||
|
<MediaServerLibrary />
|
||||||
|
</VCol>
|
||||||
|
|
||||||
|
<VCol
|
||||||
|
v-if="config.playing"
|
||||||
|
cols="12"
|
||||||
|
>
|
||||||
|
<MediaServerPlaying />
|
||||||
|
</VCol>
|
||||||
|
|
||||||
|
<VCol
|
||||||
|
v-if="config.latest"
|
||||||
|
cols="12"
|
||||||
|
>
|
||||||
|
<MediaServerLatest />
|
||||||
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
|
<!-- 底部操作按钮 -->
|
||||||
|
<span class="fixed right-5 bottom-5">
|
||||||
|
<VBtn icon="mdi-view-dashboard-edit" class="me-2" color="primary" size="x-large" @click="dialog = true" />
|
||||||
|
</span>
|
||||||
|
<!-- 弹窗,根据配置生成选项 -->
|
||||||
|
<VDialog
|
||||||
|
v-model="dialog"
|
||||||
|
max-width="600"
|
||||||
|
scrollable
|
||||||
|
>
|
||||||
|
<VCard title="设置仪表板">
|
||||||
|
<VCardText>
|
||||||
|
<VRow>
|
||||||
|
<VCol
|
||||||
|
v-for="(item, key) in dashboard_names"
|
||||||
|
:key="key"
|
||||||
|
cols="12"
|
||||||
|
md="4"
|
||||||
|
>
|
||||||
|
<VCheckbox
|
||||||
|
v-model="config[key]"
|
||||||
|
:label="dashboard_names[key]"
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
|
</VRow>
|
||||||
|
</VCardText>
|
||||||
|
<VCardActions>
|
||||||
|
<VBtn
|
||||||
|
color="primary"
|
||||||
|
@click="dialog = false"
|
||||||
|
>
|
||||||
|
取消
|
||||||
|
</VBtn>
|
||||||
|
<VSpacer />
|
||||||
|
<VBtn
|
||||||
|
color="primary"
|
||||||
|
@click="setDashboardConfig"
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</VBtn>
|
||||||
|
</VCardActions>
|
||||||
|
</VCard>
|
||||||
|
</vdialog>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
48
src/views/dashboard/MediaServerLatest.vue
Normal file
48
src/views/dashboard/MediaServerLatest.vue
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import api from '@/api'
|
||||||
|
import type { MediaServerPlayItem } from '@/api/types'
|
||||||
|
import PosterCard from '@/components/cards/PosterCard.vue'
|
||||||
|
|
||||||
|
// 最近入库列表
|
||||||
|
const latestList = ref<MediaServerPlayItem[]>([])
|
||||||
|
|
||||||
|
// 调用API查询
|
||||||
|
async function loadLatest() {
|
||||||
|
try {
|
||||||
|
latestList.value = await api.get('mediaserver/latest')
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadLatest()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VCard>
|
||||||
|
<VCardItem>
|
||||||
|
<VCardTitle>最近添加</VCardTitle>
|
||||||
|
</VCardItem>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="latestList.length > 0"
|
||||||
|
class="grid gap-4 grid-media-card mx-3 mb-3"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
<PosterCard
|
||||||
|
v-for="data in latestList"
|
||||||
|
:key="data.id"
|
||||||
|
:media="data"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VCard>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.grid-media-card {
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(9.375rem, 1fr));
|
||||||
|
}
|
||||||
|
</style>
|
||||||
50
src/views/dashboard/MediaServerLibrary.vue
Normal file
50
src/views/dashboard/MediaServerLibrary.vue
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import api from '@/api'
|
||||||
|
import type { MediaServerPlayItem } from '@/api/types'
|
||||||
|
import LibraryCard from '@/components/cards/LibraryCard.vue'
|
||||||
|
|
||||||
|
// 媒体库列表
|
||||||
|
const libraryList = ref<MediaServerPlayItem[]>([])
|
||||||
|
|
||||||
|
// 调用API查询
|
||||||
|
async function loadLibrary() {
|
||||||
|
try {
|
||||||
|
libraryList.value = await api.get('mediaserver/library')
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadLibrary()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VCard>
|
||||||
|
<VCardItem>
|
||||||
|
<VCardTitle>我的媒体库</VCardTitle>
|
||||||
|
</VCardItem>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="libraryList.length > 0"
|
||||||
|
class="grid gap-4 grid-backdrop-card mx-3"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
<LibraryCard
|
||||||
|
v-for="data in libraryList"
|
||||||
|
:key="data.id"
|
||||||
|
:media="data"
|
||||||
|
height="10rem"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VCard>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.grid-backdrop-card {
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
|
||||||
|
padding-block-end: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
50
src/views/dashboard/MediaServerPlaying.vue
Normal file
50
src/views/dashboard/MediaServerPlaying.vue
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import api from '@/api'
|
||||||
|
import type { MediaServerPlayItem } from '@/api/types'
|
||||||
|
import BackdropCard from '@/components/cards/BackdropCard.vue'
|
||||||
|
|
||||||
|
// 继续播放列表
|
||||||
|
const playingList = ref<MediaServerPlayItem[]>([])
|
||||||
|
|
||||||
|
// 调用API查询
|
||||||
|
async function loadPlayingList() {
|
||||||
|
try {
|
||||||
|
playingList.value = await api.get('mediaserver/playing')
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadPlayingList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VCard>
|
||||||
|
<VCardItem>
|
||||||
|
<VCardTitle>继续观看</VCardTitle>
|
||||||
|
</VCardItem>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="playingList.length > 0"
|
||||||
|
class="grid gap-4 grid-backdrop-card mx-3"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
<BackdropCard
|
||||||
|
v-for="data in playingList"
|
||||||
|
:key="data.id"
|
||||||
|
:media="data"
|
||||||
|
height="10rem"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VCard>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.grid-backdrop-card {
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
|
||||||
|
padding-block-end: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -25,8 +25,8 @@ const mediaDetail = ref<MediaInfo>({} as MediaInfo)
|
|||||||
// 订阅编辑弹窗
|
// 订阅编辑弹窗
|
||||||
const subscribeEditDialog = ref(false)
|
const subscribeEditDialog = ref(false)
|
||||||
|
|
||||||
// 本地是否存在
|
// 本地是否存在,存在则包括Item信息
|
||||||
const isExists = ref(false)
|
const existsItemId = ref('')
|
||||||
|
|
||||||
// 是否已订阅
|
// 是否已订阅
|
||||||
const isSubscribed = ref(false)
|
const isSubscribed = ref(false)
|
||||||
@@ -46,6 +46,11 @@ const seasonsSubscribed = ref<{ [key: number]: boolean }>({})
|
|||||||
// 订阅编号
|
// 订阅编号
|
||||||
const subscribeId = ref<number>()
|
const subscribeId = ref<number>()
|
||||||
|
|
||||||
|
// 订阅规则
|
||||||
|
const subscribeRules = ref({
|
||||||
|
show_edit_dialog: false,
|
||||||
|
})
|
||||||
|
|
||||||
// 调用API查询详情
|
// 调用API查询详情
|
||||||
async function getMediaDetail() {
|
async function getMediaDetail() {
|
||||||
if (mediaProps.mediaid && mediaProps.type) {
|
if (mediaProps.mediaid && mediaProps.type) {
|
||||||
@@ -59,9 +64,8 @@ async function getMediaDetail() {
|
|||||||
return
|
return
|
||||||
|
|
||||||
// 检查存在状态
|
// 检查存在状态
|
||||||
if (mediaDetail.value.type === '电影')
|
checkExists()
|
||||||
checkMovieExists()
|
if (mediaDetail.value.type === '电视剧')
|
||||||
else
|
|
||||||
checkSeasonsNotExists()
|
checkSeasonsNotExists()
|
||||||
// 检查订阅状态
|
// 检查订阅状态
|
||||||
if (mediaDetail.value.type === '电影')
|
if (mediaDetail.value.type === '电影')
|
||||||
@@ -86,9 +90,9 @@ async function loadSeasonEpisodes(season: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询当前媒体是否已入库
|
// 查询当前媒体是否已入库
|
||||||
async function checkMovieExists() {
|
async function checkExists() {
|
||||||
try {
|
try {
|
||||||
const result: { [key: string]: any } = await api.get('media/exists', {
|
const result: { [key: string]: any } = await api.get('mediaserver/exists', {
|
||||||
params: {
|
params: {
|
||||||
tmdbid: mediaDetail.value.tmdb_id,
|
tmdbid: mediaDetail.value.tmdb_id,
|
||||||
title: mediaDetail.value.title,
|
title: mediaDetail.value.title,
|
||||||
@@ -99,7 +103,7 @@ async function checkMovieExists() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (result.success)
|
if (result.success)
|
||||||
isExists.value = true
|
existsItemId.value = result.data.item.id
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
@@ -133,11 +137,8 @@ async function checkSeasonsNotExists() {
|
|||||||
if (mediaDetail.value.type !== '电视剧')
|
if (mediaDetail.value.type !== '电视剧')
|
||||||
return
|
return
|
||||||
try {
|
try {
|
||||||
const result: NotExistMediaInfo[] = await api.post('download/notexists', mediaDetail.value)
|
const result: NotExistMediaInfo[] = await api.post('mediaserver/notexists', mediaDetail.value)
|
||||||
if (result) {
|
if (result) {
|
||||||
if (result.length === 0)
|
|
||||||
isExists.value = true
|
|
||||||
|
|
||||||
result.forEach((item) => {
|
result.forEach((item) => {
|
||||||
// 0-已入库 1-部分缺失 2-全部缺失
|
// 0-已入库 1-部分缺失 2-全部缺失
|
||||||
let state = 0
|
let state = 0
|
||||||
@@ -145,8 +146,6 @@ async function checkSeasonsNotExists() {
|
|||||||
state = 2
|
state = 2
|
||||||
else if (item.episodes.length < item.total_episode)
|
else if (item.episodes.length < item.total_episode)
|
||||||
state = 1
|
state = 1
|
||||||
if (state !== 2)
|
|
||||||
isExists.value = true
|
|
||||||
seasonsNotExisted.value[item.season] = state
|
seasonsNotExisted.value[item.season] = state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -188,7 +187,7 @@ async function addSubscribe(season = 0) {
|
|||||||
startNProgress()
|
startNProgress()
|
||||||
try {
|
try {
|
||||||
// 是否洗版
|
// 是否洗版
|
||||||
let best_version = isExists.value ? 1 : 0
|
let best_version = existsItemId.value ? 1 : 0
|
||||||
if (season)
|
if (season)
|
||||||
// 全部存在时洗版
|
// 全部存在时洗版
|
||||||
best_version = !seasonsNotExisted.value[season] ? 1 : 0
|
best_version = !seasonsNotExisted.value[season] ? 1 : 0
|
||||||
@@ -221,7 +220,7 @@ async function addSubscribe(season = 0) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// 显示编辑弹窗
|
// 显示编辑弹窗
|
||||||
if (result.success) {
|
if (result.success && subscribeRules.value.show_edit_dialog) {
|
||||||
subscribeId.value = result.data.id
|
subscribeId.value = result.data.id
|
||||||
subscribeEditDialog.value = true
|
subscribeEditDialog.value = true
|
||||||
}
|
}
|
||||||
@@ -283,6 +282,20 @@ async function removeSubscribe(season: number) {
|
|||||||
doneNProgress()
|
doneNProgress()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询订阅弹窗规则
|
||||||
|
async function querySubscribeRules() {
|
||||||
|
try {
|
||||||
|
const result: { [key: string]: any } = await api.get(
|
||||||
|
'system/setting/DefaultFilterRules',
|
||||||
|
)
|
||||||
|
if (result.data?.value)
|
||||||
|
subscribeRules.value = result.data?.value
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 订阅按钮响应
|
// 订阅按钮响应
|
||||||
function handleSubscribe(season = 0) {
|
function handleSubscribe(season = 0) {
|
||||||
if (isSubscribed.value)
|
if (isSubscribed.value)
|
||||||
@@ -403,8 +416,29 @@ function handleSearch(area: string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 跳转播放页面
|
||||||
|
async function handlePlay() {
|
||||||
|
// 获取播放链接地址
|
||||||
|
try {
|
||||||
|
const result: { [key: string]: any } = await api.get(
|
||||||
|
`mediaserver/play/${existsItemId.value}`,
|
||||||
|
)
|
||||||
|
if (result?.success) {
|
||||||
|
// 打开链接地址
|
||||||
|
setTimeout(() => {
|
||||||
|
window.open(result.data.url, '_blank')
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
else { $toast.error(`获取播放链接失败:${result.message}!`) }
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
getMediaDetail()
|
getMediaDetail()
|
||||||
|
querySubscribeRules()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -438,7 +472,7 @@ onBeforeMount(() => {
|
|||||||
</VImg>
|
</VImg>
|
||||||
</div>
|
</div>
|
||||||
<div class="media-title">
|
<div class="media-title">
|
||||||
<div v-if="isExists" class="media-status">
|
<div v-if="existsItemId" class="media-status">
|
||||||
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full whitespace-nowrap transition !no-underline bg-green-500 bg-opacity-80 border border-green-500 !text-green-100 hover:bg-green-500 hover:bg-opacity-100 false overflow-hidden">
|
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full whitespace-nowrap transition !no-underline bg-green-500 bg-opacity-80 border border-green-500 !text-green-100 hover:bg-green-500 hover:bg-opacity-100 false overflow-hidden">
|
||||||
<div class="relative z-20 flex items-center false"><span>已入库</span></div>
|
<div class="relative z-20 flex items-center false"><span>已入库</span></div>
|
||||||
</span>
|
</span>
|
||||||
@@ -458,7 +492,7 @@ onBeforeMount(() => {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="media-actions">
|
<div class="media-actions">
|
||||||
<VBtn v-if="mediaDetail.tmdb_id || mediaDetail.douban_id" variant="tonal" color="info">
|
<VBtn v-if="mediaDetail.tmdb_id || mediaDetail.douban_id" variant="tonal" color="info" class="mb-2">
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<VIcon icon="mdi-magnify" />
|
<VIcon icon="mdi-magnify" />
|
||||||
</template>
|
</template>
|
||||||
@@ -484,12 +518,18 @@ onBeforeMount(() => {
|
|||||||
</VList>
|
</VList>
|
||||||
</VMenu>
|
</VMenu>
|
||||||
</VBtn>
|
</VBtn>
|
||||||
<VBtn v-if="mediaDetail.type === '电影' || mediaDetail.douban_id" class="ms-2" :color="getSubscribeColor" variant="tonal" @click="handleSubscribe(0)">
|
<VBtn v-if="mediaDetail.type === '电影' || mediaDetail.douban_id" class="ms-2 mb-2" :color="getSubscribeColor" variant="tonal" @click="handleSubscribe(0)">
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<VIcon :icon="getSubscribeIcon" />
|
<VIcon :icon="getSubscribeIcon" />
|
||||||
</template>
|
</template>
|
||||||
{{ isSubscribed ? '已订阅' : '订阅' }}
|
{{ isSubscribed ? '已订阅' : '订阅' }}
|
||||||
</VBtn>
|
</VBtn>
|
||||||
|
<VBtn v-if="existsItemId" class="ms-2 mb-2" variant="tonal" @click="handlePlay()">
|
||||||
|
<template #prepend>
|
||||||
|
<VIcon icon="mdi-play" />
|
||||||
|
</template>
|
||||||
|
在线播放
|
||||||
|
</VBtn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="media-overview">
|
<div class="media-overview">
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import type { Ref } from 'vue'
|
|
||||||
import { ref } from 'vue'
|
|
||||||
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'
|
import { useDefer } from '@/@core/utils/dom'
|
||||||
@@ -94,7 +92,7 @@ onMounted(() => {
|
|||||||
groupedDataList.value = groupMap
|
groupedDataList.value = groupMap
|
||||||
})
|
})
|
||||||
|
|
||||||
const defer: Ref<Function> = ref(() => true)
|
let defer = (_: number) => true
|
||||||
|
|
||||||
// 计算过滤后的列表
|
// 计算过滤后的列表
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
@@ -135,7 +133,7 @@ watchEffect(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
defer.value = useDefer(dataList.value.length)
|
defer = useDefer(dataList.value.length)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue'
|
|
||||||
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 { useDefer } from '@/@core/utils/dom'
|
||||||
|
|
||||||
// 定义输入参数
|
// 定义输入参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -60,6 +60,8 @@ function initOptions(data: Context) {
|
|||||||
optionValue(resolutionFilterOptions.value, meta_info?.resource_pix)
|
optionValue(resolutionFilterOptions.value, meta_info?.resource_pix)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let defer = (_: number) => true
|
||||||
|
|
||||||
// 计算过滤后的列表
|
// 计算过滤后的列表
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
// 清空列表
|
// 清空列表
|
||||||
@@ -88,6 +90,7 @@ watchEffect(() => {
|
|||||||
)
|
)
|
||||||
dataList.value.push(data)
|
dataList.value.push(data)
|
||||||
})
|
})
|
||||||
|
defer = useDefer(dataList.value.length)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 初始化过滤选项
|
// 初始化过滤选项
|
||||||
@@ -106,11 +109,11 @@ onMounted(() => {
|
|||||||
<VListItemTitle>没有附合当前过滤条件的资源。</VListItemTitle>
|
<VListItemTitle>没有附合当前过滤条件的资源。</VListItemTitle>
|
||||||
</VListItem>
|
</VListItem>
|
||||||
</VList>
|
</VList>
|
||||||
<TorrentItem
|
<div>
|
||||||
v-for="(item, index) in dataList"
|
<div v-for="(item, index) in dataList" :key="`${index}_${item.torrent_info.title}_${item.torrent_info.site}`">
|
||||||
:key="`${index}_${item.torrent_info.title}_${item.torrent_info.site}`"
|
<TorrentItem v-if="defer(index)" :torrent="item" />
|
||||||
:torrent="item"
|
</div>
|
||||||
/>
|
</div>
|
||||||
</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">
|
<VList lines="one" class="rounded">
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ const currentRuleType = ref('SubscribeFilterRules')
|
|||||||
const defaultFilterRules = ref({
|
const defaultFilterRules = ref({
|
||||||
include: '',
|
include: '',
|
||||||
exclude: '',
|
exclude: '',
|
||||||
|
movie_size: '',
|
||||||
|
tv_size: '',
|
||||||
|
show_edit_dialog: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 导入代码弹窗
|
// 导入代码弹窗
|
||||||
@@ -503,6 +506,28 @@ onMounted(() => {
|
|||||||
label="排除(关键字、正则式)"
|
label="排除(关键字、正则式)"
|
||||||
/>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
|
<VCol cols="12" md="6">
|
||||||
|
<VTextField
|
||||||
|
v-model="defaultFilterRules.movie_size"
|
||||||
|
type="text"
|
||||||
|
label="电影文件大小(GB)"
|
||||||
|
placeholder="0-30"
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
|
<VCol cols="12" md="6">
|
||||||
|
<VTextField
|
||||||
|
v-model="defaultFilterRules.tv_size"
|
||||||
|
type="text"
|
||||||
|
label="剧集单集文件大小(GB)"
|
||||||
|
placeholder="0-10"
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
|
<VCol cols="12" md="6">
|
||||||
|
<VSwitch
|
||||||
|
v-model="defaultFilterRules.show_edit_dialog"
|
||||||
|
label="订阅时编辑更多规则"
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
</VForm>
|
</VForm>
|
||||||
</VCardText>
|
</VCardText>
|
||||||
|
|||||||
Reference in New Issue
Block a user