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.
- package/lib/button-group.js +16 -6
- package/lib/button.js +16 -6
- package/lib/checkbox-group.js +16 -6
- package/lib/clients.js +16 -7
- package/lib/data-table-form.js +16 -6
- package/lib/data-table.js +16 -6
- package/lib/date-picker.js +16 -6
- package/lib/dialog.js +16 -6
- package/lib/eoss-ui.common.js +176 -82
- package/lib/flow-group.js +16 -6
- package/lib/flow-list.js +16 -6
- package/lib/flow.js +16 -6
- package/lib/form.js +16 -6
- package/lib/handle-user.js +16 -6
- package/lib/handler.js +16 -6
- package/lib/index.js +1 -1
- package/lib/input-number.js +16 -6
- package/lib/input.js +16 -6
- package/lib/login.js +24 -14
- package/lib/main.js +98 -28
- package/lib/nav.js +64 -29
- package/lib/page.js +16 -6
- package/lib/player.js +16 -6
- package/lib/qr-code.js +16 -6
- package/lib/radio-group.js +16 -6
- package/lib/retrial-auth.js +16 -6
- package/lib/select-ganged.js +16 -6
- package/lib/select.js +16 -6
- package/lib/selector-panel.js +16 -6
- package/lib/selector.js +16 -6
- package/lib/sizer.js +16 -6
- package/lib/steps.js +16 -6
- package/lib/switch.js +16 -6
- package/lib/table-form.js +16 -6
- package/lib/tabs.js +16 -6
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/nav.css +1 -1
- package/lib/tips.js +16 -6
- package/lib/tree-group.js +16 -6
- package/lib/tree.js +16 -6
- package/lib/upload.js +16 -6
- package/lib/utils/webSocket.js +16 -6
- package/lib/wujie.js +16 -6
- package/lib/wxlogin.js +16 -6
- package/package.json +1 -1
- package/packages/clients/src/main.vue +3 -1
- package/packages/login/src/resetPassword.vue +1 -1
- package/packages/main/src/main.vue +44 -10
- package/packages/nav/src/main.vue +25 -8
- package/packages/theme-chalk/lib/index.css +1 -1
- package/packages/theme-chalk/lib/nav.css +1 -1
- package/packages/theme-chalk/src/nav.scss +4 -1
- package/src/index.js +1 -1
- package/src/utils/webSocket.js +14 -7
package/lib/button-group.js
CHANGED
|
@@ -4196,6 +4196,8 @@ var WebSocket = function () {
|
|
|
4196
4196
|
this.connects = 1;
|
|
4197
4197
|
this.recon = false;
|
|
4198
4198
|
this.sendTimeout = null;
|
|
4199
|
+
this.socket = null;
|
|
4200
|
+
this.subscription = null;
|
|
4199
4201
|
}
|
|
4200
4202
|
|
|
4201
4203
|
/** socket连接 */
|
|
@@ -4206,14 +4208,12 @@ var WebSocket = function () {
|
|
|
4206
4208
|
|
|
4207
4209
|
if (!this.client) {
|
|
4208
4210
|
// 连接SockJS
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
|
|
4211
|
+
this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
|
|
4212
|
+
this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
|
|
4212
4213
|
}
|
|
4213
4214
|
|
|
4214
4215
|
// 日志不打印
|
|
4215
4216
|
if (!this.debug) {
|
|
4216
|
-
console.log(111);
|
|
4217
4217
|
this.client.debug = function () {};
|
|
4218
4218
|
}
|
|
4219
4219
|
|
|
@@ -4225,9 +4225,10 @@ var WebSocket = function () {
|
|
|
4225
4225
|
// 订阅消息
|
|
4226
4226
|
_this.subscribe();
|
|
4227
4227
|
}, function (error) {
|
|
4228
|
+
_this.unsubscribe();
|
|
4229
|
+
_this.client = null;
|
|
4228
4230
|
var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
|
|
4229
4231
|
if (_this.connects > 5 && diffSecond < _this.interval) {
|
|
4230
|
-
_this.client.disconnect();
|
|
4231
4232
|
_this.error && _this.error(error);
|
|
4232
4233
|
} else {
|
|
4233
4234
|
_this.reconTimeout = setTimeout(function () {
|
|
@@ -4236,6 +4237,14 @@ var WebSocket = function () {
|
|
|
4236
4237
|
}, 5000);
|
|
4237
4238
|
}
|
|
4238
4239
|
});
|
|
4240
|
+
}; // 清除订阅
|
|
4241
|
+
|
|
4242
|
+
|
|
4243
|
+
WebSocket.prototype.unsubscribe = function unsubscribe() {
|
|
4244
|
+
if (this.subscription) {
|
|
4245
|
+
this.subscription.unsubscribe();
|
|
4246
|
+
this.subscription = null;
|
|
4247
|
+
}
|
|
4239
4248
|
};
|
|
4240
4249
|
/** 订阅服务端 */
|
|
4241
4250
|
|
|
@@ -4244,7 +4253,7 @@ var WebSocket = function () {
|
|
|
4244
4253
|
var _this2 = this;
|
|
4245
4254
|
|
|
4246
4255
|
// 订阅服务端提供的某个topic
|
|
4247
|
-
this.client.subscribe(this.take, function (response) {
|
|
4256
|
+
this.subscription = this.client.subscribe(this.take, function (response) {
|
|
4248
4257
|
if (response && (_this2.callback || _this2.success)) {
|
|
4249
4258
|
var callback = _this2.callback || _this2.success;
|
|
4250
4259
|
callback(JSON.parse(response.body));
|
|
@@ -4285,6 +4294,7 @@ var WebSocket = function () {
|
|
|
4285
4294
|
|
|
4286
4295
|
WebSocket.prototype.destroy = function destroy() {
|
|
4287
4296
|
// 断开连接,清除定时器
|
|
4297
|
+
this.unsubscribe();
|
|
4288
4298
|
if (this.client) {
|
|
4289
4299
|
this.client.disconnect();
|
|
4290
4300
|
};
|
package/lib/button.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
|
-
|
|
3672
|
-
|
|
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/checkbox-group.js
CHANGED
|
@@ -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
|
-
|
|
3657
|
-
|
|
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/clients.js
CHANGED
|
@@ -199,7 +199,7 @@ function normalizeComponent(
|
|
|
199
199
|
// ESM COMPAT FLAG
|
|
200
200
|
__webpack_require__.r(__webpack_exports__);
|
|
201
201
|
|
|
202
|
-
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/clients/src/main.vue?vue&type=template&id=
|
|
202
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/clients/src/main.vue?vue&type=template&id=12fa73ca&
|
|
203
203
|
var render = function () {
|
|
204
204
|
var _vm = this
|
|
205
205
|
var _h = _vm.$createElement
|
|
@@ -208,11 +208,18 @@ var render = function () {
|
|
|
208
208
|
_vm.logo
|
|
209
209
|
? _c("img", { staticClass: "es-clients-logo", attrs: { src: _vm.logo } })
|
|
210
210
|
: _vm._e(),
|
|
211
|
-
_c(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
_c(
|
|
212
|
+
"div",
|
|
213
|
+
{ staticClass: "es-clients-title" },
|
|
214
|
+
[
|
|
215
|
+
_vm._v("\n 请通过手机浏览器\n "),
|
|
216
|
+
_vm.ios
|
|
217
|
+
? [_vm._v(" (iOS11版本以上的苹果手机使用照相功能) ")]
|
|
218
|
+
: _vm._e(),
|
|
219
|
+
_vm._v("\n 扫码下载安装\n "),
|
|
220
|
+
],
|
|
221
|
+
2
|
|
222
|
+
),
|
|
216
223
|
_c("ul", { staticClass: "es-clients-list" }, [
|
|
217
224
|
_vm.ios
|
|
218
225
|
? _c(
|
|
@@ -325,7 +332,7 @@ var staticRenderFns = [
|
|
|
325
332
|
render._withStripped = true
|
|
326
333
|
|
|
327
334
|
|
|
328
|
-
// CONCATENATED MODULE: ./packages/clients/src/main.vue?vue&type=template&id=
|
|
335
|
+
// CONCATENATED MODULE: ./packages/clients/src/main.vue?vue&type=template&id=12fa73ca&
|
|
329
336
|
|
|
330
337
|
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/clients/src/main.vue?vue&type=script&lang=js&
|
|
331
338
|
var _props;
|
|
@@ -373,6 +380,8 @@ var _props;
|
|
|
373
380
|
//
|
|
374
381
|
//
|
|
375
382
|
//
|
|
383
|
+
//
|
|
384
|
+
//
|
|
376
385
|
|
|
377
386
|
//import util from 'eoss-ui/src/utils/util';
|
|
378
387
|
/* harmony default export */ var mainvue_type_script_lang_js_ = ({
|
package/lib/data-table-form.js
CHANGED
|
@@ -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
|
-
|
|
3657
|
-
|
|
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/data-table.js
CHANGED
|
@@ -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
|
-
|
|
3657
|
-
|
|
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/date-picker.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
|
-
|
|
3672
|
-
|
|
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/dialog.js
CHANGED
|
@@ -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
|
-
|
|
3657
|
-
|
|
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
|
};
|