diff --git a/public/bim.html b/public/bim.html index 650d1b96..fa8b2481 100644 --- a/public/bim.html +++ b/public/bim.html @@ -12,6 +12,7 @@ let viewer3D; let app; let modelState; + let oldViewToken; const bimCallback = viewToken => { // let viewToken = '11b0d307c09f43bfa5fa3922bcce0342' let loaderConfig = new BimfaceSDKLoaderConfig() @@ -52,24 +53,21 @@ window.addEventListener('message', async function(e) { // const modelId = e.data.modelId const data = e.data || {} - console.log('eeeeeeeeeee',e) if (data.token) { // removeModel(modelId) + document.getElementById('domId').innerHTML=""; await bimCallback(data.token) } if(data.hideArr && data.colorArr){ - console.log(data.hideArr) - console.log(data.colorArr) setTimeout(() => { - // 恢复模型状态 - viewer3D.setState(modelState); - console.log(model3D) - model3D.hideComponentsById(data.hideArr); - data.colorArr.map(item => { - model3D.overrideComponentsColorById([item.name], new Glodon.Web.Graphics.Color(item.color, 1)); - }) - viewer3D.render(); - }, 1000) + // 恢复模型状态 + viewer3D.setState(modelState); + model3D.hideComponentsById(data.hideArr); + data.colorArr.map(item => { + model3D.overrideComponentsColorById([item.name], new Glodon.Web.Graphics.Color(item.color, 1)); + }) + viewer3D.render(); + }, 2000) } // console.log(e.data, '父级页面传来的数据') // setTimeout(() => { diff --git a/public/js/config.js b/public/js/config.js index 0a958e0f..802d4761 100644 --- a/public/js/config.js +++ b/public/js/config.js @@ -20,7 +20,7 @@ var COMPANY = '' //通用 // COMPANY = 'shjg'//上海优益(上海建工) // COMPANY = 'syhy'//沈阳和盈 // COMPANY = 'jxwjj'//嘉兴王江泾公用码头项目 -COMPANY = 'gxbs'//广西百色 +// COMPANY = 'gxbs'//广西百色 var PROJECT = { local_test: 'common', // 普通版 diff --git a/src/store/index.js b/src/store/index.js index 1201a67d..e4230109 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -48,15 +48,15 @@ export default new Vuex.Store({ // FILEURL:'http://192.168.34.221:30001/image/',//郭圣雄 // UPLOADURL:'http://10.0.1.43:6023/upload/image',//测试 // FILEURL:'http://10.0.1.43:6023/image/',//测试 - BASEURL: baseUrl - ? baseUrl - : window.location.protocol + "//" + window.location.host + "/", //正式环境 - UPLOADURL: - window.location.protocol + - "//" + - window.location.host + - "/upload/image", //正式环境 - FILEURL: window.location.protocol + "//" + window.location.host + "/image/", //正式环境 + // BASEURL: baseUrl + // ? baseUrl + // : window.location.protocol + "//" + window.location.host + "/", //正式环境 + // UPLOADURL: + // window.location.protocol + + // "//" + + // window.location.host + + // "/upload/image", //正式环境 + // FILEURL: window.location.protocol + "//" + window.location.host + "/image/", //正式环境 //--------------------------------------------------------------------------------------------- // BASEURL: baseUrl // ? baseUrl @@ -104,8 +104,8 @@ export default new Vuex.Store({ // FILEURL: 'http://118.121.198.147:23232/image/',//四川成润(正式) // UPLOADURL: 'http://121.196.214.246/api/upload/image',//金林湾 // FILEURL: 'http://121.196.214.246/api/image/',//金林湾 - // UPLOADURL: 'http://192.168.34.221:28888/upload/image',//郭圣雄本地 - // FILEURL: 'http://192.168.34.221:28888/image/',//郭圣雄本地 + UPLOADURL: 'http://192.168.34.221:28888/upload/image',//郭圣雄本地 + FILEURL: 'http://192.168.34.221:28888/image/',//郭圣雄本地 // UPLOADURL: 'http://101.43.164.214:45011/upload/image',//上海优益 // FILEURL: 'http://101.43.164.214:45011/image/',//上海优益 diff --git a/src/views/projectFront/BIMCenter/overviewTwo.vue b/src/views/projectFront/BIMCenter/overviewTwo.vue index 81dd4786..8ce24fec 100644 --- a/src/views/projectFront/BIMCenter/overviewTwo.vue +++ b/src/views/projectFront/BIMCenter/overviewTwo.vue @@ -35,7 +35,7 @@ > - + @@ -73,7 +73,7 @@ export default { this.url = window.location.origin + '/bim.html', this.iframe = document.getElementById('iframe') window.addEventListener('message', this.getIframeMessage) - this.getModelList() + // this.getModelList() }, watch: { fileId: { @@ -100,6 +100,7 @@ export default { let that = this saveBimfaceConfig({ id: this.resData.id,hiddenComponentId:this.selectedHideList.join(','),componentColorJson: JSON.stringify(this.selectedColorList) }).then(res => { if(res.code == 200){ + this.$message.success("操作成功") that.iframe.contentWindow.postMessage({ hideArr: this.selectedHideList,colorArr: this.selectedColorList }) } }) @@ -115,7 +116,8 @@ export default { }, load() { // console.log(this.iframe,'iframe') - this.iframe.contentWindow.postMessage("我进来啦") + // this.iframe.contentWindow.postMessage("我进来啦") + this.getModelList() }, getIframeMessage(e) { console.log('Message from iframe:', e.data.msg) @@ -139,23 +141,24 @@ export default { }, getModelList() { - projectJlwBimListApi({ projectSn: this.$store.state.projectSn }).then(res => { - this.buildList = res.result.page.records - res.result.page.records.forEach(item => { - if (item.isEnable) { - this.getToken(item.fileId) - // this.getToken() - } - }) - }) + this.getToken(this.fileId) + // projectJlwBimListApi({ projectSn: this.$store.state.projectSn }).then(res => { + // this.buildList = res.result.page.records + // res.result.page.records.forEach(item => { + // if (item.isEnable) { + // // this.getToken() + // } + // }) + // }) }, getToken(fileId) { + console.log("我切换了-------------------",fileId) getJlwDetailsApi({ fileId, projectSn: this.$store.state.projectSn }).then(res => { console.log(res) this.resData = res.result; const token = res.result.viewToken; - this.selectedHideList = this.resData.hiddenComponentId.split(','); - this.selectedColorList = JSON.parse(this.resData.componentColorJson); + this.selectedHideList = this.resData.hiddenComponentId?this.resData.hiddenComponentId.split(','):[]; + this.selectedColorList = this.resData.componentColorJson?JSON.parse(this.resData.componentColorJson):[]; this.iframe.contentWindow.postMessage({ token, hideArr: this.selectedHideList,colorArr: this.selectedColorList }) }) } @@ -183,6 +186,11 @@ export default { display: flex; align-items: center; } +.fullHeight { + height: 100%; + display: flex; + flex-direction: column; +} .bimModel-operate{ display: flex; flex-direction: column; @@ -192,14 +200,17 @@ export default { } .data-show{ width: max-content; + max-width: 100%; @include flex; margin-top: 10px; .selected-box{ + flex: 1%; min-width: 208px; min-height: 32px; border: 1px solid #c0c4cc; border-radius: 4px; @include flex; + flex-wrap: wrap; padding-left: 6px; margin-right: 15px; >div{