!205 修复bpmn不支持跨域的问题

Merge pull request !205 from 高雄/N/A
pull/206/head
kailing 1 year ago committed by Gitee
commit fa2a5d3e35
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -5,6 +5,14 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<#include "*/commonHeader.ftl">
<script src="js/base64.min.js" type="text/javascript"></script>
<#if currentUrl?contains("http://") || currentUrl?contains("https://") || currentUrl?contains("file://")>
<#assign finalUrl="${currentUrl}">
<#elseif currentUrl?contains("ftp://") >
<#assign finalUrl="${currentUrl}">
<#else>
<#assign finalUrl="${baseUrl}${currentUrl}">
</#if>
<style>
html, body, #diagram {
height: 100%
@ -33,12 +41,16 @@
const viewer = new BpmnJS({
container: '#diagram'
});
var url = '${finalUrl}';
var baseUrl = '${baseUrl}'.endsWith('/') ? '${baseUrl}' : '${baseUrl}' + '/';
if (!url.startsWith(baseUrl)) {
url = baseUrl + 'getCorsFile?urlPath=' + encodeURIComponent(Base64.encode(url));
}
async function showDiagram(diagramXML) {
await viewer.importXML(diagramXML);
}
// load + show diagram
$.get('${currentUrl}', showDiagram, 'text');
$.get(url, showDiagram, 'text');
</script>
</body>
</html>

Loading…
Cancel
Save