Kaynağa Gözat

优化-户型查看页开始聚焦在户型中心

zjs_project 1 hafta önce
ebeveyn
işleme
823a2f7b78

+ 3 - 2
src/components/newBottomCom/viewShell/viewShell.vue

@@ -195,8 +195,9 @@
 					clkId: 'clk_2cmina_23080410', //点击ID
 					clkName: 'floorswitching_clk', //点击前往的页面名称
 					clkParams: {
-						locusName: "楼层切换",
-					}
+						locusValue: "切换到" + (this.floorIndex + 1) + '楼',
+					},
+                    behaviorName:"楼层切换",
 				};
 				util.trackRequest(param);
 				this.$emit("curHouseFloorChange", item);//通知页面,户型楼层发生了变更

+ 3 - 2
src/components/newQCCom/viewShell/viewShell.vue

@@ -183,8 +183,9 @@
 					clkId: 'clk_2cmina_23080410', //点击ID
 					clkName: 'floorswitching_clk', //点击前往的页面名称
 					clkParams: {
-						locusName: "楼层切换",
-					}
+						locusValue: "切换到" + (this.floorIndex + 1) + '楼',
+					},
+                    behaviorName:"楼层切换",
 				};
 				util.trackRequest(param);
 				this.$emit("curHouseFloorChange", this.floorList[index]);//通知页面,户型楼层发生了变更

+ 4 - 0
src/pages/webgl_rxdz_test_look/webgl_rxdz_test_look.html

@@ -14,4 +14,8 @@
 			{{floor.houseFloor?floor.houseFloor+'F':''}}
 		</div>
 	</div>
+    <!-- 定位视图 -->
+    <div class="location-view rows justify-center" @click.stop="locationHandle">
+        <span class="iconfont icon-pipei" style="color: #000;font-size: 44rpx;"></span>
+    </div>
 </div>

+ 10 - 0
src/pages/webgl_rxdz_test_look/webgl_rxdz_test_look.scss

@@ -57,4 +57,14 @@ canvas {
 .floor-item.active{
 	color: #faa040;
 	background: #fff;
+}
+.location-view{
+    position: absolute;
+    top: 100px;
+    right: 20px;
+    width: 80px;
+    height: 80px;
+    border-radius: 24px;
+    background: radial-gradient(50.00% 50.00% at 50.00% 50.00%, #fff 0%, #f7f7f7 67.98%, #fff 100%);
+    border: 2px solid #d6d6d6;
 }

+ 46 - 5
src/pages/webgl_rxdz_test_look/webgl_rxdz_test_look.vue

@@ -180,6 +180,7 @@
 			this.moveMeshCenterHandle = moveMeshCenterHandle;
 			this.cameraInit = cameraInit;
 			this.resetControl = resetControl;
+            this.movePositionHandle = movePositionHandle;
 			function init() {
 
                 scene.background = new THREE.Color("#FFFFFF");
@@ -301,6 +302,38 @@
 					updateLables();
 				}
 			}
+            //把摄像机移动到目标点位
+            function movePositionHandle(position = null, height=null){
+                that.showLables = false;//隐藏
+                controls.enable = false;//控制器不响应用户的操作
+            	let cameraNewPosition ={};
+            	let targetNewPosition ={};
+            	let oldUp = {};
+            	let newUp = {};
+                let cy = height ? height : camera.position.y;
+            	let _juli = cy * Math.tan(Math.PI / 8);
+            	cameraNewPosition = {
+            		x:position.x,
+            		y:cy, 
+            		z:position.z + _juli,//增加偏差,防止极点翻转问题?不知道为啥会有用
+            	}
+            	//新的观察点的位置-取模型的中心点坐标,加上高度,由于模型都是贴地的,所以高度设置为0
+            	targetNewPosition = {
+            		x:position.x,
+            		y:position.y, 
+            		z:position.z
+            	}
+            	oldUp = camera.up;//俯视状态
+            	newUp = camera.up;
+            	// console.warn("**movePositionHandle***",position,JSON.stringify(camera.position),JSON.stringify(controls.target)
+            	// ,cameraNewPosition,targetNewPosition,JSON.stringify(camera.up))
+            	tweenCamera(camera.position,controls.target,cameraNewPosition,targetNewPosition,oldUp,newUp,500);
+                setTimeout(()=>{
+                	that.showLables = true;
+                	updateLables();
+                	controls.enable = true;//控制器响应用户的操作
+                },511);//动画结束后回复原始状态
+            }
 			//把摄像机移动的选中模型的正上方,观察点也变更为模型中心点,同时选中模型
 			function moveMeshCenterHandle(mesh = null,noChangeColor = true){
 				if(mesh){//如果传入了模型,则取模型
@@ -602,12 +635,15 @@
 						if(element.wallList){
 							this.wallList.push(JSON.parse(element.wallList));
 						}
-						if(element.isSelected){ // 默认选中空间
-						    this.curSpaceObj = element;
-						}
+						// if(element.isSelected){ // 默认选中空间
+						//     this.curSpaceObj = element;
+						// }
+                        if(element.isSelected && element.spaceName && !element.isSizeLock && !this.curSpaceObj){ // 默认选中空间
+                            this.curSpaceObj = element;
+                        }
                     }
 					if(!this.curSpaceObj && this.spaceList.length > 0){
-					    this.curSpaceObj = this.spaceList[0];
+					    this.curSpaceObj = this.spaceList.find(it=>it.spaceName && !it.isSizeLock && (it.spaceHeightMax!=0 && it.spaceWidthMax!=0))
 					}
                 }
 				if(this.curHouseObj.layoutArea<=100){//面积小于100平米,则摄像头靠近一点
@@ -615,6 +651,7 @@
 				}else if(this.curHouseObj.layoutArea>100){
 					this.cameraStarPosition.y = 35;
 				}
+                this.allSpaceCenter = this.getAllSpaceCenter(this.spaceList);//获取所有空间的中心点
                 console.log("该户型空间数据:", this.spaceList);
 				console.log("当前选中的空间:", this.curSpaceObj);
 				this.cameraInit();
@@ -622,6 +659,9 @@
                 // 获取墙体数据并且绘制墙体
                 this.getHouseTypeSpaceWalls();
             },
+            locationHandle(){
+                this.movePositionHandle(this.allSpaceCenter,this.cameraStarPosition.y);//把摄像机移动到所有模型的中心点(水平面中心)
+            },
             // 获取墙体数据
             async getHouseTypeSpaceWalls(){
                 // let data = {id:this.wallIds}
@@ -685,7 +725,8 @@
 							this.myLoadingStatus = false;
 							// this.$refs.myLoading.hideLoading();
 							setTimeout(()=>{
-								this.moveMeshCenter(this.curSpaceObj);
+								// this.moveMeshCenter(this.curSpaceObj);
+                                this.movePositionHandle(this.allSpaceCenter);//把摄像机移动到所有模型的中心点(水平面中心)
 								this.addWordLabel(); // 添加文字标签
 							}, 610);
 						})

+ 1 - 1
src/pages/webgl_rxdz_text_customize/webgl_rxdz_text_customize.html

@@ -34,7 +34,7 @@
                     </div>
                     <div class="lookHouseView rows justify-center" v-else-if="layoutStruct.ueIds && layoutStruct.ueIds.length>0" @click="toUEDatail">
                     	<img class="icon-ai" src="https://dm.static.elab-plus.com/miniProgram/iconfont/icon-ai.png" mode="widthFix"/>
-                    	柔性定制
+                    	定制流程
                     </div>
                 </template>
             </template>