zjs_project 1 year ago
parent
commit
61f79c99b9

+ 4 - 0
src/components/newBottomCom/viewCareful/viewCareful.vue

@@ -127,6 +127,10 @@
 					}
 					// console.warn("***carefulList-change1***", it.area,it)
 				})
+				if(this.curSpaceId){
+					let index = this.carefulList.findIndex(it=>it.spaceId==this.curSpaceId);
+					this.selectIndex = index;
+				}
 				console.warn("***viewCareful-change***", this.carefulList)
 			},
 			updataData(spaceId,layoutObj){

+ 0 - 10
src/components/newBottomCom/viewMask/viewMask.vue

@@ -520,16 +520,6 @@
 					let list = res.list;
 					this.styleList = list;
 				}
-				if(!this.styleList || this.styleList.length==0){
-					// this.disableAble = true;//不能点击-没有风格
-					let unit = this.screenWidth / 750;//单位rpm 对应 px 的值
-					this.$parent.canvasHeight = this.screenHeight - (208 * unit);
-					this.$parent.camera.aspect = this.screenWidth / this.$parent.canvasHeight;
-					this.$parent.camera.updateProjectionMatrix();
-					this.$parent.renderer.setSize(this.screenWidth, this.$parent.canvasHeight);
-				}else{
-					// this.disableAble = false;//可以点击
-				}
 			},
 			//风格选择
 			selectStyle(idx){

+ 6 - 5
src/components/newBottomCom/viewPlot/viewPlot.vue

@@ -73,7 +73,7 @@
 		methods:{
 			//初始化数据
 			initData(){
-				console.warn("***initData***",this.spaceList)
+				console.warn("***initData***",this.curSpaceId,this.spaceList)
 				const spaceDetail = this.spaceList.find(it=>it.spaceId == this.curSpaceId);
 				this.selectSpace = spaceDetail;
 				if(spaceDetail.layouts){
@@ -112,13 +112,14 @@
 						data.dataList.push(item);
 					}
 					if(item.id==this.selectSpace.layoutId){
-						this.tabIndex = this.plotList.length - 1;
-						this.selectIndex = this.plotList[this.tabIndex].dataList.length - 1;
+						let index = this.plotList.findIndex(it=>it.type==item.type);
+						this.tabIndex = index;
+						this.selectIndex = this.plotList[this.tabIndex].dataList.findIndex(it=>it.id==this.selectSpace.layoutId);;
 						this.lastTabIndex = this.tabIndex;
 						this.unSelect = true;
 					}
 				});
-				console.warn("***viewPlot***", this.plotList)
+				console.warn("***viewPlot***", this.plotList,this.selectSpace,this.unSelect)
 			},
 			changeType(index){
 				this.tabIndex=index;
@@ -131,7 +132,7 @@
 				}
 			},
 			//切换选项
-			changeOption(id) {
+			changeOption(item,id) {
 				if (id == this.selectIndex) {
 					return false;
 				}

+ 6 - 1
src/components/newBottomCom/viewlayout/viewlayout.vue

@@ -207,8 +207,13 @@
 			//打开布局
 			openLayout(style) {
 				console.warn("***openLayout***",style)
+				let space = this.spaceList.find(it=>it.spaceId==this.curSpaceId);
+				if(space && space.spaceType==15){//X空间
+					this.showX = true;
+				}else{
+					this.showX = false;
+				}
 				if(style==3){
-					let space = this.spaceList.find(it=>it.spaceId==this.curSpaceId);
 					if(this.showX){//X空间
 						this.$emit("changeStyle",style);
 					}else{

+ 5 - 1
src/components/newQCCom/viewCareful/viewCareful.vue

@@ -127,7 +127,11 @@
 					}
 					// console.warn("***carefulList-change1***", it.area,it)
 				})
-				console.warn("***viewCareful-change***", this.carefulList)
+				if(this.curSpaceId){
+					let index = this.carefulList.findIndex(it=>it.spaceId==this.curSpaceId);
+					this.selectIndex = index;
+				}
+				console.warn("***viewCareful-change***", this.carefulList,this.curSpaceId)
 			},
 			updataData(spaceId,layoutObj){
 				let lable = this.carefulList.find(it=>it.spaceId == spaceId);

+ 0 - 10
src/components/newQCCom/viewMask/viewMask.vue

@@ -520,16 +520,6 @@
 					let list = res.list;
 					this.styleList = list;
 				}
-				if(!this.styleList || this.styleList.length==0){
-					// this.disableAble = true;//不能点击-没有风格
-					let unit = this.screenWidth / 750;//单位rpm 对应 px 的值
-					this.$parent.canvasHeight = this.screenHeight - (208 * unit);
-					this.$parent.camera.aspect = this.screenWidth / this.$parent.canvasHeight;
-					this.$parent.camera.updateProjectionMatrix();
-					this.$parent.renderer.setSize(this.screenWidth, this.$parent.canvasHeight);
-				}else{
-					// this.disableAble = false;//可以点击
-				}
 			},
 			//风格选择
 			selectStyle(idx){

+ 5 - 4
src/components/newQCCom/viewPlot/viewPlot.vue

@@ -71,7 +71,7 @@
 			//初始化数据
 			initData(){
 				// var currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null;
-				console.warn("***initData***",this.spaceList)
+				console.warn("***initData***",this.curSpaceId,this.spaceList)
 				const spaceDetail = this.spaceList.find(it=>it.spaceId == this.curSpaceId);
 				this.selectSpace = spaceDetail;
 				if(spaceDetail.layouts){
@@ -110,13 +110,14 @@
 						data.dataList.push(item);
 					}
 					if(item.id==this.selectSpace.layoutId){
-						this.tabIndex = this.plotList.length - 1;
-						this.selectIndex = this.plotList[this.tabIndex].dataList.length - 1;
+						let index = this.plotList.findIndex(it=>it.type==item.type);
+						this.tabIndex = index;
+						this.selectIndex = this.plotList[this.tabIndex].dataList.findIndex(it=>it.id==this.selectSpace.layoutId);;
 						this.lastTabIndex = this.tabIndex;
 						this.unSelect = true;
 					}
 				});
-				console.warn("***viewPlot***", this.plotList)
+				console.warn("***viewPlot***", this.plotList,this.selectSpace,this.unSelect)
 			},
 			changeType(index){
 				this.tabIndex=index;

+ 7 - 2
src/components/newQCCom/viewlayout/viewlayout.vue

@@ -203,9 +203,14 @@
 			},
 			//打开布局
 			openLayout(style) {
-				console.warn("***openLayout***",style)
+				console.warn("***openLayout***",style,this.curSpaceId)
+				let space = this.spaceList.find(it=>it.spaceId==this.curSpaceId);
+				if(space && space.spaceType==15){//X空间
+					this.showX = true;
+				}else{
+					this.showX = false;
+				}
 				if(style==3){
-					let space = this.spaceList.find(it=>it.spaceId==this.curSpaceId);
 					if(this.showX){//X空间
 						this.$emit("changeStyle",style);
 					}else{

+ 76 - 24
src/mixins/loadModel.js

@@ -146,6 +146,73 @@ export default {
 			this.furnHandle(list,spaceList)
 			this.changeSpaces = []
 		},
+		//加载单个空间的家具模型
+		furnSingleSpaceHandle(space){
+			let arrFrunList = this.arrFrunList;
+			// let space = this.curSpaceObj;
+			let allowSpaceId = [space.spaceId];
+			if(!arrFrunList || arrFrunList.length == 0){
+				return
+			}
+			this.clearAllLayoutData();//清空家具模型
+			this.promise_list = [];
+			this.gltfLayouts = []; //模型列表,所有空间里面的每个模型(家具)对应一条记录
+			
+			let startTime = new Date().getTime();
+			let tmpList = [];//临时数据-精简模型数据
+			let curSpaceList = [];//当前空间的数据对象
+			console.warn("重新加载布局", arrFrunList,this.gltfLayouts,allowSpaceId);
+			//每个空间都处理下,确保空间不遗漏,arrFrunList遍历,如果不同空间使用同一个布局,会出现只处理第一个空间
+			let spaceId = space.spaceId;
+			let signel = arrFrunList.find(it => it.id == space.layoutId);
+			if(signel){//只加载允许的空间的布局,其他不加载
+				let md = JSON.parse(signel.modelJson); //获取布局里面的模型信息
+				//遍历模型信息,获取模型列表
+				for (let i = 0; i < md.modelData.length; i++) {
+					let item = md.modelData[i];
+					item.spaceId = spaceId;
+					item.layoutId = signel.id;
+					item.h5Id = signel.id+""+item.id;//唯一标识
+					if(item.modelName=='BP_furnitureBase_C'){
+						continue;
+					}else{
+						if(spaceId==this.curSpaceObj.spaceId){
+							curSpaceList.push(item);
+						}else{
+							tmpList.push(item);
+						}
+					}
+				}
+			}
+			this.realList = []
+			this.tmpList = tmpList;
+			this.fliterList(tmpList);//精简模式下,只计算白名单里面的模型位置等信息
+			console.warn("***fliterList***",this.type,this.realList.length);
+			tmpList = this.realList;
+			tmpList = tmpList.concat(curSpaceList);//合并详细空间的模型
+			
+			let realFurArr = this.preFurnitureData(tmpList);//统一处理家具模型
+			this.calculateLayoutModelSize() // 提前计算模型的位置
+			tmpList = [];
+			this.realList = [];
+			this.tmpList = []
+			console.log("***realFurArr***", realFurArr,this.gltfLayouts);
+			realFurArr && realFurArr.forEach((item,index) => {
+				this.loadLayFlag = true;
+				this.promise_list.push(
+					new Promise((resolve, reject) => {
+						this.loadLayoutModels(item, resolve);
+					})
+				)
+			});
+			Promise.all(this.promise_list).then(() => {
+				let endTime = new Date().getTime();
+				this.loadLayFlag = false;
+				realFurArr = [];
+				console.log("家具模型全部加载完成,时间:", endTime - startTime, this.gltfLayouts);
+				this.loadLastSpaceModel();//加载剩余空间的家具模型
+			})
+		},
 		//拆分家具模型加载逻辑
 		furnHandle(arrFrunList, tmpSpaceList=[]){
 			if(!arrFrunList || arrFrunList.length == 0){
@@ -201,28 +268,6 @@ export default {
 					}
 				}
 			});
-			// 处理删除模型时,其他空间引用了该模型时的重新载入处理
-			// if(this.lastFrunList && this.lastFrunList.length>0){
-			// 	let spaceIds = tmpSpaceList.map(it=>it.spaceId);
-			// 	this.arrFrunList.forEach(signel => {
-			// 		let spaceId = this.spaceList.find(it => it.layoutId == signel.id).spaceId;
-			// 		let md = JSON.parse(signel.modelJson); //获取布局里面的模型信息
-			// 		//遍历模型信息,获取模型列表
-			// 		for (let i = 0; i < md.modelData.length; i++) {
-			// 			let item = md.modelData[i];
-			// 			if(this.lastFrunList.includes(item.modelName) && !spaceIds.includes(spaceId)){
-			// 				item.spaceId = spaceId;
-			// 				item.layoutId = signel.id;
-			// 				item.h5Id = signel.id+""+item.id;//唯一标识
-			// 				if(!tmpList.find(it=>it.h5Id==item.h5Id)){
-			// 					// tmpList.push(item);
-			// 					console.warn("***布局xxxx***", item, signel.id)
-			// 				}
-			// 			}
-			// 		}
-			// 	})
-			// 	this.lastFrunList = [];
-			// }
 			this.tmpList = tmpList;
 			if(this.type==2){//全局精简模型;需要的是所有空间的模型
 				this.fliterList(tmpList);//精简模式下,只计算白名单里面的模型位置等信息
@@ -1000,7 +1045,7 @@ export default {
 			
 			}
 			// console.log("模型计算位置--", positionX, positionY)
-			console.log("模型计算位置", cubeInfo, centerX, centerY, spaceWidth, spaceHeight, modelWidth, modelHeight, spaceId, scaleX, scaleY, positionX, positionY, cubeInfo.modelName)
+			// console.log("模型计算位置", cubeInfo, centerX, centerY, spaceWidth, spaceHeight, modelWidth, modelHeight, spaceId, scaleX, scaleY, positionX, positionY, cubeInfo.modelName)
 			let oldPosition = new THREE.Vector3();//当前几何体的位置参数
 			oldPosition.copy(cube.position);
 			let oldScale = new THREE.Vector3();//当前几何体的位置参数
@@ -1335,7 +1380,14 @@ export default {
 			const element = this.spaceList.find(it=>it.spaceId == spaceObj.spaceId);
 			if(element){
 				this.deleteLayoutModel(element, layoutObj)
-				element.layoutId = layoutObj.id
+				element.layoutId = layoutObj.id;
+				if(element.spaceType==15){
+					element.layoutSpaceType = layoutObj.type;//更新布局信息到空间对象里面
+					element.layoutSpaceName = layoutObj.spacexName || layoutObj.name;//更新布局信息到空间对象里面
+					if(this.updataLable && typeof(this.updataLable)=='function'){
+						this.updataLable(element.spaceId,layoutObj);
+					}
+				}
 				console.log("替换空间的布局ID", spaceObj.spaceId, layoutObj.id);
 			}
 			this.changeLayouts.push(layoutObj)

+ 6 - 0
src/pages/webgl_rxdz/webgl_rxdz.vue

@@ -917,10 +917,16 @@
 			},
 			curSpaceSelect(data){
 				console.warn("***curSpaceSelect***",data);
+				if(this.selectSpace){
+					this.changeSpaceColor(this.selectSpace.spaceId,2);//取消上一个空间的颜色
+				}
 				let spaceId = data.spaceId;
 				let space = this.spaceList.find(it=>it.spaceId==spaceId);
+				this.selectSpace = space;
 				this.currentChangeSpaceId = spaceId;
 				this.$store.state.curSpaceId = data.spaceId;
+				
+				this.changeSpaceColor(data.spaceId,1);//设置选中空间的颜色
 				this.moveMeshCenter(space);
 			},
 			//具体空间面积变化-拖动产生的

+ 1 - 1
src/pages/webgl_rxdz_customize/webgl_rxdz_customize.vue

@@ -66,7 +66,7 @@ export default {
         const that = this;
         this.houseId = this.$route.query.houseId?this.$route.query.houseId:'';
         // this.spaceId = this.$route.query.spaceId?this.$route.query.spaceId:'';
-        this.id = this.$route.query.id?this.$route.query.id:'6523d91af65c626211ee21c8';
+        this.id = this.$route.query.id?this.$route.query.id:'';
 		if(!this.id){
 			this.showToast("没有数据!");
 			return false;

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

@@ -6,7 +6,7 @@
 	import Stats from 'three/addons/libs/stats.module.js';
 	import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 	import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
-	
+	import spaceTypes from '@/static/spaceTypesIE.js';
 	import TWEEN from 'three/addons/libs/tween.module.js';
 
 	var requestId = "";
@@ -541,9 +541,17 @@
 				this.gltfSpaces.forEach((cube,index) =>{
 					// 给地板加上空间类型标注, 空间为链接空间的不显示
 					if(cube.spaceName && !cube.isSizeLock){
+						let name = spaceTypes[cube.spaceType - 1];
+						if(cube.spaceType==15){			//更改空间显示名称 X空间 类型 根据布局所属类型来显示
+							let layoutId = this.spaceList.find(it => it.spaceId == cube.spaceId).layoutId;
+							let layout = this.arrFrunList.find(it=>it.id == layoutId);
+							if(layout){
+								name = spaceTypes[layout.type - 1];
+							}
+						}
 						this.lableItem.push(
 							{
-								text:cube.spaceName,
+								text:name,
 								spaceId:cube.spaceId,
 								transform:'',
 								cubeIndex:index,

+ 4 - 1
src/pages/webgl_rxdz_roam/webgl_rxdz_roam.vue

@@ -653,7 +653,7 @@
 				let data = roamPositionHandle();
 				let cameraNewPosition = data.cameraNewPosition;
 				let targetNewPosition = data.targetNewPosition;
-				targetNewPosition.z = targetNewPosition.z + 0.5;//增加偏差,防止极点翻转问题?不知道为啥会有用
+				targetNewPosition.z = targetNewPosition.z;//增加偏差,防止极点翻转问题?不知道为啥会有用
 				let lookPosition = data.lookPosition;
 				creatMoveTip(cameraNewPosition);//创建移动的地标
 				if(needAni){
@@ -869,6 +869,9 @@
 				}
 				this.spaceId = spaceId;
 				this.curSpaceObj = this.spaceList.find(it=>it.spaceId == spaceId);
+				if(this.isIOS){
+					this.furnSingleSpaceHandle(this.curSpaceObj);
+				}
 				this.positionCamer(this.curSpaceObj,true);
 				let curSpaceArea = parseFloat((this.curSpaceObj.spaceWidth * this.curSpaceObj.spaceHeight) / 10000).toFixed(1);
 				this.navbar.title = this.curSpaceObj.spaceName + "  " + curSpaceArea + "㎡";

+ 6 - 0
src/pages/webgl_rxdz_test/webgl_rxdz_test.vue

@@ -804,10 +804,16 @@
 			},
 			curSpaceSelect(data){
 				console.warn("***curSpaceSelect***",data);
+				if(this.selectSpace){
+					this.changeSpaceColor(this.selectSpace.spaceId,2);//取消上一个空间的颜色
+				}
 				let spaceId = data.spaceId;
 				let space = this.spaceList.find(it=>it.spaceId==spaceId);
+				this.selectSpace = space;
 				this.currentChangeSpaceId = spaceId;
 				this.$store.state.curSpaceId = data.spaceId;
+				
+				this.changeSpaceColor(data.spaceId,1);//设置选中空间的颜色
 				this.moveMeshCenter(space);
 			},
 			//具体空间面积变化-拖动产生的

+ 26 - 2
src/pages/webgl_rxdz_test_env/webgl_rxdz_test_env.vue

@@ -13,6 +13,7 @@
 	import {
 		Toast
 	} from 'mint-ui';
+	import { MessageBox } from 'mint-ui';
 	import touchHandle from '@/mixins/touchHandle.js';
 	// import createImgHandle from '@/mixins/createImgHandle.js';
 	import commonPageMethod from '@/mixins/commonPageMethod.js';
@@ -374,8 +375,31 @@
 				if(this.queryObj && this.queryObj.id1 && this.queryObj.id2 && this.queryObj.id3){
 					this.resultDataHandle();
 				}else{
-					Toast({
-						message: '谢谢参与',
+					// Toast({
+					// 	message: '谢谢参与',
+					// });
+					MessageBox.confirm('',{
+						title: '提示',
+						message: '感谢您的参与',
+						showCancelButton: true,
+						confirmButtonText:'返回首页',
+						cancelButtonText:'确认',
+					}).then(action => {
+						console.warn("***MessageBox-action***",action)
+						if(action == 'confirm'){
+							if(window.__wxjs_environment === 'miniprogram'){
+								this.pvCloseHandle();//小程序跳转会主动杀死关闭当前页面-不经过vue跳转关闭逻辑-所以需要主动触发关闭埋点
+								wx.miniProgram.redirectTo({url: '/pages/index/index?houseId='+this.houseId})
+							}else{
+								// this.$message.warning("敬请期待");
+								// this.showPop();
+							}
+						}
+					}).catch(err=>{
+						console.warn("***MessageBox-err***",err)
+						if(err == 'cancel'){
+							// self.cancelHandle();
+						}
 					});
 				}
 				// console.log("进入订制户型: ", this.curHouseObj);

+ 4 - 1
src/pages/webgl_rxdz_test_roam/webgl_rxdz_test_roam.vue

@@ -651,7 +651,7 @@
 				let data = roamPositionHandle();
 				let cameraNewPosition = data.cameraNewPosition;
 				let targetNewPosition = data.targetNewPosition;
-				targetNewPosition.z = targetNewPosition.z + 0.5;//增加偏差,防止极点翻转问题?不知道为啥会有用
+				targetNewPosition.z = targetNewPosition.z;//增加偏差,防止极点翻转问题?不知道为啥会有用
 				let lookPosition = data.lookPosition;
 				creatMoveTip(cameraNewPosition);//创建移动的地标
 				if(needAni){
@@ -868,6 +868,9 @@
 				}
 				this.spaceId = spaceId;
 				this.curSpaceObj = this.spaceList.find(it=>it.spaceId == spaceId);
+				if(this.isIOS){
+					this.furnSingleSpaceHandle(this.curSpaceObj);
+				}
 				this.positionCamer(this.curSpaceObj,true);
 				let curSpaceArea = parseFloat((this.curSpaceObj.spaceWidth * this.curSpaceObj.spaceHeight) / 10000).toFixed(1);
 				this.navbar.title = this.curSpaceObj.spaceName + "  " + curSpaceArea + "㎡";