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/nav.js CHANGED
@@ -3495,6 +3495,13 @@ module.exports = require("sm-crypto");
3495
3495
 
3496
3496
  /***/ }),
3497
3497
 
3498
+ /***/ 11:
3499
+ /***/ (function(module, exports) {
3500
+
3501
+ module.exports = require("throttle-debounce");
3502
+
3503
+ /***/ }),
3504
+
3498
3505
  /***/ 2:
3499
3506
  /***/ (function(module, exports) {
3500
3507
 
@@ -3628,7 +3635,7 @@ module.exports = require("axios");
3628
3635
  // ESM COMPAT FLAG
3629
3636
  __webpack_require__.r(__webpack_exports__);
3630
3637
 
3631
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/nav/src/main.vue?vue&type=template&id=7b4319fb&
3638
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/nav/src/main.vue?vue&type=template&id=ccb38c80&
3632
3639
  var render = function () {
3633
3640
  var _vm = this
3634
3641
  var _h = _vm.$createElement
@@ -3692,15 +3699,15 @@ var render = function () {
3692
3699
  {
3693
3700
  name: "show",
3694
3701
  rawName: "v-show",
3695
- value: _vm.biserial ? _vm.subMenu.length : _vm.menu.length,
3696
- expression: "biserial ? subMenu.length : menu.length",
3702
+ value: _vm.showMenu,
3703
+ expression: "showMenu",
3697
3704
  },
3698
3705
  ],
3699
3706
  staticClass: "es-nav-main",
3700
3707
  class: { "es-nav-overlap": _vm.overlap },
3701
3708
  style: {
3702
3709
  width: _vm.biserial ? _vm.width : _vm.boxWidth,
3703
- left: _vm.show ? "15px" : _vm.navWidth,
3710
+ left: _vm.biserial ? (_vm.show ? "15px" : _vm.navWidth) : "",
3704
3711
  },
3705
3712
  attrs: { biserial: _vm.biserial },
3706
3713
  },
@@ -3819,11 +3826,14 @@ var staticRenderFns = []
3819
3826
  render._withStripped = true
3820
3827
 
3821
3828
 
3822
- // CONCATENATED MODULE: ./packages/nav/src/main.vue?vue&type=template&id=7b4319fb&
3829
+ // CONCATENATED MODULE: ./packages/nav/src/main.vue?vue&type=template&id=ccb38c80&
3823
3830
 
3824
3831
  // EXTERNAL MODULE: ./src/utils/util.js
3825
3832
  var util = __webpack_require__(0);
3826
3833
 
3834
+ // EXTERNAL MODULE: external "throttle-debounce"
3835
+ var external_throttle_debounce_ = __webpack_require__(11);
3836
+
3827
3837
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/nav/src/main.vue?vue&type=script&lang=js&
3828
3838
  //
3829
3839
  //
@@ -3918,6 +3928,7 @@ var util = __webpack_require__(0);
3918
3928
  //
3919
3929
 
3920
3930
 
3931
+
3921
3932
  /* harmony default export */ var mainvue_type_script_lang_js_ = ({
3922
3933
  name: 'EsNav',
3923
3934
  inheritAttrs: false,
@@ -3958,7 +3969,9 @@ var util = __webpack_require__(0);
3958
3969
  type: Boolean,
3959
3970
  default: true
3960
3971
  },
3961
- overlap: Boolean
3972
+ overlap: Boolean,
3973
+ //隐藏菜单
3974
+ hideSubMenu: Boolean
3962
3975
  },
3963
3976
  computed: {
3964
3977
  show: function show() {
@@ -3995,7 +4008,7 @@ var util = __webpack_require__(0);
3995
4008
  return this.navWidth;
3996
4009
  }
3997
4010
  }
3998
- return this.subMenu && this.subMenu.length && this.isShow && !this.overlap ? parseInt(this.width, 10) + parseInt(this.navWidth, 10) + 'px' : this.navWidth;
4011
+ return this.subMenu && this.subMenu.length && this.isShow && !this.overlap && !this.hideSubMenu ? parseInt(this.width, 10) + parseInt(this.navWidth, 10) + 'px' : this.navWidth;
3999
4012
  },
4000
4013
  _navWidth: function _navWidth() {
4001
4014
  return this.overlap ? parseInt(this.navWidth, 10) - 30 + 'px' : this.navWidth;
@@ -4010,11 +4023,14 @@ var util = __webpack_require__(0);
4010
4023
  this.headline = val;
4011
4024
  }
4012
4025
  },
4026
+ boxWidth: function boxWidth() {
4027
+ this.getHeight();
4028
+ },
4013
4029
 
4014
4030
  biserial: {
4015
4031
  handler: function handler(val) {
4016
4032
  this.isShow = !val;
4017
- this.resetHeight();
4033
+ this.getHeight();
4018
4034
  }
4019
4035
  },
4020
4036
  defaultActive: {
@@ -4065,8 +4081,10 @@ var util = __webpack_require__(0);
4065
4081
  this.subMenu = [];
4066
4082
  }
4067
4083
  },
4068
- showMenu: function showMenu() {
4069
- this.resetHeight();
4084
+ showMenu: function showMenu(val) {
4085
+ if (val) {
4086
+ this.getHeight();
4087
+ }
4070
4088
  }
4071
4089
  },
4072
4090
  data: function data() {
@@ -4081,15 +4099,22 @@ var util = __webpack_require__(0);
4081
4099
  subMenu: []
4082
4100
  };
4083
4101
  },
4102
+ beforeCreate: function beforeCreate() {
4103
+ var _this3 = this;
4104
+
4105
+ this.getHeight = Object(external_throttle_debounce_["debounce"])(500, function () {
4106
+ _this3.resetHeight();
4107
+ });
4108
+ },
4084
4109
  mounted: function mounted() {
4085
- this.resetHeight();
4110
+ this.getHeight();
4086
4111
  this.move();
4087
4112
  },
4088
4113
 
4089
4114
  methods: {
4090
4115
  //设置按钮拖动
4091
4116
  move: function move() {
4092
- var _this3 = this;
4117
+ var _this4 = this;
4093
4118
 
4094
4119
  var area = this.$refs.area.$el;
4095
4120
  var box = this.$refs.box;
@@ -4141,7 +4166,7 @@ var util = __webpack_require__(0);
4141
4166
  var isClick = eTime - sTime < 200;
4142
4167
  if (isClick) {
4143
4168
  var onArea = function onArea() {
4144
- _this3.subMenu = [];
4169
+ _this4.subMenu = [];
4145
4170
  area.removeEventListener('click', onArea);
4146
4171
  };
4147
4172
  area.addEventListener('click', onArea);
@@ -4187,12 +4212,12 @@ var util = __webpack_require__(0);
4187
4212
  this.$emit('close', res);
4188
4213
  },
4189
4214
  resetHeight: function resetHeight() {
4190
- var _this4 = this;
4215
+ var _this5 = this;
4191
4216
 
4192
4217
  this.$nextTick(function () {
4193
- var height = _this4.$refs.esNav.parentNode.offsetHeight;
4194
- Array.from(_this4.$refs.esNav.parentNode.children).forEach(function (item) {
4195
- if (item !== _this4.$refs.esNav) {
4218
+ var height = _this5.$refs.esNav.parentNode.offsetHeight;
4219
+ Array.from(_this5.$refs.esNav.parentNode.children).forEach(function (item) {
4220
+ if (item !== _this5.$refs.esNav) {
4196
4221
  var mt = util["a" /* default */].getStyle(item, 'margin-top');
4197
4222
  var mb = util["a" /* default */].getStyle(item, 'margin-bottom');
4198
4223
  mt = mt ? parseInt(mt, 10) : 0;
@@ -4200,15 +4225,15 @@ var util = __webpack_require__(0);
4200
4225
  height -= item.offsetHeight + mt + mb;
4201
4226
  }
4202
4227
  });
4203
- if (_this4.overlap) {
4228
+ if (_this5.overlap) {
4204
4229
  height -= 15;
4205
4230
  }
4206
- _this4.height = height + 'px';
4207
- if (_this4.showTitle) {
4208
- var theight = _this4.$refs.navTitle.offsetHeight;
4209
- _this4.menuHeight = height - theight + 'px';
4231
+ _this5.height = height + 'px';
4232
+ if (_this5.showTitle) {
4233
+ var theight = _this5.$refs.navTitle.offsetHeight;
4234
+ _this5.menuHeight = height - theight + 'px';
4210
4235
  } else {
4211
- _this4.menuHeight = height + 'px';
4236
+ _this5.menuHeight = height + 'px';
4212
4237
  }
4213
4238
  });
4214
4239
  }
@@ -4287,6 +4312,8 @@ var WebSocket = function () {
4287
4312
  this.connects = 1;
4288
4313
  this.recon = false;
4289
4314
  this.sendTimeout = null;
4315
+ this.socket = null;
4316
+ this.subscription = null;
4290
4317
  }
4291
4318
 
4292
4319
  /** socket连接 */
@@ -4297,14 +4324,12 @@ var WebSocket = function () {
4297
4324
 
4298
4325
  if (!this.client) {
4299
4326
  // 连接SockJS
4300
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
4301
- // 获取STOMP子协议的客户端对象
4302
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
4327
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
4328
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
4303
4329
  }
4304
4330
 
4305
4331
  // 日志不打印
4306
4332
  if (!this.debug) {
4307
- console.log(111);
4308
4333
  this.client.debug = function () {};
4309
4334
  }
4310
4335
 
@@ -4316,9 +4341,10 @@ var WebSocket = function () {
4316
4341
  // 订阅消息
4317
4342
  _this.subscribe();
4318
4343
  }, function (error) {
4344
+ _this.unsubscribe();
4345
+ _this.client = null;
4319
4346
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
4320
4347
  if (_this.connects > 5 && diffSecond < _this.interval) {
4321
- _this.client.disconnect();
4322
4348
  _this.error && _this.error(error);
4323
4349
  } else {
4324
4350
  _this.reconTimeout = setTimeout(function () {
@@ -4327,6 +4353,14 @@ var WebSocket = function () {
4327
4353
  }, 5000);
4328
4354
  }
4329
4355
  });
4356
+ }; // 清除订阅
4357
+
4358
+
4359
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
4360
+ if (this.subscription) {
4361
+ this.subscription.unsubscribe();
4362
+ this.subscription = null;
4363
+ }
4330
4364
  };
4331
4365
  /** 订阅服务端 */
4332
4366
 
@@ -4335,7 +4369,7 @@ var WebSocket = function () {
4335
4369
  var _this2 = this;
4336
4370
 
4337
4371
  // 订阅服务端提供的某个topic
4338
- this.client.subscribe(this.take, function (response) {
4372
+ this.subscription = this.client.subscribe(this.take, function (response) {
4339
4373
  if (response && (_this2.callback || _this2.success)) {
4340
4374
  var callback = _this2.callback || _this2.success;
4341
4375
  callback(JSON.parse(response.body));
@@ -4376,6 +4410,7 @@ var WebSocket = function () {
4376
4410
 
4377
4411
  WebSocket.prototype.destroy = function destroy() {
4378
4412
  // 断开连接,清除定时器
4413
+ this.unsubscribe();
4379
4414
  if (this.client) {
4380
4415
  this.client.disconnect();
4381
4416
  };
package/lib/page.js CHANGED
@@ -4084,6 +4084,8 @@ var WebSocket = function () {
4084
4084
  this.connects = 1;
4085
4085
  this.recon = false;
4086
4086
  this.sendTimeout = null;
4087
+ this.socket = null;
4088
+ this.subscription = null;
4087
4089
  }
4088
4090
 
4089
4091
  /** socket连接 */
@@ -4094,14 +4096,12 @@ var WebSocket = function () {
4094
4096
 
4095
4097
  if (!this.client) {
4096
4098
  // 连接SockJS
4097
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
4098
- // 获取STOMP子协议的客户端对象
4099
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
4099
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
4100
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
4100
4101
  }
4101
4102
 
4102
4103
  // 日志不打印
4103
4104
  if (!this.debug) {
4104
- console.log(111);
4105
4105
  this.client.debug = function () {};
4106
4106
  }
4107
4107
 
@@ -4113,9 +4113,10 @@ var WebSocket = function () {
4113
4113
  // 订阅消息
4114
4114
  _this.subscribe();
4115
4115
  }, function (error) {
4116
+ _this.unsubscribe();
4117
+ _this.client = null;
4116
4118
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
4117
4119
  if (_this.connects > 5 && diffSecond < _this.interval) {
4118
- _this.client.disconnect();
4119
4120
  _this.error && _this.error(error);
4120
4121
  } else {
4121
4122
  _this.reconTimeout = setTimeout(function () {
@@ -4124,6 +4125,14 @@ var WebSocket = function () {
4124
4125
  }, 5000);
4125
4126
  }
4126
4127
  });
4128
+ }; // 清除订阅
4129
+
4130
+
4131
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
4132
+ if (this.subscription) {
4133
+ this.subscription.unsubscribe();
4134
+ this.subscription = null;
4135
+ }
4127
4136
  };
4128
4137
  /** 订阅服务端 */
4129
4138
 
@@ -4132,7 +4141,7 @@ var WebSocket = function () {
4132
4141
  var _this2 = this;
4133
4142
 
4134
4143
  // 订阅服务端提供的某个topic
4135
- this.client.subscribe(this.take, function (response) {
4144
+ this.subscription = this.client.subscribe(this.take, function (response) {
4136
4145
  if (response && (_this2.callback || _this2.success)) {
4137
4146
  var callback = _this2.callback || _this2.success;
4138
4147
  callback(JSON.parse(response.body));
@@ -4173,6 +4182,7 @@ var WebSocket = function () {
4173
4182
 
4174
4183
  WebSocket.prototype.destroy = function destroy() {
4175
4184
  // 断开连接,清除定时器
4185
+ this.unsubscribe();
4176
4186
  if (this.client) {
4177
4187
  this.client.disconnect();
4178
4188
  };
package/lib/player.js CHANGED
@@ -3952,6 +3952,8 @@ var WebSocket = function () {
3952
3952
  this.connects = 1;
3953
3953
  this.recon = false;
3954
3954
  this.sendTimeout = null;
3955
+ this.socket = null;
3956
+ this.subscription = null;
3955
3957
  }
3956
3958
 
3957
3959
  /** socket连接 */
@@ -3962,14 +3964,12 @@ var WebSocket = function () {
3962
3964
 
3963
3965
  if (!this.client) {
3964
3966
  // 连接SockJS
3965
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
3966
- // 获取STOMP子协议的客户端对象
3967
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
3967
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
3968
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
3968
3969
  }
3969
3970
 
3970
3971
  // 日志不打印
3971
3972
  if (!this.debug) {
3972
- console.log(111);
3973
3973
  this.client.debug = function () {};
3974
3974
  }
3975
3975
 
@@ -3981,9 +3981,10 @@ var WebSocket = function () {
3981
3981
  // 订阅消息
3982
3982
  _this.subscribe();
3983
3983
  }, function (error) {
3984
+ _this.unsubscribe();
3985
+ _this.client = null;
3984
3986
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
3985
3987
  if (_this.connects > 5 && diffSecond < _this.interval) {
3986
- _this.client.disconnect();
3987
3988
  _this.error && _this.error(error);
3988
3989
  } else {
3989
3990
  _this.reconTimeout = setTimeout(function () {
@@ -3992,6 +3993,14 @@ var WebSocket = function () {
3992
3993
  }, 5000);
3993
3994
  }
3994
3995
  });
3996
+ }; // 清除订阅
3997
+
3998
+
3999
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
4000
+ if (this.subscription) {
4001
+ this.subscription.unsubscribe();
4002
+ this.subscription = null;
4003
+ }
3995
4004
  };
3996
4005
  /** 订阅服务端 */
3997
4006
 
@@ -4000,7 +4009,7 @@ var WebSocket = function () {
4000
4009
  var _this2 = this;
4001
4010
 
4002
4011
  // 订阅服务端提供的某个topic
4003
- this.client.subscribe(this.take, function (response) {
4012
+ this.subscription = this.client.subscribe(this.take, function (response) {
4004
4013
  if (response && (_this2.callback || _this2.success)) {
4005
4014
  var callback = _this2.callback || _this2.success;
4006
4015
  callback(JSON.parse(response.body));
@@ -4041,6 +4050,7 @@ var WebSocket = function () {
4041
4050
 
4042
4051
  WebSocket.prototype.destroy = function destroy() {
4043
4052
  // 断开连接,清除定时器
4053
+ this.unsubscribe();
4044
4054
  if (this.client) {
4045
4055
  this.client.disconnect();
4046
4056
  };
package/lib/qr-code.js CHANGED
@@ -3906,6 +3906,8 @@ var WebSocket = function () {
3906
3906
  this.connects = 1;
3907
3907
  this.recon = false;
3908
3908
  this.sendTimeout = null;
3909
+ this.socket = null;
3910
+ this.subscription = null;
3909
3911
  }
3910
3912
 
3911
3913
  /** socket连接 */
@@ -3916,14 +3918,12 @@ var WebSocket = function () {
3916
3918
 
3917
3919
  if (!this.client) {
3918
3920
  // 连接SockJS
3919
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
3920
- // 获取STOMP子协议的客户端对象
3921
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
3921
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
3922
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
3922
3923
  }
3923
3924
 
3924
3925
  // 日志不打印
3925
3926
  if (!this.debug) {
3926
- console.log(111);
3927
3927
  this.client.debug = function () {};
3928
3928
  }
3929
3929
 
@@ -3935,9 +3935,10 @@ var WebSocket = function () {
3935
3935
  // 订阅消息
3936
3936
  _this.subscribe();
3937
3937
  }, function (error) {
3938
+ _this.unsubscribe();
3939
+ _this.client = null;
3938
3940
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
3939
3941
  if (_this.connects > 5 && diffSecond < _this.interval) {
3940
- _this.client.disconnect();
3941
3942
  _this.error && _this.error(error);
3942
3943
  } else {
3943
3944
  _this.reconTimeout = setTimeout(function () {
@@ -3946,6 +3947,14 @@ var WebSocket = function () {
3946
3947
  }, 5000);
3947
3948
  }
3948
3949
  });
3950
+ }; // 清除订阅
3951
+
3952
+
3953
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
3954
+ if (this.subscription) {
3955
+ this.subscription.unsubscribe();
3956
+ this.subscription = null;
3957
+ }
3949
3958
  };
3950
3959
  /** 订阅服务端 */
3951
3960
 
@@ -3954,7 +3963,7 @@ var WebSocket = function () {
3954
3963
  var _this2 = this;
3955
3964
 
3956
3965
  // 订阅服务端提供的某个topic
3957
- this.client.subscribe(this.take, function (response) {
3966
+ this.subscription = this.client.subscribe(this.take, function (response) {
3958
3967
  if (response && (_this2.callback || _this2.success)) {
3959
3968
  var callback = _this2.callback || _this2.success;
3960
3969
  callback(JSON.parse(response.body));
@@ -3995,6 +4004,7 @@ var WebSocket = function () {
3995
4004
 
3996
4005
  WebSocket.prototype.destroy = function destroy() {
3997
4006
  // 断开连接,清除定时器
4007
+ this.unsubscribe();
3998
4008
  if (this.client) {
3999
4009
  this.client.disconnect();
4000
4010
  };
@@ -4220,6 +4220,8 @@ var WebSocket = function () {
4220
4220
  this.connects = 1;
4221
4221
  this.recon = false;
4222
4222
  this.sendTimeout = null;
4223
+ this.socket = null;
4224
+ this.subscription = null;
4223
4225
  }
4224
4226
 
4225
4227
  /** socket连接 */
@@ -4230,14 +4232,12 @@ var WebSocket = function () {
4230
4232
 
4231
4233
  if (!this.client) {
4232
4234
  // 连接SockJS
4233
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
4234
- // 获取STOMP子协议的客户端对象
4235
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
4235
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
4236
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
4236
4237
  }
4237
4238
 
4238
4239
  // 日志不打印
4239
4240
  if (!this.debug) {
4240
- console.log(111);
4241
4241
  this.client.debug = function () {};
4242
4242
  }
4243
4243
 
@@ -4249,9 +4249,10 @@ var WebSocket = function () {
4249
4249
  // 订阅消息
4250
4250
  _this.subscribe();
4251
4251
  }, function (error) {
4252
+ _this.unsubscribe();
4253
+ _this.client = null;
4252
4254
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
4253
4255
  if (_this.connects > 5 && diffSecond < _this.interval) {
4254
- _this.client.disconnect();
4255
4256
  _this.error && _this.error(error);
4256
4257
  } else {
4257
4258
  _this.reconTimeout = setTimeout(function () {
@@ -4260,6 +4261,14 @@ var WebSocket = function () {
4260
4261
  }, 5000);
4261
4262
  }
4262
4263
  });
4264
+ }; // 清除订阅
4265
+
4266
+
4267
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
4268
+ if (this.subscription) {
4269
+ this.subscription.unsubscribe();
4270
+ this.subscription = null;
4271
+ }
4263
4272
  };
4264
4273
  /** 订阅服务端 */
4265
4274
 
@@ -4268,7 +4277,7 @@ var WebSocket = function () {
4268
4277
  var _this2 = this;
4269
4278
 
4270
4279
  // 订阅服务端提供的某个topic
4271
- this.client.subscribe(this.take, function (response) {
4280
+ this.subscription = this.client.subscribe(this.take, function (response) {
4272
4281
  if (response && (_this2.callback || _this2.success)) {
4273
4282
  var callback = _this2.callback || _this2.success;
4274
4283
  callback(JSON.parse(response.body));
@@ -4309,6 +4318,7 @@ var WebSocket = function () {
4309
4318
 
4310
4319
  WebSocket.prototype.destroy = function destroy() {
4311
4320
  // 断开连接,清除定时器
4321
+ this.unsubscribe();
4312
4322
  if (this.client) {
4313
4323
  this.client.disconnect();
4314
4324
  };
@@ -4141,6 +4141,8 @@ var WebSocket = function () {
4141
4141
  this.connects = 1;
4142
4142
  this.recon = false;
4143
4143
  this.sendTimeout = null;
4144
+ this.socket = null;
4145
+ this.subscription = null;
4144
4146
  }
4145
4147
 
4146
4148
  /** socket连接 */
@@ -4151,14 +4153,12 @@ var WebSocket = function () {
4151
4153
 
4152
4154
  if (!this.client) {
4153
4155
  // 连接SockJS
4154
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
4155
- // 获取STOMP子协议的客户端对象
4156
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
4156
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
4157
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
4157
4158
  }
4158
4159
 
4159
4160
  // 日志不打印
4160
4161
  if (!this.debug) {
4161
- console.log(111);
4162
4162
  this.client.debug = function () {};
4163
4163
  }
4164
4164
 
@@ -4170,9 +4170,10 @@ var WebSocket = function () {
4170
4170
  // 订阅消息
4171
4171
  _this.subscribe();
4172
4172
  }, function (error) {
4173
+ _this.unsubscribe();
4174
+ _this.client = null;
4173
4175
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
4174
4176
  if (_this.connects > 5 && diffSecond < _this.interval) {
4175
- _this.client.disconnect();
4176
4177
  _this.error && _this.error(error);
4177
4178
  } else {
4178
4179
  _this.reconTimeout = setTimeout(function () {
@@ -4181,6 +4182,14 @@ var WebSocket = function () {
4181
4182
  }, 5000);
4182
4183
  }
4183
4184
  });
4185
+ }; // 清除订阅
4186
+
4187
+
4188
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
4189
+ if (this.subscription) {
4190
+ this.subscription.unsubscribe();
4191
+ this.subscription = null;
4192
+ }
4184
4193
  };
4185
4194
  /** 订阅服务端 */
4186
4195
 
@@ -4189,7 +4198,7 @@ var WebSocket = function () {
4189
4198
  var _this2 = this;
4190
4199
 
4191
4200
  // 订阅服务端提供的某个topic
4192
- this.client.subscribe(this.take, function (response) {
4201
+ this.subscription = this.client.subscribe(this.take, function (response) {
4193
4202
  if (response && (_this2.callback || _this2.success)) {
4194
4203
  var callback = _this2.callback || _this2.success;
4195
4204
  callback(JSON.parse(response.body));
@@ -4230,6 +4239,7 @@ var WebSocket = function () {
4230
4239
 
4231
4240
  WebSocket.prototype.destroy = function destroy() {
4232
4241
  // 断开连接,清除定时器
4242
+ this.unsubscribe();
4233
4243
  if (this.client) {
4234
4244
  this.client.disconnect();
4235
4245
  };
@@ -3665,6 +3665,8 @@ var WebSocket = function () {
3665
3665
  this.connects = 1;
3666
3666
  this.recon = false;
3667
3667
  this.sendTimeout = null;
3668
+ this.socket = null;
3669
+ this.subscription = null;
3668
3670
  }
3669
3671
 
3670
3672
  /** socket连接 */
@@ -3675,14 +3677,12 @@ var WebSocket = function () {
3675
3677
 
3676
3678
  if (!this.client) {
3677
3679
  // 连接SockJS
3678
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
3679
- // 获取STOMP子协议的客户端对象
3680
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
3680
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
3681
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
3681
3682
  }
3682
3683
 
3683
3684
  // 日志不打印
3684
3685
  if (!this.debug) {
3685
- console.log(111);
3686
3686
  this.client.debug = function () {};
3687
3687
  }
3688
3688
 
@@ -3694,9 +3694,10 @@ var WebSocket = function () {
3694
3694
  // 订阅消息
3695
3695
  _this.subscribe();
3696
3696
  }, function (error) {
3697
+ _this.unsubscribe();
3698
+ _this.client = null;
3697
3699
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
3698
3700
  if (_this.connects > 5 && diffSecond < _this.interval) {
3699
- _this.client.disconnect();
3700
3701
  _this.error && _this.error(error);
3701
3702
  } else {
3702
3703
  _this.reconTimeout = setTimeout(function () {
@@ -3705,6 +3706,14 @@ var WebSocket = function () {
3705
3706
  }, 5000);
3706
3707
  }
3707
3708
  });
3709
+ }; // 清除订阅
3710
+
3711
+
3712
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
3713
+ if (this.subscription) {
3714
+ this.subscription.unsubscribe();
3715
+ this.subscription = null;
3716
+ }
3708
3717
  };
3709
3718
  /** 订阅服务端 */
3710
3719
 
@@ -3713,7 +3722,7 @@ var WebSocket = function () {
3713
3722
  var _this2 = this;
3714
3723
 
3715
3724
  // 订阅服务端提供的某个topic
3716
- this.client.subscribe(this.take, function (response) {
3725
+ this.subscription = this.client.subscribe(this.take, function (response) {
3717
3726
  if (response && (_this2.callback || _this2.success)) {
3718
3727
  var callback = _this2.callback || _this2.success;
3719
3728
  callback(JSON.parse(response.body));
@@ -3754,6 +3763,7 @@ var WebSocket = function () {
3754
3763
 
3755
3764
  WebSocket.prototype.destroy = function destroy() {
3756
3765
  // 断开连接,清除定时器
3766
+ this.unsubscribe();
3757
3767
  if (this.client) {
3758
3768
  this.client.disconnect();
3759
3769
  };