fix: 修复刮削功能中的路径错误

This commit is contained in:
jxxghp
2024-06-21 12:17:57 +08:00
parent 80690d4cc8
commit 34c3aa25da

View File

@@ -396,7 +396,7 @@ watch(
props: { props: {
prependIcon: 'mdi-auto-fix', prependIcon: 'mdi-auto-fix',
click: (_item: FileItem) => { click: (_item: FileItem) => {
scrape(_item.path || '') scrape(_item)
}, },
}, },
}, },
@@ -456,30 +456,30 @@ async function recognize(path: string) {
} }
// 调用API刮削 // 调用API刮削
async function scrape(path: string, confirm: boolean = true) { async function scrape(item: FileItem, confirm: boolean = true) {
try { try {
if (confirm) { if (confirm) {
// 确认 // 确认
const confirmed = await createConfirm({ const confirmed = await createConfirm({
title: '确认', title: '确认',
content: `是否确认刮削 ${path}`, content: `是否确认刮削 ${item.path}`,
}) })
if (!confirmed) return if (!confirmed) return
} }
// 显示进度条 // 显示进度条
progressDialog.value = true progressDialog.value = true
progressText.value = `正在刮削 ${path} ...` progressText.value = `正在刮削 ${item.path} ...`
const result: { [key: string]: any } = await api.get('media/scrape', { const result: { [key: string]: any } = await api.get('media/scrape', {
params: { params: {
path, ...item,
storage: inProps.storage, storage: inProps.storage,
}, },
}) })
// 关闭进度条 // 关闭进度条
progressDialog.value = false progressDialog.value = false
if (!result.success) $toast.error(result.message) if (!result.success) $toast.error(result.message)
else $toast.success(`${path} 削刮完成!`) else $toast.success(`${item.path} 削刮完成!`)
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }
@@ -495,7 +495,7 @@ async function batchScrape() {
if (!confirmed) return if (!confirmed) return
selected.value.map(item => { selected.value.map(item => {
scrape(item.path || '', false) scrape(item, false)
}) })
} }
@@ -646,7 +646,7 @@ onMounted(() => {
</VTooltip> </VTooltip>
<VTooltip text="刮削"> <VTooltip text="刮削">
<template #activator="{ props }"> <template #activator="{ props }">
<IconBtn v-bind="props" @click.stop="scrape(item.path)"> <IconBtn v-bind="props" @click.stop="scrape(item)">
<VIcon icon="mdi-auto-fix" /> <VIcon icon="mdi-auto-fix" />
</IconBtn> </IconBtn>
</template> </template>