mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-06 16:16:42 +08:00
feat:阿里云盘支持备份盘
This commit is contained in:
@@ -765,6 +765,8 @@ export interface FileItem {
|
|||||||
thumbnail?: string
|
thumbnail?: string
|
||||||
// pickcode
|
// pickcode
|
||||||
pickcode?: string
|
pickcode?: string
|
||||||
|
// drive_id
|
||||||
|
drive_id?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 媒体服务器播放条目
|
// 媒体服务器播放条目
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const props = defineProps({
|
|||||||
type: Object as PropType<FileItem>,
|
type: Object as PropType<FileItem>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
fileidstack: Array as PropType<string[]>,
|
itemstack: Array as PropType<FileItem[]>,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 对外事件
|
// 对外事件
|
||||||
@@ -169,7 +169,7 @@ function u115AuthDone() {
|
|||||||
<div v-if="activeStorage && item">
|
<div v-if="activeStorage && item">
|
||||||
<FileToolbar
|
<FileToolbar
|
||||||
:item="item"
|
:item="item"
|
||||||
:fileidstack="fileidstack"
|
:itemstack="itemstack"
|
||||||
:storages="storagesArray"
|
:storages="storagesArray"
|
||||||
:storage="activeStorage"
|
:storage="activeStorage"
|
||||||
:endpoints="endpoints"
|
:endpoints="endpoints"
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ const inProps = defineProps({
|
|||||||
type: Object as PropType<FileItem>,
|
type: Object as PropType<FileItem>,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
fileidstack: {
|
itemstack: {
|
||||||
type: Array as PropType<string[]>,
|
type: Array as PropType<FileItem[]>,
|
||||||
default: () => [],
|
required: true,
|
||||||
},
|
},
|
||||||
endpoints: Object as PropType<EndPoints>,
|
endpoints: Object as PropType<EndPoints>,
|
||||||
axios: {
|
axios: {
|
||||||
@@ -50,14 +50,12 @@ const pathSegments = computed(() => {
|
|||||||
let path_str = ''
|
let path_str = ''
|
||||||
const isFolder = inProps.item.path?.endsWith('/')
|
const isFolder = inProps.item.path?.endsWith('/')
|
||||||
const segments = inProps.item.path?.split('/').filter(item => item)
|
const segments = inProps.item.path?.split('/').filter(item => item)
|
||||||
const fileids = inProps.fileidstack ?? []
|
|
||||||
return (
|
return (
|
||||||
segments?.map((item, index) => {
|
segments?.map((item, index) => {
|
||||||
path_str += item + (index < segments.length - 1 || isFolder ? '/' : '')
|
path_str += item + (index < segments.length - 1 || isFolder ? '/' : '')
|
||||||
return {
|
return {
|
||||||
name: item,
|
name: item,
|
||||||
path: path_str,
|
path: path_str,
|
||||||
fileid: fileids[index],
|
|
||||||
}
|
}
|
||||||
}) ?? []
|
}) ?? []
|
||||||
)
|
)
|
||||||
@@ -76,19 +74,15 @@ function changeStorage(code: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 路径变化
|
// 路径变化
|
||||||
function changePath(_path: string, _fileid: string) {
|
function changePath(item: FileItem) {
|
||||||
emit('pathchanged', {
|
emit('pathchanged', item)
|
||||||
path: _path,
|
|
||||||
fileid: _fileid,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回上一级
|
// 返回上一级
|
||||||
function goUp() {
|
function goUp() {
|
||||||
const segments = pathSegments.value ?? []
|
const segments = pathSegments.value ?? []
|
||||||
const path = segments?.length === 1 ? '/' : segments[segments.length - 2].path
|
const fileitem = inProps.itemstack[segments.length - 1]
|
||||||
const fileid = segments?.length === 1 ? 'root' : segments[segments.length - 1].fileid
|
changePath(fileitem)
|
||||||
changePath(path, fileid)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建目录
|
// 创建目录
|
||||||
@@ -145,7 +139,7 @@ const sortIcon = computed(() => {
|
|||||||
</VListItem>
|
</VListItem>
|
||||||
</VList>
|
</VList>
|
||||||
</VMenu>
|
</VMenu>
|
||||||
<VBtn variant="text" :input-value="item.path === '/'" class="px-1" @click="changePath('/', 'root')">
|
<VBtn variant="text" :input-value="item.path === '/'" class="px-1" @click="changePath(inProps.itemstack[0])">
|
||||||
<VIcon :icon="storageObject?.icon" class="mr-2" />
|
<VIcon :icon="storageObject?.icon" class="mr-2" />
|
||||||
{{ storageObject?.name }}
|
{{ storageObject?.name }}
|
||||||
</VBtn>
|
</VBtn>
|
||||||
@@ -155,7 +149,7 @@ const sortIcon = computed(() => {
|
|||||||
variant="text"
|
variant="text"
|
||||||
:input-value="index === pathSegments.length - 1"
|
:input-value="index === pathSegments.length - 1"
|
||||||
class="px-1"
|
class="px-1"
|
||||||
@click="changePath(segment.path, inProps.fileidstack[index + 1])"
|
@click="changePath(inProps.itemstack[index + 1])"
|
||||||
>
|
>
|
||||||
<VIcon icon=" mdi-chevron-right" />
|
<VIcon icon=" mdi-chevron-right" />
|
||||||
{{ segment.name }}
|
{{ segment.name }}
|
||||||
|
|||||||
@@ -45,7 +45,14 @@ const operItem = ref<FileItem>({
|
|||||||
})
|
})
|
||||||
|
|
||||||
// fileid的堆栈
|
// fileid的堆栈
|
||||||
const fileidstack = ref<string[]>(['root'])
|
const itemstack = ref<FileItem[]>([
|
||||||
|
{
|
||||||
|
type: 'dir',
|
||||||
|
name: '/',
|
||||||
|
path: '/',
|
||||||
|
fileid: 'root',
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
// 下载目录列表
|
// 下载目录列表
|
||||||
const downloadDirectories = ref<MediaDirectory[]>([])
|
const downloadDirectories = ref<MediaDirectory[]>([])
|
||||||
@@ -106,12 +113,11 @@ async function loadDownloadDirectories() {
|
|||||||
// 目录变化
|
// 目录变化
|
||||||
function pathChanged(item: FileItem) {
|
function pathChanged(item: FileItem) {
|
||||||
operItem.value = item
|
operItem.value = item
|
||||||
if (item.fileid) {
|
const index = itemstack.value.findIndex(i => i.path === item.path)
|
||||||
if (fileidstack.value.includes(item.fileid)) {
|
if (index >= 0) {
|
||||||
fileidstack.value = fileidstack.value.slice(0, fileidstack.value.indexOf(item.fileid) + 1)
|
itemstack.value = itemstack.value.slice(0, index + 1)
|
||||||
} else {
|
} else {
|
||||||
fileidstack.value.push(item.fileid)
|
itemstack.value.push(item)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +130,7 @@ onBeforeMount(loadDownloadDirectories)
|
|||||||
<FileBrowser
|
<FileBrowser
|
||||||
:storages="userStorage"
|
:storages="userStorage"
|
||||||
:tree="false"
|
:tree="false"
|
||||||
:fileidstack="fileidstack"
|
:itemstack="itemstack"
|
||||||
:endpoints="endpoints"
|
:endpoints="endpoints"
|
||||||
:axios="api"
|
:axios="api"
|
||||||
:item="operItem"
|
:item="operItem"
|
||||||
|
|||||||
Reference in New Issue
Block a user