fix: BUG修改
This commit is contained in:
parent
1b1aa61b08
commit
1aaa013028
@ -1,8 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div @click="getModelTree" style="color: white">获取信息</div>
|
<div class="bimBox">
|
||||||
<div @click="cancelModel" style="color: white">隐藏</div>
|
<iframe :src="url" frameborder="0" width="100%" height="100%" id="iframe"></iframe>
|
||||||
<div class="bimBox" id="domId">
|
|
||||||
<!-- <iframe :src="url" frameborder="0" width="100%" height="100%" id="iframe"></iframe> -->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -20,7 +18,7 @@ function getBimfaceList() {
|
|||||||
if (item.isEnable) {
|
if (item.isEnable) {
|
||||||
token.value = res.result.viewToken;
|
token.value = res.result.viewToken;
|
||||||
console.log("token的值", token.value);
|
console.log("token的值", token.value);
|
||||||
localStorage.setItem("bimToken", JSON.stringify(token.value));
|
localStorage.setItem('bimToken', JSON.stringify(token.value));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -33,52 +31,16 @@ function getBimfaceList() {
|
|||||||
//
|
//
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
// 声明viewer及app变量
|
onMounted(() => {
|
||||||
let viewer, app;
|
url.value = window.location.origin + "/static/bim.html";
|
||||||
// 声明viewToken变量,填入想要显示的模型/图纸/场景token
|
console.log("url-------的地址", window.location.origin);
|
||||||
let viewToken = '3831955cbf80408582ed3833742b6eb5';
|
getBimfaceList();
|
||||||
|
});
|
||||||
// 构造BimfaceSDKLoaderConfig对象
|
|
||||||
let loaderConfig = new BimfaceSDKLoaderConfig();
|
|
||||||
// 设置BimfaceSDKLoaderConfig的viewToken
|
|
||||||
loaderConfig.viewToken = viewToken;
|
|
||||||
|
|
||||||
// 调用BimfaceSDKLoader的load方法加载模型
|
|
||||||
BimfaceSDKLoader.load(loaderConfig, successCallback, failureCallback);
|
|
||||||
|
|
||||||
// 加载成功回调函数
|
|
||||||
function successCallback(viewMetaData) {
|
|
||||||
|
|
||||||
// 获取DOM元素
|
|
||||||
let domShow = document.getElementById('domId');
|
|
||||||
// 创建WebApplicationGISConfig
|
|
||||||
let webAppConfig = new Glodon.Bimface.Application.WebApplicationGISConfig();
|
|
||||||
// 设置创建WebApplicationGIS的dom对象
|
|
||||||
webAppConfig.domElement = domShow;
|
|
||||||
// 创建WebApplicationGIS
|
|
||||||
app = new Glodon.Bimface.Application.WebApplicationGIS(webAppConfig);
|
|
||||||
|
|
||||||
// 加载待显示的场景
|
|
||||||
app.addScene(viewToken);
|
|
||||||
|
|
||||||
// 获取ViewerGIS对象
|
|
||||||
viewer = app.getViewer();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// 加载失败回调函数
|
|
||||||
function failureCallback(error) {
|
|
||||||
|
|
||||||
console.log(error);
|
|
||||||
|
|
||||||
};
|
|
||||||
onMounted(() => {});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.bimBox {
|
.bimBox {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 90%;
|
height: 100%;
|
||||||
margin-top: 20px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,46 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="bimBox">
|
|
||||||
<iframe :src="url" frameborder="0" width="100%" height="100%" id="iframe"></iframe>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { GlobalStore } from "@/stores";
|
|
||||||
import { getSelectProjectBimfaceList, getViewTokenByFileId } from "@/api/modules/binModel";
|
|
||||||
import { ref, onMounted } from "vue";
|
|
||||||
const store = GlobalStore();
|
|
||||||
const url = ref("");
|
|
||||||
const token = ref("" as any);
|
|
||||||
//获取bim列表
|
|
||||||
function getBimfaceList() {
|
|
||||||
getSelectProjectBimfaceList({ projectSn: store.sn }).then(res => {
|
|
||||||
res.result.page.records.forEach(item => {
|
|
||||||
if (item.isEnable) {
|
|
||||||
token.value = res.result.viewToken;
|
|
||||||
console.log("token的值", token.value);
|
|
||||||
localStorage.setItem('bimToken', JSON.stringify(token.value));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取token
|
|
||||||
// function getBimfaceToken(fileId) {
|
|
||||||
// getViewTokenByFileId({ projectSn: store.sn, fileId }).then(res => {
|
|
||||||
// console.log("token结果", res);
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
onMounted(() => {
|
|
||||||
url.value = window.location.origin + "/static/bim.html";
|
|
||||||
console.log("url-------的地址", window.location.origin);
|
|
||||||
getBimfaceList();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.bimBox {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user