mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-04 23:18:44 +08:00
feat: 更新存储选项以包含图标并简化存储逻辑
This commit is contained in:
@@ -2,22 +2,27 @@ export const storageOptions = [
|
|||||||
{
|
{
|
||||||
title: '本地',
|
title: '本地',
|
||||||
value: 'local',
|
value: 'local',
|
||||||
|
icon: 'mdi-folder-multiple-outline',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '阿里云盘',
|
title: '阿里云盘',
|
||||||
value: 'alipan',
|
value: 'alipan',
|
||||||
|
icon: 'mdi-cloud-outline',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '115网盘',
|
title: '115网盘',
|
||||||
value: 'u115',
|
value: 'u115',
|
||||||
|
icon: 'mdi-cloud-outline',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Rclone网盘',
|
title: 'RClone',
|
||||||
value: 'rclone',
|
value: 'rclone',
|
||||||
|
icon: 'mdi-cloud-outline',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'AList',
|
title: 'AList',
|
||||||
value: 'alist',
|
value: 'alist',
|
||||||
|
icon: 'mdi-cloud-outline',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import type { Axios } from 'axios'
|
|||||||
import FileList from './filebrowser/FileList.vue'
|
import FileList from './filebrowser/FileList.vue'
|
||||||
import FileToolbar from './filebrowser/FileToolbar.vue'
|
import FileToolbar from './filebrowser/FileToolbar.vue'
|
||||||
import type { EndPoints, FileItem, StorageConf } from '@/api/types'
|
import type { EndPoints, FileItem, StorageConf } from '@/api/types'
|
||||||
|
import { storageOptions } from '@/api/constants'
|
||||||
|
|
||||||
// 输入参数
|
// 输入参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -27,34 +28,6 @@ const props = defineProps({
|
|||||||
// 对外事件
|
// 对外事件
|
||||||
const emit = defineEmits(['pathchanged'])
|
const emit = defineEmits(['pathchanged'])
|
||||||
|
|
||||||
const availableStorages = [
|
|
||||||
{
|
|
||||||
name: '本地',
|
|
||||||
code: 'local',
|
|
||||||
icon: 'mdi-folder-multiple-outline',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '阿里云盘',
|
|
||||||
code: 'alipan',
|
|
||||||
icon: 'mdi-cloud-outline',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '115网盘',
|
|
||||||
code: 'u115',
|
|
||||||
icon: 'mdi-cloud-outline',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Rclone网盘',
|
|
||||||
code: 'rclone',
|
|
||||||
icon: 'mdi-cloud-outline',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'AList',
|
|
||||||
code: 'alist',
|
|
||||||
icon: 'mdi-cloud-outline',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const fileIcons = {
|
const fileIcons = {
|
||||||
// 压缩包
|
// 压缩包
|
||||||
zip: 'mdi-folder-zip-outline',
|
zip: 'mdi-folder-zip-outline',
|
||||||
@@ -156,7 +129,7 @@ const sort = ref('name')
|
|||||||
// 计算属性
|
// 计算属性
|
||||||
const storagesArray = computed(() => {
|
const storagesArray = computed(() => {
|
||||||
const storageCodes = props.storages?.map(item => item.type)
|
const storageCodes = props.storages?.map(item => item.type)
|
||||||
return availableStorages.filter(item => storageCodes?.includes(item.code))
|
return storageOptions.filter(item => storageCodes?.includes(item.value))
|
||||||
})
|
})
|
||||||
|
|
||||||
// 方法
|
// 方法
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { TransferDirectoryConf } from '@/api/types'
|
import type { TransferDirectoryConf } from '@/api/types'
|
||||||
import { VDivider, VSpacer, VTextField } from 'vuetify/lib/components/index.mjs'
|
import { VDivider, VSpacer, VTextField } from 'vuetify/lib/components/index.mjs'
|
||||||
import { useToast } from 'vue-toast-notification'
|
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import { nextTick } from 'vue'
|
import { nextTick } from 'vue'
|
||||||
|
import { storageOptions } from '@/api/constants'
|
||||||
|
|
||||||
// 输入参数
|
// 输入参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -36,14 +36,6 @@ const typeItems = [
|
|||||||
{ title: '电视剧', value: '电视剧' },
|
{ title: '电视剧', value: '电视剧' },
|
||||||
]
|
]
|
||||||
|
|
||||||
// 存储下拉字典
|
|
||||||
const storageItems = [
|
|
||||||
{ title: '本地', value: 'local' },
|
|
||||||
{ title: '阿里云盘', value: 'alipan' },
|
|
||||||
{ title: '115网盘', value: 'u115' },
|
|
||||||
{ title: 'Rclone网盘', value: 'rclone' },
|
|
||||||
]
|
|
||||||
|
|
||||||
// 自动整理方式下拉字典
|
// 自动整理方式下拉字典
|
||||||
const transferSourceItems = [
|
const transferSourceItems = [
|
||||||
{ title: '不整理', value: '' },
|
{ title: '不整理', value: '' },
|
||||||
@@ -228,7 +220,7 @@ watch(
|
|||||||
/>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
<VCol cols="4">
|
<VCol cols="4">
|
||||||
<VSelect v-model="props.directory.storage" variant="underlined" :items="storageItems" label="下载存储" />
|
<VSelect v-model="props.directory.storage" variant="underlined" :items="storageOptions" label="下载存储" />
|
||||||
</VCol>
|
</VCol>
|
||||||
<VCol cols="8">
|
<VCol cols="8">
|
||||||
<VPathField @update:modelValue="updateDownloadPath" :storage="props.directory.storage">
|
<VPathField @update:modelValue="updateDownloadPath" :storage="props.directory.storage">
|
||||||
@@ -273,7 +265,7 @@ watch(
|
|||||||
<VSelect
|
<VSelect
|
||||||
v-model="props.directory.library_storage"
|
v-model="props.directory.library_storage"
|
||||||
variant="underlined"
|
variant="underlined"
|
||||||
:items="storageItems"
|
:items="storageOptions"
|
||||||
label="媒体库存储"
|
label="媒体库存储"
|
||||||
/>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ const pathSegments = computed(() => {
|
|||||||
|
|
||||||
// 当前存储
|
// 当前存储
|
||||||
const storageObject = computed(() => {
|
const storageObject = computed(() => {
|
||||||
return inProps.storages?.find(item => item.code === inProps.storage)
|
return inProps.storages?.find(item => item.value === inProps.storage)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 切换存储
|
// 切换存储
|
||||||
@@ -127,19 +127,19 @@ const sortIcon = computed(() => {
|
|||||||
<VListItem
|
<VListItem
|
||||||
v-for="(item, index) in storages"
|
v-for="(item, index) in storages"
|
||||||
:key="index"
|
:key="index"
|
||||||
:disabled="item.code === storageObject?.code"
|
:disabled="item.value === storageObject?.value"
|
||||||
@click="changeStorage(item.code)"
|
@click="changeStorage(item.value)"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<Icon :icon="item.icon" />
|
<Icon :icon="item.icon" />
|
||||||
</template>
|
</template>
|
||||||
<VListItemTitle>{{ item.name }}</VListItemTitle>
|
<VListItemTitle>{{ item.title }}</VListItemTitle>
|
||||||
</VListItem>
|
</VListItem>
|
||||||
</VList>
|
</VList>
|
||||||
</VMenu>
|
</VMenu>
|
||||||
<VBtn variant="text" :input-value="item.path === '/'" class="px-1" @click="changePath(inProps.itemstack[0])">
|
<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?.title }}
|
||||||
</VBtn>
|
</VBtn>
|
||||||
<template v-for="(segment, index) in pathSegments" :key="index">
|
<template v-for="(segment, index) in pathSegments" :key="index">
|
||||||
<VBtn
|
<VBtn
|
||||||
|
|||||||
Reference in New Issue
Block a user