huangxiaojing 4 years ago
parent
commit
404aa90567
2 changed files with 7 additions and 33 deletions
  1. 3 0
      screenIos/WXdraw.js
  2. 4 33
      screenIos/websocket.js

+ 3 - 0
screenIos/WXdraw.js

@@ -48,6 +48,9 @@ function doConnect() {
 			"event": "bitRate"
 		}
 		wsss.send(ExexuteMove(JSON.stringify(bitRate), form.sn))
+		$('.weui-mask_transparent').hide()
+		$('.weui-toast').hide()
+		$('.loading').hide()
 	};
 	wsss.onclose = function () {
 		$.confirm({

+ 4 - 33
screenIos/websocket.js

@@ -1,6 +1,4 @@
 self.importScripts("helper.js");
-self.importScripts("jquery-1.11.0.min.js");
-self.importScripts("jquery-weui.min.js");
 var parameters = GetRequest();
 var ip = parameters["ip"];
 var socketURL = "ws://192.168.198.82:9100/card?cardIp=" + ip;
@@ -12,35 +10,10 @@ function doConnect() {
 	ws.binaryType = 'arraybuffer';
 
 	ws.onclose = function (e) {
-		$.confirm({
-			title: '提示',
-			text: '连接断开,是否准备重连?',
-			onOK: function () {
-				doConnect();
-			},
-			onCancel: function () {
-				wx.miniProgram.switchTab({
-					url: '/pages/home/home'
-				})
-			}
-		});
+		alert("websocket连接断开,准备重连");
+		doConnect();
 	}
 
-	ws.addEventListener('error', function (event) {
-		$.confirm({
-			title: '提示',
-			text: '连接失败,是否准备重连?',
-			onOK: function () {
-				doConnect();
-			},
-			onCancel: function () {
-				wx.miniProgram.switchTab({
-					url: '/pages/home/home'
-				})
-			}
-		});
-	});
-
 	ws.addEventListener('open', function (event) {
 		ws.send(ConfigChannel("RK3923C1201900139"));
 		var buffer = RequestIFrame();
@@ -52,9 +25,7 @@ function doConnect() {
 	}, false);
 	ws.addEventListener('message', function (event) {
 		var input = new Uint8Array(event.data);
-		$('.weui-mask_transparent').hide()
-		$('.weui-toast').hide()
-		$('.loading').hide()
+
 		if (input[0] == 0xff) {
 			self.postMessage(input);
 		} else {
@@ -74,4 +45,4 @@ function GetRequest() {
 		}
 	}
 	return obj;
-}
+}