eoss-ui 0.5.11 → 0.5.13

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 (76) hide show
  1. package/lib/button-group.js +215 -123
  2. package/lib/button.js +154 -74
  3. package/lib/card.js +2 -2
  4. package/lib/cascader.js +2 -2
  5. package/lib/checkbox-group.js +154 -75
  6. package/lib/clients.js +2 -2
  7. package/lib/data-table-form.js +154 -75
  8. package/lib/data-table.js +192 -99
  9. package/lib/date-picker.js +159 -79
  10. package/lib/dialog.js +163 -84
  11. package/lib/enterprise.js +2 -2
  12. package/lib/eoss-ui.common.js +357 -219
  13. package/lib/error-page.js +2 -2
  14. package/lib/flow-group.js +154 -74
  15. package/lib/flow-list.js +189 -84
  16. package/lib/flow.js +215 -119
  17. package/lib/form.js +247 -152
  18. package/lib/handle-user.js +155 -75
  19. package/lib/handler.js +154 -74
  20. package/lib/icons.js +4 -4
  21. package/lib/index.js +1 -1
  22. package/lib/input-number.js +154 -74
  23. package/lib/input.js +156 -76
  24. package/lib/label.js +5 -4
  25. package/lib/layout.js +4 -4
  26. package/lib/login.js +157 -78
  27. package/lib/main.js +203 -122
  28. package/lib/menu.js +2 -2
  29. package/lib/nav.js +154 -74
  30. package/lib/notify.js +2 -2
  31. package/lib/page.js +154 -74
  32. package/lib/pagination.js +2 -2
  33. package/lib/player.js +160 -80
  34. package/lib/qr-code.js +156 -76
  35. package/lib/radio-group.js +155 -75
  36. package/lib/retrial-auth.js +154 -74
  37. package/lib/select-ganged.js +154 -74
  38. package/lib/select.js +155 -75
  39. package/lib/selector-panel.js +155 -76
  40. package/lib/selector.js +156 -76
  41. package/lib/sizer.js +156 -76
  42. package/lib/steps.js +154 -74
  43. package/lib/switch.js +154 -74
  44. package/lib/table-form.js +156 -76
  45. package/lib/tabs-panel.js +2 -2
  46. package/lib/tabs.js +159 -79
  47. package/lib/theme-chalk/index.css +1 -1
  48. package/lib/theme-chalk/nav.css +1 -1
  49. package/lib/tips.js +154 -74
  50. package/lib/toolbar.js +2 -2
  51. package/lib/tree-group.js +154 -74
  52. package/lib/tree.js +154 -74
  53. package/lib/upload.js +157 -78
  54. package/lib/utils/util.js +8 -61
  55. package/lib/utils/webSocket.js +131 -0
  56. package/lib/wujie.js +154 -74
  57. package/lib/wxlogin.js +154 -74
  58. package/package.json +1 -1
  59. package/packages/data-table/src/column copy.vue +977 -0
  60. package/packages/data-table/src/main copy.vue +1325 -0
  61. package/packages/data-table/src/main.vue +31 -8
  62. package/packages/data-table/src/sizer.vue +1 -1
  63. package/packages/flow/src/component/taskUnionExamine.vue +1 -1
  64. package/packages/flow/src/main.vue +3 -1
  65. package/packages/flow/src/processForm.vue +24 -10
  66. package/packages/flow/src/processReject.vue +1 -1
  67. package/packages/flow/src/startTaskRead.vue +1 -1
  68. package/packages/flow-list/src/main.vue +25 -2
  69. package/packages/label/src/main.vue +3 -2
  70. package/packages/main/src/main.vue +19 -18
  71. package/packages/theme-chalk/lib/index.css +1 -1
  72. package/packages/theme-chalk/lib/nav.css +1 -1
  73. package/packages/theme-chalk/src/nav.scss +21 -2
  74. package/src/index.js +1 -1
  75. package/src/utils/util.js +29 -81
  76. package/src/utils/webSocket.js +100 -0
package/lib/table-form.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 = 64);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 65);
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({}, {
@@ -2532,60 +2526,13 @@ var setStorage = function setStorage(_ref14) {
2532
2526
  * @param {String} [take] - 订阅地址
2533
2527
  * @param {String} [debug] - 调试
2534
2528
  * @param {String} [interval] - 重连间隔时间
2529
+ * @param {Function} [success] - 调试
2530
+ * @param {Function} [error] - 重连间隔时间
2535
2531
  **/
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
- });
2532
+ function socket(option, vm) {
2533
+ var socket = new _webSocket__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]();
2534
+ socket.init(option, vm);
2535
+ return socket;
2589
2536
  }
2590
2537
  /**
2591
2538
  * sum
@@ -3366,7 +3313,14 @@ var formContents = '/config/admin/online/onlineForm/render';
3366
3313
 
3367
3314
  /***/ }),
3368
3315
 
3369
- /***/ 12:
3316
+ /***/ 10:
3317
+ /***/ (function(module, exports) {
3318
+
3319
+ module.exports = require("sm-crypto");
3320
+
3321
+ /***/ }),
3322
+
3323
+ /***/ 13:
3370
3324
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3371
3325
 
3372
3326
  "use strict";
@@ -3524,7 +3478,7 @@ module.exports = require("json-bigint");
3524
3478
 
3525
3479
  /***/ }),
3526
3480
 
3527
- /***/ 64:
3481
+ /***/ 65:
3528
3482
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3529
3483
 
3530
3484
  "use strict";
@@ -6189,7 +6143,7 @@ tablevue_type_template_id_3e2bccce_render._withStripped = true
6189
6143
  // CONCATENATED MODULE: ./packages/form/src/table.vue?vue&type=template&id=3e2bccce&
6190
6144
 
6191
6145
  // EXTERNAL MODULE: ./src/utils/rules.js
6192
- var rules = __webpack_require__(12);
6146
+ var rules = __webpack_require__(13);
6193
6147
 
6194
6148
  // EXTERNAL MODULE: ./src/utils/util.js
6195
6149
  var util = __webpack_require__(0);
@@ -7577,23 +7531,149 @@ table.install = function (Vue) {
7577
7531
  /***/ }),
7578
7532
 
7579
7533
  /***/ 7:
7580
- /***/ (function(module, exports) {
7534
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
7581
7535
 
7582
- module.exports = require("sockjs-client");
7536
+ "use strict";
7537
+ /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
7538
+ /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sockjs_client__WEBPACK_IMPORTED_MODULE_0__);
7539
+ /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
7540
+ /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(stompjs__WEBPACK_IMPORTED_MODULE_1__);
7541
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7542
+
7543
+
7544
+
7545
+
7546
+ var WebSocket = function () {
7547
+ // 构造函数
7548
+ function WebSocket() {
7549
+ _classCallCheck(this, WebSocket);
7550
+
7551
+ this.host = sessionStorage.getItem('wshost') || '';
7552
+ this.tryTimes = 1; // 重连次数
7553
+ this.callback = null; // 回调函数
7554
+ this.client = null; // stomp对象
7555
+ this.reconTimeout = null; // 重连延时器
7556
+ this.debug = true; // 调试
7557
+ this.interval = 20; // 重连间隔时间
7558
+ this.vm = null;
7559
+ this.nextDate = 0;
7560
+ this.connects = 1;
7561
+ this.recon = false;
7562
+ this.sendTimeout = null;
7563
+ }
7564
+
7565
+ /** socket连接 */
7566
+
7567
+
7568
+ WebSocket.prototype.connect = function connect() {
7569
+ var _this = this;
7570
+
7571
+ if (!this.client) {
7572
+ // 连接SockJS
7573
+ var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
7574
+ // 获取STOMP子协议的客户端对象
7575
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
7576
+ }
7577
+
7578
+ // 日志不打印
7579
+ if (!this.debug) {
7580
+ console.log(111);
7581
+ this.client.debug = function () {};
7582
+ }
7583
+
7584
+ // 向服务器发起websocket连接
7585
+ this.client.connect({}, function () {
7586
+ _this.recon = true;
7587
+ // tryTimes定义重置
7588
+ _this.connects = 1;
7589
+ // 订阅消息
7590
+ _this.subscribe();
7591
+ }, function (error) {
7592
+ var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
7593
+ if (_this.connects > 5 && diffSecond < _this.interval) {
7594
+ _this.client.disconnect();
7595
+ _this.error && _this.error(error);
7596
+ } else {
7597
+ _this.reconTimeout = setTimeout(function () {
7598
+ _this.connect();
7599
+ _this.connects++;
7600
+ }, 5000);
7601
+ }
7602
+ });
7603
+ };
7604
+ /** 订阅服务端 */
7605
+
7606
+
7607
+ WebSocket.prototype.subscribe = function subscribe() {
7608
+ var _this2 = this;
7609
+
7610
+ // 订阅服务端提供的某个topic
7611
+ this.client.subscribe(this.take, function (response) {
7612
+ if (response && (_this2.callback || _this2.success)) {
7613
+ var callback = _this2.callback || _this2.success;
7614
+ callback(JSON.parse(response.body));
7615
+ }
7616
+ });
7617
+ };
7618
+
7619
+ /** 赋值、初始化socket */
7620
+
7621
+
7622
+ WebSocket.prototype.init = function init(option, vm) {
7623
+ for (var i in option) {
7624
+ this[i] = option[i];
7625
+ }
7626
+ this.vm = vm;
7627
+ // 初始化连接
7628
+ this.connect();
7629
+ };
7630
+
7631
+ /** 发送消息 */
7632
+
7633
+
7634
+ WebSocket.prototype.send = function send(data) {
7635
+ var _this3 = this;
7636
+
7637
+ if (this.recon) {
7638
+ clearTimeout(this.sendTimeout);
7639
+ this.client.send(this.take, {}, typeof data === 'string' ? data : JSON.stringify(data));
7640
+ } else {
7641
+ this.sendTimeout = setTimeout(function () {
7642
+ _this3.send(data);
7643
+ }, 1000);
7644
+ }
7645
+ };
7646
+
7647
+ /** 销毁 */
7648
+
7649
+
7650
+ WebSocket.prototype.destroy = function destroy() {
7651
+ // 断开连接,清除定时器
7652
+ if (this.client) {
7653
+ this.client.disconnect();
7654
+ };
7655
+ this.reconTimeout && clearTimeout(this.reconTimeout);
7656
+ this.sendTimeout && clearTimeout(this.sendTimeout);
7657
+ };
7658
+
7659
+ return WebSocket;
7660
+ }();
7661
+
7662
+ /* harmony default export */ __webpack_exports__["a"] = (WebSocket);
7583
7663
 
7584
7664
  /***/ }),
7585
7665
 
7586
7666
  /***/ 8:
7587
7667
  /***/ (function(module, exports) {
7588
7668
 
7589
- module.exports = require("stompjs");
7669
+ module.exports = require("sockjs-client");
7590
7670
 
7591
7671
  /***/ }),
7592
7672
 
7593
7673
  /***/ 9:
7594
7674
  /***/ (function(module, exports) {
7595
7675
 
7596
- module.exports = require("sm-crypto");
7676
+ module.exports = require("stompjs");
7597
7677
 
7598
7678
  /***/ })
7599
7679
 
package/lib/tabs-panel.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 = 60);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 61);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -192,7 +192,7 @@ function normalizeComponent(
192
192
 
193
193
  /***/ }),
194
194
 
195
- /***/ 60:
195
+ /***/ 61:
196
196
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
197
197
 
198
198
  "use strict";
package/lib/tabs.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 = 59);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 60);
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({}, {
@@ -2532,60 +2526,13 @@ var setStorage = function setStorage(_ref14) {
2532
2526
  * @param {String} [take] - 订阅地址
2533
2527
  * @param {String} [debug] - 调试
2534
2528
  * @param {String} [interval] - 重连间隔时间
2529
+ * @param {Function} [success] - 调试
2530
+ * @param {Function} [error] - 重连间隔时间
2535
2531
  **/
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
- });
2532
+ function socket(option, vm) {
2533
+ var socket = new _webSocket__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]();
2534
+ socket.init(option, vm);
2535
+ return socket;
2589
2536
  }
2590
2537
  /**
2591
2538
  * sum
@@ -3366,6 +3313,13 @@ var formContents = '/config/admin/online/onlineForm/render';
3366
3313
 
3367
3314
  /***/ }),
3368
3315
 
3316
+ /***/ 10:
3317
+ /***/ (function(module, exports) {
3318
+
3319
+ module.exports = require("sm-crypto");
3320
+
3321
+ /***/ }),
3322
+
3369
3323
  /***/ 2:
3370
3324
  /***/ (function(module, exports) {
3371
3325
 
@@ -3492,7 +3446,14 @@ module.exports = require("axios");
3492
3446
 
3493
3447
  /***/ }),
3494
3448
 
3495
- /***/ 59:
3449
+ /***/ 6:
3450
+ /***/ (function(module, exports) {
3451
+
3452
+ module.exports = require("json-bigint");
3453
+
3454
+ /***/ }),
3455
+
3456
+ /***/ 60:
3496
3457
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3497
3458
 
3498
3459
  "use strict";
@@ -6003,31 +5964,150 @@ main.install = function (Vue) {
6003
5964
 
6004
5965
  /***/ }),
6005
5966
 
6006
- /***/ 6:
6007
- /***/ (function(module, exports) {
5967
+ /***/ 7:
5968
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
6008
5969
 
6009
- module.exports = require("json-bigint");
5970
+ "use strict";
5971
+ /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
5972
+ /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sockjs_client__WEBPACK_IMPORTED_MODULE_0__);
5973
+ /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
5974
+ /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(stompjs__WEBPACK_IMPORTED_MODULE_1__);
5975
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5976
+
5977
+
5978
+
5979
+
5980
+ var WebSocket = function () {
5981
+ // 构造函数
5982
+ function WebSocket() {
5983
+ _classCallCheck(this, WebSocket);
5984
+
5985
+ this.host = sessionStorage.getItem('wshost') || '';
5986
+ this.tryTimes = 1; // 重连次数
5987
+ this.callback = null; // 回调函数
5988
+ this.client = null; // stomp对象
5989
+ this.reconTimeout = null; // 重连延时器
5990
+ this.debug = true; // 调试
5991
+ this.interval = 20; // 重连间隔时间
5992
+ this.vm = null;
5993
+ this.nextDate = 0;
5994
+ this.connects = 1;
5995
+ this.recon = false;
5996
+ this.sendTimeout = null;
5997
+ }
6010
5998
 
6011
- /***/ }),
5999
+ /** socket连接 */
6012
6000
 
6013
- /***/ 7:
6014
- /***/ (function(module, exports) {
6015
6001
 
6016
- module.exports = require("sockjs-client");
6002
+ WebSocket.prototype.connect = function connect() {
6003
+ var _this = this;
6004
+
6005
+ if (!this.client) {
6006
+ // 连接SockJS
6007
+ var socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url);
6008
+ // 获取STOMP子协议的客户端对象
6009
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(socket);
6010
+ }
6011
+
6012
+ // 日志不打印
6013
+ if (!this.debug) {
6014
+ console.log(111);
6015
+ this.client.debug = function () {};
6016
+ }
6017
+
6018
+ // 向服务器发起websocket连接
6019
+ this.client.connect({}, function () {
6020
+ _this.recon = true;
6021
+ // tryTimes定义重置
6022
+ _this.connects = 1;
6023
+ // 订阅消息
6024
+ _this.subscribe();
6025
+ }, function (error) {
6026
+ var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
6027
+ if (_this.connects > 5 && diffSecond < _this.interval) {
6028
+ _this.client.disconnect();
6029
+ _this.error && _this.error(error);
6030
+ } else {
6031
+ _this.reconTimeout = setTimeout(function () {
6032
+ _this.connect();
6033
+ _this.connects++;
6034
+ }, 5000);
6035
+ }
6036
+ });
6037
+ };
6038
+ /** 订阅服务端 */
6039
+
6040
+
6041
+ WebSocket.prototype.subscribe = function subscribe() {
6042
+ var _this2 = this;
6043
+
6044
+ // 订阅服务端提供的某个topic
6045
+ this.client.subscribe(this.take, function (response) {
6046
+ if (response && (_this2.callback || _this2.success)) {
6047
+ var callback = _this2.callback || _this2.success;
6048
+ callback(JSON.parse(response.body));
6049
+ }
6050
+ });
6051
+ };
6052
+
6053
+ /** 赋值、初始化socket */
6054
+
6055
+
6056
+ WebSocket.prototype.init = function init(option, vm) {
6057
+ for (var i in option) {
6058
+ this[i] = option[i];
6059
+ }
6060
+ this.vm = vm;
6061
+ // 初始化连接
6062
+ this.connect();
6063
+ };
6064
+
6065
+ /** 发送消息 */
6066
+
6067
+
6068
+ WebSocket.prototype.send = function send(data) {
6069
+ var _this3 = this;
6070
+
6071
+ if (this.recon) {
6072
+ clearTimeout(this.sendTimeout);
6073
+ this.client.send(this.take, {}, typeof data === 'string' ? data : JSON.stringify(data));
6074
+ } else {
6075
+ this.sendTimeout = setTimeout(function () {
6076
+ _this3.send(data);
6077
+ }, 1000);
6078
+ }
6079
+ };
6080
+
6081
+ /** 销毁 */
6082
+
6083
+
6084
+ WebSocket.prototype.destroy = function destroy() {
6085
+ // 断开连接,清除定时器
6086
+ if (this.client) {
6087
+ this.client.disconnect();
6088
+ };
6089
+ this.reconTimeout && clearTimeout(this.reconTimeout);
6090
+ this.sendTimeout && clearTimeout(this.sendTimeout);
6091
+ };
6092
+
6093
+ return WebSocket;
6094
+ }();
6095
+
6096
+ /* harmony default export */ __webpack_exports__["a"] = (WebSocket);
6017
6097
 
6018
6098
  /***/ }),
6019
6099
 
6020
6100
  /***/ 8:
6021
6101
  /***/ (function(module, exports) {
6022
6102
 
6023
- module.exports = require("stompjs");
6103
+ module.exports = require("sockjs-client");
6024
6104
 
6025
6105
  /***/ }),
6026
6106
 
6027
6107
  /***/ 9:
6028
6108
  /***/ (function(module, exports) {
6029
6109
 
6030
- module.exports = require("sm-crypto");
6110
+ module.exports = require("stompjs");
6031
6111
 
6032
6112
  /***/ })
6033
6113