From d86074138429ee2912fd7b4bc0a3cff7b97628e3 Mon Sep 17 00:00:00 2001 From: Kven <2955163637@qq.com> Date: Tue, 13 May 2025 17:24:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(@vben/web-antd):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=88=AC=E8=99=AB=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/.env.production | 2 +- .../src/ui/spider/spider-work-view.vue | 28 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/apps/web-antd/.env.production b/apps/web-antd/.env.production index 5375847..a890ef2 100644 --- a/apps/web-antd/.env.production +++ b/apps/web-antd/.env.production @@ -1,7 +1,7 @@ VITE_BASE=/ # 接口地址 -VITE_GLOB_API_URL=https://mock-napi.vben.pro/api +VITE_GLOB_API_URL=http://dify.vertoryao.xyz/api # 是否开启压缩,可以设置为 none, brotli, gzip VITE_COMPRESS=none diff --git a/packages/effects/common-ui/src/ui/spider/spider-work-view.vue b/packages/effects/common-ui/src/ui/spider/spider-work-view.vue index 3f41f7f..2ca4dcf 100644 --- a/packages/effects/common-ui/src/ui/spider/spider-work-view.vue +++ b/packages/effects/common-ui/src/ui/spider/spider-work-view.vue @@ -111,25 +111,20 @@ const startFetching = async () => { // 下载文件逻辑 const downloadFile = () => { - if (!fetchResult.value) return; + if (!fetchResult.value || !fetchResult.value.startsWith('http')) { + message.error('无效的文件链接'); + return; + } - // 使用抓取结果作为文件内容 - const fileName = `${props.item.name}.txt`; - const fileContent = fetchResult.value; + const fileUrl = fetchResult.value; + const fileName = decodeURIComponent( + fileUrl.slice(Math.max(0, fileUrl.lastIndexOf('/') + 1)), + ); - // 创建 Blob 对象 - const blob = new Blob([fileContent], { type: 'text/plain' }); - - // 创建下载链接 const link = document.createElement('a'); - link.href = URL.createObjectURL(blob); + link.href = fileUrl; link.download = fileName; - - // 触发下载 link.click(); - - // 释放 URL 对象 - URL.revokeObjectURL(link.href); }; const isFetching = ref(false); @@ -152,7 +147,10 @@ const fetchStatus = ref(''); v-model:value="selectedDateRange" format="YYYY/MM/DD" /> -