mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
优化 PluginFolderCard 组件
This commit is contained in:
@@ -3,7 +3,6 @@ import { useToast } from 'vue-toast-notification'
|
|||||||
import { useConfirm } from 'vuetify-use-dialog'
|
import { useConfirm } from 'vuetify-use-dialog'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useDisplay } from 'vuetify'
|
import { useDisplay } from 'vuetify'
|
||||||
import api from '@/api'
|
|
||||||
|
|
||||||
// 文件夹配置接口
|
// 文件夹配置接口
|
||||||
interface FolderConfig {
|
interface FolderConfig {
|
||||||
@@ -55,13 +54,20 @@ const settingDialog = ref(false)
|
|||||||
// 新名称
|
// 新名称
|
||||||
const newFolderName = ref('')
|
const newFolderName = ref('')
|
||||||
|
|
||||||
|
// 默认颜色
|
||||||
|
const defaultColor = '#2196F3'
|
||||||
|
// 默认图标
|
||||||
|
const defaultIcon = 'mdi-folder'
|
||||||
|
// 默认渐变
|
||||||
|
const defaultGradient =
|
||||||
|
'linear-gradient(rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.5) 100%), linear-gradient(135deg, rgba(33, 150, 243, 0.7) 0%, rgba(33, 150, 243, 0.8s) 100%)'
|
||||||
|
|
||||||
// 文件夹设置
|
// 文件夹设置
|
||||||
const folderSettings = ref<FolderConfig>({
|
const folderSettings = ref<FolderConfig>({
|
||||||
background: '',
|
background: '',
|
||||||
icon: 'mdi-folder',
|
icon: defaultIcon,
|
||||||
color: '#2196F3',
|
color: defaultColor,
|
||||||
gradient:
|
gradient: defaultGradient,
|
||||||
'linear-gradient(rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.5) 100%), linear-gradient(135deg, rgba(33, 150, 243, 0.7) 0%, rgba(33, 150, 243, 0.8s) 100%)',
|
|
||||||
showIcon: true,
|
showIcon: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -103,30 +109,6 @@ const gradientOptions = [
|
|||||||
'linear-gradient(rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.5) 100%), linear-gradient(135deg, rgba(63, 81, 181, 0.7) 0%, rgba(156, 39, 176, 0.8) 100%)',
|
'linear-gradient(rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.5) 100%), linear-gradient(135deg, rgba(63, 81, 181, 0.7) 0%, rgba(156, 39, 176, 0.8) 100%)',
|
||||||
]
|
]
|
||||||
|
|
||||||
// 计算文件夹样式
|
|
||||||
const folderStyle: any = computed(() => {
|
|
||||||
const config = props.folderConfig || {}
|
|
||||||
const settings = folderSettings.value
|
|
||||||
|
|
||||||
let style = {}
|
|
||||||
|
|
||||||
// 背景图片
|
|
||||||
if (config.background || settings.background) {
|
|
||||||
const bg = config.background || settings.background
|
|
||||||
if (bg?.startsWith('http')) {
|
|
||||||
style = {
|
|
||||||
...style,
|
|
||||||
backgroundImage: `url(${bg})`,
|
|
||||||
backgroundSize: 'cover',
|
|
||||||
backgroundPosition: 'center',
|
|
||||||
backgroundRepeat: 'no-repeat',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return style
|
|
||||||
})
|
|
||||||
|
|
||||||
// 计算背景渐变
|
// 计算背景渐变
|
||||||
const backgroundGradient = computed(() => {
|
const backgroundGradient = computed(() => {
|
||||||
const config = props.folderConfig || {}
|
const config = props.folderConfig || {}
|
||||||
@@ -140,7 +122,7 @@ const folderIcon = computed(() => {
|
|||||||
const config = props.folderConfig || {}
|
const config = props.folderConfig || {}
|
||||||
const settings = folderSettings.value
|
const settings = folderSettings.value
|
||||||
|
|
||||||
return config.icon || settings.icon || 'mdi-folder'
|
return config.icon || settings.icon || defaultIcon
|
||||||
})
|
})
|
||||||
|
|
||||||
// 计算图标颜色
|
// 计算图标颜色
|
||||||
@@ -148,7 +130,7 @@ const iconColor = computed(() => {
|
|||||||
const config = props.folderConfig || {}
|
const config = props.folderConfig || {}
|
||||||
const settings = folderSettings.value
|
const settings = folderSettings.value
|
||||||
|
|
||||||
return config.color || settings.color || '#2196F3'
|
return config.color || settings.color || defaultColor
|
||||||
})
|
})
|
||||||
|
|
||||||
// 计算是否显示图标
|
// 计算是否显示图标
|
||||||
@@ -224,8 +206,8 @@ async function deleteFolder() {
|
|||||||
function showSettingDialog() {
|
function showSettingDialog() {
|
||||||
folderSettings.value = {
|
folderSettings.value = {
|
||||||
background: props.folderConfig?.background || '',
|
background: props.folderConfig?.background || '',
|
||||||
icon: props.folderConfig?.icon || 'mdi-folder',
|
icon: props.folderConfig?.icon || defaultIcon,
|
||||||
color: props.folderConfig?.color || '#2196F3',
|
color: props.folderConfig?.color || defaultColor,
|
||||||
gradient: props.folderConfig?.gradient || gradientOptions[0],
|
gradient: props.folderConfig?.gradient || gradientOptions[0],
|
||||||
showIcon: props.folderConfig?.showIcon !== undefined ? props.folderConfig.showIcon : true,
|
showIcon: props.folderConfig?.showIcon !== undefined ? props.folderConfig.showIcon : true,
|
||||||
}
|
}
|
||||||
@@ -294,14 +276,14 @@ const dropdownItems = ref([
|
|||||||
'plugin-folder-card--mobile': display.mobile,
|
'plugin-folder-card--mobile': display.mobile,
|
||||||
'plugin-folder-card--hover': hover.isHovering,
|
'plugin-folder-card--hover': hover.isHovering,
|
||||||
}"
|
}"
|
||||||
:style="folderStyle"
|
|
||||||
>
|
>
|
||||||
|
<template v-if="props.folderConfig.background || folderSettings.background" #image>
|
||||||
|
<VImg :src="props.folderConfig.background || folderSettings.background" cover position="top"> </VImg>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- 背景渐变层 -->
|
<!-- 背景渐变层 -->
|
||||||
<div class="plugin-folder-card__bg" :style="{ background: backgroundGradient }" />
|
<div class="plugin-folder-card__bg" :style="{ background: backgroundGradient }" />
|
||||||
|
|
||||||
<!-- 背景遮罩(当有背景图片时) -->
|
|
||||||
<div v-if="folderStyle.backgroundImage" class="plugin-folder-card__overlay" />
|
|
||||||
|
|
||||||
<!-- 卡片内容 -->
|
<!-- 卡片内容 -->
|
||||||
<div class="plugin-folder-card__content">
|
<div class="plugin-folder-card__content">
|
||||||
<!-- 主体内容 -->
|
<!-- 主体内容 -->
|
||||||
@@ -332,7 +314,7 @@ const dropdownItems = ref([
|
|||||||
<VMenu v-model="menuVisible" location="top end" :close-on-content-click="true">
|
<VMenu v-model="menuVisible" location="top end" :close-on-content-click="true">
|
||||||
<template #activator="{ props: menuProps }">
|
<template #activator="{ props: menuProps }">
|
||||||
<IconBtn v-bind="menuProps" @click.stop>
|
<IconBtn v-bind="menuProps" @click.stop>
|
||||||
<VIcon size="small" icon="mdi-dots-vertical" color="white" />
|
<VIcon size="small" icon="mdi-dots-vertical" />
|
||||||
</IconBtn>
|
</IconBtn>
|
||||||
</template>
|
</template>
|
||||||
<VList>
|
<VList>
|
||||||
@@ -495,21 +477,13 @@ const dropdownItems = ref([
|
|||||||
|
|
||||||
&__bg {
|
&__bg {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
outline: none;
|
||||||
|
|
||||||
&__overlay {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 1;
|
|
||||||
background: rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__content {
|
&__content {
|
||||||
|
|||||||
@@ -1508,21 +1508,4 @@ function onDragEndPlugin(evt: any) {
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 网格布局
|
|
||||||
.grid-plugin-card {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
|
||||||
gap: 16px;
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user