eoss-ui 0.5.72 → 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 (63) 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 +31 -13
  7. package/lib/date-picker.js +16 -6
  8. package/lib/dialog.js +16 -6
  9. package/lib/eoss-ui.common.js +252 -115
  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 +128 -40
  21. package/lib/menu.js +3 -0
  22. package/lib/nav.js +73 -25
  23. package/lib/page.js +16 -6
  24. package/lib/player.js +16 -6
  25. package/lib/qr-code.js +16 -6
  26. package/lib/radio-group.js +16 -6
  27. package/lib/retrial-auth.js +16 -6
  28. package/lib/select-ganged.js +16 -6
  29. package/lib/select.js +17 -6
  30. package/lib/selector-panel.js +16 -6
  31. package/lib/selector.js +19 -9
  32. package/lib/sizer.js +16 -6
  33. package/lib/steps.js +16 -6
  34. package/lib/switch.js +16 -6
  35. package/lib/table-form.js +16 -6
  36. package/lib/tabs.js +16 -6
  37. package/lib/theme-chalk/index.css +1 -1
  38. package/lib/theme-chalk/main.css +1 -1
  39. package/lib/theme-chalk/nav.css +1 -1
  40. package/lib/tips.js +16 -6
  41. package/lib/tree-group.js +16 -6
  42. package/lib/tree.js +19 -9
  43. package/lib/upload.js +16 -6
  44. package/lib/utils/webSocket.js +16 -6
  45. package/lib/wujie.js +16 -6
  46. package/lib/wxlogin.js +16 -6
  47. package/package.json +2 -2
  48. package/packages/clients/src/main.vue +3 -1
  49. package/packages/data-table/src/main.vue +9 -7
  50. package/packages/login/src/resetPassword.vue +1 -1
  51. package/packages/main/src/main.vue +53 -14
  52. package/packages/menu/src/main.vue +3 -0
  53. package/packages/nav/src/main.vue +37 -8
  54. package/packages/select/src/main.vue +1 -0
  55. package/packages/selector/src/main.vue +1 -1
  56. package/packages/theme-chalk/lib/index.css +1 -1
  57. package/packages/theme-chalk/lib/main.css +1 -1
  58. package/packages/theme-chalk/lib/nav.css +1 -1
  59. package/packages/theme-chalk/src/main.scss +3 -1
  60. package/packages/theme-chalk/src/nav.scss +4 -1
  61. package/packages/tree/src/main.vue +1 -1
  62. package/src/index.js +1 -1
  63. 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=3f63e2ce&
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
  },
@@ -3708,7 +3715,7 @@ var render = function () {
3708
3715
  _vm.showTitle
3709
3716
  ? _c(
3710
3717
  "div",
3711
- { staticClass: "es-nav-title" },
3718
+ { ref: "navTitle", staticClass: "es-nav-title" },
3712
3719
  [
3713
3720
  _c(
3714
3721
  "span",
@@ -3767,6 +3774,7 @@ var render = function () {
3767
3774
  collapse: _vm.isCollapse,
3768
3775
  "default-active": _vm.menuActive,
3769
3776
  width: _vm.isTop ? _vm.boxWidth : _vm.menuWidth,
3777
+ height: _vm.menuHeight,
3770
3778
  "is-default": _vm.isDefault,
3771
3779
  biserial: _vm.biserial,
3772
3780
  paddingLeft: _vm.paddingLeft,
@@ -3818,11 +3826,14 @@ var staticRenderFns = []
3818
3826
  render._withStripped = true
3819
3827
 
3820
3828
 
3821
- // CONCATENATED MODULE: ./packages/nav/src/main.vue?vue&type=template&id=3f63e2ce&
3829
+ // CONCATENATED MODULE: ./packages/nav/src/main.vue?vue&type=template&id=ccb38c80&
3822
3830
 
3823
3831
  // EXTERNAL MODULE: ./src/utils/util.js
3824
3832
  var util = __webpack_require__(0);
3825
3833
 
3834
+ // EXTERNAL MODULE: external "throttle-debounce"
3835
+ var external_throttle_debounce_ = __webpack_require__(11);
3836
+
3826
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&
3827
3838
  //
3828
3839
  //
@@ -3914,6 +3925,8 @@ var util = __webpack_require__(0);
3914
3925
  //
3915
3926
  //
3916
3927
  //
3928
+ //
3929
+
3917
3930
 
3918
3931
 
3919
3932
  /* harmony default export */ var mainvue_type_script_lang_js_ = ({
@@ -3956,12 +3969,17 @@ var util = __webpack_require__(0);
3956
3969
  type: Boolean,
3957
3970
  default: true
3958
3971
  },
3959
- overlap: Boolean
3972
+ overlap: Boolean,
3973
+ //隐藏菜单
3974
+ hideSubMenu: Boolean
3960
3975
  },
3961
3976
  computed: {
3962
3977
  show: function show() {
3963
3978
  return this.overlap && this.subMenu.length;
3964
3979
  },
3980
+ showMenu: function showMenu() {
3981
+ return this.biserial ? this.subMenu.length : this.menu.length;
3982
+ },
3965
3983
  menu: function menu() {
3966
3984
  return this.data;
3967
3985
  },
@@ -3990,7 +4008,7 @@ var util = __webpack_require__(0);
3990
4008
  return this.navWidth;
3991
4009
  }
3992
4010
  }
3993
- 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;
3994
4012
  },
3995
4013
  _navWidth: function _navWidth() {
3996
4014
  return this.overlap ? parseInt(this.navWidth, 10) - 30 + 'px' : this.navWidth;
@@ -4005,11 +4023,14 @@ var util = __webpack_require__(0);
4005
4023
  this.headline = val;
4006
4024
  }
4007
4025
  },
4026
+ boxWidth: function boxWidth() {
4027
+ this.getHeight();
4028
+ },
4008
4029
 
4009
4030
  biserial: {
4010
4031
  handler: function handler(val) {
4011
4032
  this.isShow = !val;
4012
- this.resetHeight();
4033
+ this.getHeight();
4013
4034
  }
4014
4035
  },
4015
4036
  defaultActive: {
@@ -4059,6 +4080,11 @@ var util = __webpack_require__(0);
4059
4080
  } else {
4060
4081
  this.subMenu = [];
4061
4082
  }
4083
+ },
4084
+ showMenu: function showMenu(val) {
4085
+ if (val) {
4086
+ this.getHeight();
4087
+ }
4062
4088
  }
4063
4089
  },
4064
4090
  data: function data() {
@@ -4073,15 +4099,22 @@ var util = __webpack_require__(0);
4073
4099
  subMenu: []
4074
4100
  };
4075
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
+ },
4076
4109
  mounted: function mounted() {
4077
- this.resetHeight();
4110
+ this.getHeight();
4078
4111
  this.move();
4079
4112
  },
4080
4113
 
4081
4114
  methods: {
4082
4115
  //设置按钮拖动
4083
4116
  move: function move() {
4084
- var _this3 = this;
4117
+ var _this4 = this;
4085
4118
 
4086
4119
  var area = this.$refs.area.$el;
4087
4120
  var box = this.$refs.box;
@@ -4133,7 +4166,7 @@ var util = __webpack_require__(0);
4133
4166
  var isClick = eTime - sTime < 200;
4134
4167
  if (isClick) {
4135
4168
  var onArea = function onArea() {
4136
- _this3.subMenu = [];
4169
+ _this4.subMenu = [];
4137
4170
  area.removeEventListener('click', onArea);
4138
4171
  };
4139
4172
  area.addEventListener('click', onArea);
@@ -4179,12 +4212,12 @@ var util = __webpack_require__(0);
4179
4212
  this.$emit('close', res);
4180
4213
  },
4181
4214
  resetHeight: function resetHeight() {
4182
- var _this4 = this;
4215
+ var _this5 = this;
4183
4216
 
4184
4217
  this.$nextTick(function () {
4185
- var height = _this4.$refs.esNav.parentNode.offsetHeight;
4186
- Array.from(_this4.$refs.esNav.parentNode.children).forEach(function (item) {
4187
- 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) {
4188
4221
  var mt = util["a" /* default */].getStyle(item, 'margin-top');
4189
4222
  var mb = util["a" /* default */].getStyle(item, 'margin-bottom');
4190
4223
  mt = mt ? parseInt(mt, 10) : 0;
@@ -4192,11 +4225,16 @@ var util = __webpack_require__(0);
4192
4225
  height -= item.offsetHeight + mt + mb;
4193
4226
  }
4194
4227
  });
4195
- if (_this4.overlap) {
4228
+ if (_this5.overlap) {
4196
4229
  height -= 15;
4197
4230
  }
4198
- _this4.height = height + 'px';
4199
- _this4.menuHeight = _this4.showTitle ? height - 49 + 'px' : height + 'px';
4231
+ _this5.height = height + 'px';
4232
+ if (_this5.showTitle) {
4233
+ var theight = _this5.$refs.navTitle.offsetHeight;
4234
+ _this5.menuHeight = height - theight + 'px';
4235
+ } else {
4236
+ _this5.menuHeight = height + 'px';
4237
+ }
4200
4238
  });
4201
4239
  }
4202
4240
  }
@@ -4274,6 +4312,8 @@ var WebSocket = function () {
4274
4312
  this.connects = 1;
4275
4313
  this.recon = false;
4276
4314
  this.sendTimeout = null;
4315
+ this.socket = null;
4316
+ this.subscription = null;
4277
4317
  }
4278
4318
 
4279
4319
  /** socket连接 */
@@ -4284,14 +4324,12 @@ var WebSocket = function () {
4284
4324
 
4285
4325
  if (!this.client) {
4286
4326
  // 连接SockJS
4287
- var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
4288
- // 获取STOMP子协议的客户端对象
4289
- 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);
4290
4329
  }
4291
4330
 
4292
4331
  // 日志不打印
4293
4332
  if (!this.debug) {
4294
- console.log(111);
4295
4333
  this.client.debug = function () {};
4296
4334
  }
4297
4335
 
@@ -4303,9 +4341,10 @@ var WebSocket = function () {
4303
4341
  // 订阅消息
4304
4342
  _this.subscribe();
4305
4343
  }, function (error) {
4344
+ _this.unsubscribe();
4345
+ _this.client = null;
4306
4346
  var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
4307
4347
  if (_this.connects > 5 && diffSecond < _this.interval) {
4308
- _this.client.disconnect();
4309
4348
  _this.error && _this.error(error);
4310
4349
  } else {
4311
4350
  _this.reconTimeout = setTimeout(function () {
@@ -4314,6 +4353,14 @@ var WebSocket = function () {
4314
4353
  }, 5000);
4315
4354
  }
4316
4355
  });
4356
+ }; // 清除订阅
4357
+
4358
+
4359
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
4360
+ if (this.subscription) {
4361
+ this.subscription.unsubscribe();
4362
+ this.subscription = null;
4363
+ }
4317
4364
  };
4318
4365
  /** 订阅服务端 */
4319
4366
 
@@ -4322,7 +4369,7 @@ var WebSocket = function () {
4322
4369
  var _this2 = this;
4323
4370
 
4324
4371
  // 订阅服务端提供的某个topic
4325
- this.client.subscribe(this.take, function (response) {
4372
+ this.subscription = this.client.subscribe(this.take, function (response) {
4326
4373
  if (response && (_this2.callback || _this2.success)) {
4327
4374
  var callback = _this2.callback || _this2.success;
4328
4375
  callback(JSON.parse(response.body));
@@ -4363,6 +4410,7 @@ var WebSocket = function () {
4363
4410
 
4364
4411
  WebSocket.prototype.destroy = function destroy() {
4365
4412
  // 断开连接,清除定时器
4413
+ this.unsubscribe();
4366
4414
  if (this.client) {
4367
4415
  this.client.disconnect();
4368
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
  };