|
@@ -145,7 +145,7 @@
|
|
|
// video.play();
|
|
|
// audio.play();
|
|
|
// }, false);
|
|
|
- var topwinHeight = window.screen.height - window.innerHeight + 30; //计算title top 头部 是否准备重连
|
|
|
+ var topwinHeight = window.screen.height - window.innerHeight + 30; //计算title top 头部
|
|
|
$('#wine').css({
|
|
|
"width": window.screen.width,
|
|
|
"height": window.screen.height - topwinHeight - 20,
|
|
@@ -224,37 +224,26 @@
|
|
|
}
|
|
|
var ws;
|
|
|
doConnect();
|
|
|
- // function throttle(fn, delay) {
|
|
|
- // let flag = true;
|
|
|
- // return () => {
|
|
|
- // if (!flag) return;
|
|
|
- // flag = false;
|
|
|
- // timer = setTimeout(() => {
|
|
|
- // fn();
|
|
|
- // flag = true;
|
|
|
- // }, delay);
|
|
|
- // };
|
|
|
- // }
|
|
|
function doConnect() {
|
|
|
ws = new WebSocket(socketURL);
|
|
|
ws.binaryType = 'arraybuffer';
|
|
|
|
|
|
ws.onclose = function (e) {
|
|
|
- // throttle(doConnect,500);
|
|
|
+ doConnect();
|
|
|
// console.log(e);
|
|
|
- $.confirm({
|
|
|
- title: '提示',
|
|
|
- text: '连接断开,是否准备重连?',
|
|
|
- onOK: function () {
|
|
|
- window.location.reload();
|
|
|
- // doConnect();
|
|
|
- },
|
|
|
- onCancel: function () {
|
|
|
- wx.miniProgram.switchTab({
|
|
|
- url: '/pages/home/home'
|
|
|
- })
|
|
|
- }
|
|
|
- });
|
|
|
+ // $.confirm({
|
|
|
+ // title: '提示',
|
|
|
+ // text: '连接断开,是否准备重连?',
|
|
|
+ // onOK: function () {
|
|
|
+ // window.location.reload();
|
|
|
+ // // doConnect();
|
|
|
+ // },
|
|
|
+ // onCancel: function () {
|
|
|
+ // wx.miniProgram.switchTab({
|
|
|
+ // url: '/pages/home/home'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // });
|
|
|
}
|
|
|
|
|
|
ws.addEventListener('open', function (event) {
|
|
@@ -263,19 +252,20 @@
|
|
|
|
|
|
ws.addEventListener('error', function (event) {
|
|
|
console.log(event);
|
|
|
- $.confirm({
|
|
|
- title: '提示',
|
|
|
- text: '连接失败,是否准备重连?',
|
|
|
- onOK: function () {
|
|
|
- window.location.reload();
|
|
|
- // doConnect();
|
|
|
- },
|
|
|
- onCancel: function () {
|
|
|
- wx.miniProgram.switchTab({
|
|
|
- url: '/pages/home/home'
|
|
|
- })
|
|
|
- }
|
|
|
- });
|
|
|
+ doConnect();
|
|
|
+ // $.confirm({
|
|
|
+ // title: '提示',
|
|
|
+ // text: '连接失败,是否准备重连?',
|
|
|
+ // onOK: function () {
|
|
|
+ // throttle(doConnect,500);
|
|
|
+ // // doConnect();
|
|
|
+ // },
|
|
|
+ // onCancel: function () {
|
|
|
+ // wx.miniProgram.switchTab({
|
|
|
+ // url: '/pages/home/home'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // });
|
|
|
});
|
|
|
|
|
|
ws.addEventListener('message', function (event) {
|