diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index ac1c4a7..390c1f6 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -37,6 +37,7 @@ "batch_download": "Batch Download", "batch_export": "Batch Export", "batch_import": "Batch Import", + "export_url": "Export Url", "import_success": "Export Success", "all": "All", "image": "Image", diff --git a/frontend/src/locales/zh.json b/frontend/src/locales/zh.json index cf10f29..88b0e58 100644 --- a/frontend/src/locales/zh.json +++ b/frontend/src/locales/zh.json @@ -37,6 +37,7 @@ "batch_download": "批量下载", "batch_export": "批量导出", "batch_import": "批量导入", + "export_url": "导出链接", "import_success": "导出成功", "all": "全部", "image": "图片", diff --git a/frontend/src/views/index.vue b/frontend/src/views/index.vue index 26b46c0..2bfa5e5 100644 --- a/frontend/src/views/index.vue +++ b/frontend/src/views/index.vue @@ -10,22 +10,23 @@ - - - {{ t("index.clear_list_tip") }} - + + + {{ t("index.clear_list_tip") }} + + {{ t('index.batch_download') }} - - - {{ t('index.batch_export') }} - - - - {{ t('index.batch_import') }} + + + +
+ + + {{ t('index.cancel_down') }} + + + + {{ t('index.batch_export') }} + + + + {{ t('index.batch_import') }} + + + + {{ t('index.export_url') }} + +
+
@@ -105,7 +133,8 @@ import { ArrowRedoCircleOutline, ServerOutline, SearchOutline, - TrashOutline + Apps, + TrashOutline, CloseOutline } from "@vicons/ionicons5" const {t} = useI18n() @@ -483,16 +512,16 @@ const dataAction = (row: appType.MediaInfo, index: number, type: string) => { case "cancel": if (row.Status === "running") { appApi.cancel({id: row.Id}).then((res)=>{ - if (res.code === 0) { - window?.$message?.error(res.message) - return - } updateItem(row.Id, item => { item.Status = 'ready' item.SavePath = '' }) cacheData() checkQueue() + if (res.code === 0) { + window?.$message?.error(res.message) + return + } }) } break @@ -572,7 +601,26 @@ const batchDown = async () => { checkedRowKeysValue.value = [] } -const batchExport = () => { +const batchCancel = () =>{ + if (checkedRowKeysValue.value.length <= 0) { + window?.$message?.error(t("index.use_data")) + return + } + + data.value.forEach((item, index) => { + if (checkedRowKeysValue.value.includes(item.Id) && item.Status === "running") { + appApi.cancel({id: item.Id}).then((res)=>{ + item.Status = 'ready' + item.SavePath = '' + }) + } + }) + checkedRowKeysValue.value = [] + cacheData() + checkQueue() +} + +const batchExport = (type?: string) => { if (checkedRowKeysValue.value.length <= 0) { window?.$message?.error(t("index.use_data")) return @@ -586,9 +634,13 @@ const batchExport = () => { loadingText.value = t("common.loading") loading.value = true - const jsonData = data.value - .filter(item => checkedRowKeysValue.value.includes(item.Id)) - .map(item => encodeURIComponent(JSON.stringify(item))) + let jsonData = data.value.filter(item => checkedRowKeysValue.value.includes(item.Id)) + + if (type === "url"){ + jsonData = jsonData.map(item => item.Url) + } else{ + jsonData = jsonData.map(item => encodeURIComponent(JSON.stringify(item))) + } appApi.batchExport({content: jsonData.join("\n")}).then((res: appType.Res) => { loading.value = false