From 41c9b2fa8cef5f45c23d00d33680764b48dfc3cc Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期日, 27 四月 2025 11:03:43 +0800
Subject: [PATCH] 修改缓存

---
 src/util/fileTransform.js |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/src/util/fileTransform.js b/src/util/fileTransform.js
index 6471e85..6f8ccec 100644
--- a/src/util/fileTransform.js
+++ b/src/util/fileTransform.js
@@ -36,4 +36,24 @@
     URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄
     document.body.removeChild(elink)
   }
-}
\ No newline at end of file
+}
+
+export function transformDoc(response) {
+    const relType = ['application/vnd.openxmlformats-officedocument.wordprocessingml.document']
+    let type = response.data.type
+    if (relType.includes(type)) {
+        const blob = new Blob([response.data], {type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'})
+        const disposition = response.headers["content-disposition"]
+        let temp = disposition.substring(disposition.lastIndexOf('=') + 1)
+        let filename = decodeURI(temp)
+        // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠�
+        const elink = document.createElement('a')
+        elink.download = filename
+        elink.style.display = 'none'
+        elink.href = URL.createObjectURL(blob)
+        document.body.appendChild(elink)
+        elink.click()
+        URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄
+        document.body.removeChild(elink)
+    }
+}

--
Gitblit v1.9.3