eoss-ui 0.5.73 → 0.5.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/lib/button-group.js +16 -6
  2. package/lib/button.js +16 -6
  3. package/lib/checkbox-group.js +16 -6
  4. package/lib/clients.js +16 -7
  5. package/lib/data-table-form.js +16 -6
  6. package/lib/data-table.js +16 -6
  7. package/lib/date-picker.js +16 -6
  8. package/lib/dialog.js +16 -6
  9. package/lib/eoss-ui.common.js +176 -82
  10. package/lib/flow-group.js +16 -6
  11. package/lib/flow-list.js +16 -6
  12. package/lib/flow.js +16 -6
  13. package/lib/form.js +16 -6
  14. package/lib/handle-user.js +16 -6
  15. package/lib/handler.js +16 -6
  16. package/lib/index.js +1 -1
  17. package/lib/input-number.js +16 -6
  18. package/lib/input.js +16 -6
  19. package/lib/login.js +24 -14
  20. package/lib/main.js +98 -28
  21. package/lib/nav.js +64 -29
  22. package/lib/page.js +16 -6
  23. package/lib/player.js +16 -6
  24. package/lib/qr-code.js +16 -6
  25. package/lib/radio-group.js +16 -6
  26. package/lib/retrial-auth.js +16 -6
  27. package/lib/select-ganged.js +16 -6
  28. package/lib/select.js +16 -6
  29. package/lib/selector-panel.js +16 -6
  30. package/lib/selector.js +16 -6
  31. package/lib/sizer.js +16 -6
  32. package/lib/steps.js +16 -6
  33. package/lib/switch.js +16 -6
  34. package/lib/table-form.js +16 -6
  35. package/lib/tabs.js +16 -6
  36. package/lib/theme-chalk/index.css +1 -1
  37. package/lib/theme-chalk/nav.css +1 -1
  38. package/lib/tips.js +16 -6
  39. package/lib/tree-group.js +16 -6
  40. package/lib/tree.js +16 -6
  41. package/lib/upload.js +16 -6
  42. package/lib/utils/webSocket.js +16 -6
  43. package/lib/wujie.js +16 -6
  44. package/lib/wxlogin.js +16 -6
  45. package/package.json +1 -1
  46. package/packages/clients/src/main.vue +3 -1
  47. package/packages/login/src/resetPassword.vue +1 -1
  48. package/packages/main/src/main.vue +44 -10
  49. package/packages/nav/src/main.vue +25 -8
  50. package/packages/theme-chalk/lib/index.css +1 -1
  51. package/packages/theme-chalk/lib/nav.css +1 -1
  52. package/packages/theme-chalk/src/nav.scss +4 -1
  53. package/src/index.js +1 -1
  54. package/src/utils/webSocket.js +14 -7
package/lib/select.js CHANGED
@@ -3712,6 +3712,8 @@ var WebSocket = function () {
3712
3712
  this.connects = 1;
3713
3713
  this.recon = false;
3714
3714
  this.sendTimeout = null;
3715
+ this.socket = null;
3716
+ this.subscription = null;
3715
3717
  }
3716
3718
 
3717
3719
  /** socket连接 */
@@ -3722,14 +3724,12 @@ var WebSocket = function () {
3722
3724
 
3723
3725
  if (!this.client) {
3724
3726
  // 连接SockJS
3725
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
3726
- // 获取STOMP子协议的客户端对象
3727
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
3727
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
3728
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
3728
3729
  }
3729
3730
 
3730
3731
  // 日志不打印
3731
3732
  if (!this.debug) {
3732
- console.log(111);
3733
3733
  this.client.debug = function () {};
3734
3734
  }
3735
3735
 
@@ -3741,9 +3741,10 @@ var WebSocket = function () {
3741
3741
  // 订阅消息
3742
3742
  _this.subscribe();
3743
3743
  }, function (error) {
3744
+ _this.unsubscribe();
3745
+ _this.client = null;
3744
3746
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
3745
3747
  if (_this.connects > 5 && diffSecond < _this.interval) {
3746
- _this.client.disconnect();
3747
3748
  _this.error && _this.error(error);
3748
3749
  } else {
3749
3750
  _this.reconTimeout = setTimeout(function () {
@@ -3752,6 +3753,14 @@ var WebSocket = function () {
3752
3753
  }, 5000);
3753
3754
  }
3754
3755
  });
3756
+ }; // 清除订阅
3757
+
3758
+
3759
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
3760
+ if (this.subscription) {
3761
+ this.subscription.unsubscribe();
3762
+ this.subscription = null;
3763
+ }
3755
3764
  };
3756
3765
  /** 订阅服务端 */
3757
3766
 
@@ -3760,7 +3769,7 @@ var WebSocket = function () {
3760
3769
  var _this2 = this;
3761
3770
 
3762
3771
  // 订阅服务端提供的某个topic
3763
- this.client.subscribe(this.take, function (response) {
3772
+ this.subscription = this.client.subscribe(this.take, function (response) {
3764
3773
  if (response && (_this2.callback || _this2.success)) {
3765
3774
  var callback = _this2.callback || _this2.success;
3766
3775
  callback(JSON.parse(response.body));
@@ -3801,6 +3810,7 @@ var WebSocket = function () {
3801
3810
 
3802
3811
  WebSocket.prototype.destroy = function destroy() {
3803
3812
  // 断开连接,清除定时器
3813
+ this.unsubscribe();
3804
3814
  if (this.client) {
3805
3815
  this.client.disconnect();
3806
3816
  };
@@ -3643,6 +3643,8 @@ var WebSocket = function () {
3643
3643
  this.connects = 1;
3644
3644
  this.recon = false;
3645
3645
  this.sendTimeout = null;
3646
+ this.socket = null;
3647
+ this.subscription = null;
3646
3648
  }
3647
3649
 
3648
3650
  /** socket连接 */
@@ -3653,14 +3655,12 @@ var WebSocket = function () {
3653
3655
 
3654
3656
  if (!this.client) {
3655
3657
  // 连接SockJS
3656
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
3657
- // 获取STOMP子协议的客户端对象
3658
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
3658
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
3659
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
3659
3660
  }
3660
3661
 
3661
3662
  // 日志不打印
3662
3663
  if (!this.debug) {
3663
- console.log(111);
3664
3664
  this.client.debug = function () {};
3665
3665
  }
3666
3666
 
@@ -3672,9 +3672,10 @@ var WebSocket = function () {
3672
3672
  // 订阅消息
3673
3673
  _this.subscribe();
3674
3674
  }, function (error) {
3675
+ _this.unsubscribe();
3676
+ _this.client = null;
3675
3677
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
3676
3678
  if (_this.connects > 5 && diffSecond < _this.interval) {
3677
- _this.client.disconnect();
3678
3679
  _this.error && _this.error(error);
3679
3680
  } else {
3680
3681
  _this.reconTimeout = setTimeout(function () {
@@ -3683,6 +3684,14 @@ var WebSocket = function () {
3683
3684
  }, 5000);
3684
3685
  }
3685
3686
  });
3687
+ }; // 清除订阅
3688
+
3689
+
3690
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
3691
+ if (this.subscription) {
3692
+ this.subscription.unsubscribe();
3693
+ this.subscription = null;
3694
+ }
3686
3695
  };
3687
3696
  /** 订阅服务端 */
3688
3697
 
@@ -3691,7 +3700,7 @@ var WebSocket = function () {
3691
3700
  var _this2 = this;
3692
3701
 
3693
3702
  // 订阅服务端提供的某个topic
3694
- this.client.subscribe(this.take, function (response) {
3703
+ this.subscription = this.client.subscribe(this.take, function (response) {
3695
3704
  if (response && (_this2.callback || _this2.success)) {
3696
3705
  var callback = _this2.callback || _this2.success;
3697
3706
  callback(JSON.parse(response.body));
@@ -3732,6 +3741,7 @@ var WebSocket = function () {
3732
3741
 
3733
3742
  WebSocket.prototype.destroy = function destroy() {
3734
3743
  // 断开连接,清除定时器
3744
+ this.unsubscribe();
3735
3745
  if (this.client) {
3736
3746
  this.client.disconnect();
3737
3747
  };
package/lib/selector.js CHANGED
@@ -4867,6 +4867,8 @@ var WebSocket = function () {
4867
4867
  this.connects = 1;
4868
4868
  this.recon = false;
4869
4869
  this.sendTimeout = null;
4870
+ this.socket = null;
4871
+ this.subscription = null;
4870
4872
  }
4871
4873
 
4872
4874
  /** socket连接 */
@@ -4877,14 +4879,12 @@ var WebSocket = function () {
4877
4879
 
4878
4880
  if (!this.client) {
4879
4881
  // 连接SockJS
4880
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
4881
- // 获取STOMP子协议的客户端对象
4882
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
4882
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
4883
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
4883
4884
  }
4884
4885
 
4885
4886
  // 日志不打印
4886
4887
  if (!this.debug) {
4887
- console.log(111);
4888
4888
  this.client.debug = function () {};
4889
4889
  }
4890
4890
 
@@ -4896,9 +4896,10 @@ var WebSocket = function () {
4896
4896
  // 订阅消息
4897
4897
  _this.subscribe();
4898
4898
  }, function (error) {
4899
+ _this.unsubscribe();
4900
+ _this.client = null;
4899
4901
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
4900
4902
  if (_this.connects > 5 && diffSecond < _this.interval) {
4901
- _this.client.disconnect();
4902
4903
  _this.error && _this.error(error);
4903
4904
  } else {
4904
4905
  _this.reconTimeout = setTimeout(function () {
@@ -4907,6 +4908,14 @@ var WebSocket = function () {
4907
4908
  }, 5000);
4908
4909
  }
4909
4910
  });
4911
+ }; // 清除订阅
4912
+
4913
+
4914
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
4915
+ if (this.subscription) {
4916
+ this.subscription.unsubscribe();
4917
+ this.subscription = null;
4918
+ }
4910
4919
  };
4911
4920
  /** 订阅服务端 */
4912
4921
 
@@ -4915,7 +4924,7 @@ var WebSocket = function () {
4915
4924
  var _this2 = this;
4916
4925
 
4917
4926
  // 订阅服务端提供的某个topic
4918
- this.client.subscribe(this.take, function (response) {
4927
+ this.subscription = this.client.subscribe(this.take, function (response) {
4919
4928
  if (response && (_this2.callback || _this2.success)) {
4920
4929
  var callback = _this2.callback || _this2.success;
4921
4930
  callback(JSON.parse(response.body));
@@ -4956,6 +4965,7 @@ var WebSocket = function () {
4956
4965
 
4957
4966
  WebSocket.prototype.destroy = function destroy() {
4958
4967
  // 断开连接,清除定时器
4968
+ this.unsubscribe();
4959
4969
  if (this.client) {
4960
4970
  this.client.disconnect();
4961
4971
  };
package/lib/sizer.js CHANGED
@@ -4115,6 +4115,8 @@ var WebSocket = function () {
4115
4115
  this.connects = 1;
4116
4116
  this.recon = false;
4117
4117
  this.sendTimeout = null;
4118
+ this.socket = null;
4119
+ this.subscription = null;
4118
4120
  }
4119
4121
 
4120
4122
  /** socket连接 */
@@ -4125,14 +4127,12 @@ var WebSocket = function () {
4125
4127
 
4126
4128
  if (!this.client) {
4127
4129
  // 连接SockJS
4128
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
4129
- // 获取STOMP子协议的客户端对象
4130
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
4130
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
4131
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
4131
4132
  }
4132
4133
 
4133
4134
  // 日志不打印
4134
4135
  if (!this.debug) {
4135
- console.log(111);
4136
4136
  this.client.debug = function () {};
4137
4137
  }
4138
4138
 
@@ -4144,9 +4144,10 @@ var WebSocket = function () {
4144
4144
  // 订阅消息
4145
4145
  _this.subscribe();
4146
4146
  }, function (error) {
4147
+ _this.unsubscribe();
4148
+ _this.client = null;
4147
4149
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
4148
4150
  if (_this.connects > 5 && diffSecond < _this.interval) {
4149
- _this.client.disconnect();
4150
4151
  _this.error && _this.error(error);
4151
4152
  } else {
4152
4153
  _this.reconTimeout = setTimeout(function () {
@@ -4155,6 +4156,14 @@ var WebSocket = function () {
4155
4156
  }, 5000);
4156
4157
  }
4157
4158
  });
4159
+ }; // 清除订阅
4160
+
4161
+
4162
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
4163
+ if (this.subscription) {
4164
+ this.subscription.unsubscribe();
4165
+ this.subscription = null;
4166
+ }
4158
4167
  };
4159
4168
  /** 订阅服务端 */
4160
4169
 
@@ -4163,7 +4172,7 @@ var WebSocket = function () {
4163
4172
  var _this2 = this;
4164
4173
 
4165
4174
  // 订阅服务端提供的某个topic
4166
- this.client.subscribe(this.take, function (response) {
4175
+ this.subscription = this.client.subscribe(this.take, function (response) {
4167
4176
  if (response && (_this2.callback || _this2.success)) {
4168
4177
  var callback = _this2.callback || _this2.success;
4169
4178
  callback(JSON.parse(response.body));
@@ -4204,6 +4213,7 @@ var WebSocket = function () {
4204
4213
 
4205
4214
  WebSocket.prototype.destroy = function destroy() {
4206
4215
  // 断开连接,清除定时器
4216
+ this.unsubscribe();
4207
4217
  if (this.client) {
4208
4218
  this.client.disconnect();
4209
4219
  };
package/lib/steps.js CHANGED
@@ -4009,6 +4009,8 @@ var WebSocket = function () {
4009
4009
  this.connects = 1;
4010
4010
  this.recon = false;
4011
4011
  this.sendTimeout = null;
4012
+ this.socket = null;
4013
+ this.subscription = null;
4012
4014
  }
4013
4015
 
4014
4016
  /** socket连接 */
@@ -4019,14 +4021,12 @@ var WebSocket = function () {
4019
4021
 
4020
4022
  if (!this.client) {
4021
4023
  // 连接SockJS
4022
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
4023
- // 获取STOMP子协议的客户端对象
4024
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
4024
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
4025
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
4025
4026
  }
4026
4027
 
4027
4028
  // 日志不打印
4028
4029
  if (!this.debug) {
4029
- console.log(111);
4030
4030
  this.client.debug = function () {};
4031
4031
  }
4032
4032
 
@@ -4038,9 +4038,10 @@ var WebSocket = function () {
4038
4038
  // 订阅消息
4039
4039
  _this.subscribe();
4040
4040
  }, function (error) {
4041
+ _this.unsubscribe();
4042
+ _this.client = null;
4041
4043
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
4042
4044
  if (_this.connects > 5 && diffSecond < _this.interval) {
4043
- _this.client.disconnect();
4044
4045
  _this.error && _this.error(error);
4045
4046
  } else {
4046
4047
  _this.reconTimeout = setTimeout(function () {
@@ -4049,6 +4050,14 @@ var WebSocket = function () {
4049
4050
  }, 5000);
4050
4051
  }
4051
4052
  });
4053
+ }; // 清除订阅
4054
+
4055
+
4056
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
4057
+ if (this.subscription) {
4058
+ this.subscription.unsubscribe();
4059
+ this.subscription = null;
4060
+ }
4052
4061
  };
4053
4062
  /** 订阅服务端 */
4054
4063
 
@@ -4057,7 +4066,7 @@ var WebSocket = function () {
4057
4066
  var _this2 = this;
4058
4067
 
4059
4068
  // 订阅服务端提供的某个topic
4060
- this.client.subscribe(this.take, function (response) {
4069
+ this.subscription = this.client.subscribe(this.take, function (response) {
4061
4070
  if (response && (_this2.callback || _this2.success)) {
4062
4071
  var callback = _this2.callback || _this2.success;
4063
4072
  callback(JSON.parse(response.body));
@@ -4098,6 +4107,7 @@ var WebSocket = function () {
4098
4107
 
4099
4108
  WebSocket.prototype.destroy = function destroy() {
4100
4109
  // 断开连接,清除定时器
4110
+ this.unsubscribe();
4101
4111
  if (this.client) {
4102
4112
  this.client.disconnect();
4103
4113
  };
package/lib/switch.js CHANGED
@@ -3658,6 +3658,8 @@ var WebSocket = function () {
3658
3658
  this.connects = 1;
3659
3659
  this.recon = false;
3660
3660
  this.sendTimeout = null;
3661
+ this.socket = null;
3662
+ this.subscription = null;
3661
3663
  }
3662
3664
 
3663
3665
  /** socket连接 */
@@ -3668,14 +3670,12 @@ var WebSocket = function () {
3668
3670
 
3669
3671
  if (!this.client) {
3670
3672
  // 连接SockJS
3671
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
3672
- // 获取STOMP子协议的客户端对象
3673
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
3673
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
3674
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
3674
3675
  }
3675
3676
 
3676
3677
  // 日志不打印
3677
3678
  if (!this.debug) {
3678
- console.log(111);
3679
3679
  this.client.debug = function () {};
3680
3680
  }
3681
3681
 
@@ -3687,9 +3687,10 @@ var WebSocket = function () {
3687
3687
  // 订阅消息
3688
3688
  _this.subscribe();
3689
3689
  }, function (error) {
3690
+ _this.unsubscribe();
3691
+ _this.client = null;
3690
3692
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
3691
3693
  if (_this.connects > 5 && diffSecond < _this.interval) {
3692
- _this.client.disconnect();
3693
3694
  _this.error && _this.error(error);
3694
3695
  } else {
3695
3696
  _this.reconTimeout = setTimeout(function () {
@@ -3698,6 +3699,14 @@ var WebSocket = function () {
3698
3699
  }, 5000);
3699
3700
  }
3700
3701
  });
3702
+ }; // 清除订阅
3703
+
3704
+
3705
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
3706
+ if (this.subscription) {
3707
+ this.subscription.unsubscribe();
3708
+ this.subscription = null;
3709
+ }
3701
3710
  };
3702
3711
  /** 订阅服务端 */
3703
3712
 
@@ -3706,7 +3715,7 @@ var WebSocket = function () {
3706
3715
  var _this2 = this;
3707
3716
 
3708
3717
  // 订阅服务端提供的某个topic
3709
- this.client.subscribe(this.take, function (response) {
3718
+ this.subscription = this.client.subscribe(this.take, function (response) {
3710
3719
  if (response && (_this2.callback || _this2.success)) {
3711
3720
  var callback = _this2.callback || _this2.success;
3712
3721
  callback(JSON.parse(response.body));
@@ -3747,6 +3756,7 @@ var WebSocket = function () {
3747
3756
 
3748
3757
  WebSocket.prototype.destroy = function destroy() {
3749
3758
  // 断开连接,清除定时器
3759
+ this.unsubscribe();
3750
3760
  if (this.client) {
3751
3761
  this.client.disconnect();
3752
3762
  };
package/lib/table-form.js CHANGED
@@ -7934,6 +7934,8 @@ var WebSocket = function () {
7934
7934
  this.connects = 1;
7935
7935
  this.recon = false;
7936
7936
  this.sendTimeout = null;
7937
+ this.socket = null;
7938
+ this.subscription = null;
7937
7939
  }
7938
7940
 
7939
7941
  /** socket连接 */
@@ -7944,14 +7946,12 @@ var WebSocket = function () {
7944
7946
 
7945
7947
  if (!this.client) {
7946
7948
  // 连接SockJS
7947
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
7948
- // 获取STOMP子协议的客户端对象
7949
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
7949
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
7950
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
7950
7951
  }
7951
7952
 
7952
7953
  // 日志不打印
7953
7954
  if (!this.debug) {
7954
- console.log(111);
7955
7955
  this.client.debug = function () {};
7956
7956
  }
7957
7957
 
@@ -7963,9 +7963,10 @@ var WebSocket = function () {
7963
7963
  // 订阅消息
7964
7964
  _this.subscribe();
7965
7965
  }, function (error) {
7966
+ _this.unsubscribe();
7967
+ _this.client = null;
7966
7968
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
7967
7969
  if (_this.connects > 5 && diffSecond < _this.interval) {
7968
- _this.client.disconnect();
7969
7970
  _this.error && _this.error(error);
7970
7971
  } else {
7971
7972
  _this.reconTimeout = setTimeout(function () {
@@ -7974,6 +7975,14 @@ var WebSocket = function () {
7974
7975
  }, 5000);
7975
7976
  }
7976
7977
  });
7978
+ }; // 清除订阅
7979
+
7980
+
7981
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
7982
+ if (this.subscription) {
7983
+ this.subscription.unsubscribe();
7984
+ this.subscription = null;
7985
+ }
7977
7986
  };
7978
7987
  /** 订阅服务端 */
7979
7988
 
@@ -7982,7 +7991,7 @@ var WebSocket = function () {
7982
7991
  var _this2 = this;
7983
7992
 
7984
7993
  // 订阅服务端提供的某个topic
7985
- this.client.subscribe(this.take, function (response) {
7994
+ this.subscription = this.client.subscribe(this.take, function (response) {
7986
7995
  if (response && (_this2.callback || _this2.success)) {
7987
7996
  var callback = _this2.callback || _this2.success;
7988
7997
  callback(JSON.parse(response.body));
@@ -8023,6 +8032,7 @@ var WebSocket = function () {
8023
8032
 
8024
8033
  WebSocket.prototype.destroy = function destroy() {
8025
8034
  // 断开连接,清除定时器
8035
+ this.unsubscribe();
8026
8036
  if (this.client) {
8027
8037
  this.client.disconnect();
8028
8038
  };
package/lib/tabs.js CHANGED
@@ -6209,6 +6209,8 @@ var WebSocket = function () {
6209
6209
  this.connects = 1;
6210
6210
  this.recon = false;
6211
6211
  this.sendTimeout = null;
6212
+ this.socket = null;
6213
+ this.subscription = null;
6212
6214
  }
6213
6215
 
6214
6216
  /** socket连接 */
@@ -6219,14 +6221,12 @@ var WebSocket = function () {
6219
6221
 
6220
6222
  if (!this.client) {
6221
6223
  // 连接SockJS
6222
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
6223
- // 获取STOMP子协议的客户端对象
6224
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
6224
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
6225
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
6225
6226
  }
6226
6227
 
6227
6228
  // 日志不打印
6228
6229
  if (!this.debug) {
6229
- console.log(111);
6230
6230
  this.client.debug = function () {};
6231
6231
  }
6232
6232
 
@@ -6238,9 +6238,10 @@ var WebSocket = function () {
6238
6238
  // 订阅消息
6239
6239
  _this.subscribe();
6240
6240
  }, function (error) {
6241
+ _this.unsubscribe();
6242
+ _this.client = null;
6241
6243
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
6242
6244
  if (_this.connects > 5 && diffSecond < _this.interval) {
6243
- _this.client.disconnect();
6244
6245
  _this.error && _this.error(error);
6245
6246
  } else {
6246
6247
  _this.reconTimeout = setTimeout(function () {
@@ -6249,6 +6250,14 @@ var WebSocket = function () {
6249
6250
  }, 5000);
6250
6251
  }
6251
6252
  });
6253
+ }; // 清除订阅
6254
+
6255
+
6256
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
6257
+ if (this.subscription) {
6258
+ this.subscription.unsubscribe();
6259
+ this.subscription = null;
6260
+ }
6252
6261
  };
6253
6262
  /** 订阅服务端 */
6254
6263
 
@@ -6257,7 +6266,7 @@ var WebSocket = function () {
6257
6266
  var _this2 = this;
6258
6267
 
6259
6268
  // 订阅服务端提供的某个topic
6260
- this.client.subscribe(this.take, function (response) {
6269
+ this.subscription = this.client.subscribe(this.take, function (response) {
6261
6270
  if (response && (_this2.callback || _this2.success)) {
6262
6271
  var callback = _this2.callback || _this2.success;
6263
6272
  callback(JSON.parse(response.body));
@@ -6298,6 +6307,7 @@ var WebSocket = function () {
6298
6307
 
6299
6308
  WebSocket.prototype.destroy = function destroy() {
6300
6309
  // 断开连接,清除定时器
6310
+ this.unsubscribe();
6301
6311
  if (this.client) {
6302
6312
  this.client.disconnect();
6303
6313
  };