eoss-ui 0.5.11 → 0.5.12

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 (65) hide show
  1. package/lib/button-group.js +228 -124
  2. package/lib/button.js +167 -75
  3. package/lib/card.js +2 -2
  4. package/lib/cascader.js +2 -2
  5. package/lib/checkbox-group.js +166 -75
  6. package/lib/clients.js +2 -2
  7. package/lib/data-table-form.js +165 -74
  8. package/lib/data-table.js +185 -94
  9. package/lib/date-picker.js +172 -80
  10. package/lib/dialog.js +174 -83
  11. package/lib/enterprise.js +2 -2
  12. package/lib/eoss-ui.common.js +316 -183
  13. package/lib/error-page.js +2 -2
  14. package/lib/flow-group.js +165 -73
  15. package/lib/flow-list.js +200 -83
  16. package/lib/flow.js +200 -92
  17. package/lib/form.js +258 -151
  18. package/lib/handle-user.js +168 -76
  19. package/lib/handler.js +166 -74
  20. package/lib/icons.js +4 -4
  21. package/lib/index.js +1 -1
  22. package/lib/input-number.js +167 -75
  23. package/lib/input.js +169 -77
  24. package/lib/label.js +2 -2
  25. package/lib/layout.js +4 -4
  26. package/lib/login.js +168 -77
  27. package/lib/main.js +209 -118
  28. package/lib/menu.js +2 -2
  29. package/lib/nav.js +167 -75
  30. package/lib/notify.js +2 -2
  31. package/lib/page.js +167 -75
  32. package/lib/pagination.js +2 -2
  33. package/lib/player.js +173 -81
  34. package/lib/qr-code.js +169 -77
  35. package/lib/radio-group.js +167 -75
  36. package/lib/retrial-auth.js +167 -75
  37. package/lib/select-ganged.js +165 -73
  38. package/lib/select.js +166 -74
  39. package/lib/selector-panel.js +166 -75
  40. package/lib/selector.js +167 -75
  41. package/lib/sizer.js +169 -77
  42. package/lib/steps.js +167 -75
  43. package/lib/switch.js +167 -75
  44. package/lib/table-form.js +167 -75
  45. package/lib/tabs-panel.js +2 -2
  46. package/lib/tabs.js +170 -78
  47. package/lib/tips.js +167 -75
  48. package/lib/toolbar.js +2 -2
  49. package/lib/tree-group.js +165 -73
  50. package/lib/tree.js +165 -73
  51. package/lib/upload.js +168 -77
  52. package/lib/utils/util.js +17 -61
  53. package/lib/utils/webSocket.js +134 -0
  54. package/lib/wujie.js +167 -75
  55. package/lib/wxlogin.js +167 -75
  56. package/package.json +1 -1
  57. package/packages/data-table/src/main.vue +2 -2
  58. package/packages/data-table/src/sizer.vue +1 -1
  59. package/packages/flow/src/main.vue +2 -0
  60. package/packages/flow/src/processForm.vue +23 -9
  61. package/packages/flow-list/src/main.vue +25 -2
  62. package/packages/main/src/main.vue +13 -14
  63. package/src/index.js +1 -1
  64. package/src/utils/util.js +38 -81
  65. package/src/utils/webSocket.js +103 -0
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 71);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 72);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -98,14 +98,9 @@ module.exports =
98
98
  /* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_2__);
99
99
  /* harmony import */ var json_bigint__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6);
100
100
  /* harmony import */ var json_bigint__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(json_bigint__WEBPACK_IMPORTED_MODULE_3__);
101
- /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7);
102
- /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(sockjs_client__WEBPACK_IMPORTED_MODULE_4__);
103
- /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8);
104
- /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(stompjs__WEBPACK_IMPORTED_MODULE_5__);
105
- /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2);
106
- /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(eoss_element__WEBPACK_IMPORTED_MODULE_6__);
107
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
108
-
101
+ /* harmony import */ var _webSocket__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7);
102
+ /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2);
103
+ /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(eoss_element__WEBPACK_IMPORTED_MODULE_5__);
109
104
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
110
105
 
111
106
  /**
@@ -116,8 +111,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
116
111
  **/
117
112
 
118
113
  /* eslint-disable indent */
119
- var sm2 = __webpack_require__(9).sm2;
120
-
114
+ var sm2 = __webpack_require__(10).sm2;
121
115
 
122
116
 
123
117
 
@@ -265,7 +259,7 @@ var ajax = function ajax(_ref) {
265
259
  clearTimeout(loginMsg);
266
260
  loginMsg = setTimeout(function () {
267
261
  sessionStorage.setItem('remind', 1);
268
- eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"].confirm(response.data.rCode === 69 ? '该账号在其他地方已登陆!' : '登录已过期,请重新登录!', '提示', response.data.rCode === 69 ? {
262
+ eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"].confirm(response.data.rCode === 69 ? '该账号在其他地方已登陆!' : '登录已过期,请重新登录!', '提示', response.data.rCode === 69 ? {
269
263
  confirmButtonText: '确定',
270
264
  closeOnClickModal: false,
271
265
  type: 'warning'
@@ -312,7 +306,7 @@ var ajax = function ajax(_ref) {
312
306
  } else if (response.data.rCode === 61) {
313
307
  clearTimeout(initAuth);
314
308
  initAuth = setTimeout(function () {
315
- Object(eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"])({
309
+ Object(eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"])({
316
310
  title: '请进行二次鉴权',
317
311
  closeOnClickModal: false,
318
312
  closeOnPressEscape: false,
@@ -2013,7 +2007,7 @@ var isLogined = function isLogined(_ref8) {
2013
2007
  win.top.location.href = href;
2014
2008
  break;
2015
2009
  case 4:
2016
- eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"].alert(results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!', '提示', {
2010
+ eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"].alert(results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!', '提示', {
2017
2011
  confirmButtonText: '确定',
2018
2012
  type: 'error',
2019
2013
  callback: function callback() {
@@ -2033,7 +2027,7 @@ var isLogined = function isLogined(_ref8) {
2033
2027
  default:
2034
2028
  }
2035
2029
  } else {
2036
- eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"].alert(res.msg, '提示', {
2030
+ eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"].alert(res.msg, '提示', {
2037
2031
  confirmButtonText: '确定',
2038
2032
  type: 'error',
2039
2033
  callback: function callback() {
@@ -2164,7 +2158,7 @@ var loadJs = function loadJs(_ref10) {
2164
2158
  **/
2165
2159
  var loading = function loading($loading, res) {
2166
2160
  if (!$loading) {
2167
- $loading = eoss_element__WEBPACK_IMPORTED_MODULE_6__["Loading"].service;
2161
+ $loading = eoss_element__WEBPACK_IMPORTED_MODULE_5__["Loading"].service;
2168
2162
  }
2169
2163
  if (isObject(res)) {
2170
2164
  var config = extend({}, {
@@ -2529,63 +2523,25 @@ var setStorage = function setStorage(_ref14) {
2529
2523
  * @author huangbo
2530
2524
  * @date 2022年5月7日
2531
2525
  * @param {String} [url] - 连接地址
2526
+ * @param {String} [send] - 是否发送消息
2532
2527
  * @param {String} [take] - 订阅地址
2533
2528
  * @param {String} [debug] - 调试
2534
2529
  * @param {String} [interval] - 重连间隔时间
2535
- **/
2536
- function socket(options) {
2537
- var nextDate = 0;
2538
- var connect = 1;
2539
- return new Promise(function (resolve, reject) {
2540
- var wshost = getStorage('wshost') || '';
2541
- var option = {
2542
- url: wshost + _config_api__WEBPACK_IMPORTED_MODULE_0__[/* wss */ "Zb"],
2543
- take: _config_api__WEBPACK_IMPORTED_MODULE_0__[/* topic */ "Qb"],
2544
- debug: true,
2545
- interval: 20
2546
- };
2547
- var websocket = win.websocket || {};
2548
- if (options && isObject(options)) {
2549
- option = _extends({}, option, options);
2550
- }
2551
- var key = window.btoa(option.url);
2552
- if (!websocket[key]) {
2553
- websocket[key] = { socket: new sockjs_client__WEBPACK_IMPORTED_MODULE_4___default.a(option.url) };
2554
- win.websocket = websocket;
2555
- }
2556
-
2557
- var client = websocket[key] ? websocket[key].client : null;
2558
- if (!client) {
2559
- client = websocket[key].client = stompjs__WEBPACK_IMPORTED_MODULE_5___default.a.over(websocket[key].socket);
2560
- !option.debug && (client.debug = null);
2561
- }
2562
- client.connect({}, function () {
2563
- client.subscribe(option.take, function (response) {
2564
- var res = JSON.parse(response.body);
2565
- resolve(res, function () {
2566
- client.disconnect();
2567
- win.top.websocket && win.top.websocket[key] && delete win.top.websocket[key];
2568
- }, client, websocket[key]);
2569
- });
2570
- }, function (error) {
2571
- var diffSecond = parseInt((new Date() - nextDate) / 1000, 10);
2572
- if (connect > 5 && diffSecond < option.interval) {
2573
- client.disconnect();
2574
- if (win.top.websocket) {
2575
- if (Object.keys(win.top.websocket).length > 1) {
2576
- delete win.top.websocket[key];
2577
- } else {
2578
- delete win.top.websocket;
2579
- }
2580
- }
2581
- } else {
2582
- win.top.websocket && win.top.websocket[key] && setTimeout(function () {
2583
- socket(options);
2584
- }, 5000);
2585
- }
2586
- reject(error);
2587
- });
2588
- });
2530
+ * @param {Function} [success] - 调试
2531
+ * @param {Function} [error] - 重连间隔时间
2532
+ **/
2533
+ function socket(option, vm) {
2534
+ var options = {};
2535
+ for (var i in option) {
2536
+ if (i === 'send') {
2537
+ options['isSend'] = option[i];
2538
+ } else {
2539
+ options[i] = option[i];
2540
+ }
2541
+ }
2542
+ var socket = new _webSocket__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]();
2543
+ socket.init(options, vm);
2544
+ return socket;
2589
2545
  }
2590
2546
  /**
2591
2547
  * sum
@@ -3366,6 +3322,13 @@ var formContents = '/config/admin/online/onlineForm/render';
3366
3322
 
3367
3323
  /***/ }),
3368
3324
 
3325
+ /***/ 10:
3326
+ /***/ (function(module, exports) {
3327
+
3328
+ module.exports = require("sm-crypto");
3329
+
3330
+ /***/ }),
3331
+
3369
3332
  /***/ 2:
3370
3333
  /***/ (function(module, exports) {
3371
3334
 
@@ -3500,13 +3463,142 @@ module.exports = require("json-bigint");
3500
3463
  /***/ }),
3501
3464
 
3502
3465
  /***/ 7:
3503
- /***/ (function(module, exports) {
3466
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3504
3467
 
3505
- module.exports = require("sockjs-client");
3468
+ "use strict";
3469
+ /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
3470
+ /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sockjs_client__WEBPACK_IMPORTED_MODULE_0__);
3471
+ /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
3472
+ /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(stompjs__WEBPACK_IMPORTED_MODULE_1__);
3473
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3474
+
3475
+
3476
+
3477
+
3478
+ var WebSocket = function () {
3479
+ // 构造函数
3480
+ function WebSocket() {
3481
+ _classCallCheck(this, WebSocket);
3482
+
3483
+ this.host = sessionStorage.getItem('wshost') || '';
3484
+ this.tryTimes = 1; // 重连次数
3485
+ this.callback = null; // 回调函数
3486
+ this.client = null; // stomp对象
3487
+ this.reconTimeout = null; // 重连延时器
3488
+ this.debug = true; // 调试
3489
+ this.interval = 20; // 重连间隔时间
3490
+ this.vm = null;
3491
+ this.nextDate = 0;
3492
+ this.connects = 1;
3493
+ this.recon = false;
3494
+ this.sendTimeout = null;
3495
+ this.isSend = false;
3496
+ }
3497
+
3498
+ /** socket连接 */
3499
+
3500
+
3501
+ WebSocket.prototype.connect = function connect() {
3502
+ var _this = this;
3503
+
3504
+ if (!this.client) {
3505
+ // 连接SockJS
3506
+ var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
3507
+ // 获取STOMP子协议的客户端对象
3508
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
3509
+ }
3510
+
3511
+ // 日志不打印
3512
+ if (!this.debug) {
3513
+ console.log(111);
3514
+ this.client.debug = function () {};
3515
+ }
3516
+
3517
+ // 向服务器发起websocket连接
3518
+ this.client.connect({}, function () {
3519
+ _this.recon = true;
3520
+ // tryTimes定义重置
3521
+ _this.connects = 1;
3522
+ // 订阅消息
3523
+ // if (!this.isSend) {
3524
+ _this.subscribe();
3525
+ // }
3526
+ }, function (error) {
3527
+ var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
3528
+ if (_this.connects > 5 && diffSecond < _this.interval) {
3529
+ _this.client.disconnect();
3530
+ _this.error && _this.error(error);
3531
+ } else {
3532
+ _this.reconTimeout = setTimeout(function () {
3533
+ _this.connect();
3534
+ _this.connects++;
3535
+ }, 5000);
3536
+ }
3537
+ });
3538
+ };
3539
+ /** 订阅服务端 */
3540
+
3541
+
3542
+ WebSocket.prototype.subscribe = function subscribe() {
3543
+ var _this2 = this;
3544
+
3545
+ // 订阅服务端提供的某个topic
3546
+ this.client.subscribe(this.take, function (response) {
3547
+ if (response && (_this2.callback || _this2.success)) {
3548
+ var callback = _this2.callback || _this2.success;
3549
+ callback(JSON.parse(response.body));
3550
+ }
3551
+ });
3552
+ };
3553
+
3554
+ /** 赋值、初始化socket */
3555
+
3556
+
3557
+ WebSocket.prototype.init = function init(option, vm) {
3558
+ for (var i in option) {
3559
+ this[i] = option[i];
3560
+ }
3561
+ this.vm = vm;
3562
+ // 初始化连接
3563
+ this.connect();
3564
+ };
3565
+
3566
+ /** 发送消息 */
3567
+
3568
+
3569
+ WebSocket.prototype.send = function send(data) {
3570
+ var _this3 = this;
3571
+
3572
+ if (this.recon) {
3573
+ clearTimeout(this.sendTimeout);
3574
+ this.client.send(this.take, {}, typeof data === 'string' ? data : JSON.stringify(data));
3575
+ } else {
3576
+ this.sendTimeout = setTimeout(function () {
3577
+ _this3.send(data);
3578
+ }, 1000);
3579
+ }
3580
+ };
3581
+
3582
+ /** 销毁 */
3583
+
3584
+
3585
+ WebSocket.prototype.destroy = function destroy() {
3586
+ // 断开连接,清除定时器
3587
+ if (this.client) {
3588
+ this.client.disconnect();
3589
+ };
3590
+ this.reconTimeout && clearTimeout(this.reconTimeout);
3591
+ this.sendTimeout && clearTimeout(this.sendTimeout);
3592
+ };
3593
+
3594
+ return WebSocket;
3595
+ }();
3596
+
3597
+ /* harmony default export */ __webpack_exports__["a"] = (WebSocket);
3506
3598
 
3507
3599
  /***/ }),
3508
3600
 
3509
- /***/ 71:
3601
+ /***/ 72:
3510
3602
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3511
3603
 
3512
3604
  "use strict";
@@ -3642,14 +3734,14 @@ main.install = function (Vue) {
3642
3734
  /***/ 8:
3643
3735
  /***/ (function(module, exports) {
3644
3736
 
3645
- module.exports = require("stompjs");
3737
+ module.exports = require("sockjs-client");
3646
3738
 
3647
3739
  /***/ }),
3648
3740
 
3649
3741
  /***/ 9:
3650
3742
  /***/ (function(module, exports) {
3651
3743
 
3652
- module.exports = require("sm-crypto");
3744
+ module.exports = require("stompjs");
3653
3745
 
3654
3746
  /***/ })
3655
3747
 
package/lib/input.js CHANGED
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 70);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 71);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -98,14 +98,9 @@ module.exports =
98
98
  /* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_2__);
99
99
  /* harmony import */ var json_bigint__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6);
100
100
  /* harmony import */ var json_bigint__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(json_bigint__WEBPACK_IMPORTED_MODULE_3__);
101
- /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7);
102
- /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(sockjs_client__WEBPACK_IMPORTED_MODULE_4__);
103
- /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8);
104
- /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(stompjs__WEBPACK_IMPORTED_MODULE_5__);
105
- /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2);
106
- /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(eoss_element__WEBPACK_IMPORTED_MODULE_6__);
107
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
108
-
101
+ /* harmony import */ var _webSocket__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7);
102
+ /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2);
103
+ /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(eoss_element__WEBPACK_IMPORTED_MODULE_5__);
109
104
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
110
105
 
111
106
  /**
@@ -116,8 +111,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
116
111
  **/
117
112
 
118
113
  /* eslint-disable indent */
119
- var sm2 = __webpack_require__(9).sm2;
120
-
114
+ var sm2 = __webpack_require__(10).sm2;
121
115
 
122
116
 
123
117
 
@@ -265,7 +259,7 @@ var ajax = function ajax(_ref) {
265
259
  clearTimeout(loginMsg);
266
260
  loginMsg = setTimeout(function () {
267
261
  sessionStorage.setItem('remind', 1);
268
- eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"].confirm(response.data.rCode === 69 ? '该账号在其他地方已登陆!' : '登录已过期,请重新登录!', '提示', response.data.rCode === 69 ? {
262
+ eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"].confirm(response.data.rCode === 69 ? '该账号在其他地方已登陆!' : '登录已过期,请重新登录!', '提示', response.data.rCode === 69 ? {
269
263
  confirmButtonText: '确定',
270
264
  closeOnClickModal: false,
271
265
  type: 'warning'
@@ -312,7 +306,7 @@ var ajax = function ajax(_ref) {
312
306
  } else if (response.data.rCode === 61) {
313
307
  clearTimeout(initAuth);
314
308
  initAuth = setTimeout(function () {
315
- Object(eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"])({
309
+ Object(eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"])({
316
310
  title: '请进行二次鉴权',
317
311
  closeOnClickModal: false,
318
312
  closeOnPressEscape: false,
@@ -2013,7 +2007,7 @@ var isLogined = function isLogined(_ref8) {
2013
2007
  win.top.location.href = href;
2014
2008
  break;
2015
2009
  case 4:
2016
- eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"].alert(results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!', '提示', {
2010
+ eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"].alert(results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!', '提示', {
2017
2011
  confirmButtonText: '确定',
2018
2012
  type: 'error',
2019
2013
  callback: function callback() {
@@ -2033,7 +2027,7 @@ var isLogined = function isLogined(_ref8) {
2033
2027
  default:
2034
2028
  }
2035
2029
  } else {
2036
- eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"].alert(res.msg, '提示', {
2030
+ eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"].alert(res.msg, '提示', {
2037
2031
  confirmButtonText: '确定',
2038
2032
  type: 'error',
2039
2033
  callback: function callback() {
@@ -2164,7 +2158,7 @@ var loadJs = function loadJs(_ref10) {
2164
2158
  **/
2165
2159
  var loading = function loading($loading, res) {
2166
2160
  if (!$loading) {
2167
- $loading = eoss_element__WEBPACK_IMPORTED_MODULE_6__["Loading"].service;
2161
+ $loading = eoss_element__WEBPACK_IMPORTED_MODULE_5__["Loading"].service;
2168
2162
  }
2169
2163
  if (isObject(res)) {
2170
2164
  var config = extend({}, {
@@ -2529,63 +2523,25 @@ var setStorage = function setStorage(_ref14) {
2529
2523
  * @author huangbo
2530
2524
  * @date 2022年5月7日
2531
2525
  * @param {String} [url] - 连接地址
2526
+ * @param {String} [send] - 是否发送消息
2532
2527
  * @param {String} [take] - 订阅地址
2533
2528
  * @param {String} [debug] - 调试
2534
2529
  * @param {String} [interval] - 重连间隔时间
2535
- **/
2536
- function socket(options) {
2537
- var nextDate = 0;
2538
- var connect = 1;
2539
- return new Promise(function (resolve, reject) {
2540
- var wshost = getStorage('wshost') || '';
2541
- var option = {
2542
- url: wshost + _config_api__WEBPACK_IMPORTED_MODULE_0__[/* wss */ "Zb"],
2543
- take: _config_api__WEBPACK_IMPORTED_MODULE_0__[/* topic */ "Qb"],
2544
- debug: true,
2545
- interval: 20
2546
- };
2547
- var websocket = win.websocket || {};
2548
- if (options && isObject(options)) {
2549
- option = _extends({}, option, options);
2550
- }
2551
- var key = window.btoa(option.url);
2552
- if (!websocket[key]) {
2553
- websocket[key] = { socket: new sockjs_client__WEBPACK_IMPORTED_MODULE_4___default.a(option.url) };
2554
- win.websocket = websocket;
2555
- }
2556
-
2557
- var client = websocket[key] ? websocket[key].client : null;
2558
- if (!client) {
2559
- client = websocket[key].client = stompjs__WEBPACK_IMPORTED_MODULE_5___default.a.over(websocket[key].socket);
2560
- !option.debug && (client.debug = null);
2561
- }
2562
- client.connect({}, function () {
2563
- client.subscribe(option.take, function (response) {
2564
- var res = JSON.parse(response.body);
2565
- resolve(res, function () {
2566
- client.disconnect();
2567
- win.top.websocket && win.top.websocket[key] && delete win.top.websocket[key];
2568
- }, client, websocket[key]);
2569
- });
2570
- }, function (error) {
2571
- var diffSecond = parseInt((new Date() - nextDate) / 1000, 10);
2572
- if (connect > 5 && diffSecond < option.interval) {
2573
- client.disconnect();
2574
- if (win.top.websocket) {
2575
- if (Object.keys(win.top.websocket).length > 1) {
2576
- delete win.top.websocket[key];
2577
- } else {
2578
- delete win.top.websocket;
2579
- }
2580
- }
2581
- } else {
2582
- win.top.websocket && win.top.websocket[key] && setTimeout(function () {
2583
- socket(options);
2584
- }, 5000);
2585
- }
2586
- reject(error);
2587
- });
2588
- });
2530
+ * @param {Function} [success] - 调试
2531
+ * @param {Function} [error] - 重连间隔时间
2532
+ **/
2533
+ function socket(option, vm) {
2534
+ var options = {};
2535
+ for (var i in option) {
2536
+ if (i === 'send') {
2537
+ options['isSend'] = option[i];
2538
+ } else {
2539
+ options[i] = option[i];
2540
+ }
2541
+ }
2542
+ var socket = new _webSocket__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]();
2543
+ socket.init(options, vm);
2544
+ return socket;
2589
2545
  }
2590
2546
  /**
2591
2547
  * sum
@@ -3366,7 +3322,14 @@ var formContents = '/config/admin/online/onlineForm/render';
3366
3322
 
3367
3323
  /***/ }),
3368
3324
 
3369
- /***/ 12:
3325
+ /***/ 10:
3326
+ /***/ (function(module, exports) {
3327
+
3328
+ module.exports = require("sm-crypto");
3329
+
3330
+ /***/ }),
3331
+
3332
+ /***/ 13:
3370
3333
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3371
3334
 
3372
3335
  "use strict";
@@ -3525,13 +3488,142 @@ module.exports = require("json-bigint");
3525
3488
  /***/ }),
3526
3489
 
3527
3490
  /***/ 7:
3528
- /***/ (function(module, exports) {
3491
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3529
3492
 
3530
- module.exports = require("sockjs-client");
3493
+ "use strict";
3494
+ /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
3495
+ /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sockjs_client__WEBPACK_IMPORTED_MODULE_0__);
3496
+ /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
3497
+ /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(stompjs__WEBPACK_IMPORTED_MODULE_1__);
3498
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3499
+
3500
+
3501
+
3502
+
3503
+ var WebSocket = function () {
3504
+ // 构造函数
3505
+ function WebSocket() {
3506
+ _classCallCheck(this, WebSocket);
3507
+
3508
+ this.host = sessionStorage.getItem('wshost') || '';
3509
+ this.tryTimes = 1; // 重连次数
3510
+ this.callback = null; // 回调函数
3511
+ this.client = null; // stomp对象
3512
+ this.reconTimeout = null; // 重连延时器
3513
+ this.debug = true; // 调试
3514
+ this.interval = 20; // 重连间隔时间
3515
+ this.vm = null;
3516
+ this.nextDate = 0;
3517
+ this.connects = 1;
3518
+ this.recon = false;
3519
+ this.sendTimeout = null;
3520
+ this.isSend = false;
3521
+ }
3522
+
3523
+ /** socket连接 */
3524
+
3525
+
3526
+ WebSocket.prototype.connect = function connect() {
3527
+ var _this = this;
3528
+
3529
+ if (!this.client) {
3530
+ // 连接SockJS
3531
+ var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
3532
+ // 获取STOMP子协议的客户端对象
3533
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
3534
+ }
3535
+
3536
+ // 日志不打印
3537
+ if (!this.debug) {
3538
+ console.log(111);
3539
+ this.client.debug = function () {};
3540
+ }
3541
+
3542
+ // 向服务器发起websocket连接
3543
+ this.client.connect({}, function () {
3544
+ _this.recon = true;
3545
+ // tryTimes定义重置
3546
+ _this.connects = 1;
3547
+ // 订阅消息
3548
+ // if (!this.isSend) {
3549
+ _this.subscribe();
3550
+ // }
3551
+ }, function (error) {
3552
+ var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
3553
+ if (_this.connects > 5 && diffSecond < _this.interval) {
3554
+ _this.client.disconnect();
3555
+ _this.error && _this.error(error);
3556
+ } else {
3557
+ _this.reconTimeout = setTimeout(function () {
3558
+ _this.connect();
3559
+ _this.connects++;
3560
+ }, 5000);
3561
+ }
3562
+ });
3563
+ };
3564
+ /** 订阅服务端 */
3565
+
3566
+
3567
+ WebSocket.prototype.subscribe = function subscribe() {
3568
+ var _this2 = this;
3569
+
3570
+ // 订阅服务端提供的某个topic
3571
+ this.client.subscribe(this.take, function (response) {
3572
+ if (response && (_this2.callback || _this2.success)) {
3573
+ var callback = _this2.callback || _this2.success;
3574
+ callback(JSON.parse(response.body));
3575
+ }
3576
+ });
3577
+ };
3578
+
3579
+ /** 赋值、初始化socket */
3580
+
3581
+
3582
+ WebSocket.prototype.init = function init(option, vm) {
3583
+ for (var i in option) {
3584
+ this[i] = option[i];
3585
+ }
3586
+ this.vm = vm;
3587
+ // 初始化连接
3588
+ this.connect();
3589
+ };
3590
+
3591
+ /** 发送消息 */
3592
+
3593
+
3594
+ WebSocket.prototype.send = function send(data) {
3595
+ var _this3 = this;
3596
+
3597
+ if (this.recon) {
3598
+ clearTimeout(this.sendTimeout);
3599
+ this.client.send(this.take, {}, typeof data === 'string' ? data : JSON.stringify(data));
3600
+ } else {
3601
+ this.sendTimeout = setTimeout(function () {
3602
+ _this3.send(data);
3603
+ }, 1000);
3604
+ }
3605
+ };
3606
+
3607
+ /** 销毁 */
3608
+
3609
+
3610
+ WebSocket.prototype.destroy = function destroy() {
3611
+ // 断开连接,清除定时器
3612
+ if (this.client) {
3613
+ this.client.disconnect();
3614
+ };
3615
+ this.reconTimeout && clearTimeout(this.reconTimeout);
3616
+ this.sendTimeout && clearTimeout(this.sendTimeout);
3617
+ };
3618
+
3619
+ return WebSocket;
3620
+ }();
3621
+
3622
+ /* harmony default export */ __webpack_exports__["a"] = (WebSocket);
3531
3623
 
3532
3624
  /***/ }),
3533
3625
 
3534
- /***/ 70:
3626
+ /***/ 71:
3535
3627
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3536
3628
 
3537
3629
  "use strict";
@@ -3542,7 +3634,7 @@ __webpack_require__.r(__webpack_exports__);
3542
3634
  var util = __webpack_require__(0);
3543
3635
 
3544
3636
  // EXTERNAL MODULE: ./src/utils/rules.js
3545
- var rules = __webpack_require__(12);
3637
+ var rules = __webpack_require__(13);
3546
3638
 
3547
3639
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/input/src/main.vue?vue&type=script&lang=js&
3548
3640
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
@@ -3855,14 +3947,14 @@ main.install = function (Vue) {
3855
3947
  /***/ 8:
3856
3948
  /***/ (function(module, exports) {
3857
3949
 
3858
- module.exports = require("stompjs");
3950
+ module.exports = require("sockjs-client");
3859
3951
 
3860
3952
  /***/ }),
3861
3953
 
3862
3954
  /***/ 9:
3863
3955
  /***/ (function(module, exports) {
3864
3956
 
3865
- module.exports = require("sm-crypto");
3957
+ module.exports = require("stompjs");
3866
3958
 
3867
3959
  /***/ })
3868
3960