From d0f593f5e4fee6dc2d0a1a1ece456156a16c8867 Mon Sep 17 00:00:00 2001 From: 18154758993 <605281283@qq.com> Date: Thu, 16 Oct 2025 15:35:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E9=80=BB=E8=BE=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/comprehensive/knzzGlApply/fdy.vue | 42 ++++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/src/views/comprehensive/knzzGlApply/fdy.vue b/src/views/comprehensive/knzzGlApply/fdy.vue index a590937..010d7db 100644 --- a/src/views/comprehensive/knzzGlApply/fdy.vue +++ b/src/views/comprehensive/knzzGlApply/fdy.vue @@ -264,24 +264,38 @@ export default { this.getOwnSign(); }, methods: { - getFileName(path) { + getFileName(path) { if (!path) return ''; return path.split('/').pop(); }, - downloadDiploma() { - if (!this.lookForm.hardFile) return; - const isAbsoluteUrl = this.lookForm.hardFile.startsWith('http'); - const pdfUrl = isAbsoluteUrl - ? this.lookForm.hardFile - : `${this.baseurl}${this.lookForm.hardFile}`; - const link = document.createElement('a'); - link.href = pdfUrl; - link.download = this.getFileName(this.lookForm.hardFile); - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); + downloadDiploma() { + const raw = this.lookForm.hardFile; + if (!raw) return; + // 支持逗号分隔的多个文件 + const files = String(raw) + .split(',') + .map(s => s.trim()) + .filter(Boolean); + + const triggerDownload = (href, filename) => { + const link = document.createElement('a'); + link.href = href; + // 设置下载文件名(跨域时可能被浏览器忽略,但不影响触发下载/打开) + link.download = filename || ''; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }; + + files.forEach((file, idx) => { + const isAbsoluteUrl = /^https?:\/\//i.test(file); + const url = isAbsoluteUrl ? file : `${this.baseurl}${file}`; + const name = this.getFileName(file); + // 轻微延时,避免浏览器对一次事件同时触发多个下载的限制 + setTimeout(() => triggerDownload(url, name), idx * 200); + }); }, - lookBiye() { + lookBiye() { const isAbsoluteUrl = this.lookForm.hardFile.startsWith('http'); const pdfUrl = isAbsoluteUrl ? this.lookForm.hardFile