浏览代码

优化&处理结果页空间名称

zjs_project 1 年之前
父节点
当前提交
b6e40458db

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

@@ -188,7 +188,7 @@
 				if (newVal == null) {
 					return;
 				}
-				console.log("当前空间数据view-mark-watch:", newVal);
+				console.log("当前空间数据view-mark-watch:", newVal,newVal.layoutSpaceName,newVal.layoutSpaceType);
 				this.getAiBeautyFamily();
 				// this.curSpaceArea = parseFloat(
 				// 	(newVal.spaceWidth * newVal.spaceHeight) / 10000

+ 4 - 1
src/mixins/loadModel.js

@@ -86,10 +86,13 @@ export default {
 					let layout = list.find(it=>it.id == space.layoutId);
 					if(layout){
 						space.layoutSpaceType = layout.type;//更新布局信息到空间对象里面
-						space.layoutSpaceName = layoutObj.spacexName || layout.name;//更新布局信息到空间对象里面
+						space.layoutSpaceName = layout.spacexName || layout.name;//更新布局信息到空间对象里面
 						if(this.$refs && this.$refs.viewShell){
 							this.$refs.viewShell.$refs.viewCareful.updataData(space.spaceId,layout);
 						}
+						if(this.updataPageData && typeof(this.updataPageData)=='function'){
+							this.updataPageData();//更新数据
+						}
 					}
 				}
 			});

+ 9 - 1
src/pages/webgl_rxdz_text_customize/webgl_rxdz_text_customize.vue

@@ -10,6 +10,7 @@
 	import router from "@/router";
 	import touchHandle from '@/mixins/touchHandle.js';
 	import commonPageMethod from '@/mixins/commonPageMethod.js';
+	import spaceTypes from '@/static/spaceTypesIE.js';
 // const app = getApp(); //获取应用实例
 // import requestConfig from '@/static/lib/requestConfig.js';
 // import commonPageMethod from '@/common/commonPageMethod.js';
@@ -406,8 +407,15 @@ export default {
 				this.form.houseJson.forEach((item,index)=>{
 					//获取面积
 					let curSpaceArea = parseFloat((item.spaceWidth * item.spaceHeight) / 10000).toFixed(1);
+					let text = item.spaceName;
+					if(item.spaceId && item.spaceType){
+						text = spaceTypes[item.spaceType - 1];
+						if(item.spaceType==15 && item.layoutSpaceType){
+							text = spaceTypes[item.layoutSpaceType - 1]; 
+						}
+					}
 					let data = {
-						name : item.spaceName,
+						name : text,
 						imgUrl : item.hardboundEffect[0],
 						hardboundEffect:item.hardboundEffect,
 						gsImage:item.hardboundEffect[0],

+ 20 - 6
src/utils/util.js

@@ -81,6 +81,7 @@ function initWebsocket() {
 function websocketonopen() {
 	let data = initPage();
     console.log('建立ws连接', data)
+	//开启心跳
 	start();
     //发送链接身份数据
     connectSend(data.openId, data.userId, data.houseId);
@@ -93,7 +94,7 @@ function websocketonopen() {
 function websocketonmessage(e) {
     // console.log('客户端接收服务端数据时触发', e);
     //收到服务器信息,心跳重置
-    // reset();
+    reset();
 }
 
 /**
@@ -118,7 +119,7 @@ function websocketclose(e) {
 }
 
 function websocketsend(Data) {
-    console.log('ws状态', wsConfig.ws)
+    // console.log('ws状态', wsConfig.ws)
 	if(wsConfig.ws && wsConfig.ws.readyState==1){
 		let param = [
 			"SEND" +
@@ -271,11 +272,13 @@ function reconnect() {
 function reset() {
     console.log('重启心跳')
     //重置心跳
-    // clearTimeout(wsConfig.timeoutObj);
+    clearTimeout(wsConfig.timeoutObj);
     // //清除时间
-    // clearTimeout(wsConfig.serverTimeoutObj);
+    clearTimeout(wsConfig.serverTimeoutObj);
     //重启心跳
-    wsSendHeartBeat();
+    // wsSendHeartBeat();
+	//开启心跳
+	start();
 }
 // socket 心跳发送
 function wsSendHeartBeat() {
@@ -305,15 +308,26 @@ function start() {
     let ws = wsConfig.ws;
     //开启心跳
     // console.log("开启心跳", wsConfig,ws.readyState);
+	let data = ["\n"];//心跳的数据格式
+	ws.send(JSON.stringify(data));
     wsConfig.timeoutObj && clearTimeout(wsConfig.timeoutObj);
     wsConfig.serverTimeoutObj && clearTimeout(wsConfig.serverTimeoutObj);
     wsConfig.timeoutObj = setTimeout(function() {
+		//这里发送一个心跳,后端收到后,返回一个心跳消息,
+		if (websock.readyState == 1) {
+			//如果连接正常
+			ws.send(JSON.stringify(data)); //这里可以自己跟后端约定
+		} else {
+			//否则重连
+			self.reconnect();
+		}
         wsConfig.serverTimeoutObj = setTimeout(function() {
+			console.warn("***超时主动关闭***")
             //超时关闭
             ws.close();
         }, wsConfig.timeout);
     }, wsConfig.timeout);
-	wsSendHeartBeat();//开始心跳
+	// wsSendHeartBeat();//开始心跳
 }
 var util = {
 	dateFormat(date, fmt) {