[Frontend] 修正forge bug和路徑問題

This commit is contained in:
wanli 2022-11-24 21:58:54 +08:00
parent 5931b57144
commit 1eec1ff044
2 changed files with 13 additions and 13 deletions

View File

@ -7,8 +7,8 @@
<body>
<link rel="shortcut icon" href="https://github.com/Autodesk-Forge/learn.forge.viewmodels/raw/master/img/favicon.ico">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/themes/default/style.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/themes/default/style.min.css" />
<!-- Autodesk Forge Viewer files -->
<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css">
@ -31,24 +31,24 @@
<!--Base JS-->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
<script src="lib//vendors.bundle.js"></script>
<script src="lib//app.bundle.js"></script>
<!--<script src="lib//vendors.bundle.js"></script>
<script src="lib//app.bundle.js"></script>-->
<!-- JQuery Validate -->
<script src="lib/jquery-validation/dist/jquery.validate.js"></script>
<!--<script src="lib/jquery-validation/dist/jquery.validate.js"></script>
<script src="lib/jquery-validation/dist/additional-methods.min.js"></script>
<script src="lib/jquery-validation/dist/localization/messages_zh_TW.js"></script>
<script src="lib/notifications/sweetalert2/sweetalert2.bundle.js"></script>
<script src="lib/notifications/toastr/toastr.js"></script>
<script src="js/toast.js"></script>
<script src="js/toast.js"></script>-->
<script src="js/init.js"></script>
<!-- Common packages: jQuery, Bootstrap, jsTree -->
<!--<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>-->
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/jstree.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.7/jstree.min.js"></script>
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.js"></script>
<!-- <script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.16/viewer3D.js"></script> -->
<script src="/js/forge/forgemodel.js"></script>
<script src="js/forge/forgemodel.js"></script>
<script>

View File

@ -64,13 +64,13 @@ function launchViewer(urn) {
//test
for (let i = 0; i < urns.length; i++) {
Autodesk.Viewing.Document.load(urns[i]["urn"], async (doc) => {
for (let i = 0; i < urn.length; i++) {
Autodesk.Viewing.Document.load(urn[i]["urn"], async (doc) => {
let viewables = doc.getRoot().getDefaultGeometry();
let model = await viewer.loadDocumentNode(doc, viewables, {
preserveView: false,
keepCurrentModels: true,
placementTransform: (new THREE.Matrix4()).setPosition(urns[i]["xform"]),
placementTransform: (new THREE.Matrix4()).setPosition(urn[i]["xform"]),
keepCurrentModels: true,
globalOffset: {
x: 0,
@ -262,7 +262,7 @@ function onDocumentLoadFailure(viewerErrorCode) {
}
function getForgeToken(callback) {
fetch('http://localhost:3604/api/forge/oauth/token').then(res => {
fetch(baseApiUrl + '/api/forge/oauth/token').then(res => {
res.json().then(data => {
callback(data.dictionary.access_token, data.dictionary.expires_in);
});