fix: BUG修改

This commit is contained in:
kun 2023-12-04 17:16:49 +08:00
parent 78cfed6e75
commit fb4935148b
4 changed files with 47 additions and 38 deletions

View File

@ -12,6 +12,7 @@
let viewer3D; let viewer3D;
let app; let app;
let modelState; let modelState;
let oldViewToken;
const bimCallback = viewToken => { const bimCallback = viewToken => {
// let viewToken = '11b0d307c09f43bfa5fa3922bcce0342' // let viewToken = '11b0d307c09f43bfa5fa3922bcce0342'
let loaderConfig = new BimfaceSDKLoaderConfig() let loaderConfig = new BimfaceSDKLoaderConfig()
@ -52,24 +53,21 @@
window.addEventListener('message', async function(e) { window.addEventListener('message', async function(e) {
// const modelId = e.data.modelId // const modelId = e.data.modelId
const data = e.data || {} const data = e.data || {}
console.log('eeeeeeeeeee',e)
if (data.token) { if (data.token) {
// removeModel(modelId) // removeModel(modelId)
document.getElementById('domId').innerHTML="";
await bimCallback(data.token) await bimCallback(data.token)
} }
if(data.hideArr && data.colorArr){ if(data.hideArr && data.colorArr){
console.log(data.hideArr)
console.log(data.colorArr)
setTimeout(() => { setTimeout(() => {
// 恢复模型状态 // 恢复模型状态
viewer3D.setState(modelState); viewer3D.setState(modelState);
console.log(model3D) model3D.hideComponentsById(data.hideArr);
model3D.hideComponentsById(data.hideArr); data.colorArr.map(item => {
data.colorArr.map(item => { model3D.overrideComponentsColorById([item.name], new Glodon.Web.Graphics.Color(item.color, 1));
model3D.overrideComponentsColorById([item.name], new Glodon.Web.Graphics.Color(item.color, 1)); })
}) viewer3D.render();
viewer3D.render(); }, 2000)
}, 1000)
} }
// console.log(e.data, '父级页面传来的数据') // console.log(e.data, '父级页面传来的数据')
// setTimeout(() => { // setTimeout(() => {

View File

@ -20,7 +20,7 @@ var COMPANY = '' //通用
// COMPANY = 'shjg'//上海优益(上海建工) // COMPANY = 'shjg'//上海优益(上海建工)
// COMPANY = 'syhy'//沈阳和盈 // COMPANY = 'syhy'//沈阳和盈
// COMPANY = 'jxwjj'//嘉兴王江泾公用码头项目 // COMPANY = 'jxwjj'//嘉兴王江泾公用码头项目
COMPANY = 'gxbs'//广西百色 // COMPANY = 'gxbs'//广西百色
var PROJECT = { var PROJECT = {
local_test: 'common', // 普通版 local_test: 'common', // 普通版

View File

@ -48,15 +48,15 @@ export default new Vuex.Store({
// FILEURL:'http://192.168.34.221:30001/image/',//郭圣雄 // FILEURL:'http://192.168.34.221:30001/image/',//郭圣雄
// UPLOADURL:'http://10.0.1.43:6023/upload/image',//测试 // UPLOADURL:'http://10.0.1.43:6023/upload/image',//测试
// FILEURL:'http://10.0.1.43:6023/image/',//测试 // FILEURL:'http://10.0.1.43:6023/image/',//测试
BASEURL: baseUrl // BASEURL: baseUrl
? baseUrl // ? baseUrl
: window.location.protocol + "//" + window.location.host + "/", //正式环境 // : window.location.protocol + "//" + window.location.host + "/", //正式环境
UPLOADURL: // UPLOADURL:
window.location.protocol + // window.location.protocol +
"//" + // "//" +
window.location.host + // window.location.host +
"/upload/image", //正式环境 // "/upload/image", //正式环境
FILEURL: window.location.protocol + "//" + window.location.host + "/image/", //正式环境 // FILEURL: window.location.protocol + "//" + window.location.host + "/image/", //正式环境
//--------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------
// BASEURL: baseUrl // BASEURL: baseUrl
// ? baseUrl // ? baseUrl
@ -104,8 +104,8 @@ export default new Vuex.Store({
// FILEURL: 'http://118.121.198.147:23232/image/',//四川成润(正式) // FILEURL: 'http://118.121.198.147:23232/image/',//四川成润(正式)
// UPLOADURL: 'http://121.196.214.246/api/upload/image',//金林湾 // UPLOADURL: 'http://121.196.214.246/api/upload/image',//金林湾
// FILEURL: 'http://121.196.214.246/api/image/',//金林湾 // FILEURL: 'http://121.196.214.246/api/image/',//金林湾
// UPLOADURL: 'http://192.168.34.221:28888/upload/image',//郭圣雄本地 UPLOADURL: 'http://192.168.34.221:28888/upload/image',//郭圣雄本地
// FILEURL: 'http://192.168.34.221:28888/image/',//郭圣雄本地 FILEURL: 'http://192.168.34.221:28888/image/',//郭圣雄本地
// UPLOADURL: 'http://101.43.164.214:45011/upload/image',//上海优益 // UPLOADURL: 'http://101.43.164.214:45011/upload/image',//上海优益
// FILEURL: 'http://101.43.164.214:45011/image/',//上海优益 // FILEURL: 'http://101.43.164.214:45011/image/',//上海优益

View File

@ -35,7 +35,7 @@
> >
</div> </div>
</div> </div>
<iframe :src="url" frameborder="0" width="100%" height="92%" id="iframe" @load="load"></iframe> <iframe :src="url" frameborder="0" width="100%" id="iframe" style="flex: 1"></iframe>
</div> </div>
</template> </template>
@ -73,7 +73,7 @@ export default {
this.url = window.location.origin + '/bim.html', this.url = window.location.origin + '/bim.html',
this.iframe = document.getElementById('iframe') this.iframe = document.getElementById('iframe')
window.addEventListener('message', this.getIframeMessage) window.addEventListener('message', this.getIframeMessage)
this.getModelList() // this.getModelList()
}, },
watch: { watch: {
fileId: { fileId: {
@ -100,6 +100,7 @@ export default {
let that = this let that = this
saveBimfaceConfig({ id: this.resData.id,hiddenComponentId:this.selectedHideList.join(','),componentColorJson: JSON.stringify(this.selectedColorList) }).then(res => { saveBimfaceConfig({ id: this.resData.id,hiddenComponentId:this.selectedHideList.join(','),componentColorJson: JSON.stringify(this.selectedColorList) }).then(res => {
if(res.code == 200){ if(res.code == 200){
this.$message.success("操作成功")
that.iframe.contentWindow.postMessage({ hideArr: this.selectedHideList,colorArr: this.selectedColorList }) that.iframe.contentWindow.postMessage({ hideArr: this.selectedHideList,colorArr: this.selectedColorList })
} }
}) })
@ -115,7 +116,8 @@ export default {
}, },
load() { load() {
// console.log(this.iframe,'iframe') // console.log(this.iframe,'iframe')
this.iframe.contentWindow.postMessage("我进来啦") // this.iframe.contentWindow.postMessage("")
this.getModelList()
}, },
getIframeMessage(e) { getIframeMessage(e) {
console.log('Message from iframe', e.data.msg) console.log('Message from iframe', e.data.msg)
@ -139,23 +141,24 @@ export default {
}, },
getModelList() { getModelList() {
projectJlwBimListApi({ projectSn: this.$store.state.projectSn }).then(res => { this.getToken(this.fileId)
this.buildList = res.result.page.records // projectJlwBimListApi({ projectSn: this.$store.state.projectSn }).then(res => {
res.result.page.records.forEach(item => { // this.buildList = res.result.page.records
if (item.isEnable) { // res.result.page.records.forEach(item => {
this.getToken(item.fileId) // if (item.isEnable) {
// this.getToken() // // this.getToken()
} // }
}) // })
}) // })
}, },
getToken(fileId) { getToken(fileId) {
console.log("我切换了-------------------",fileId)
getJlwDetailsApi({ fileId, projectSn: this.$store.state.projectSn }).then(res => { getJlwDetailsApi({ fileId, projectSn: this.$store.state.projectSn }).then(res => {
console.log(res) console.log(res)
this.resData = res.result; this.resData = res.result;
const token = res.result.viewToken; const token = res.result.viewToken;
this.selectedHideList = this.resData.hiddenComponentId.split(','); this.selectedHideList = this.resData.hiddenComponentId?this.resData.hiddenComponentId.split(','):[];
this.selectedColorList = JSON.parse(this.resData.componentColorJson); this.selectedColorList = this.resData.componentColorJson?JSON.parse(this.resData.componentColorJson):[];
this.iframe.contentWindow.postMessage({ token, hideArr: this.selectedHideList,colorArr: this.selectedColorList }) this.iframe.contentWindow.postMessage({ token, hideArr: this.selectedHideList,colorArr: this.selectedColorList })
}) })
} }
@ -183,6 +186,11 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.fullHeight {
height: 100%;
display: flex;
flex-direction: column;
}
.bimModel-operate{ .bimModel-operate{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -192,14 +200,17 @@ export default {
} }
.data-show{ .data-show{
width: max-content; width: max-content;
max-width: 100%;
@include flex; @include flex;
margin-top: 10px; margin-top: 10px;
.selected-box{ .selected-box{
flex: 1%;
min-width: 208px; min-width: 208px;
min-height: 32px; min-height: 32px;
border: 1px solid #c0c4cc; border: 1px solid #c0c4cc;
border-radius: 4px; border-radius: 4px;
@include flex; @include flex;
flex-wrap: wrap;
padding-left: 6px; padding-left: 6px;
margin-right: 15px; margin-right: 15px;
>div{ >div{