0823
This commit is contained in:
1 parent
e5029688e5
commit
0db0a99c85
288 files changed
+41335
-11400
No files matched your search
@@ -17,7 +17,7 @@ export default {
|
||||
// const { data: downloadUrl } = await getFileDownloadUrl(String(ossId));
|
||||
|
||||
const response = await request({
|
||||
url: "/resource/oss/download/" + ossId,
|
||||
url: '/resource/oss/download/' + ossId,
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
timeout: 300000 // 300秒超时
|
||||
@@ -30,9 +30,11 @@ export default {
|
||||
if (!blob) {
|
||||
throw new Error('响应数据为空');
|
||||
}
|
||||
const filename = response.headers.get('content-disposition')?.split('filename=')[1]?.replace(/"/g, '') || `file_${ossId}`;
|
||||
|
||||
FileSaver.saveAs(blob, decodeURIComponent(filename));
|
||||
// 由于响应拦截器直接返回blob,无法获取headers,使用默认文件名
|
||||
const filename = `file_${ossId}`;
|
||||
|
||||
FileSaver.saveAs(blob, filename);
|
||||
downloadLoadingInstance.close();
|
||||
} catch (r) {
|
||||
console.error(r);
|
||||
@@ -50,7 +52,7 @@ export default {
|
||||
// const { data: downloadUrl } = await getFileDownloadUrl(String(ossId));
|
||||
|
||||
const response = await request({
|
||||
url: "/resource/oss/download/" + ossId,
|
||||
url: '/resource/oss/download/' + ossId,
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
timeout: 300000 // 300秒超时
|
||||
@@ -64,9 +66,10 @@ export default {
|
||||
throw new Error('响应数据为空');
|
||||
}
|
||||
|
||||
const finalFileName = fileName || response.headers.get('content-disposition')?.split('filename=')[1]?.replace(/"/g, '') || `file_${ossId}`;
|
||||
// 由于响应拦截器直接返回blob,无法获取headers,使用传入的文件名或默认文件名
|
||||
const finalFileName = fileName || `file_${ossId}`;
|
||||
|
||||
FileSaver.saveAs(blob, decodeURIComponent(finalFileName));
|
||||
FileSaver.saveAs(blob, finalFileName);
|
||||
downloadLoadingInstance.close();
|
||||
} catch (r) {
|
||||
console.error(r);
|
||||
@@ -83,7 +86,7 @@ export default {
|
||||
method: 'get',
|
||||
url: url,
|
||||
responseType: 'blob',
|
||||
timeout: 300000 ,// 300秒超时
|
||||
timeout: 300000, // 300秒超时
|
||||
headers: globalHeaders()
|
||||
});
|
||||
const isBlob = blobValidate(res.data);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { App } from 'vue'
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
import { App } from 'vue';
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
|
||||
|
||||
export default function registerIcons(app: App) {
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
app.component(key, component);
|
||||
}
|
||||
|
||||
|
||||
// 移除重复的Close组件注册
|
||||
// app.component('Close', ElementPlusIconsVue.Close);
|
||||
|
||||
|
||||
// 注册常用图标的别名
|
||||
app.component('CircleCloseIcon', ElementPlusIconsVue.CircleClose);
|
||||
}
|
||||
Reference in new issue
Block a user