提交 515fe723 编写于 作者: Cano1997's avatar Cano1997

update: 文件下载路径调整

上级 9f7879f2
...@@ -487,12 +487,14 @@ export default class AppFileUpload extends Vue { ...@@ -487,12 +487,14 @@ export default class AppFileUpload extends Vue {
let _this: any = this; let _this: any = this;
const id = typeof file.id == "string" ? file.id : JSON.stringify(file.id); const id = typeof file.id == "string" ? file.id : JSON.stringify(file.id);
const name = typeof file.name == "string" ? file.name : JSON.stringify(file.filename); const name = typeof file.name == "string" ? file.name : JSON.stringify(file.filename);
// const downloadUrl = '/ibizutilrpm/download/' + this.getFolder() + '/' + id + '/' + encodeURIComponent(name); const downloadUrl = `${(window as any).Environment.ExportFile}`+ '/' + id + '/' + name;
const entityName = this.appEntityService.APPDENAME; const entityName = this.appEntityService.APPDENAME;
const base64 = `${id}|${entityName}|${this.ownerid}|${this.context.srfpersonid || this.context.srfuserid}`; const base64 = `${id}|${entityName}|${this.ownerid}|${this.context.srfpersonid || this.context.srfuserid}`;
const downloadUrl =`http://downloadpath?key=${window.btoa(base64)}` const url =`${downloadUrl}?key=${window.btoa(base64)}${Math.floor(
1000 + Math.random() * 9000,
)}`
// 发送get请求 // 发送get请求
Axios.get(downloadUrl, { Axios.get(url, {
responseType: 'arraybuffer', responseType: 'arraybuffer',
}).then((response: any) => { }).then((response: any) => {
if (!response || response.status != 200) { if (!response || response.status != 200) {
......
...@@ -99,10 +99,12 @@ export default class AppUploadFileInfo extends Vue { ...@@ -99,10 +99,12 @@ export default class AppUploadFileInfo extends Vue {
let files = JSON.parse(this.value); let files = JSON.parse(this.value);
if(files.length){ if(files.length){
files.forEach((file: any) => { files.forEach((file: any) => {
// let url = `${this.downloadUrl}/${file.id}`; let url = `${this.downloadUrl}/${file.id}`;
const entityName = this.appEntityService.APPDENAME; const entityName = this.appEntityService.APPDENAME;
const base64 = `${file.id}|${entityName}|${this.ownerid}|${this.context.srfpersonid || this.context.srfuserid}`; const base64 = `${file.id}|${entityName}|${this.ownerid}|${this.context.srfpersonid || this.context.srfuserid}`;
const downloadUrl =`http://downloadpath?key=${window.btoa(base64)}` const downloadUrl =`${url}?key=${window.btoa(base64)}${Math.floor(
1000 + Math.random() * 9000,
)}`
file.url = downloadUrl; file.url = downloadUrl;
}); });
}else{ }else{
......
...@@ -536,12 +536,14 @@ export default class DiskFileUpload extends Vue { ...@@ -536,12 +536,14 @@ export default class DiskFileUpload extends Vue {
let _this: any = this; let _this: any = this;
const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id); const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id);
const name = typeof item.name == "string" ? item.name : JSON.stringify(item.filename); const name = typeof item.name == "string" ? item.name : JSON.stringify(item.filename);
// const downloadUrl = '/ibizutilrpm/download/' + this.getFolder() + '/' + id + '/' + encodeURIComponent(name); const downloadUrl = '/ibizutilrpm/download/' + this.getFolder() + '/' + id + '/' + encodeURIComponent(name);
const entityName = this.appEntityService.APPDENAME; const entityName = this.appEntityService.APPDENAME;
const base64 = `${id}|${entityName}|${this.getOwnerid()}|${this.context.srfpersonid || this.context.srfuserid}`; const base64 = `${id}|${entityName}|${this.getOwnerid()}|${this.context.srfpersonid || this.context.srfuserid}`;
const downloadUrl =`http://downloadpath?key=${window.btoa(base64)}` const url =`${downloadUrl}?key=${window.btoa(base64)}${Math.floor(
1000 + Math.random() * 9000,
)}`
// 发送get请求 // 发送get请求
Axios.get(downloadUrl, { Axios.get(url, {
headers: { headers: {
'authcode': item.authcode, 'authcode': item.authcode,
}, },
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册