浏览代码

修复挂在rbd卡问题

wuyongxiang 4 年之前
父节点
当前提交
fc52781efd
共有 1 个文件被更改,包括 80 次插入63 次删除
  1. 80 63
      screenH5/homeNew.html

+ 80 - 63
screenH5/homeNew.html

@@ -192,7 +192,7 @@
 			}
 			.thl-time{
 				    text-align: left;
-				    margin-left: -0.4rem !important;
+				    margin-left: -0.4rem !important;c
 			}
     </style>
 	</head>
@@ -330,6 +330,7 @@
 					message: 'Hello Vue!',
 					homeList: [],
 					urlData: {},
+					rbdData: {}
 				},
 				mounted() {
 					this.gethomeList();
@@ -414,24 +415,29 @@
 							"userCardId": this.homeList[activeIndex].id,
 							"deviceStatus": 1,
 						};
-						var baseUrl = "https://192.168.31.20";
+						var baseUrl = "http://192.168.31.20";
 						var urlss = 'test.androidscloud.com'
-						$.ajax({
-							url: baseUrl + "/api/storage/v1/cardStatus/getRbd",
-							data: JSON.stringify(rbdData),
-							type: 'post',
-							dataType: 'json',
-							contentType: "application/json;charset=UTF-8",
-							headers: {
-								'token': tokens.substring(6, tokens.length),
-								"Authorization": tokens.substring(6, tokens.length)
-							},
-							success: function(data) {
-								console.log("挂载安卓卡成功", data);
-								//                       
-							}
-						})
+						let that = this;
+						
 						setTimeout(() => {
+							$.ajax({
+								url: baseUrl + "/api/storage/v1/cardStatus/getRbd",
+								data: JSON.stringify(rbdData),
+								type: 'post',
+								dataType: 'json',
+								async: false,
+								contentType: "application/json;charset=UTF-8",
+								headers: {
+									'token': tokens.substring(6, tokens.length),
+									"Authorization": tokens.substring(6, tokens.length)
+								},
+								success: function(data) {
+									
+									that.urlData = data.data;
+									console.log("挂载安卓卡成功",that.urlData);
+									//                       
+								}
+							})
 							$(".swiper-wrapper .swiper-slide-active .wine").attr('id', 'wine');
 							var player = new Player({
 								size: {
@@ -439,13 +445,14 @@
 									height: 1024
 								}
 							});
+
 							var secanv = document.getElementById("wine");
 							secanv.appendChild(player.canvas);
 
-							var strhost = "wss://" + urlss + "/videoWebSocket?clientType=" + that.urlData.clientType + "&cardIp=" +
-								that.urlData.cardIp +
-								"&port=" + that.urlData.port + "&sn=" + that.urlData.sn;
-							// var client = new WebSocket(strhost);
+							var strhost = "wss://" + urlss + "/videoWebSocket?clientType=1&cardIp=" +
+								that.urlData.exIp +
+								"&port=" + that.urlData.exPort + "&sn=" + that.urlData.sn;
+							var client = new WebSocket(strhost);
 							console.log('wsssss==============', client)
 
 							client.binaryType = 'arraybuffer';
@@ -476,23 +483,10 @@
 							"userCardId": this.homeList[activeIndex].id,
 							"deviceStatus": 1,
 						};
-						var baseUrl = "https://192.168.31.20";
+						var baseUrl = "http://192.168.31.20";
 						var urlss = 'test.androidscloud.com'
-						$.ajax({
-							url: baseUrl + "/api/storage/v1/cardStatus/getRbd",
-							data: JSON.stringify(rbdData),
-							type: 'post',
-							dataType: 'json',
-							contentType: "application/json;charset=UTF-8",
-							headers: {
-								'token': tokens.substring(6, tokens.length),
-								"Authorization": tokens.substring(6, tokens.length)
-							},
-							success: function(data) {
-								console.log("挂载安卓卡成功", data);
-								//                       
-							}
-						})
+						let that = this;
+
 						var domnext = $('.swiper-slide-prev').next().children().find(".wine");
 						domnext.removeAttr("id");
 						// console.log("打印索引值", domnext)
@@ -500,6 +494,23 @@
 						domprev.attr("id", "wine");
 						domnext.empty();
 						setTimeout(() => {
+							$.ajax({
+								url: baseUrl + "/api/storage/v1/cardStatus/getRbd",
+								data: JSON.stringify(rbdData),
+								type: 'post',
+								dataType: 'json',
+								async: false,
+								contentType: "application/json;charset=UTF-8",
+								headers: {
+									'token': tokens.substring(6, tokens.length),
+									"Authorization": tokens.substring(6, tokens.length)
+								},
+								success: function(data) {
+									that.urlData = data.data;
+									console.log("挂载安卓卡成功",that.urlData);
+									//                       
+								}
+							})
 							$(".swiper-wrapper .swiper-slide-active .wine").attr('id', 'wine');
 							var player = new Player({
 								size: {
@@ -509,10 +520,10 @@
 							});
 							var secanv = document.getElementById("wine");
 							secanv.appendChild(player.canvas);
-							var strhost = "wss://" + urlss + "/videoWebSocket?clientType=" + that.urlData.clientType + "&cardIp=" +
-								that.urlData.cardIp +
-								"&port=" + that.urlData.port + "&sn=" + that.urlData.sn;
-							// var client = new WebSocket(strhost);
+							var strhost = "wss://" + urlss + "/videoWebSocket?clientType=1&cardIp=" +
+								that.urlData.exIp +
+								"&port=" + that.urlData.exPort + "&sn=" + that.urlData.sn;
+							var client = new WebSocket(strhost);
 							console.log('wsssss==============', client)
 
 							client.binaryType = 'arraybuffer';
@@ -538,7 +549,7 @@
 					},
 					gethomeList() {
 						// var baseUrl = 'https://test.androidscloud.com';
-						var baseUrl = "https://192.168.31.20";
+						var baseUrl = "http://192.168.31.20";
 						var query = window.location.search.substring(1);
 						var vars = query.split("&");
 						var tokens = vars.find(e => {
@@ -633,22 +644,27 @@
 										"deviceStatus": 1,
 									};
 
-									$.ajax({
-										url: baseUrl + "/api/storage/v1/cardStatus/getRbd",
-										data: JSON.stringify(rbdData),
-										type: 'post',
-										dataType: 'json',
-										contentType: "application/json;charset=UTF-8",
-										headers: {
-											'token': tokens.substring(6, tokens.length),
-											"Authorization": tokens.substring(6, tokens.length)
-										},
-										success: function(data) {
-											console.log("挂载安卓卡成功", data);
-											//                       
-										}
-									})
+
+									// let that = this;
 									setTimeout(() => {
+										$.ajax({
+											url: baseUrl + "/api/storage/v1/cardStatus/getRbd",
+											data: JSON.stringify(rbdData),
+											type: 'post',
+											dataType: 'json',
+											contentType: "application/json;charset=UTF-8",
+											async: false,
+											headers: {
+												'token': tokens.substring(6, tokens.length),
+												"Authorization": tokens.substring(6, tokens.length)
+											},
+											success: function(data) {
+												that.urlData = data.data;
+												console.log("挂载安卓卡成功",that.urlData);
+												//                       
+											}
+										})
+										console.log("that.urlDatathat.urlDatathat.urlDatathat.urlData", that.urlData);
 										$(".swiper-wrapper .swiper-slide-active .wine").attr('id', 'wine');
 										var player = new Player({
 											size: {
@@ -658,10 +674,10 @@
 										});
 										var secanv = document.getElementById("wine");
 										secanv.appendChild(player.canvas);
-										var strhost = "wss://" + urlss + "/videoWebSocket?clientType=" + that.urlData.clientType + "&cardIp=" +
-											that.urlData.cardIp +
-											"&port=" + that.urlData.port + "&sn=" + that.urlData.sn;
-										// var client = new WebSocket(strhost);
+										var strhost = "wss://" + urlss + "/videoWebSocket?clientType=1&cardIp=" +
+											that.urlData.exIp +
+											"&port=" + that.urlData.exPort + "&sn=" + that.urlData.sn;
+										var client = new WebSocket(strhost);
 										console.log('wsssss==============', client)
 
 										client.binaryType = 'arraybuffer';
@@ -700,8 +716,8 @@
 			url = url.split('/')
 			console.log(url)
 			// var baseUrl = 'https://' + url[2] //'http://192.168.31.159'//'http://' + url[2] 
-			// var baseUrl = 'http://192.168.31.20'
-			var baseUrl = 'https://test.androidscloud.com';
+			var baseUrl = 'http://192.168.31.20'
+			// var baseUrl = 'https://test.androidscloud.com';
 			var query = window.location.search.substring(1);
 
 			var vars = query.split("&");
@@ -712,6 +728,7 @@
 				data: {},
 				type: 'get',
 				dataType: 'json',
+				contentType: "application/json;charset=UTF-8",
 				success: function(data) {
 					if (data.data) {
 						$("#showsuss").show()