mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-11 18:10:49 +08:00
fix 插件混合排序问题
This commit is contained in:
@@ -1,51 +1,3 @@
|
||||
<template>
|
||||
<div class="mixed-sort-card-wrapper">
|
||||
<!-- 文件夹卡片 -->
|
||||
<div
|
||||
v-if="item.type === 'folder'"
|
||||
class="drop-zone cursor-move"
|
||||
:data-plugin-id="item.id"
|
||||
@dragover="handleDragOver"
|
||||
@dragenter="handleDragEnter"
|
||||
@dragleave="handleDragLeave"
|
||||
@drop="handleDropToFolder"
|
||||
>
|
||||
<PluginFolderCard
|
||||
:folder-name="item.data.name"
|
||||
:plugin-count="item.data.pluginCount"
|
||||
:folder-config="item.data.config"
|
||||
@open="$emit('openFolder', item.id)"
|
||||
@delete="$emit('deleteFolder', item.id)"
|
||||
@rename="(oldName, newName) => $emit('renameFolder', oldName, newName)"
|
||||
@update-config="config => $emit('updateFolderConfig', item.id, config)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 插件卡片 -->
|
||||
<div v-else-if="item.type === 'plugin'" class="plugin-item-wrapper cursor-move" :data-plugin-id="item.id">
|
||||
<PluginCard
|
||||
:count="pluginStatistics[item.id] || 0"
|
||||
:plugin="item.data"
|
||||
:action="pluginActions[item.id] || false"
|
||||
@remove="$emit('refreshData')"
|
||||
@save="$emit('refreshData')"
|
||||
@action-done="$emit('actionDone', item.id)"
|
||||
/>
|
||||
|
||||
<!-- 移出文件夹按钮(仅在文件夹内显示) -->
|
||||
<VBtn
|
||||
v-if="showRemoveButton"
|
||||
icon="mdi-folder-remove"
|
||||
variant="text"
|
||||
color="warning"
|
||||
size="small"
|
||||
class="remove-from-folder-btn"
|
||||
@click="$emit('removeFromFolder', item.id)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import PluginCard from './PluginCard.vue'
|
||||
import PluginFolderCard from './PluginFolderCard.vue'
|
||||
@@ -121,14 +73,76 @@ function handleDropToFolder(event: DragEvent) {
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mixed-sort-card-wrapper">
|
||||
<!-- 文件夹卡片 -->
|
||||
<div
|
||||
v-if="item.type === 'folder'"
|
||||
class="drop-zone cursor-move"
|
||||
:data-plugin-id="item.id"
|
||||
@dragover="handleDragOver"
|
||||
@dragenter="handleDragEnter"
|
||||
@dragleave="handleDragLeave"
|
||||
@drop="handleDropToFolder"
|
||||
>
|
||||
<PluginFolderCard
|
||||
:folder-name="item.data.name"
|
||||
:plugin-count="item.data.pluginCount"
|
||||
:folder-config="item.data.config"
|
||||
@open="$emit('openFolder', item.id)"
|
||||
@delete="$emit('deleteFolder', item.id)"
|
||||
@rename="(oldName, newName) => $emit('renameFolder', oldName, newName)"
|
||||
@update-config="(folderName, config) => $emit('updateFolderConfig', folderName, config)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 插件卡片 -->
|
||||
<div v-else-if="item.type === 'plugin'" class="plugin-item-wrapper cursor-move" :data-plugin-id="item.id">
|
||||
<PluginCard
|
||||
:count="pluginStatistics[item.id] || 0"
|
||||
:plugin="item.data"
|
||||
:action="pluginActions[item.id] || false"
|
||||
@remove="$emit('refreshData')"
|
||||
@save="$emit('refreshData')"
|
||||
@action-done="$emit('actionDone', item.id)"
|
||||
/>
|
||||
|
||||
<!-- 移出文件夹按钮(仅在文件夹内显示) -->
|
||||
<VBtn
|
||||
v-if="showRemoveButton"
|
||||
icon="mdi-folder-remove"
|
||||
variant="text"
|
||||
color="warning"
|
||||
size="small"
|
||||
class="remove-from-folder-btn"
|
||||
@click="$emit('removeFromFolder', item.id)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mixed-sort-card-wrapper {
|
||||
block-size: 100%;
|
||||
inline-size: 100%;
|
||||
|
||||
// 确保拖拽时的边界清晰
|
||||
&.sortable-chosen {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
&.sortable-ghost {
|
||||
border: 2px dashed #2196f3;
|
||||
border-radius: 16px;
|
||||
background: rgba(33, 150, 243, 10%);
|
||||
opacity: 0.3;
|
||||
}
|
||||
}
|
||||
|
||||
// 拖拽相关样式
|
||||
.drop-zone {
|
||||
position: relative;
|
||||
isolation: isolate; // 创建新的层叠上下文
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&.drag-over {
|
||||
@@ -141,6 +155,7 @@ function handleDropToFolder(event: DragEvent) {
|
||||
|
||||
.plugin-item-wrapper {
|
||||
position: relative;
|
||||
isolation: isolate; // 创建新的层叠上下文
|
||||
|
||||
.remove-from-folder-btn {
|
||||
position: absolute;
|
||||
@@ -158,4 +173,11 @@ function handleDropToFolder(event: DragEvent) {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
// 拖拽时的样式优化
|
||||
.mixed-sort-card-wrapper.sortable-drag {
|
||||
.remove-from-folder-btn {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -5,7 +5,6 @@ import api from '@/api'
|
||||
import type { Plugin } from '@/api/types'
|
||||
import NoDataFound from '@/components/NoDataFound.vue'
|
||||
import PluginAppCard from '@/components/cards/PluginAppCard.vue'
|
||||
import PluginCard from '@/components/cards/PluginCard.vue'
|
||||
import noImage from '@images/logos/plugin.png'
|
||||
import { useDisplay } from 'vuetify'
|
||||
import { isNullOrEmptyObject } from '@/@core/utils'
|
||||
@@ -13,8 +12,7 @@ import { getPluginTabs } from '@/router/i18n-menu'
|
||||
import PluginMarketSettingDialog from '@/components/dialog/PluginMarketSettingDialog.vue'
|
||||
import { useDynamicButton } from '@/composables/useDynamicButton'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import PluginFolderCard from '@/components/cards/PluginFolderCard.vue'
|
||||
import MixedSortCard from '@/components/cards/MixedSortCard.vue'
|
||||
import PluginMixedSortCard from '@/components/cards/PluginMixedSortCard.vue'
|
||||
|
||||
// 国际化
|
||||
const { t } = useI18n()
|
||||
@@ -1345,7 +1343,7 @@ function onDragEndPlugin(evt: any) {
|
||||
group="mixed"
|
||||
>
|
||||
<template #item="{ element }">
|
||||
<MixedSortCard
|
||||
<PluginMixedSortCard
|
||||
:item="element"
|
||||
:plugin-statistics="PluginStatistics"
|
||||
:plugin-actions="pluginActions"
|
||||
@@ -1378,7 +1376,7 @@ function onDragEndPlugin(evt: any) {
|
||||
group="plugins"
|
||||
>
|
||||
<template #item="{ element }">
|
||||
<MixedSortCard
|
||||
<PluginMixedSortCard
|
||||
:item="{ type: 'plugin', id: element.id, data: element, order: 0 }"
|
||||
:plugin-statistics="PluginStatistics"
|
||||
:plugin-actions="pluginActions"
|
||||
@@ -1565,5 +1563,5 @@ function onDragEndPlugin(evt: any) {
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 样式已移至 MixedSortCard 组件
|
||||
// 样式已移至 PluginMixedSortCard 组件
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user