zjs_project 1 rok pred
rodič
commit
c36672c4c9

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

@@ -322,10 +322,13 @@ export default {
 					}else{
 						this.unlikedCount = this.unlikedCount + 1
 					}
-					this.total ++;
+					// if(userId != this.layoutStruct.userId){
+					// 	this.total ++;
+					// }
 					this.proportion = parseInt((this.likeCount / (this.likeCount + this.unlikedCount))*100);
 				}
 			}
+			// this.getIdData();
 			this.repeatFlag = false;
 		},
 		async getIdData(){

+ 24 - 0
src/utils/util.js

@@ -3,6 +3,7 @@ import {
 	setStorage
 } from '@/utils/localStorage';
 window.sessionTime = new Date();
+var socketTaskList = []; //websocket 待发送任务列表
 /**
  * websocket配置项
  * @type {{serverTimeoutObj: null, timeoutObj: null, timeoutnum: null, lockReconnect: boolean, ws: null, params: {houseId: null, openid: null, userid: null}, timeout: number}}
@@ -94,6 +95,13 @@ function websocketsend(Data) {
 	if(wsConfig.ws.readyState==1){
 		//数据发送
 		wsConfig.ws.send(Data);
+	}else{
+		// 如果还没有创建好socket链接或者链接还没打开,则放到待发送列表中
+		if(Data){
+			socketTaskList.push(Data);
+		}
+		console.log("***ws-socketTaskList列表count***", socketTaskList.length)
+		return
 	}
     
 }
@@ -140,6 +148,7 @@ function initPage(){
  */
 function connectSend(openid, userid, houseId) {
     console.log('建立ws通信', openid, userid, houseId)
+	//发送堆积的待发送消息
     const param = [
         "CONNECT" +
         "\nopenId:" +
@@ -153,6 +162,21 @@ function connectSend(openid, userid, houseId) {
         "\naccept-version:1.1,1.0\nheart-beat:5000,5000\n\n\u0000",
     ];
     websocketsend(JSON.stringify(param));
+	if (socketTaskList && socketTaskList.length > 0) {
+		for (var i = 0; i < socketTaskList.length; i++) {
+			if(socketTaskList[i]){
+				console.log("***ws-socketTaskList列表***", i)
+				// 发送堆积的待发送消息
+				wsConfig.ws.send(socketTaskList[i]);
+				socketTaskList[i] = null;
+			}
+		}
+		for (var i = 0; i < socketTaskList.length; i++) {
+			if(!socketTaskList[i]){
+				socketTaskList.splice(i,1);
+			}
+		}
+	}
 }
 
 /**