From 997548b7d6d75c65c47a677f1c100dbfe965d985 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 18 Jun 2024 13:56:34 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E8=87=AA=E5=8A=A8=E8=AF=86?= =?UTF-8?q?=E5=88=AB=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/filebrowser/FileList.vue | 36 ++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/components/filebrowser/FileList.vue b/src/components/filebrowser/FileList.vue index 4b822958..17cb6640 100644 --- a/src/components/filebrowser/FileList.vue +++ b/src/components/filebrowser/FileList.vue @@ -44,6 +44,9 @@ const $toast = useToast() // 是否正在加载 const loading = ref(true) +// 重命名loading +const renameLoading = ref(false) + // 识别进度条 const progressDialog = ref(false) @@ -186,6 +189,27 @@ function showRenmae(item: FileItem) { renamePopper.value = true } +// 调用API获取新名称 +async function get_recommend_name() { + renameLoading.value = true + try { + const result: { [key: string]: any } = await api.get('transfer/name', { + params: { + path: `${inProps.path}${currentItem.value?.name}`, + filetype: currentItem.value?.type ?? 'file', + }, + }) + if (result.success && result.data) { + newName.value = result.data.name + } else { + $toast.error(result.message) + } + } catch (error) { + console.error(error) + } + renameLoading.value = false +} + // 重命名 async function rename() { emit('loading', true) @@ -495,13 +519,17 @@ onMounted(() => { + - + - 取消 - - 重命名 + + 自动识别名称 + + + 确定 +