Browse Source

ofd和tiff下载跨域文件接口修改

pull/54/MERGE
陈精华 2 years ago
parent
commit
3dcd183171
No known key found for this signature in database
GPG Key ID: 30BDC970902B755D
  1. 2
      server/src/main/resources/web/ofd.ftl
  2. 13
      server/src/main/resources/web/tiff.ftl

2
server/src/main/resources/web/ofd.ftl

@ -15,7 +15,7 @@
var url = '${currentUrl}';
var baseUrl = '${baseUrl}'.endsWith('/') ? '${baseUrl}' : '${baseUrl}' + '/';
if (!url.startsWith(baseUrl)) {
url = baseUrl + 'getCorsFile?urlPath=' + encodeURIComponent(url);
url = baseUrl + 'getCorsFile?urlPath=' + encodeURIComponent(Base64.encode(url));
}
document.getElementsByTagName('iframe')[0].src = "${baseUrl}ofd/index.html?file="+ encodeURIComponent(url)+"";
document.getElementsByTagName('iframe')[0].height = document.documentElement.clientHeight - 10;

13
server/src/main/resources/web/tiff.ftl

@ -58,17 +58,6 @@
loadOne();
}
function doPrint() {
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->";
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
initWaterMark();
window.print();
}
String.prototype.startsWithh = function(str) {
var reg = new RegExp("^" + str);
return reg.test(this);
@ -82,7 +71,7 @@
var url = '${finalUrl}';
var baseUrl = '${baseUrl}'.endsWithh('/') ? '${baseUrl}' : '${baseUrl}' + '/';
if (!url.startsWithh(baseUrl)) {
url = baseUrl + 'getCorsFile?urlPath=' + encodeURIComponent(url);
url = baseUrl + 'getCorsFile?urlPath=' + encodeURIComponent(Base64.encode(url));
}
const xhr = new XMLHttpRequest();
xhr.open('GET', url);

Loading…
Cancel
Save