Kaynağa Gözat

优化交互&修复双指平移问题等

zjs_project 1 yıl önce
ebeveyn
işleme
6b3bdb8395

Dosya farkı çok büyük olduğundan ihmal edildi
+ 2 - 0
src/assets/jquery-3.7.1.min.js


+ 6 - 17
src/components/newBottomCom/viewCareful/viewCareful.vue

@@ -77,6 +77,9 @@
 					}
 					//修改为显示空间类型名称
 					let text = spaceTypes[item.spaceType - 1] || item.spaceName;
+					if(item.spaceType==15 && item.layoutSpaceType){
+						text = spaceTypes[item.layoutSpaceType - 1]; 
+					}
 					if(item.spaceName && !item.isSizeLock){//楼梯不显示
 						let curSpaceArea = Number(parseFloat(
 							(item.spaceWidth * item.spaceHeight) / 10000
@@ -148,25 +151,11 @@
 					clkId: 'clk_2cmina_23080405', //点击ID
 					clkName: 'zoomin_clk', //点击前往的页面名称
 					clkParams: {
-						locusName: "精细调整放大",
-						spaceId:item.spaceId,
-						area:Math.abs(_area),
-						isZoomIn:_area>0?true:false,
+						locusName: this.curHouseObj.houseType + "·" + this.curHouseObj.houseArea,
+						locusValue:this.carefulList[index].name + "面积由" + parseFloat(item.area).toFixed(1)
+						+ "㎡调整为"+ value + "㎡",
 					}
 				};
-				if(_area<0){//缩小
-					param = {
-						type: 'CLK', //埋点类型
-						clkId: 'clk_2cmina_23080406', //点击ID
-						clkName: 'zoomout_clk', //点击前往的页面名称
-						clkParams: {
-							locusName: "精细调整缩小",
-							spaceId:item.spaceId,
-							area:Math.abs(_area),
-							isZoomIn:_area>0?true:false,
-						}
-					};
-				}
 				util.trackRequest(param);
 				console.log("发送消息-空间变化: ",data, JSON.stringify(item));
 				// this.selectItem = item;

+ 1 - 1
src/components/newBottomCom/viewPlot/viewPlot.scss

@@ -54,7 +54,7 @@
 		&.tabActive{
 			border-color: #ffbd3e;
 			background: rgba(253, 191, 71, 0.08);
-			box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
+			// box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
 		}
 		&:first-child{
 			margin-left: 0px;

+ 21 - 10
src/components/newBottomCom/viewPlot/viewPlot.vue

@@ -8,6 +8,9 @@
 	import {
 		Toast
 	} from 'mint-ui';
+	import {
+		getStorage,
+	} from '@/utils/localStorage';
 	// import Bus from '@/common/bus';
 	// import commonMethod from '@/common/commonMethod.js';
 	// import requestConfig from '@/static/lib/requestConfig';
@@ -20,7 +23,9 @@
 				selectItem:null,
 				selectIndex:0,
 				tabIndex:0,
+				lastTabIndex:0,
 				plotList:[],//布局数据
+				curHouseObj:null,
 			}
 		},
 		props:{
@@ -50,6 +55,7 @@
 		},
 		mixins: [],
 		async mounted() {//组件挂载时事件
+			this.curHouseObj = JSON.parse(getStorage('curHouseObj'));
 			// this.initData();
 			// var currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null;
 			// this.$parent.$parent.updateCareFul = this.initData;//页面注册变更方法
@@ -104,6 +110,7 @@
 					if(item.id==this.selectSpace.layoutId){
 						this.tabIndex = this.plotList.length - 1;
 						this.selectIndex = this.plotList[this.tabIndex].dataList.length - 1;
+						this.lastTabIndex = this.tabIndex;
 					}
 				});
 				console.warn("***viewPlot***", this.plotList)
@@ -120,16 +127,6 @@
 				// 	this.$refs.carousel.setActiveItem(this.currImgIdx);
 				// }
 				console.warn("***changeOption***", this.plotList,this.selectIndex)
-				let param = {
-					type: 'CLK', //埋点类型
-					clkId: 'clk_2cmina_24012302', //点击ID
-					clkName: 'option_clk', //点击前往的页面名称
-					clkParams: {
-						type: this.plotList[this.tabIndex].dataList[this.selectIndex].name,
-						locusName: "选项选择",
-					}
-				};
-				util.trackRequest(param);
 			},
 			closeHandle(){
 				this.$parent.rebackLast();//告知页面,关闭当前弹窗
@@ -154,7 +151,21 @@
 					});
 					return false
 				}
+				let typeName = this.plotList[this.lastTabIndex].name;
+				let newTypeName = this.plotList[this.tabIndex].name;
+				let optionName = this.plotList[this.tabIndex].dataList[this.selectIndex].name;
+				let param = {
+					type: 'CLK', //埋点类型
+					clkId: 'clk_2cmina_24012302', //点击ID
+					clkName: 'option_clk', //点击前往的页面名称
+					clkParams: {
+						locusName: this.curHouseObj.houseType + "·" + this.curHouseObj.houseArea,
+						locusValue: typeName + "调整为" + newTypeName + "-" + optionName,
+					}
+				};
+				util.trackRequest(param);
 				this.$parent.$parent.userSelectPlot(plot);//告知页面,用户选择的布局id
+				this.lastTabIndex = this.tabIndex;
 			},
 			//去往详情页面
 			goRoam(){

+ 1 - 1
src/components/newBottomCom/viewShell/viewShell.vue

@@ -258,7 +258,7 @@
 					if(window.__wxjs_environment === 'miniprogram'){
 						wx.miniProgram.navigateTo({url: '/pages/transfer/transfer?event=openCustomerServiceChat&houseId='+this.$store.state.houseId})
 					}else{
-						this.$message.warning("敬请期待");
+						// this.$message.warning("敬请期待");
 					}
 				}
 			},

+ 2 - 1
src/main.js

@@ -5,7 +5,8 @@ import api from '@/services/urlConfig.js'; //导入请求的环境地址配置
 import router from '@/router';
 import ElementUI from 'element-ui';
 import 'element-ui/lib/theme-chalk/index.css'; //导入ele-ui 的样式
-import $ from 'jquery'; //引入JQuery
+// import $ from 'jquery'; //引入JQuery
+import $ from '@/assets/jquery-3.7.1.min'; //引入JQuery
 import axios from '@/services/request.js'; //重新定义axios,向里面添加一些参数
 import '@/services/requestConfig.js'; //导入请求的拦截器
 // import '@/utils/rem.js'; //rem单位的使用

+ 12 - 5
src/pages/webgl_rxdz_look/webgl_rxdz_look.vue

@@ -58,7 +58,7 @@
                 controls:null,
 				curHouseObj: null,
 				controlStarPosition : { x:0, y:0, z:0},	//控制器初始位置
-				cameraStarPosition : { x:0, y:20, z:0}	,//摄像头初始位置
+				cameraStarPosition : { x:0, y:30, z:0}	,//摄像头初始位置
 				// cameraLastPosition: null,		//摄像头上一次移动到的位置
 				// controlLastPosition: null,		//观察点上一次移动到的位置
 				canvasHeight:430,	//canvas视图的高度-计算得出
@@ -235,11 +235,11 @@
 				// controls.target = new THREE.Vector3( that.controlStarPosition.x, that.controlStarPosition.y, that.controlStarPosition.z );;
                 
 				controls = new OrbitControls(camera, renderer.domElement);
-				controls.screenSpacePanning = true;
+				controls.screenSpacePanning = false;
 				controls.enableDamping = true;
 				controls.minDistance = 1;
 				controls.maxDistance = 400;
-				controls.minPolarAngle = 0;// 默认0
+				controls.minPolarAngle = Math.PI / 8;// 默认0
 				controls.maxPolarAngle = Math.PI / 2; // 默认Math.PI,即可以向下旋转到的视角。
 				controls.target.set(that.controlStarPosition.x, that.controlStarPosition.y, that.controlStarPosition.z);
 				controls.enableZoom = true;//启用摄像机的缩放
@@ -327,10 +327,11 @@
 				let oldUp = {};
 				let newUp = {};
 				if (isUserContorl === false) { // 非漫游状态
+					let _juli = camera.position.y * Math.tan(Math.PI / 8);
 					cameraNewPosition = {
 						x:spaceObj.centerX/100,
 						y:camera.position.y, 
-						z:-spaceObj.centerY/100,
+						z:-spaceObj.centerY/100 + _juli,
 					}
 					//新的观察点的位置-取模型的中心点坐标,加上高度,由于模型都是贴地的,所以高度设置为0
 					targetNewPosition = {
@@ -609,8 +610,14 @@
 					    this.curSpaceObj = this.spaceList[0];
 					}
                 }
+				if(this.curHouseObj.layoutArea<=100){//面积小于100平米,则摄像头靠近一点
+					this.cameraStarPosition.y = 25;
+				}else if(this.curHouseObj.layoutArea>100){
+					this.cameraStarPosition.y = 35;
+				}
                 console.log("该户型空间数据:", this.spaceList);
 				console.log("当前选中的空间:", this.curSpaceObj);
+				this.cameraInit();
 				this.loaderSpaceArr(this.spaceList);
                 // 获取墙体数据并且绘制墙体
                 this.getHouseTypeSpaceWalls();
@@ -671,7 +678,6 @@
 					let endTime = new Date().getTime();
 					console.log("模型全部加载完成,时间:",endTime - startTime);
 					this.$nextTick(()=>{
-						this.moveMeshCenter(this.curSpaceObj);
 						this.progress = 100;
 						// this.$refs.myLoading.showLoading("加载中..." + this.progress + '%')
 						this.$store.state.loadingMsg="加载中..." + this.progress + '%';
@@ -679,6 +685,7 @@
 							this.myLoadingStatus = false;
 							// this.$refs.myLoading.hideLoading();
 							setTimeout(()=>{
+								this.moveMeshCenter(this.curSpaceObj);
 								this.addWordLabel(); // 添加文字标签
 							}, 610);
 						})

+ 24 - 40
src/pages/webgl_rxdz_test/webgl_rxdz_test.vue

@@ -350,9 +350,9 @@
 			}
 			function attendEvent () {
 				window.addEventListener('resize', onWindowResize);
-				renderer.domElement.addEventListener('touchstart', onPointerStart, false);
-				renderer.domElement.addEventListener('touchmove', onPointerMove, false);
-				renderer.domElement.addEventListener('touchend', onPointerUp, false);
+				// renderer.domElement.addEventListener('touchstart', onPointerStart, false);
+				// renderer.domElement.addEventListener('touchmove', onPointerMove, false);
+				// renderer.domElement.addEventListener('touchend', onPointerUp, false);
 			}
 			function tweenCameraAnmaChange (value) {
 				tweenCameraAnma = value
@@ -363,9 +363,9 @@
 			//取消事件监听-避免二次进入时触发多次事件
 			function clearEvent(){
 				console.warn("**clearEvent****")
-				renderer && renderer.domElement && renderer.domElement.removeEventListener('touchstart', onPointerStart);
-				renderer && renderer.domElement && renderer.domElement.removeEventListener('touchmove', onPointerMove );
-				renderer && renderer.domElement && renderer.domElement.removeEventListener('touchend', onPointerUp );
+				// renderer && renderer.domElement && renderer.domElement.removeEventListener('touchstart', onPointerStart);
+				// renderer && renderer.domElement && renderer.domElement.removeEventListener('touchmove', onPointerMove );
+				// renderer && renderer.domElement && renderer.domElement.removeEventListener('touchend', onPointerUp );
 			}
 			// 手指移动开始
 			function onPointerStart(event){
@@ -522,6 +522,7 @@
 
 				// that.showLables = false;
 				// let canvas_webgl = document.getElementById('canvas_webgl');
+				console.log("相机变化1:", camera.position.y);
 				var tween = new TWEEN.Tween({
 				    h1: _jisua,
 				})
@@ -537,12 +538,20 @@
 						camera.top  = frustumSize / 2;
 						camera.bottom  = frustumSize / -2;
 						camera.updateProjectionMatrix();
-						// that.canvasHeight = object.h1;
 					}
 					else if(camera.isPerspectiveCamera){//透视相机
 						camera.aspect = screenWidth / object.h1;
 						camera.updateProjectionMatrix();
 						renderer.setSize( screenWidth, object.h1 );
+						let step = 0.12;//每次缩放放大的尺度
+						let _juli = step * Math.tan(Math.PI / 8);//由于观测点和相机存在角度,所以要计算每次变化尺度产生的Z轴变化量
+						if(_height>0){
+							camera.position.y = camera.position.y + step;
+							camera.position.z = camera.position.z + _juli;
+						}else{
+							camera.position.y = camera.position.y - step;
+							camera.position.z = camera.position.z - _juli;
+						}
 						// that.canvasHeight = object.h1;
 					}
 				}).onComplete(()=>{
@@ -550,6 +559,7 @@
 					camera.updateProjectionMatrix();
 					renderer.setSize(screenWidth, that.canvasHeight );
 					tweenCameraAnma = false;
+					console.log("相机变化2:", camera.position.y);
 					// that.showLables = true;
 					// updateLables();//更新lable
 				});
@@ -1556,37 +1566,6 @@
 				this.currentChangeSpaceId = null;//变化结束后
 				console.warn("***curLayoutStruct-updataPageData***",this.changeArea,this.sumArea,this.curHouseFloor,this.curHouseObj)
 			},
-			// //户型大类发生了变更
-			// curHouseTypeChange(item){
-			// 	this.curHouseType = item.spaceStructure;//当前选中的户型类型-传递给子组件触发具体的户型数据选取
-			// 	this.curHouseName = item.spaceName;//当前选中的户型类型名称
-			// 	//获取当前户型大类下的所有户型信息-用于用户提交
-			// 	this.curLayoutStruct = this.houseList.find(it=>it.spaceStructure == this.curHouseType).layoutStruct;
-			// 	this.curLayoutStruct.forEach(it=>{
-			// 		this.layoutArea += it.houseArea
-			// 	})
-			// 	console.warn("***curLayoutStruct***",this.curLayoutStruct)
-			// },
-			// //户型楼层发生了变更
-			// curHouseFloorChange(item){
-			// 	let that = this;
-			// 	this.curHouseFloor = item.houseFloor;//当前选中的户型楼层
-			// 	this.curHouseObj = item;//更新当前具体的户型数据
-			// 	this.id = this.curHouseObj.id;
-			// 	// 遍历场景中的所有子对象,找到类型为Mesh的对象并移除
-			// 	let deleList = that.scene && that.scene.children.filter(object=>{
-			// 		if(object.userType=="mesh" || object.userType=="layoutMesh"){
-			// 			return object
-			// 		}
-			// 	})
-			// 	// console.warn("***deleList***",deleList)
-			// 	if(deleList && deleList.length>0){
-			// 		that.showLables = false;//隐藏lable
-			// 		that.scene.remove(...deleList);
-			// 	}
-			// 	this.houseInit()
-				
-			// },
 			//当前户型初始化
 			houseInit(item){
 				this.gltfWalls = [];
@@ -1599,8 +1578,7 @@
 				this.instancedFurList = [];
 				this.wallList = [];
 				this.changeArea = 0;
-				//恢复初始视角
-				this.cameraInit();
+				// this.cameraInit();
 				this.resetControl();
 				setTimeout(()=>{
 					this.loadSpace();
@@ -1612,6 +1590,12 @@
 				this.sumArea = this.curHouseObj.houseArea;
 				this.fixedArea = this.curHouseObj.houseArea;
 				this.curHouseName = this.curHouseObj.name;
+				if(this.curHouseObj.houseArea<=100){//面积小于100平米,则摄像头靠近一点
+					this.cameraStarPosition.y = 20;
+				}else if(this.curHouseObj.houseArea>100){
+					this.cameraStarPosition.y = 30;
+				}
+				this.cameraInit();
 			},
 			// async getInitData(){
 			// 	let parmas = {

+ 24 - 8
src/pages/webgl_rxdz_text_customize/webgl_rxdz_text_customize.vue

@@ -72,6 +72,7 @@ export default {
 			verifyText:'',	//验证码提示
 			isSend:false,
 			showPopup:false,
+			isIOS:false,
 		}
     },
     /**
@@ -83,6 +84,8 @@ export default {
         this.houseId = this.$route.query.houseId?this.$route.query.houseId:'';
         this.id = this.$route.query.id?this.$route.query.id:'';
 		this.typeStatus = this.$route.query.typeStatus?this.$route.query.typeStatus:0;
+		let isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
+		this.isIOS = isIOS;
 		if(!this.id){
 			Toast({
 				message: '没有数据!',
@@ -274,7 +277,7 @@ export default {
 				this.showPop();
 			}
 		},
-		share(){
+		async share(){
 			if(window.__wxjs_environment === 'miniprogram'){
 				// Toast({
 				// 	message: '请点击右上角发起分享',
@@ -291,13 +294,26 @@ export default {
 				} else {
 					url = webUrl;
 				}
-				var textArea = document.createElement("textarea");
-				console.warn("***复制***",url)
-				textArea.value = url;
-				document.body.appendChild(textArea);
-				textArea.select();
-				document.execCommand('copy');
-				document.body.removeChild(textArea);
+				console.warn("***复制***",url);
+				if(this.isIOS){
+					navigator.clipboard.writeText(url);
+					// const permission = await navigator.permissions.query({ name: 'clipboard-write' });
+					// if (permission.state === 'denied') {
+					// 	return console.error("Damn, we don't have permissions to do this")
+					// }
+					// try{
+					// 	await navigator.clipboard.writeText(url) // 写入文本
+					// }catch(e){
+					// 	console.error("Error while copying text!",e)
+					// }
+				}else{
+					var textArea = document.createElement("textarea");
+					textArea.value = url;
+					document.body.appendChild(textArea);
+					textArea.select();
+					document.execCommand('copy');
+					document.body.removeChild(textArea);
+				}
 				Toast({
 					message: '链接已复制',
 				});