|
|
@@ -594,8 +594,21 @@ const handleDownloadAttachment = async (file: any) => {
|
|
|
if (!response) {
|
|
|
throw new Error('响应数据为空');
|
|
|
}
|
|
|
+ console.log('response', response);
|
|
|
+
|
|
|
+ // 检查response的结构,判断是直接的Blob还是包含data属性的响应对象
|
|
|
+ let blobData: Blob;
|
|
|
+ if (response instanceof Blob) {
|
|
|
+ // 如果response本身就是Blob对象
|
|
|
+ blobData = response;
|
|
|
+ } else if (response.data instanceof Blob) {
|
|
|
+ // 如果response.data是Blob对象
|
|
|
+ blobData = response.data;
|
|
|
+ } else {
|
|
|
+ throw new Error('无效的响应数据格式');
|
|
|
+ }
|
|
|
|
|
|
- const url = window.URL.createObjectURL(response.data as Blob);
|
|
|
+ const url = window.URL.createObjectURL(blobData);
|
|
|
|
|
|
const link = document.createElement('a');
|
|
|
link.href = url;
|