zjs_project 1 år sedan
förälder
incheckning
24b32a645e

+ 1 - 0
package.json

@@ -38,6 +38,7 @@
     "@vue/cli-plugin-babel": "~5.0.0",
     "@vue/cli-plugin-eslint": "~5.0.0",
     "@vue/cli-service": "~5.0.0",
+    "amfe-flexible": "^2.2.1",
     "cross-env": "^7.0.3",
     "eslint": "^7.32.0",
     "eslint-plugin-vue": "^8.0.3",

+ 0 - 8
src/App.vue

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

+ 2 - 2
src/components/newBottomCom/viewCareful/viewCareful.scss

@@ -12,14 +12,14 @@
 }
 .careful-list{
 	width: 100%;
-	max-height:600px;
-	margin-top:30px;
+	max-height:584px;
 }
 .item-top{
 	width: 100%;
 }
 .scroll-view{
 	overflow-y: auto;
+	margin-top:30px;
 }
 .careful-item .item-top {
 	font-family: "Verdana Bold";

+ 2 - 2
src/main.js

@@ -8,7 +8,7 @@ import 'element-ui/lib/theme-chalk/index.css'; //导入ele-ui 的样式
 import $ from 'jquery'; //引入JQuery
 import axios from '@/services/request.js'; //重新定义axios,向里面添加一些参数
 import '@/services/requestConfig.js'; //导入请求的拦截器
-import '@/utils/rem.js'; //rem单位的使用
+// import '@/utils/rem.js'; //rem单位的使用
 
 import '@/assets/common.css'; //公共样式
 import "@/assets/font/iconfont.css"; //引用公共icon库
@@ -18,7 +18,7 @@ import "@/assets/font/iconfont.css"; //引用公共icon库
 import {message} from "@/utils/resetMessage";
 
 import mynavbar from '@/components/mynavbar/mynavbar.vue'
-import 'amfe-flexible'
+import 'amfe-flexible';	//自动设置font-size的基准值
 // import checkPermission from "@/utils/permission";
 
 Vue.use(ElementUI); //导入ele-ui

+ 25 - 3
src/mixins/commonPageMethod.js

@@ -8,7 +8,12 @@ export default {
 	mounted() {
 		console.warn("---mounted---",this.pvId,this.$route.meta.keepAlive)
 		if(this.pvId && !this.$route.meta.keepAlive){
+			window.removeEventListener('beforeunload', this.pvCloseHandle);
+			window.removeEventListener('visibilitychange', this.visibilitychange);
 			window.currentPage = this;
+			if(this.starRender && typeof(this.starRender)==='function'){
+				this.starRender()
+			}
 			let param = {
 				type: 'PV',
 				pvId: this.pvId,
@@ -36,11 +41,19 @@ export default {
 	// 	console.warn("---onhide---")
 	// 	this.pvCloseHandle()
 	// },
+	// beforeUpdate() {
+	// 	console.warn("beforeUpdate");
+	// 	// 移除visibilitychange事件监听器
+	// 	window.removeEventListener('visibilitychange', this.visibilitychange);
+	// },
 	beforeRouteLeave(to, from, next) {
 		console.warn("router:beforeRouteLeave:",from.name);
 		// 在离开当前路由前执行的方法
 		// 例如保存表单数据、清理定时器等操作
 		this.pvCloseHandle();
+		if(this.stopRender && typeof(this.stopRender)==='function'){
+			this.stopRender();//停止webgl的渲染
+		}
 		window.removeEventListener('beforeunload', this.pvCloseHandle);//注销监听刷新事件
 		window.removeEventListener('visibilitychange', this.visibilitychange);
 		next();
@@ -50,9 +63,14 @@ export default {
 		next();
 	},
 	activated(){
-		console.warn("activated:",this.pvId);
+		console.warn("activated:",this.pvId); 
 		if(this.pvId && this.$route.meta.keepAlive){
+			window.removeEventListener('beforeunload', this.pvCloseHandle);
+			window.removeEventListener('visibilitychange', this.visibilitychange);
 			window.currentPage = this;
+			if(this.starRender && typeof(this.starRender)==='function'){
+				this.starRender()
+			}
 			let param = {
 				type: 'PV',
 				pvId: this.pvId,
@@ -66,10 +84,14 @@ export default {
 	},
 	methods: {
 		visibilitychange(){
+			console.warn("visibilitychange");
 			if (document.visibilityState !== 'visible') { // 离开页面
-			   this.pvCloseHandle()
+				if(this.stopRender && typeof(this.stopRender)==='function'){
+					this.stopRender();//停止webgl的渲染
+				}
+				this.pvCloseHandle()
 			} else { // 进入页面
-			   this.pvShowHandle()
+				this.pvShowHandle()
 			}
 		},
 		pvShowHandle(){

+ 4 - 52
src/mixins/floorMethod.js

@@ -38,7 +38,7 @@ export default {
 		loaderCommonSpace(gltfSpaceUrl,list,type=1){
 			var that = this;
 			this.loader.load(gltfSpaceUrl,  ( gltf ) => {
-				console.log("地板模型加载成功",list)
+				console.log("地板模型加载成功")
 				// gltf.scene.receiveShadow = true;//材质是否接收阴影
 				gltf.scene.traverse((child)=> {
 					if (child.isMesh && child.visible) {
@@ -132,9 +132,9 @@ export default {
 			let glbWidth = 300;
 			let glbHeight = 300;
 			var that = this;
-			console.log("草地模型加载成功",list)
+			console.log("草地模型加载成功")
 			//将模型添加到场景中
-			let texture = new THREE.TextureLoader().load( "https://dm.static.elab-plus.com/miniProgram/grass.jpg");
+			let texture = new THREE.TextureLoader().load("https://dm.static.elab-plus.com/miniProgram/grass.jpg");
 			// let texture = new THREE.TextureLoader().load( "https://dm.static.elab-plus.com/miniProgram/Avatar_male.png" );
 			texture.wrapS = THREE.RepeatWrapping;
 			texture.wrapT = THREE.RepeatWrapping;
@@ -183,49 +183,6 @@ export default {
 				that.scene.add(cube);
 			})
 		},
-		//修改当前空间的面积大小
-		changeSpacesAnimOld(curSpace){
-			// 寻找地板
-			const cube = this.gltfSpaces.find((item)=>{
-			    return item.spaceId == curSpace.spaceId;
-			})
-			console.log("空间移动目标",cube.spaceId, JSON.stringify(cube.position),JSON.stringify(cube.scale),curSpace.toScaleX, curSpace.toScaleZ, curSpace.toPx, curSpace.toPz);
-			//获取地板模型的geometry实例
-			cube.instancedMeshIndexList.forEach(instanced=>{
-				let _index = instanced.instancedMeshIndex;//第一个geometry实例 在 全局InstancedMesh实例的位置
-				let instancedMesh = this.instancedSpaceMeshList[_index];//获取具体的网格实例
-				let stratMatrix = new THREE.Matrix4();//定义一个四维矩阵
-				instancedMesh.getMatrixAt(instanced.instancedAtIndex,stratMatrix);//获取当前几何体的四维矩阵到stratMatrix里面
-				
-				let endMatrix = stratMatrix.clone();//复制一个四维矩阵 
-				let scaleMatrix = new THREE.Matrix4();//定义一个缩放变化矩阵
-				let panMatrix = new THREE.Matrix4();//定义一个平移变化矩阵
-				
-				scaleMatrix.makeScale(curSpace.toScaleX / cube.scale.x,1,curSpace.toScaleZ / cube.scale.z);		//获得缩放变化矩阵
-				panMatrix.makeTranslation(curSpace.toPx - cube.position.x,0,curSpace.toPz - cube.position.z);	//获得平移变化矩阵
-				endMatrix.multiply(scaleMatrix).premultiply(panMatrix);//通过矩阵计算获得最终的矩阵
-				// console.warn("***drawModel-isAnimate-space***",JSON.stringify(endMatrix1),JSON.stringify(endMatrix),JSON.stringify(stratMatrix));
-				var tween = new TWEEN.Tween(stratMatrix.elements)
-				.to(endMatrix.elements, 2000)
-				.easing(TWEEN.Easing.Quadratic.InOut)
-				.onUpdate((matrixWorld)=> {
-					let m4 = new THREE.Matrix4();//定义一个四维矩阵
-					m4.set(...matrixWorld);//注意:四维矩阵的显示和实际计算的行列优先规则不同
-					instancedMesh.instanceMatrix.needsUpdate = true;//更新之前,必须开启开关
-					instancedMesh.setMatrixAt(instanced.instancedAtIndex,m4.transpose());//更新几何体的世界矩阵
-				}).onComplete(()=>{
-					instancedMesh.setMatrixAt(instanced.instancedAtIndex,endMatrix);//更新几何体的世界矩阵
-					this.tweenCameraAnmaChange(false)
-				});
-				// 开始动画
-				tween.start();
-				this.tweenCameraAnmaChange(true)
-				cube.position.x = curSpace.toPx;
-				cube.position.z = curSpace.toPz;
-				cube.scale.x = curSpace.toScaleX;
-				cube.scale.z = curSpace.toScaleZ;
-			});
-		},
 		//修改当前空间的面积大小-动画方案2
 		changeSpacesAnim(curSpace){
 			// 寻找地板
@@ -347,15 +304,10 @@ export default {
 			if(cubeRoof){
 				let roofScaleX =  curSpace.spaceObj.spaceWidth / cubeRoof.userData.spaceWidth
 				let roofScaleY =  curSpace.spaceObj.spaceHeight / cubeRoof.userData.spaceHeight
-				console.log("屋顶尺寸变化", curSpace.spaceObj, cubeRoof, roofScaleX, roofScaleY)
-				// cubeRoof.scale.x = toScaleX / scaleX;
-				// cubeRoof.scale.z = 0.5;
-				// cubeRoof.position.x = toPx;
-				// cubeRoof.position.z = toPz;
+				// console.log("屋顶尺寸变化", curSpace.spaceObj, cubeRoof, roofScaleX, roofScaleY)
 				cubeRoof.scale.set(roofScaleX,roofScaleY,1);//缩小为原来0.5倍
 				cubeRoof.position.x = toPx;
 				cubeRoof.position.z = toPz;
-				// cubeRoof.position.set(toPx - x, 0, 1);
 			}
 		},
 		//所有空间整体缩放-同时同步到数据里面

+ 7 - 0
src/mixins/loadModel.js

@@ -201,6 +201,9 @@ export default {
 			}else{
 				this.calculateLayoutModelSize() // 提前计算模型的位置
 			}
+			tmpList = [];
+			this.realList = [];
+			this.tmpList = []
 			console.log("***realFurArr***", realFurArr,this.gltfLayouts);
 			realFurArr && realFurArr.forEach((item,index) => {
 				this.loadLayFlag = true;
@@ -213,8 +216,12 @@ export default {
 			Promise.all(this.promise_list).then(() => {
 				let endTime = new Date().getTime();
 				this.loadLayFlag = false;
+				realFurArr = [];
 				console.log("家具模型全部加载完成,时间:", endTime - startTime, this.gltfLayouts);
 				this.loadLastSpaceModel();//加载剩余空间的家具模型
+				// alert("JavaScript 堆大小限制: "+performance
+				// +"\n已使用的 JavaScript 堆大小: "+performance
+				// +"\nJavaScript 堆的总大小: "+performance.memory);
 			})
 		},
 		//过滤掉不需要的家具

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1255 - 0
src/mixins/wallMethod - 副本.js


+ 0 - 136
src/mixins/wallMethod.js

@@ -15,142 +15,6 @@ export default {
 	},
 	watch: {},
 	methods: {
-			// 加载所有墙体模型
-			// modelItem 变化后的
-			// wallObj 变化前的
-			drawModelOld(modelItem, spaceObj, wallObj, isAnimate=false){
-			    let cube = wallObj.obj;
-			    let that = this;
-				
-			    // console.log("模型参数", wallPositionX, wallPositionY, wallScaleX, wallScaleY, lastWallPosition, wallDirection)
-	
-				console.log("墙体动画", modelItem, spaceObj, wallObj, isAnimate,spaceObj.rightCenter);
-				if(!wallObj.obj){//新的逻辑
-					//无变化则不需要启动动画
-					if(modelItem.wallPositionX == wallObj.wallPositionX 
-					&& modelItem.wallPositionY == wallObj.wallPositionY
-					&& modelItem.wallScaleX == wallObj.wallScaleX
-					&& modelItem.wallScaleY == wallObj.wallScaleY){
-						return false;
-					}
-					wallObj.instancedMeshIndexList.forEach(item=>{
-						let _index = item.instancedMeshIndex;
-						let instancedMesh = this.instancedMeshList[_index];//获取网格实例
-						let stratMatrix = new THREE.Matrix4();//定义一个四维矩阵
-						let endMatrix = new THREE.Matrix4();//定义一个四维矩阵
-						instancedMesh.getMatrixAt(item.instancedAtIndex,stratMatrix);//获取当前几何体的四维矩阵到stratMatrix里面
-						let position = new THREE.Vector3();//当前几何体的位置参数
-						let position1 = new THREE.Vector3();//计算后的位移参数
-						let scale = new THREE.Vector3();//当前几何体的位置参数
-						let scale1 = new THREE.Vector3();//计算后的形变参数
-						let quaternion = new THREE.Quaternion();//四元数
-						stratMatrix.decompose(position,quaternion,scale);//从当前几何体提取相关参数
-						// 计算变化后的位置:位移后的位置 是 当前几何体的位置参数 加上 模型移动后的位置偏移量
-						let x = position.x + modelItem.wallPositionX - wallObj.wallPositionX;
-						let z = position.z + modelItem.wallPositionY - wallObj.wallPositionY;
-						// 计算变化后的缩放:缩放后的值 是 当前几何体的缩放比例 同步 模型缩放后缩放比例
-						let scalex = scale.x * (modelItem.wallScaleX/ wallObj.wallScaleX);
-						let scaley = scale.z * (modelItem.wallScaleY/ wallObj.wallScaleY);
-						//x轴放大,则需要移动多一倍的距离
-						if(modelItem.wallScaleX!=wallObj.wallScaleX){
-							if(modelItem.wallRotateY>0){//说明旋转了
-								let _ch = modelItem.wallPositionY - wallObj.wallPositionY;
-								if(spaceObj.rightCenter){//即形变几何体是右侧不变,由于中心点在左侧,所以要再加一倍变化的值
-									z = z + _ch;
-								}else{//形变几何体是左侧不变,由于中心点在左侧,所以要减去变化的值
-									z = z - _ch;
-								}
-								// z = z + modelItem.wallPositionY - wallObj.wallPositionY
-							}else{
-								let _ch = modelItem.wallPositionX - wallObj.wallPositionX;
-								if(spaceObj.rightCenter){
-									x = x + _ch;
-								}else{
-									x = x - _ch;
-								}
-							}
-						}
-						//Y轴缩小(这里理解是Z轴,映射原因),则需要移动多一倍的距离 
-						//因为几何体的操作原点是左边中心点,不是几何中心点 所以计算的时候需要在多移动一倍
-						if(modelItem.wallScaleY!=wallObj.wallScaleY){
-							if(modelItem.wallRotateY>0){//说明旋转了
-								let _ch = modelItem.wallPositionX - wallObj.wallPositionX;
-								if(spaceObj.rightCenter){
-									x = x + _ch;
-								}else{
-									x = x - _ch;
-								}
-								// x = x + modelItem.wallPositionX - wallObj.wallPositionX;
-							}else{
-								let _ch = modelItem.wallPositionY - wallObj.wallPositionY;
-								if(spaceObj.rightCenter){
-									z = z + _ch;
-								}else{
-									z = z - _ch;
-								}
-								// z = z + modelItem.wallPositionY - wallObj.wallPositionY
-							}
-						}
-						position1.set(x, position.y, z);
-						scale1.set(scalex,scale.y,scaley);
-						//获取最终的几何体四维变化矩阵
-						endMatrix = endMatrix.compose(position1,quaternion,scale1);
-						// console.warn("***drawModel-isAnimate0***",JSON.stringify(position),JSON.stringify(scale),wallObj.name,modelItem,wallObj);
-						// console.warn(JSON.stringify(stratMatrix.elements),JSON.stringify(endMatrix.elements));
-						// instancedMesh.instanceMatrix.needsUpdate = true;
-						// instancedMesh.setMatrixAt(item.instancedAtIndex,endMatrix);//更新几何体的世界矩阵
-						var tween = new TWEEN.Tween(stratMatrix.elements)
-						.to(endMatrix.elements, 2000)
-						.easing(TWEEN.Easing.Quadratic.InOut)
-						.onUpdate((matrixWorld)=> {
-							let m4 = new THREE.Matrix4();//定义一个四维矩阵
-							m4.set(...matrixWorld);//注意:四维矩阵的显示和实际计算的行列优先规则不同
-							instancedMesh.instanceMatrix.needsUpdate = true;//更新之前,必须开启开关
-							instancedMesh.setMatrixAt(item.instancedAtIndex,m4.transpose());//更新几何体的世界矩阵
-						}).onComplete(()=>{
-							instancedMesh.setMatrixAt(item.instancedAtIndex,endMatrix);//更新几何体的世界矩阵
-							this.tweenCameraAnmaChange(false)
-						});
-						// 开始动画
-						tween.start();
-						this.tweenCameraAnmaChange(true)
-					})
-					//更新模型的最新位置,确保计算结果正确
-					setTimeout(()=>{
-						let gltfWall = that.gltfWalls.find(gltfWall=>gltfWall.uniId==wallObj.uniId);//判断是否已经添加过
-						gltfWall.wallPositionX = modelItem.wallPositionX;
-						gltfWall.wallPositionY = modelItem.wallPositionY;
-						gltfWall.wallScaleX = modelItem.wallScaleX;
-						gltfWall.wallScaleY = modelItem.wallScaleY;
-						gltfWall.wallRotateY = modelItem.wallRotateY;
-					}, 2000);
-				}else{
-					console.warn("***drawModel-isAnimate-2***",JSON.stringify(cube.position),JSON.stringify(cube.scale),modelItem);
-					var tween = new TWEEN.Tween({
-						x: cube.position.x,
-						z: cube.position.z,
-						sx:cube.scale.x,
-						sz:cube.scale.z
-					})
-					.to({
-						x: modelItem.wallPositionX,
-						z: modelItem.wallPositionY,
-						sx:modelItem.wallScaleX
-					}, 2000)
-					.easing(TWEEN.Easing.Quadratic.InOut)
-					.onUpdate((object)=> {
-						cube.position.x = object.x;
-						cube.position.z = object.z;
-						cube.scale.x = object.sx;
-						cube.scale.z = object.sz;
-					}).onComplete(()=>{
-						this.tweenCameraAnmaChange(false)
-					});
-					// 开始动画
-					tween.start();
-					this.tweenCameraAnmaChange(true)
-				}
-			},
 			// modelItem 变化后的
 			// wallObj 变化前的-一面墙下的某一段墙体
 			drawModel(modelItem, spaceObj, wallObj, isAnimate=false){

+ 31 - 8
src/pages/webgl_rxdz/webgl_rxdz.vue

@@ -133,27 +133,50 @@
 			cancelAnimationFrame(requestId, this.canvas)
 			this.worker && this.worker.terminate()
 			if (this.renderer instanceof THREE.WebGLRenderer) {
-				this.renderer.dispose()
-				this.renderer.forceContextLoss()
-				this.renderer.context = null
-				this.renderer.domElement = null
-				this.renderer = null;
+				// 遍历场景中的所有子对象,找到类型为Mesh的对象并移除
+				let deleList = this.scene.children.filter(object=>{
+					if (object instanceof THREE.Mesh) {
+						return object
+					}
+				})
+				if(deleList && deleList.length>0){
+					this.scene.remove(...deleList);
+				}
+				this.scene.traverse(function(object) {
+					if (object instanceof THREE.Mesh) {
+						if(object.geometry && typeof(object.geometry.dispose)=='function'){
+							object.geometry.dispose();
+						}
+						if(object.material && typeof(object.material.dispose)=='function'){
+							object.material.dispose();
+						}
+						if(object.texture && typeof(object.texture.dispose)=='function'){
+							object.texture.dispose();
+						}
+					}
+				});
+				this.renderer.clear();
+				this.renderer.dispose();
+				this.renderer.forceContextLoss();
+				this.renderer.context = null;
+				this.renderer.domElement = null;
+				this.renderer = null;;
 				this.clearEvent()
 			}
 			this.gltfWalls = [];
 			this.gltfSpaces = [];
 			this.gltfSpaceRoofs = [];
+			this.gltfLayouts = [];
 			this.instancedMeshList = [];
 			this.instancedSpaceMeshList = [];
 			this.lableItem = [];
-			this.gltfLayouts = [];
 			this.instancedFurList = [];
 			this.wallList = [];
 			TWEEN && TWEEN.removeAll();//清除所有的tween;
 			console.warn("***beforeDestroy-webgl_rxdz***");
 		},
         mounted() {
-			console.log("***onLoad-webgl_rxdz***", this.$route.query)
+			console.log("***onLoad-webgl_rxdz***", this.$route.query);
 			var that = this;
 			this.houseId = this.$store.state.houseId || '';
 			this.childLayout = this.$route.query.childLayout || 0;//4-测试户型
@@ -197,6 +220,7 @@
 			this.gradientResize = gradientResize;
 			this.moveMeshCenterHandle = moveMeshCenterHandle;
 			this.starRender = starRender;//对外暴露启动渲染的方法
+			this.stopRender = stopRender;//对外暴露停止渲染的方法
 			this.cameraInit = cameraInit;
 			this.resetControl = resetControl;
 			function init() {
@@ -286,7 +310,6 @@
 						camera.position.y = 0;
 					}
 				});
-				// controls.target = new THREE.Vector3( that.controlStarPosition.x, that.controlStarPosition.y, that.controlStarPosition.z );;
 				// stats = new Stats();
 				// container.appendChild(stats.dom);
 				// stats.domElement.style.top = '100px';

+ 24 - 9
src/pages/webgl_rxdz_look/webgl_rxdz_look.vue

@@ -91,19 +91,34 @@
 			this.worker && this.worker.terminate()
 			setTimeout(() => {
 				if (this.renderer instanceof THREE.WebGLRenderer) {
-					// 清空场景中所有对象的资源
+					// 遍历场景中的所有子对象,找到类型为Mesh的对象并移除
+					let deleList = this.scene.children.filter(object=>{
+						if (object instanceof THREE.Mesh) {
+							return object
+						}
+					})
+					if(deleList && deleList.length>0){
+						this.scene.remove(...deleList);
+					}
 					this.scene.traverse(function(object) {
 						if (object instanceof THREE.Mesh) {
-							object.geometry && object.geometry.dispose();
-							object.material && object.material.dispose();
-							object.texture && object.texture.dispose();
+							if(object.geometry && typeof(object.geometry.dispose)=='function'){
+								object.geometry.dispose();
+							}
+							if(object.material && typeof(object.material.dispose)=='function'){
+								object.material.dispose();
+							}
+							if(object.texture && typeof(object.texture.dispose)=='function'){
+								object.texture.dispose();
+							}
 						}
 					});
-					this.renderer.dispose()
-					this.renderer.forceContextLoss()
-					this.renderer.context = null
-					this.renderer.domElement = null
-					this.renderer = null;
+					this.renderer.clear();
+					this.renderer.dispose();
+					this.renderer.forceContextLoss();
+					this.renderer.context = null;
+					this.renderer.domElement = null;
+					this.renderer = null;;
 					this.clearHandle()
 				}
 			}, 0)

+ 39 - 51
src/pages/webgl_rxdz_roam/webgl_rxdz_roam.vue

@@ -99,19 +99,34 @@
 			cancelAnimationFrame(requestId, this.canvas)
 			this.worker && this.worker.terminate()
 			if (this.renderer instanceof THREE.WebGLRenderer) {
-				// 清空场景中所有对象的资源
+				// 遍历场景中的所有子对象,找到类型为Mesh的对象并移除
+				let deleList = this.scene.children.filter(object=>{
+					if (object instanceof THREE.Mesh) {
+						return object
+					}
+				})
+				if(deleList && deleList.length>0){
+					this.scene.remove(...deleList);
+				}
 				this.scene.traverse(function(object) {
 					if (object instanceof THREE.Mesh) {
-						object.geometry && object.geometry.dispose();
-						object.material && object.material.dispose();
-						object.texture && object.texture.dispose();
+						if(object.geometry && typeof(object.geometry.dispose)=='function'){
+							object.geometry.dispose();
+						}
+						if(object.material && typeof(object.material.dispose)=='function'){
+							object.material.dispose();
+						}
+						if(object.texture && typeof(object.texture.dispose)=='function'){
+							object.texture.dispose();
+						}
 					}
 				});
-				this.renderer.dispose()
-				this.renderer.forceContextLoss()
-				this.renderer.context = null
-				this.renderer.domElement = null
-				this.renderer = null;
+				this.renderer.clear();
+				this.renderer.dispose();
+				this.renderer.forceContextLoss();
+				this.renderer.context = null;
+				this.renderer.domElement = null;
+				this.renderer = null;;
 				this.clearHandle()
 			}
 			TWEEN && TWEEN.removeAll();//清除所有的tween;
@@ -119,6 +134,9 @@
 		},
         mounted(options) {
 			var that = this;
+			// alert("JavaScript 堆大小限制: "+performance.memory.jsHeapSizeLimit
+			// +"\n已使用的 JavaScript 堆大小: "+performance.memory.usedJSHeapSize
+			// +"\nJavaScript 堆的总大小: "+performance.memory.totalJSHeapSize);
 			console.warn("***webgl_rxdz_roam-options***",this.$route.query)
 			this.isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
 			// alert("***mounted-webgl_rxdz_roam***"+this.curHouseObj)
@@ -165,6 +183,7 @@
 			this.tweenCameraAnmaChange = tweenCameraAnmaChange;
 			this.switchActor = switchActor;
 			this.starRender = starRender;//对外暴露启动渲染的方法
+			this.stopRender = stopRender;//对外暴露停止渲染的方法
 			this.positionCamer = positionCamer;
 			if(this.curHouseObj && this.curHouseObj.id){
 				this.setHouseDetail(this.curHouseObj);
@@ -354,10 +373,9 @@
 							spaceId = selectMesh.spaceId;
 						}
 						// let spaceId = that.gltfSpaces[index].spaceId;//获取选中实例的空间id
-						console.warn("***checkIntersection-地板***",mesh,floor,index,spaceId,that.spaceId)
+						console.warn("***checkIntersection-地板***",floor,index,spaceId,that.spaceId)
 						//当前拾取到的是本空间的底部-意味着用户点击了地板
 						if(floor && spaceId == that.spaceId){
-							// console.warn("***checkIntersection-地板***",mesh,floor)
 							moveCarmer(mesh.point);
 							return false;
 						}
@@ -392,7 +410,6 @@
 				}
 				let _x =  point.x - camera.position.x;//x轴移动的距离
 				let _z =  point.z - camera.position.z;//z轴移动的距离
-				// console.warn("***moveCarmer***",_x,_z)
 				let cameraNewPosition = {x:camera.position.x + _x,y:1.5,z:camera.position.z + _z};
 				let targetNewPosition = {x:controls.target.x + _x,y:1.5,z:controls.target.z + _z};
 				let oldUp = {x:0,y:1,z:0};	
@@ -456,7 +473,7 @@
 				let oldUp = {x:0,y:1,z:0};	//俯视
 				let newUp = {x:0,y:1,z:0};	//正视
 				// moveTip(cameraNewPosition);
-				console.warn("**moveActor***",JSON.stringify(cameraNewPosition),JSON.stringify(targetNewPosition))
+				// console.warn("**moveActor***",JSON.stringify(cameraNewPosition),JSON.stringify(targetNewPosition))
 				tweenCamera(camera.position,controls.target,cameraNewPosition,targetNewPosition,oldUp,newUp,2000);
 				lon = 0;
 				setTimeout(()=> {
@@ -519,15 +536,12 @@
 						z:(position.z - Math.cos(_hd)),
 					}
 					cube.position = position;
-					// cube.scale.set(2, 2, 2);
 					cube.userIndex = index;
 					cube.actorEum = index;
 					cube.targetNewPosition = targetNewPosition;
-					// cube.visible = false;
-					console.warn("*actors*",cube,defaulIndex)
+					// console.warn("*actors*",cube,defaulIndex)
 					that.actors.push(cube);//添加视角
 					if(index == defaulIndex){//隐藏当前视角
-						// cube.visible = false;
 						that.currentActor = cube;//记录下当前的视角对象 mesh网格模型
 						let param = {
 							type: 'CLK', //埋点类型
@@ -584,7 +598,6 @@
 					maxY = ((-spaceObj.centerY + (spaceObj.spaceHeight/2))/100 - 0.1);
 					minY = ((-spaceObj.centerY - (spaceObj.spaceHeight/2))/100 + 0.1);
 					//新的坐标轴不在房间范围内,则不能移动
-					// console.warn("**roamPositionHandle-观察点不在范围中****",JSON.stringify(cameraNewPosition),minX,maxX,minY,maxY)
 					if(cameraNewPosition.x<minX || cameraNewPosition.x>maxX
 					||cameraNewPosition.z<minY || cameraNewPosition.z>maxY){//不在房间范围
 						let _x = ((spaceObj.spaceWidth/2) - 15)*defaultActor.presentX + spaceObj.centerX;
@@ -689,7 +702,6 @@
 					// controls.target.y = object.y2;
 					// controls.target.z = object.z2;
 					// controls.update();
-					// console.warn("****onUpdate**",object.x1,object.y1,object.z1,object.x2,object.y2,object.z2)
 				}).onComplete(()=>{
 					controls.target.x = newT.x;
 					controls.target.y = newT.y;
@@ -721,36 +733,12 @@
 				}
                 TWEEN && TWEEN.update();
 				// stats.update();
-				//不处在动画过程中,则可以处理移动等动作
-				if(tweenCameraAnma==false){
-					
-				}
 				renderer.render(scene, camera);//单次渲染
 				requestId = requestAnimationFrame(render, canvas3d);
 				if (that.screenshotResolve) {
-					// if(that.isIos){//IOS手机
-						stopRender();
-						that.screenshotResolve()
-						that.screenshotResolve = null;//释放Promise
-					// }else{//安卓手机
-					// 	let gl = renderer.getContext();
-					// 	let frameBuffer = new THREE.Vector2();
-					// 	renderer.getDrawingBufferSize(frameBuffer);
-					// 	let pixelData = new Uint8Array(frameBuffer.x * frameBuffer.y * 4);
-					// 	//参考 Threejs WebGLRenderer.readRenderTargetPixels
-					// 	if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE) {
-					// 		gl.readPixels(0, 0, frameBuffer.x, frameBuffer.y, gl.RGBA, gl.UNSIGNED_BYTE, pixelData);
-					// 		// 确保有像素,微信小程序安卓在进入子页面返回本页面后,再一次readPixels稳定无像素
-					// 		if (pixelData.some(i => i !== 0)) {
-					// 			stopRender();
-					// 			console.warn("***screenshotResolve-pixelData***");
-					// 			that.screenshotResolve([pixelData, frameBuffer.x, frameBuffer.y])
-					// 			that.screenshotResolve = null;//释放Promise
-					// 			frameBuffer = null;//清空内存中的数据
-					// 			pixelData = null;//清空内存中的数据
-					// 		}
-					// 	}
-					// }
+					stopRender();
+					that.screenshotResolve()
+					that.screenshotResolve = null;//释放Promise
 				}
             }
 
@@ -768,9 +756,9 @@
 				handler(val) {
 					if (val) {
 						// setTimeout(()=> {
-						if(this.renderer){
-							this.setHouseDetail(val);
-						}
+						// if(this.renderer){
+						// 	this.setHouseDetail(val);
+						// }
 						// }, 1000);
 					}
 				},
@@ -867,7 +855,7 @@
                 }
 				let curSpaceArea = parseFloat((this.curSpaceObj.spaceWidth * this.curSpaceObj.spaceHeight) / 10000).toFixed(1);
 				this.navbar.title = this.curSpaceObj.spaceName + "  " + curSpaceArea + "㎡"
-                console.log("该户型空间数据:", this.spaceList);curSpaceArea
+                console.log("该户型空间数据:", this.spaceList);
                 console.log("当前选中的空间:", this.curSpaceObj);
 				this.positionCamer(this.curSpaceObj);
 				this.loaderSpaceArr(this.spaceList);//绘制地板
@@ -882,7 +870,7 @@
 				}else{
 					let data = {id:this.wallIds}
 					const res = await requestConfig('getHouseTypeSpaceWalls', data, true);
-					console.log("墙体数据:", res.list)
+					// console.log("墙体数据:", res.list)
 					if(res.success){
 					    wallList = this.wallList = res.list;
 					}

+ 1 - 0
src/static/globlShowModel.js

@@ -83,6 +83,7 @@ var globlShowModel = [
 	'BP_T_1PeopleBasin03',
 	'BP_AutoWall_51M',
 	'BP_G_grass01',
+	'BP_G_tree03',
 ];
 
 module.exports = globlShowModel;

+ 2 - 2
src/static/layoutModelData.js

@@ -97,7 +97,7 @@ var layoutModel = [
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_tree00.glb', name: '大树',modelName: 'BP_G_tree00', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_tree01.glb', name: '中树',modelName: 'BP_G_tree01', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_tree02.glb', name: '小树',modelName: 'BP_G_tree02', type:1},
-	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_tree02.glb', name: '最小树',modelName: 'BP_G_tree03', type:1},
+	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_tree03.glb', name: '最小树',modelName: 'BP_G_tree03', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_parterre01.gltf', name: '9格花坛',modelName: 'BP_G_parterre01', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_parterre03.gltf', name: '三角花坛',modelName: 'BP_G_parterre03', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_parterre04.gltf', name: '矩形花坛',modelName: 'BP_G_parterre04', type:1},
@@ -134,7 +134,7 @@ var layoutModel = [
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_D_DinningChiar01_30Degree.glb', name: '餐椅01_30度',modelName: 'BP_D_DinningChiar01_30Degree', type:1},
 	
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_D_LongDiningTable_240CM.glb', name: '2.4M长餐桌',modelName: 'BP_D_LongDiningTable_240CM', type:1},
-	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_D_DiningDecration01.glb', name: '桌面饰品01',modelName: 'BP_D_DiningDecoration01', type:1},
+	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_D_DiningDecoration01.glb', name: '桌面饰品01',modelName: 'BP_D_DiningDecoration01', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_D_DinningDecration03.glb', name: '餐桌装饰03',modelName: 'BP_D_DinningDecration03', type:1},
 	
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_D_DinningDecration02_30D.glb', name: '餐桌饰品02_30度',modelName: 'BP_D_DinningDecration02_30D', type:1},

+ 1 - 1
src/utils/util.js

@@ -225,7 +225,7 @@ var util = {
 			// return data;
 			// app.globalData.session_id = data.session
 			// app.globalData.sessionTime = timeNow;
-			// requestConfig('upload', data, true);
+			requestConfig('upload', data, true);
 			// let param = ["SEND" +
 			// 	"\nproject:" + "elab-marketing-system" + 
 			// 	"\nmethod:" + 'POST' +