47 lines
1.2 KiB
Vue

<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>