mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-03-13 08:28:13 -04:00
✨ Feature: folder structure can be keeped when uploading folders
This commit is contained in:
parent
221d0eaf3d
commit
750ea58845
@ -521,7 +521,7 @@ https://www.baidu.com/img/bd_logo1.png"
|
|||||||
:underline="false"
|
:underline="false"
|
||||||
:type="item.checked ? 'primary' : 'info'"
|
:type="item.checked ? 'primary' : 'info'"
|
||||||
>
|
>
|
||||||
{{ formatFileName(item.fileName ?? '', 10) }}
|
{{ formatFileName(item.fileName ?? '', 8) }}
|
||||||
</el-link>
|
</el-link>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
@ -689,11 +689,18 @@ https://www.baidu.com/img/bd_logo1.png"
|
|||||||
</el-affix>
|
</el-affix>
|
||||||
<el-drawer
|
<el-drawer
|
||||||
v-model="isShowUploadPanel"
|
v-model="isShowUploadPanel"
|
||||||
title="上传文件"
|
|
||||||
size="60%"
|
size="60%"
|
||||||
@open="startRefreshUploadTask"
|
@open="startRefreshUploadTask"
|
||||||
@close="stopRefreshUploadTask"
|
@close="stopRefreshUploadTask"
|
||||||
>
|
>
|
||||||
|
<template #header>
|
||||||
|
<el-switch
|
||||||
|
v-model="isUploadKeepDirStructure"
|
||||||
|
@change="handleUploadKeepDirChange"
|
||||||
|
active-text="保持目录结构"
|
||||||
|
inactive-text="不保持目录结构"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
<div
|
<div
|
||||||
id="upload-area"
|
id="upload-area"
|
||||||
:class="{ 'is-dragover': dragover }"
|
:class="{ 'is-dragover': dragover }"
|
||||||
@ -1299,6 +1306,7 @@ const isShowVideoFileDialog = ref(false)
|
|||||||
const videoFileUrl = ref('')
|
const videoFileUrl = ref('')
|
||||||
const videoPlayerHeaders = ref({})
|
const videoPlayerHeaders = ref({})
|
||||||
const showFileStyle = ref<'list' | 'grid'>('grid')
|
const showFileStyle = ref<'list' | 'grid'>('grid')
|
||||||
|
const isUploadKeepDirStructure = ref(manageStore.config.settings.isUploadKeepDirStructure ?? true)
|
||||||
|
|
||||||
const showCustomUrlSelectList = computed(() => ['tcyun', 'aliyun', 'qiniu', 'github'].includes(currentPicBedName.value))
|
const showCustomUrlSelectList = computed(() => ['tcyun', 'aliyun', 'qiniu', 'github'].includes(currentPicBedName.value))
|
||||||
|
|
||||||
@ -1320,6 +1328,11 @@ const downloadedTaskList = computed(() => downloadTaskList.value.filter(item =>
|
|||||||
|
|
||||||
const isAutoCustomUrl = computed(() => manageStore.config.picBed[configMap.alias].isAutoCustomUrl === undefined ? true : manageStore.config.picBed[configMap.alias].isAutoCustomUrl)
|
const isAutoCustomUrl = computed(() => manageStore.config.picBed[configMap.alias].isAutoCustomUrl === undefined ? true : manageStore.config.picBed[configMap.alias].isAutoCustomUrl)
|
||||||
|
|
||||||
|
function handleUploadKeepDirChange (val: any) {
|
||||||
|
saveConfig('settings.isUploadKeepDirStructure', !!val)
|
||||||
|
manageStore.refreshConfig()
|
||||||
|
}
|
||||||
|
|
||||||
function handleViewChange (val: 'list' | 'grid') {
|
function handleViewChange (val: 'list' | 'grid') {
|
||||||
showFileStyle.value = val
|
showFileStyle.value = val
|
||||||
}
|
}
|
||||||
@ -1408,7 +1421,8 @@ function webkitReadDataTransfer (dataTransfer: DataTransfer) {
|
|||||||
uploadPanelFilesList.value.push({
|
uploadPanelFilesList.value.push({
|
||||||
name: item.name,
|
name: item.name,
|
||||||
path: item.path,
|
path: item.path,
|
||||||
size: item.size
|
size: item.size,
|
||||||
|
relativePath: item.relativePath
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1530,12 +1544,19 @@ function uploadFiles () {
|
|||||||
rawName: item.name,
|
rawName: item.name,
|
||||||
path: item.path.replace(/\\/g, '/'),
|
path: item.path.replace(/\\/g, '/'),
|
||||||
size: item.size,
|
size: item.size,
|
||||||
renamedFileName: renameFileBeforeUpload(item.name)
|
renamedFileName: renameFileBeforeUpload(item.name),
|
||||||
|
relativePath: item.relativePath ?? ''
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
formateduploadPanelFilesList.forEach((item: any) => {
|
if (isUploadKeepDirStructure.value) {
|
||||||
item.key = currentPrefix.value + item.renamedFileName
|
formateduploadPanelFilesList.forEach((item: any) => {
|
||||||
})
|
item.key = `${currentPrefix.value}${item.relativePath.substring(0, item.relativePath.lastIndexOf('/'))}/${item.renamedFileName}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
formateduploadPanelFilesList.forEach((item: any) => {
|
||||||
|
item.key = currentPrefix.value + item.renamedFileName
|
||||||
|
})
|
||||||
|
}
|
||||||
clearTableData()
|
clearTableData()
|
||||||
const param = {
|
const param = {
|
||||||
// tcyun
|
// tcyun
|
||||||
|
@ -146,6 +146,54 @@
|
|||||||
@change="handelIsForceCustomUrlHttpsChange"
|
@change="handelIsForceCustomUrlHttpsChange"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<template #label>
|
||||||
|
<span
|
||||||
|
style="position:absolute;left: 0;"
|
||||||
|
>上传时保留目录结构
|
||||||
|
<el-tooltip
|
||||||
|
effect="dark"
|
||||||
|
content="开启后,上传文件时会保留目录结构,关闭后会将所有文件展开到指定目录下"
|
||||||
|
placement="right"
|
||||||
|
>
|
||||||
|
<el-icon>
|
||||||
|
<InfoFilled />
|
||||||
|
</el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<el-switch
|
||||||
|
v-model="form.isUploadKeepDirStructure"
|
||||||
|
style="position:absolute;right: 0;"
|
||||||
|
active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949"
|
||||||
|
@change="handelIsUploadKeepDirStructureChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<template #label>
|
||||||
|
<span
|
||||||
|
style="position:absolute;left: 0;"
|
||||||
|
>下载时保留目录结构
|
||||||
|
<el-tooltip
|
||||||
|
effect="dark"
|
||||||
|
content="开启后,下载文件时会保留目录结构,关闭后会将所有文件展开到下载目录下"
|
||||||
|
placement="right"
|
||||||
|
>
|
||||||
|
<el-icon>
|
||||||
|
<InfoFilled />
|
||||||
|
</el-icon>
|
||||||
|
</el-tooltip>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<el-switch
|
||||||
|
v-model="form.isDownloadKeepDirStructure"
|
||||||
|
style="position:absolute;right: 0;"
|
||||||
|
active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949"
|
||||||
|
@change="handelIsDownloadKeepDirStructureChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<template #label>
|
<template #label>
|
||||||
<span
|
<span
|
||||||
@ -449,7 +497,9 @@ const form = reactive<IStringKeyMap>({
|
|||||||
isAutoRefresh: false,
|
isAutoRefresh: false,
|
||||||
isIgnoreCase: false,
|
isIgnoreCase: false,
|
||||||
isForceCustomUrlHttps: false,
|
isForceCustomUrlHttps: false,
|
||||||
isShowList: false
|
isShowList: false,
|
||||||
|
isUploadKeepDirStructure: true,
|
||||||
|
isDownloadKeepDirStructure: true
|
||||||
})
|
})
|
||||||
|
|
||||||
const downloadDir = ref('')
|
const downloadDir = ref('')
|
||||||
@ -520,6 +570,8 @@ async function initData () {
|
|||||||
form.isForceCustomUrlHttps = config.settings.isForceCustomUrlHttps ?? true
|
form.isForceCustomUrlHttps = config.settings.isForceCustomUrlHttps ?? true
|
||||||
PreSignedExpire.value = config.settings.PreSignedExpire ?? 14400
|
PreSignedExpire.value = config.settings.PreSignedExpire ?? 14400
|
||||||
maxDownloadFileCount.value = config.settings.maxDownloadFileCount ?? 5
|
maxDownloadFileCount.value = config.settings.maxDownloadFileCount ?? 5
|
||||||
|
form.isUploadKeepDirStructure = config.settings.isUploadKeepDirStructure ?? true
|
||||||
|
form.isDownloadKeepDirStructure = config.settings.isDownloadKeepDirStructure ?? true
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDownloadDirClick () {
|
async function handleDownloadDirClick () {
|
||||||
@ -553,6 +605,18 @@ function handelIsAutoRefreshChange (val:ICheckBoxValueType) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handelIsUploadKeepDirStructureChange (val:ICheckBoxValueType) {
|
||||||
|
saveConfig({
|
||||||
|
'settings.isUploadKeepDirStructure': val
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handelIsDownloadKeepDirStructureChange (val:ICheckBoxValueType) {
|
||||||
|
saveConfig({
|
||||||
|
'settings.isDownloadKeepDirStructure': val
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function handelIsForceCustomUrlHttpsChange (val:ICheckBoxValueType) {
|
function handelIsForceCustomUrlHttpsChange (val:ICheckBoxValueType) {
|
||||||
saveConfig({
|
saveConfig({
|
||||||
'settings.isForceCustomUrlHttps': val
|
'settings.isForceCustomUrlHttps': val
|
||||||
|
Loading…
Reference in New Issue
Block a user