Browse Source

Merge branch 'master' of http://192.168.32.253:3000/Software/android-cloud-H5

huangxiaojing 4 years ago
parent
commit
1042df52fe
4 changed files with 72 additions and 61 deletions
  1. 29 25
      screenAndroid/WXdraw.js
  2. 2 0
      screenAndroid/WXtrialInterface.html
  3. 28 24
      screenIos/WXdraw.js
  4. 13 12
      screenIos/WXtrialInterface.html

+ 29 - 25
screenAndroid/WXdraw.js

@@ -6,7 +6,7 @@ var vowidth = window.screen.width;
 var topwinHeightDraw = window.screen.height - window.innerHeight + 30; // 计算title top 头部
 var topwinHeightDraw = window.screen.height - window.innerHeight + 30; // 计算title top 头部
 var numse = window.screen.height;
 var numse = window.screen.height;
 
 
-// 计算title top 头部
+// 计算title top 头部 连接断开,是否准备重连?
 if (numse <= 70) {
 if (numse <= 70) {
 	var voheight = window.screen.height - winHeight - 34 - 20
 	var voheight = window.screen.height - winHeight - 34 - 20
 } else {
 } else {
@@ -55,33 +55,37 @@ function doConnect() {
 	};
 	};
 	wsss.onclose = function (evt) {
 	wsss.onclose = function (evt) {
 		console.log(evt);
 		console.log(evt);
-		$.confirm({
-			title: '提示',
-			text: '连接断开,是否准备重连?',
-			onOK: function () {
-				doConnect();
-			},
-			onCancel: function () {
-				wx.miniProgram.switchTab({
-					url: '/pages/home/home'
-				})
-			}
-		});
+		ws.close();
+		doConnect();
+		// $.confirm({
+		// 	title: '提示',
+		// 	text: '连接断开,是否准备重连?',
+		// 	onOK: function () {
+		// 		doConnect();
+		// 	},
+		// 	onCancel: function () {
+		// 		wx.miniProgram.switchTab({
+		// 			url: '/pages/home/home'
+		// 		})
+		// 	}
+		// });
 	};
 	};
 	wsss.onerror = function (evt) {
 	wsss.onerror = function (evt) {
 		console.log(evt);
 		console.log(evt);
-		$.confirm({
-			title: '提示',
-			text: '连接断开,是否准备重连?',
-			onOK: function () {
-				doConnect();
-			},
-			onCancel: function () {
-				wx.miniProgram.switchTab({
-					url: '/pages/home/home'
-				})
-			}
-		});
+		ws.close();
+		doConnect();
+		// $.confirm({
+		// 	title: '提示',
+		// 	text: '连接断开,是否准备重连?',
+		// 	onOK: function () {
+		// 		doConnect();
+		// 	},
+		// 	onCancel: function () {
+		// 		wx.miniProgram.switchTab({
+		// 			url: '/pages/home/home'
+		// 		})
+		// 	}
+		// });
 	};
 	};
 }
 }
 $('#box').on("click", function () {
 $('#box').on("click", function () {

+ 2 - 0
screenAndroid/WXtrialInterface.html

@@ -229,6 +229,7 @@
 			ws.binaryType = 'arraybuffer';
 			ws.binaryType = 'arraybuffer';
 
 
 			ws.onclose = function (e) {
 			ws.onclose = function (e) {
+				ws.close();
 				doConnect();
 				doConnect();
 				// console.log(e);
 				// console.log(e);
 				// $.confirm({
 				// $.confirm({
@@ -252,6 +253,7 @@
 
 
 			ws.addEventListener('error', function (event) {
 			ws.addEventListener('error', function (event) {
 				console.log(event);
 				console.log(event);
+				ws.close();
 				doConnect();
 				doConnect();
 				// $.confirm({
 				// $.confirm({
 				// 	title: '提示',
 				// 	title: '提示',

+ 28 - 24
screenIos/WXdraw.js

@@ -51,32 +51,36 @@ function doConnect() {
 		wsss.send(ExexuteMove(JSON.stringify(bitRate), form.sn))
 		wsss.send(ExexuteMove(JSON.stringify(bitRate), form.sn))
 	};
 	};
 	wsss.onclose = function () {
 	wsss.onclose = function () {
-		$.confirm({
-			title: '提示',
-			text: '连接断开,是否准备重连?',
-			onOK: function () {
-				doConnect();
-			},
-			onCancel: function () {
-				wx.miniProgram.switchTab({
-					url: '/pages/home/home'
-				})
-			}
-		});
+		wsss.close();
+		doConnect();
+		// $.confirm({
+		// 	title: '提示',
+		// 	text: '连接断开,是否准备重连?',
+		// 	onOK: function () {
+		// 		doConnect();
+		// 	},
+		// 	onCancel: function () {
+		// 		wx.miniProgram.switchTab({
+		// 			url: '/pages/home/home'
+		// 		})
+		// 	}
+		// });
 	};
 	};
 	wsss.onerror = function () {
 	wsss.onerror = function () {
-		$.confirm({
-			title: '提示',
-			text: '连接断开,是否准备重连?',
-			onOK: function () {
-				doConnect();
-			},
-			onCancel: function () {
-				wx.miniProgram.switchTab({
-					url: '/pages/home/home'
-				})
-			}
-		});
+		wsss.close();
+		doConnect();
+		// $.confirm({
+		// 	title: '提示',
+		// 	text: '连接断开,是否准备重连?',
+		// 	onOK: function () {
+		// 		doConnect();
+		// 	},
+		// 	onCancel: function () {
+		// 		wx.miniProgram.switchTab({
+		// 			url: '/pages/home/home'
+		// 		})
+		// 	}
+		// });
 	};
 	};
 }
 }
 $('#box').on("click", function () {
 $('#box').on("click", function () {

+ 13 - 12
screenIos/WXtrialInterface.html

@@ -465,18 +465,19 @@
 				decodeWoker.postMessage(event.data);
 				decodeWoker.postMessage(event.data);
 			}
 			}
 			if (event.data === 'close') {
 			if (event.data === 'close') {
-				$.confirm({
-					title: '提示',
-					text: '连接断开,是否准备重连?',
-					onOK: function () {
-						webSocketWorker.postMessage('restart');
-					},
-					onCancel: function () {
-						wx.miniProgram.switchTab({
-							url: '/pages/home/home'
-						})
-					}
-				});
+				webSocketWorker.postMessage('restart');
+				// $.confirm({
+				// 	title: '提示',
+				// 	text: '连接断开,是否准备重连?',
+				// 	onOK: function () {
+				// 		webSocketWorker.postMessage('restart');
+				// 	},
+				// 	onCancel: function () {
+				// 		wx.miniProgram.switchTab({
+				// 			url: '/pages/home/home'
+				// 		})
+				// 	}
+				// });
 			}
 			}
 		}
 		}