ztxkutils 2.7.6 → 2.7.9

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/dist/request.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import './tslib.es6-f9459658.js';
2
2
  import 'axios';
3
3
  import 'ztxkui';
4
- export { a as default } from './request-35b10c4f.js';
4
+ export { a as default } from './request-5b825e2e.js';
5
5
  import './authority-fad2028d.js';
6
6
  import './crypto-c481f616.js';
7
7
  import 'crypto';
@@ -24,26 +24,31 @@ var StompClient = /** @class */ (function () {
24
24
  var socket = new SockJS(this.connectWsConfig.baseUrl + "/api/zmdms-csc-ztim/ws?token=" + token + "&system=" + this.connectWsConfig.systemType + "&clientType=" + this.connectWsConfig.clientType);
25
25
  // 获取 STOMP 子协议的客户端对象
26
26
  this.client = Stomp.over(socket);
27
+ this.isClient = false;
28
+ // 如果存在 证明已经初始化过,直接删除
27
29
  if (this.clearIsClient) {
28
30
  clearTimeout(this.clearIsClient);
29
31
  this.clearIsClient = null;
32
+ }
33
+ if (!this.clearIsClient) {
30
34
  this.clearIsClient = setTimeout(function () {
35
+ _this.clearIsClient = null;
31
36
  if (!_this.isClient) {
32
37
  console.log("\u8FDE\u63A5\u5DF2\u53D1\u8D77\uFF0C\u4F46\u662F10\u79D2\u540E\u672A\u6210\u529F\u5EFA\u7ACB\u8FDE\u63A5\uFF0C\u624B\u52A8\u65AD\u5F00\u91CD\u8FDE!");
33
38
  _this.client.disconnect(function () {
34
- _this.client = null;
35
- _this.reconnectionNum++;
36
39
  // const timeInterval =
37
40
  // Math.ceil(this.reconnectionNum / 5) *
38
41
  // (this.connectWsConfig.reconnectionTime ?? 3000);
39
- var timeInterval = 3000;
40
- console.log("\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\uFF01");
41
- setTimeout(function () {
42
- _this.init();
43
- }, timeInterval);
44
42
  });
43
+ _this.client = null;
44
+ _this.reconnectionNum++;
45
+ var timeInterval = 3000;
46
+ console.log("\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\uFF01");
47
+ setTimeout(function () {
48
+ _this.init();
49
+ }, timeInterval > 10000 ? 10000 : timeInterval);
45
50
  }
46
- }, 10000);
51
+ }, 20000);
47
52
  }
48
53
  // 拦截输出的一大堆垃圾信息
49
54
  this.client.debug = function (str) {
@@ -62,6 +67,7 @@ var StompClient = /** @class */ (function () {
62
67
  _this.isClient = true;
63
68
  if (_this.clearIsClient) {
64
69
  clearTimeout(_this.clearIsClient);
70
+ _this.clearIsClient = null;
65
71
  }
66
72
  _this.reconnectionNum = 0;
67
73
  console.log('---------连接成功--------');
@@ -102,6 +108,7 @@ var StompClient = /** @class */ (function () {
102
108
  _this.isClient = true;
103
109
  if (_this.clearIsClient) {
104
110
  clearTimeout(_this.clearIsClient);
111
+ _this.clearIsClient = null;
105
112
  }
106
113
  // this.errorCallback(err);
107
114
  // 连接失败后,将当前已注册的 连接通道 全部置为未执行状态
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkutils",
3
- "version": "2.7.6",
3
+ "version": "2.7.9",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",