diff --git a/src/views/screenAdaptation/pages/index.vue b/src/views/screenAdaptation/pages/index.vue index d3d8daa..f9dfb65 100644 --- a/src/views/screenAdaptation/pages/index.vue +++ b/src/views/screenAdaptation/pages/index.vue @@ -24,11 +24,20 @@ load3DModel:false,//是否加载学校3D模型 model3DUrl:"",//学校3D模型路径 pointerEvents:"auto", - env:getEnv() + env:getEnv(), + modelId:1, } }, mounted(){ this.cancelLoading(); + window.addEventListener('message',(event)=>{ + this.listen3DEvent(event) + }) + }, + beforeDestroy(){ + window.removeEventListener('message',(event)=>{ + this.listen3DEvent(event) + },true); }, watch:{ $route:{ @@ -72,12 +81,13 @@ * 改变div背景图 以及事件穿透属性值 * */ changeBackGround:function (modelId) { + this.modelId = modelId; if(modelId !== 3){ if(modelId == 1){ //立体校园 - window.removeEventListener('message',(event)=>{ - this.listen3DEvent(event) - }) +// window.removeEventListener('message',(event)=>{ +// this.listen3DEvent(event) +// }) if(this.env === "development"){ // this.model3DUrl = "https://three-dimensional.obs.myhuaweicloud.com/tech-tools/others/yangpuxuexiao3D/index.html?AccessKeyId=WAFBGJACKDOQZDH1MKZ1&Expires=1667894500&Signature=mE9wpuN1ImyOz3yMGPwiaI0UPaU%3D"; }else { @@ -89,17 +99,11 @@ //this.model3DUrl = "https://three-dimensional.obs.myhuaweicloud.com/tech-tools/others/yangpuxuexiaonew/index.html?AccessKeyId=WAFBGJACKDOQZDH1MKZ1&Expires=1668049230&Signature=r4Vs%2BaCdcmsQso6Pq2/luCcJU3U%3D"; }else { this.model3DUrl = "./3D/builds-b1/index.html"; - window.addEventListener('message',(event)=>{ - this.listen3DEvent(event) - }) } } this.pointerEvents = "none"; document.getElementById("screenContent").style.backgroundImage = ""; }else { - window.removeEventListener('message',(event)=>{ - this.listen3DEvent(event) - }) this.load3DModel = false; this.model3DUrl = ""; this.pointerEvents = "auto"; @@ -110,16 +114,28 @@ if(event.data){ switch (event.data){ case 'click_01': - //行政管理 - this.$router.push({path:'/adminCenter'}); + if(this.modelId === 1){ + window.open("https://720yun.com/t/09vkOb1h78b?scene_id=59463132") + }else { + //行政管理 + this.$router.push({path:'/adminCenter'}); + } break; case 'click_02': - //家长服务 - this.$router.push({path:'/serviceCenter'}); + if(this.modelId === 1){ + window.open("https://720yun.com/t/09vkOb1h78b?scene_id=59463132") + }else { + //家长服务 + this.$router.push({path:'/serviceCenter'}); + } break; case 'click_03': - //运行数据 - this.$router.push({path:'/monitorCenter'}); + if(this.modelId === 1){ + window.open("https://720yun.com/t/09vkOb1h78b?scene_id=58868837") + }else { + //运行数据 + this.$router.push({path:'/monitorCenter'}); + } break; case 'click_04': //教师管理