mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-07 00:36:41 +08:00
添加文件浏览器目录树切换功能,优化用户界面交互
This commit is contained in:
@@ -134,6 +134,9 @@ const refreshPending = ref(false)
|
|||||||
// 排序
|
// 排序
|
||||||
const sort = ref('name')
|
const sort = ref('name')
|
||||||
|
|
||||||
|
// 是否显示目录树
|
||||||
|
const showDirTree = ref(false)
|
||||||
|
|
||||||
// 计算属性
|
// 计算属性
|
||||||
const storagesArray = computed(() => {
|
const storagesArray = computed(() => {
|
||||||
const storageCodes = props.storages?.map(item => item.type)
|
const storageCodes = props.storages?.map(item => item.type)
|
||||||
@@ -163,6 +166,11 @@ function sortChanged(s: string) {
|
|||||||
refreshPending.value = true
|
refreshPending.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 切换目录树
|
||||||
|
function switchDirTree(state: boolean) {
|
||||||
|
showDirTree.value = !state
|
||||||
|
}
|
||||||
|
|
||||||
// 文件列表
|
// 文件列表
|
||||||
const fileListItems = ref<FileItem[]>([])
|
const fileListItems = ref<FileItem[]>([])
|
||||||
|
|
||||||
@@ -202,14 +210,18 @@ const fileListStyle = computed(() => {
|
|||||||
@sortchanged="sortChanged"
|
@sortchanged="sortChanged"
|
||||||
/>
|
/>
|
||||||
<div class="flex" :style="scrollStyle">
|
<div class="flex" :style="scrollStyle">
|
||||||
<FileNavigator
|
<VSlideXTransition v-if="showDirTree">
|
||||||
:storage="activeStorage"
|
<div>
|
||||||
:currentPath="item.path"
|
<FileNavigator
|
||||||
:items="fileListItems"
|
:storage="activeStorage"
|
||||||
:endpoints="endpoints"
|
:currentPath="item.path"
|
||||||
:axios="axios"
|
:items="fileListItems"
|
||||||
@navigate="pathChanged"
|
:endpoints="endpoints"
|
||||||
/>
|
:axios="axios"
|
||||||
|
@navigate="pathChanged"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VSlideXTransition>
|
||||||
<FileList
|
<FileList
|
||||||
class="flex-grow"
|
class="flex-grow"
|
||||||
:item="item"
|
:item="item"
|
||||||
@@ -220,12 +232,14 @@ const fileListStyle = computed(() => {
|
|||||||
:refreshpending="refreshPending"
|
:refreshpending="refreshPending"
|
||||||
:sort="sort"
|
:sort="sort"
|
||||||
:listStyle="fileListStyle"
|
:listStyle="fileListStyle"
|
||||||
|
:showTree="showDirTree"
|
||||||
@pathchanged="pathChanged"
|
@pathchanged="pathChanged"
|
||||||
@loading="loadingChanged"
|
@loading="loadingChanged"
|
||||||
@refreshed="refreshPending = false"
|
@refreshed="refreshPending = false"
|
||||||
@filedeleted="refreshPending = true"
|
@filedeleted="refreshPending = true"
|
||||||
@renamed="refreshPending = true"
|
@renamed="refreshPending = true"
|
||||||
@items-updated="fileListUpdated"
|
@items-updated="fileListUpdated"
|
||||||
|
@switch-tree="switchDirTree"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -30,10 +30,19 @@ const inProps = defineProps({
|
|||||||
},
|
},
|
||||||
sort: String,
|
sort: String,
|
||||||
listStyle: String,
|
listStyle: String,
|
||||||
|
showTree: Boolean,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 对外事件
|
// 对外事件
|
||||||
const emit = defineEmits(['loading', 'pathchanged', 'refreshed', 'filedeleted', 'renamed', 'items-updated'])
|
const emit = defineEmits([
|
||||||
|
'loading',
|
||||||
|
'pathchanged',
|
||||||
|
'refreshed',
|
||||||
|
'filedeleted',
|
||||||
|
'renamed',
|
||||||
|
'items-updated',
|
||||||
|
'switch-tree',
|
||||||
|
])
|
||||||
|
|
||||||
// 确认框
|
// 确认框
|
||||||
const createConfirm = useConfirm()
|
const createConfirm = useConfirm()
|
||||||
@@ -369,6 +378,11 @@ function formatTime(timestape: number) {
|
|||||||
return new Date(timestape * 1000).toLocaleString()
|
return new Date(timestape * 1000).toLocaleString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 切换文件树显示
|
||||||
|
function switchFileTree() {
|
||||||
|
emit('switch-tree', inProps.showTree)
|
||||||
|
}
|
||||||
|
|
||||||
// 监听refreshPending变化
|
// 监听refreshPending变化
|
||||||
watch(
|
watch(
|
||||||
() => inProps.refreshpending,
|
() => inProps.refreshpending,
|
||||||
@@ -535,6 +549,9 @@ onMounted(() => {
|
|||||||
<template>
|
<template>
|
||||||
<VCard class="d-flex flex-column w-full h-full">
|
<VCard class="d-flex flex-column w-full h-full">
|
||||||
<VToolbar v-if="!loading" density="compact" flat color="gray">
|
<VToolbar v-if="!loading" density="compact" flat color="gray">
|
||||||
|
<IconBtn>
|
||||||
|
<VIcon :icon="showTree ? 'mdi-file-tree' : 'mdi-file-tree-outline'" @@click="switchFileTree" />
|
||||||
|
</IconBtn>
|
||||||
<VTextField
|
<VTextField
|
||||||
v-if="!isFile"
|
v-if="!isFile"
|
||||||
v-model="filter"
|
v-model="filter"
|
||||||
|
|||||||
Reference in New Issue
Block a user