Bladeren bron

增加面积显示逻辑

zjs_project 1 jaar geleden
bovenliggende
commit
d51fb0d47c

+ 8 - 0
src/App.vue

@@ -70,6 +70,14 @@
 					alert("**内存不足,页面重新载入**")
 				}
 			});
+			// 监听页面隐藏事件
+			window.addEventListener('pagehide', function(event) {
+			    // 判断页面是否因为内存不足而被卸载或隐藏
+			    if (event.persisted) {
+			        // 页面被卸载或隐藏,可以执行一些重载操作
+			        alert("**内存不足,页面重新载入ios**")
+			    }
+			});
 
 			// window.onerror = function(message,source,line,column,error) {
 			// };

+ 13 - 10
src/mixins/loadModel.js

@@ -121,16 +121,19 @@ export default {
 			if(this.type == 2){//全局精简模型;需要的是所有空间的模型
 				allowSpaceId = this.spaceList.map(it=>it.spaceId)
 			}else{//空间模型模式
-				// allowSpaceId = [this.curSpaceObj.spaceId];
-				// if(this.curSpaceObj.spaceType==4){//厨房
-				// 	let list = this.spaceList.filter(it=>it.spaceType==2)
-				// 	allowSpaceId.push(...list.map(it=>it.spaceId));//客厅
-				// }
-				// if(this.curSpaceObj.spaceType==2){//餐厅
-				// 	let list = this.spaceList.filter(it=>it.spaceType==4)
-				// 	allowSpaceId.push(...list.map(it=>it.spaceId));//厨房
-				// }
-				allowSpaceId = this.spaceList.map(it=>it.spaceId);//当前空间 精模加载,其他空间用 简模加载
+				if(this.isIOS){
+					allowSpaceId = [this.curSpaceObj.spaceId];
+					if(this.curSpaceObj.spaceName=='主卧'){//主卧
+						let list = this.spaceList.filter(it=>it.spaceName=='休闲小客厅')
+						allowSpaceId.push(...list.map(it=>it.spaceId));//休闲小客厅
+					}
+					if(this.curSpaceObj.spaceName=='休闲小客厅'){//休闲小客厅
+						let list = this.spaceList.filter(it=>it.spaceName=='主卧')
+						allowSpaceId.push(...list.map(it=>it.spaceId));//主卧
+					}
+				}else{
+					allowSpaceId = this.spaceList.map(it=>it.spaceId);//当前空间 精模加载,其他空间用 简模加载
+				}
 			}
 			console.warn("重新加载布局", arrFrunList,this.spaceList,this.gltfLayouts,allowSpaceId);
 			arrFrunList.forEach(signel => {

+ 2 - 2
src/pages/webgl_rxdz/webgl_rxdz.html

@@ -3,8 +3,8 @@
 	<!-- 提交按钮 -->
 	<div class="submit-btn" @click="submitHouse" v-if="styleType==1">提交</div>
 	<div class="area-view">
-		总面积:{{sumArea}} <br>
-		变化面积:{{changeArea}}
+		<div>当前面积:{{sumArea}}<span style="font-weight: 700;">㎡</span></div>
+		<div v-if="changeArea" style="font-size: 28rem;color: #fa9f40;">{{changeArea < 0 ? '减少':'增加'}}了:{{Math.abs(changeArea)}}<span style="font-weight: 700;">㎡</span></div>
 	</div>
     <div id="mapDiv" ref="webgl"></div>
 	<canvas id="glcanvas" width="100vw" height="100vh" ref="glcanvas"

+ 5 - 2
src/pages/webgl_rxdz/webgl_rxdz.scss

@@ -56,9 +56,12 @@ canvas { width:100vw; height:calc(100vh - 200rem);z-index: 10; }
 }
 .area-view{
 	position: absolute;
-	top:100rem;
+	top:68rem;
 	left:30rem;
-	width:300rem;
+	width:100%;
+	font-size: 32rem;
+	font-family: "Verdana";
+	font-weight: 400;
 }
 .tran{
 	transition-timing-function: linear;

+ 2 - 2
src/pages/webgl_rxdz_look/webgl_rxdz_look.vue

@@ -182,10 +182,10 @@
 					canvas:canvas3d, 
 					alpha: true,
 				});
-				// if(!that.isIOS){
+				if(!that.isIOS){
 					renderer.shadowMap.enabled = true;//产生阴影
 					renderer.shadowMap.type = THREE.PCFSoftShadowMap; // 阴影属性
-				// }
+				}
                 renderer.outputEncoding = THREE.sRGBEncoding;
                 renderer.outputColorSpace = THREE.SRGBColorSpace;
                 // renderer.toneMappingExposure = 0.1;//色调映射的曝光级别。默认是1

+ 13 - 11
src/pages/webgl_rxdz_roam/webgl_rxdz_roam.vue

@@ -177,16 +177,18 @@
 				//平行光
 				const light = new THREE.DirectionalLight(0xFFF8E5, 2.5);
 				light.position.set(5, 7, 3); //default; light shining from top
-				light.castShadow = true; // default false
-				// 默认情况下光投影相机区域是一个长宽高为10x10x500的长方体区域,光源投射方向为通过坐标原点
-				light.shadow.camera.left = -100; // 这个区域内产生阴影
-				light.shadow.camera.right  = 100; // 这个区域内产生阴影
-				light.shadow.camera.top  = 100; // 这个区域内产生阴影
-				light.shadow.camera.bottom  = -100; // 这个区域内产生阴影
+				if(!that.isIOS){
+					light.castShadow = true; // default false
+					// 默认情况下光投影相机区域是一个长宽高为10x10x500的长方体区域,光源投射方向为通过坐标原点
+					light.shadow.camera.left = -100; // 这个区域内产生阴影
+					light.shadow.camera.right  = 100; // 这个区域内产生阴影
+					light.shadow.camera.top  = 100; // 这个区域内产生阴影
+					light.shadow.camera.bottom  = -100; // 这个区域内产生阴影
+					
+					light.shadow.mapSize.width = 1024; 	// 影响阴影的清晰度
+					light.shadow.mapSize.height = 1024; // 影响阴影的清晰度
+				}
 				
-				light.shadow.mapSize.width = 1024; 	// 影响阴影的清晰度
-				light.shadow.mapSize.height = 1024; // 影响阴影的清晰度
-
 				scene.add(light);
 				
 				//antialias 这个值得设置为false,不然IOS上截图会失效
@@ -196,10 +198,10 @@
 					antialias:true,
 					preserveDrawingBuffer: true,
 				});
-				// if(!that.isIOS){
+				if(!that.isIOS){
 					renderer.shadowMap.enabled = true;//产生阴影
 					renderer.shadowMap.type = THREE.PCFSoftShadowMap; // 阴影属性
-				// }
+				}
 				renderer.outputEncoding = THREE.sRGBEncoding;
 				renderer.outputColorSpace = THREE.SRGBColorSpace;
 				// renderer.toneMappingExposure = 0.1;//色调映射的曝光级别。默认是1