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" /> -