From 45c217996d025d256fdd0ed5cb744750e68dd36d Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 17 三月 2026 16:43:04 +0800
Subject: [PATCH] 2026.3.17
---
src/api/fytz/creditApi.js | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/src/api/fytz/creditApi.js b/src/api/fytz/creditApi.js
index 6c0dec0..12ff2a8 100644
--- a/src/api/fytz/creditApi.js
+++ b/src/api/fytz/creditApi.js
@@ -1,5 +1,5 @@
-import { Base64 } from 'js-base64';
-import { $fytz } from '../index';
+import { Base64 } from 'js-base64'
+import { $fytz } from '../index'
/**
* 淇$敤璇勪及API鎺ュ彛
@@ -8,20 +8,22 @@
/**
* 涓嬭浇鐢ㄦ埛鐜俊鐮�
* @param {*} userId
+ * @param {*} userName
*/
- downloadCode(userId) {
+ downloadCode(userId, userName) {
return $fytz
.get(`credit/ecCode/download?userId=${userId}`, { responseType: 'blob' })
.then((res) => {
- const name = Base64.decode(res.headers.get('fileName'));
- const url = window.URL.createObjectURL(res.data);
- const link = document.createElement('a');
- link.href = url;
- link.setAttribute('download', name);
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- window.URL.revokeObjectURL(url);
- });
- }
-};
+ const name = res.headers.get('fileName') || userName
+ const fileName = Base64.decode(name)
+ const url = window.URL.createObjectURL(res.data)
+ const link = document.createElement('a')
+ link.href = url
+ link.setAttribute('download', fileName)
+ document.body.appendChild(link)
+ link.click()
+ document.body.removeChild(link)
+ window.URL.revokeObjectURL(url)
+ })
+ },
+}
--
Gitblit v1.9.3