fix : 修复文章下载文件名问题

This commit is contained in:
2024-10-27 00:55:49 +08:00
parent b5d2dceda1
commit 4f2bfb80ae
2 changed files with 66 additions and 13 deletions

View File

@@ -121,12 +121,6 @@ const init = reactive({
// }),
},
file_picker_callback: (callback, value, meta) => {
console.info("🚀 ~method:uploadFile -----")
let loading= ElLoading.service({
lock: true,
text: '文件上传中...',
background: 'rgba(0, 0, 0, 0.7)',
})
// 使用案例http://tinymce.ax-z.cn/general/upload-images.php
// meta.filetype //根据这个判断点击的是什么file image media
let filetype; //限制文件的上传类型,需要什么就添加什么的后缀
@@ -151,7 +145,11 @@ const init = reactive({
xhr.setRequestHeader(
'Authorization',getToken()
)
let loading= ElLoading.service({
lock: true,
text: '文件上传中...',
background: 'rgba(0, 0, 0, 0.7)',
})
xhr.onload = function() {
let res;
// if (xhr.status != 200) {
@@ -166,7 +164,8 @@ const init = reactive({
})
loading.close()
const fileUrl = res.data.url;
callback(fileUrl, { title: file.name });
// '?fileId='+res.data.id+
callback(fileUrl+'?fileName='+res.data.originalFilename, {title: file.name });
};
formData = new FormData();
formData.append('file', file, file.name );