From 0e25154468417a2500dcd7d6b34d19364a672ed6 Mon Sep 17 00:00:00 2001 From: liuguancen Date: Thu, 2 Apr 2026 13:39:45 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=89=8D=E7=AB=AF]=20=E4=BF=AE=E5=A4=8DPDF?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=EF=BC=9A=E7=9B=B4=E6=8E=A5=E7=94=A8axios?= =?UTF-8?q?=E8=8E=B7=E5=8F=96arraybuffer=EF=BC=8C=E7=BB=95=E8=BF=87blob?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat_web_front/src/views/reading/index.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/chat_web_front/src/views/reading/index.vue b/chat_web_front/src/views/reading/index.vue index 540543c..bdd6371 100644 --- a/chat_web_front/src/views/reading/index.vue +++ b/chat_web_front/src/views/reading/index.vue @@ -217,6 +217,7 @@ import Loading from "@/components/Loading.vue"; import {UploadFilled} from '@element-plus/icons-vue'; import {ElMessage, ElMessageBox, type UploadFile, type UploadFiles} from "element-plus"; import Mark from "mark.js"; +import axios from '@/utils/request/axios'; // ===================== 面板尺寸与折叠 ===================== const leftWidth = ref(280); @@ -437,10 +438,11 @@ const loadPdfFile = async () => { if (!selectedFile.value) return; docHtml.value = ''; try { - const resp = await downloadFile({ fileId: selectedFile.value.fileId }); - const blob = new Blob([resp]); - const arrayBuffer = await blob.arrayBuffer(); - pdfData.value = arrayBuffer; + const resp = await axios.get('/gpt/file/downloadFile', { + params: { fileId: selectedFile.value.fileId }, + responseType: 'arraybuffer' + }); + pdfData.value = resp.data; } catch (e: any) { pdfData.value = null; docHtml.value = '

PDF 文件加载失败

';