Browse Source

fix: 修复空值解构问题

zhangyuhan 1 year ago
parent
commit
5f1dc583ef

+ 16 - 13
apps/bigmember_pc/src/composables/attachment-download/component/AttachmentDownload.vue

@@ -320,22 +320,25 @@ export default {
       this.attachment.file = file
       // downUrl: 原始url
       // fileUrl: 下载地址
-      const { downUrl, fileUrl } = await this.getAttachmentInfo(file)
+      const result = await this.getAttachmentInfo(file)
+      if (result) {
+        const { downUrl, fileUrl } = result
 
-      let skipRefresh = false
-      // 定制化用户不展示提示和留资
-      if (IsCustomTopNet.value) {
-        skipRefresh = true
-      }
+        let skipRefresh = false
+        // 定制化用户不展示提示和留资
+        if (IsCustomTopNet.value) {
+          skipRefresh = true
+        }
 
-      if (!skipRefresh) {
-        this.refreshResourcePackCount()
-      }
+        if (!skipRefresh) {
+          this.refreshResourcePackCount()
+        }
 
-      if (downUrl && fileUrl) {
-        location.href = fileUrl
-      } else {
-        console.log('获取附件fid失败')
+        if (downUrl && fileUrl) {
+          location.href = fileUrl
+        } else {
+          console.log('获取附件fid失败')
+        }
       }
     },
     async getAttachmentInfo(file) {