From 5692bc829ac5cb1b1fbd113a89c44d2d3c3a41ee Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期五, 28 三月 2025 09:45:19 +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