diff --git a/.env.development b/.env.development index 3b065fe..7c12b47 100644 --- a/.env.development +++ b/.env.development @@ -13,7 +13,7 @@ NODE_ENV = 'development' # 沈阳合盈线上 # VITE_API_URL = "http://101.43.164.214:45022" # 演示平台 -# VITE_API_URL = 'http://jxj.zhgdyun.com:9809' +VITE_API_URL = 'http://jxj.zhgdyun.com:9809' # 百色七参数线上地址 # VITE_API_URL = 'http://101.43.164.214:11111' # 七参数标准版(测试平台) @@ -21,7 +21,7 @@ NODE_ENV = 'development' # 七参数标准版(测试平台) # VITE_API_URL = 'http://182.90.224.237:15551' # agjt -VITE_API_URL = 'http://47.93.215.234:9809' +# VITE_API_URL = 'http://47.93.215.234:9809' # 上传 VITE_ULD_API_URL = 'http://192.168.34.155:8012/onlinePreview?url=' diff --git a/public/static/bim.html b/public/static/bim.html index ed9ef58..89077f9 100644 --- a/public/static/bim.html +++ b/public/static/bim.html @@ -18,7 +18,7 @@ // console.log('取到的token',token); let viewer3D; let app; - let viewToken = "6a7c39a4b2324880b98680f5e804f896"; + let viewToken = "06c56a5e060d42659f29c078af03536e"; console.log('viewToken',viewToken); let loaderConfig = new BimfaceSDKLoaderConfig(); loaderConfig.viewToken = viewToken; @@ -35,8 +35,74 @@ function failureCallback(error) { console.log(error); } - - + // window.addEventListener("message", async function(e) { + // // const modelId = e.data.modelId + // const data = e.data || {}; + // if (data.token) { + // // removeModel(modelId) + // document.getElementById("domId").innerHTML = ""; + // await bimCallback(data.token); + // if (data.hideArr && data.colorArr) { + // configValue.hideArr = data.hideArr; + // configValue.colorArr = data.colorArr; + // } + // } + // // console.log(e.data, '父级页面传来的数据') + // // setTimeout(() => { + // // window.parent.postMessage({ msg: 'hello' }) + // // }, 2000) + // }); + // const bimCallback = (viewToken) => { + // // let viewToken = '11b0d307c09f43bfa5fa3922bcce0342' + // let loaderConfig = new BimfaceSDKLoaderConfig(); + // loaderConfig.viewToken = viewToken; + // BimfaceSDKLoader.load(loaderConfig, successCallback, failureCallback); + // function successCallback(viewMetaData) { + // let domShow = document.getElementById("domId"); + // let webAppConfig = new Glodon.Bimface.Application.WebApplication3DConfig(); + // webAppConfig.domElement = domShow; + // app = new Glodon.Bimface.Application.WebApplication3D(webAppConfig); + // app.addView(viewToken); + // viewer3D = app.getViewer(); + // // 监听添加view完成的事件 + // viewer3D.addEventListener( + // Glodon.Bimface.Viewer.Viewer3DEvent.ViewAdded, + // function() { + // // 调用viewer3D对象的Method,可以继续扩展功能 + // // 从viewer3D对象中获取模型对象model3D + // model3D = viewer3D.getModel(); + // // 获取模型状态 + // modelState = viewer3D.getCurrentState(); + // // 渲染3D模型 + // viewer3D.render(); + // // 操作模型 + // renderConfigModel(); + // } + // ); + // } + + // function failureCallback(error) { + // console.log(error); + // } + // }; + // function renderConfigModel() { + // // 恢复模型状态 + // viewer3D.setState(modelState); + // viewer3D.render(); + // } + // console.log(666) + // bimCallback("06c56a5e060d42659f29c078af03536e"); + // 监听父组件的信息传递 + // window.addEventListener("message", async function(e) { + // // const modelId = e.data.modelId + // const data = e.data || {}; + // console.log(data,'发送的值') + // if (data.token) { + // // removeModel(modelId) + // document.getElementById("domId").innerHTML = ""; + // await bimCallback("06c56a5e060d42659f29c078af03536e"); + // } + // }); diff --git a/src/config/config.ts b/src/config/config.ts index d03b9fe..506a59f 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -23,9 +23,9 @@ export const BAIDU_MAP_KEY: string = ""; export const BASE_IMAGE_URL = import.meta.env.VITE_BASE_IMAGE_URL; // 项目环境标识配置 部署时需更改对应的项目 -// export const COMPANY: string = ""; //标准版 +export const COMPANY: string = ""; //标准版 // export const COMPANY: string = "as"; //鞍山项目 -export const COMPANY: string = "agjt"; //鞍钢集团 +// export const COMPANY: string = "agjt"; //鞍钢集团 // export const COMPANY: string = "hfqc"; //合肥启程项目 // export const COMPANY: string = "jsyc"; // 江苏盐城项目 // export const COMPANY: string = "syhy"; //沈阳合盈盘锦项目 (需要去src\routers\modules\staticRouter.ts更换首页) diff --git a/src/routers/index.ts b/src/routers/index.ts index c0d3f36..7fab94d 100644 --- a/src/routers/index.ts +++ b/src/routers/index.ts @@ -49,10 +49,10 @@ router.beforeEach(async (to, from, next) => { const title = import.meta.env.VITE_GLOB_APP_TITLE; // document.title = to.meta.title ? `${to.meta.title} - ${title}` : title; document.title = to.meta.title ? `${to.meta.title} ` : title; - // 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由并放行到登陆页 if (to.path === LOGIN_URL) { console.log("判断是访问登陆页,有:", from.fullPath); + console.log("要去的页面,有:", to.fullPath); console.log("判断是访问登陆页,globalStore.token有:", globalStore.token); if (globalStore.token && from.fullPath !='/') return next(from.fullPath); diff --git a/src/views/sevenLargeScreen/bImModel/index.vue b/src/views/sevenLargeScreen/bImModel/index.vue index 261e2b1..afd71d9 100644 --- a/src/views/sevenLargeScreen/bImModel/index.vue +++ b/src/views/sevenLargeScreen/bImModel/index.vue @@ -18,7 +18,12 @@ function getBimfaceList() { if (item.isEnable) { token.value = res.result.viewToken; console.log("token的值", token.value); - localStorage.setItem('bimToken', JSON.stringify(token.value)); + localStorage.setItem("bimToken", JSON.stringify(token.value)); + // let iframe: any = document.getElementById("iframe"); + // console.log(iframe, "我的测试"); + // setTimeout(() => { + // iframe.contentWindow.postMessage({ token: token.value }); + // }, 500); } }); }); @@ -31,10 +36,11 @@ function getBimfaceList() { // // }); // } -onMounted(() => { +onMounted(async () => { + // url.value = "http://jxj.zhgdyun.com:9809/static/bim.html"; url.value = window.location.origin + "/static/bim.html"; console.log("url-------的地址", window.location.origin); - getBimfaceList(); + await getBimfaceList(); });