eoss-ui 0.6.55 → 0.6.57

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 (62) hide show
  1. package/lib/button-group.js +266 -212
  2. package/lib/button.js +403 -347
  3. package/lib/checkbox-group.js +270 -216
  4. package/lib/data-table-form.js +269 -215
  5. package/lib/data-table.js +271 -222
  6. package/lib/date-picker.js +403 -347
  7. package/lib/dialog.js +268 -219
  8. package/lib/enable-drag.js +8 -8
  9. package/lib/eoss-ui.common.js +264 -210
  10. package/lib/flow-group.js +272 -216
  11. package/lib/flow-list.js +618 -545
  12. package/lib/flow.js +268 -219
  13. package/lib/form.js +270 -221
  14. package/lib/handle-user.js +503 -429
  15. package/lib/handler.js +272 -216
  16. package/lib/icon.js +272 -216
  17. package/lib/index.js +1 -1
  18. package/lib/input-number.js +403 -347
  19. package/lib/input.js +405 -349
  20. package/lib/login.js +270 -221
  21. package/lib/main.js +280 -224
  22. package/lib/menu.js +7 -4
  23. package/lib/nav.js +274 -218
  24. package/lib/page.js +272 -216
  25. package/lib/pagination.js +272 -216
  26. package/lib/player.js +494 -416
  27. package/lib/qr-code.js +272 -216
  28. package/lib/radio-group.js +276 -220
  29. package/lib/retrial-auth.js +272 -216
  30. package/lib/select-ganged.js +405 -349
  31. package/lib/select.js +407 -351
  32. package/lib/selector-panel.js +268 -214
  33. package/lib/selector.js +272 -216
  34. package/lib/sizer.js +269 -220
  35. package/lib/steps.js +274 -218
  36. package/lib/switch.js +272 -216
  37. package/lib/table-form.js +272 -216
  38. package/lib/tabs.js +272 -216
  39. package/lib/theme-chalk/index.css +1 -1
  40. package/lib/theme-chalk/main.css +1 -1
  41. package/lib/theme-chalk/simplicity.css +1 -1
  42. package/lib/tips.js +274 -218
  43. package/lib/tree-group.js +272 -216
  44. package/lib/tree.js +274 -218
  45. package/lib/upload.js +270 -216
  46. package/lib/utils/util.js +231 -182
  47. package/lib/wujie.js +272 -216
  48. package/lib/wxlogin.js +404 -348
  49. package/package.json +2 -2
  50. package/packages/.DS_Store +0 -0
  51. package/packages/main/.DS_Store +0 -0
  52. package/packages/main/src/.DS_Store +0 -0
  53. package/packages/main/src/simplicity/sub-menu.vue +1 -0
  54. package/packages/menu/.DS_Store +0 -0
  55. package/packages/menu/src/main.vue +7 -3
  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/simplicity.css +1 -1
  59. package/packages/theme-chalk/src/simplicity.scss +10 -2
  60. package/src/.DS_Store +0 -0
  61. package/src/index.js +1 -1
  62. package/src/utils/util.js +2 -2
@@ -85,26 +85,31 @@ module.exports =
85
85
  /******/ return __webpack_require__(__webpack_require__.s = 48);
86
86
  /******/ })
87
87
  /************************************************************************/
88
- /******/ ({
89
-
90
- /***/ 0:
88
+ /******/ ([
89
+ /* 0 */
91
90
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
91
 
93
92
  "use strict";
94
- /* harmony import */ var _config_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
95
- /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
96
- /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__);
97
- /* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
98
- /* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_2__);
99
- /* harmony import */ var json_bigint__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6);
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 _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__);
93
+ /* harmony import */ var babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
94
+ /* harmony import */ var babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
95
+ /* harmony import */ var _config_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
96
+ /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);
97
+ /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_2__);
98
+ /* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5);
99
+ /* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_3__);
100
+ /* harmony import */ var json_bigint__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7);
101
+ /* harmony import */ var json_bigint__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(json_bigint__WEBPACK_IMPORTED_MODULE_4__);
102
+ /* harmony import */ var _webSocket__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8);
103
+ /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2);
104
+ /* harmony import */ var eoss_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(eoss_element__WEBPACK_IMPORTED_MODULE_6__);
105
+
106
+
104
107
  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; };
105
108
 
106
109
  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; };
107
110
 
111
+ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
112
+
108
113
  function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
109
114
 
110
115
  /**
@@ -115,8 +120,8 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
115
120
  **/
116
121
 
117
122
  /* eslint-disable indent */
118
- var sm2 = __webpack_require__(11).sm2;
119
- var lodash = __webpack_require__(10);
123
+ var sm2 = __webpack_require__(12).sm2;
124
+ var lodash = __webpack_require__(11);
120
125
 
121
126
 
122
127
 
@@ -137,7 +142,7 @@ var loginMsg = void 0;
137
142
  var initAuth = void 0;
138
143
  var $_http = void 0;
139
144
 
140
- var JSONbigToString = json_bigint__WEBPACK_IMPORTED_MODULE_3___default()({ storeAsString: true });
145
+ var JSONbigToString = json_bigint__WEBPACK_IMPORTED_MODULE_4___default()({ storeAsString: true });
141
146
 
142
147
 
143
148
  /**
@@ -208,7 +213,7 @@ var ajax = function ajax(_ref) {
208
213
  var http = $_http;
209
214
  if (!http) {
210
215
  var baseURL = host === true ? getStorage('host') : host === false ? '' : host;
211
- http = axios__WEBPACK_IMPORTED_MODULE_1___default.a.create({
216
+ http = axios__WEBPACK_IMPORTED_MODULE_2___default.a.create({
212
217
  baseURL: baseURL,
213
218
  timeout: 99000,
214
219
  transformResponse: [function (data) {
@@ -281,7 +286,7 @@ var ajax = function ajax(_ref) {
281
286
  clearTimeout(loginMsg);
282
287
  loginMsg = setTimeout(function () {
283
288
  sessionStorage.setItem('remind', 1);
284
- eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"].confirm(response.data.rCode === 69 ? '该账号在其他地方已登陆!' : '登录已过期,请重新登录!', '提示', response.data.rCode === 69 ? {
289
+ eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"].confirm(response.data.rCode === 69 ? '该账号在其他地方已登陆!' : '登录已过期,请重新登录!', '提示', response.data.rCode === 69 ? {
285
290
  confirmButtonText: '确定',
286
291
  closeOnClickModal: false,
287
292
  type: 'warning'
@@ -332,7 +337,7 @@ var ajax = function ajax(_ref) {
332
337
  } else if (response.data.rCode === 61) {
333
338
  clearTimeout(initAuth);
334
339
  initAuth = setTimeout(function () {
335
- Object(eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"])({
340
+ Object(eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"])({
336
341
  title: '请进行二次鉴权',
337
342
  closeOnClickModal: false,
338
343
  closeOnPressEscape: false,
@@ -488,7 +493,7 @@ var ajax = function ajax(_ref) {
488
493
  }
489
494
  }
490
495
  if (method === 'post' && format) {
491
- data = qs__WEBPACK_IMPORTED_MODULE_2___default.a.stringify(data);
496
+ data = qs__WEBPACK_IMPORTED_MODULE_3___default.a.stringify(data);
492
497
  if (!header['content-type'] && !header['Content-Type']) {
493
498
  header['content-type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
494
499
  }
@@ -1616,7 +1621,7 @@ var getLightness = function getLightness($v, $i, $isLight) {
1616
1621
  * @param {function} callback - 回调函数
1617
1622
  **/
1618
1623
  var getMainConfig = function getMainConfig(callback) {
1619
- ajax({ url: _config_api__WEBPACK_IMPORTED_MODULE_0__[/* mainConfig */ "kb"] }).then(function (res) {
1624
+ ajax({ url: _config_api__WEBPACK_IMPORTED_MODULE_1__[/* mainConfig */ "kb"] }).then(function (res) {
1620
1625
  if (res && res.rCode === 0) {
1621
1626
  callback(res.results);
1622
1627
  }
@@ -2348,137 +2353,196 @@ var isFunction = function isFunction(obj) {
2348
2353
  * @param {sting} [loginPage] - 第三方登录页面地址
2349
2354
  * @param {boolean} [redirect] - 是否重定向(用于新脚手架)
2350
2355
  **/
2351
- var isLogined = function isLogined(_ref10) {
2352
- var to = _ref10.to,
2353
- from = _ref10.from,
2354
- next = _ref10.next,
2355
- _ref10$exclude = _ref10.exclude,
2356
- exclude = _ref10$exclude === undefined ? [] : _ref10$exclude,
2357
- cookie = _ref10.cookie,
2358
- loginPage = _ref10.loginPage,
2359
- redirect = _ref10.redirect;
2360
-
2361
- if (cookie === undefined) {
2362
- cookie = getParams({ name: 'cookie' });
2363
- }
2364
- var quit = getParams('quit') || getParams('logout');
2365
- if (quit) {
2366
- ajax({ method: 'post', url: _config_api__WEBPACK_IMPORTED_MODULE_0__[/* logout */ "jb"] }).then(function (res) {
2367
- if (res.rCode === 0) {
2368
- removeStorage();
2369
- }
2370
- }).catch(function () {});
2371
- return;
2372
- }
2373
- var pathname = '';
2374
- try {
2375
- pathname = win.top.location.pathname;
2376
- } catch (error) {
2377
- pathname = win.location.pathname;
2378
- }
2379
- if (loginPage) {
2380
- sessionStorage.setItem('loginPage', loginPage);
2381
- if (!startWith(loginPage, ['http', '/'], true)) {
2382
- if (pathname !== '/') {
2383
- var path = pathname.split('/');
2384
- path.splice(pathname.length - 1);
2385
- path = path.join('/');
2386
- loginPage = path + '/' + loginPage.replace('./', '');
2387
- } else {
2388
- loginPage = pathname + loginPage.replace('./', '');
2389
- }
2390
- }
2391
- }
2392
- var token = getStorage('token') || getStorage('Authorization');
2393
- // const logined = getStorage('logined');
2394
- // eslint-disable-next-line eqeqeq
2395
- if (token || cookie == true || cookie == 1) {
2396
- next && next();
2397
- } else {
2398
- if (!token && Object.prototype.hasOwnProperty.call(to.query, 'serverId') && Object.prototype.hasOwnProperty.call(to.query, 'authType')) {
2399
- var loadingInstance = eoss_element__WEBPACK_IMPORTED_MODULE_5__["Loading"].service({ text: '页面加载中', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.65)' });
2400
- ajax({
2401
- method: 'post',
2402
- url: _config_api__WEBPACK_IMPORTED_MODULE_0__[/* authCenter */ "b"],
2403
- data: to.query
2404
- }).then(function (res) {
2405
- if (res.rCode === 0) {
2406
- var results = res.results;
2407
-
2408
- switch (results.statusCode) {
2409
- case 0:
2410
- var storage = getStorage('storage');
2411
- setStorage({
2412
- type: storage,
2413
- key: {
2414
- ssId: results.ssId,
2415
- token: results.token,
2416
- Authorization: results.token,
2417
- deviceUnique: results.deviceUnique
2356
+ var isLogined = function () {
2357
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee(_ref11) {
2358
+ var to = _ref11.to,
2359
+ from = _ref11.from,
2360
+ next = _ref11.next,
2361
+ _ref11$exclude = _ref11.exclude,
2362
+ exclude = _ref11$exclude === undefined ? [] : _ref11$exclude,
2363
+ cookie = _ref11.cookie,
2364
+ loginPage = _ref11.loginPage,
2365
+ redirect = _ref11.redirect;
2366
+ var quit, pathname, path, token, loadingInstance;
2367
+ return babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {
2368
+ while (1) {
2369
+ switch (_context.prev = _context.next) {
2370
+ case 0:
2371
+ if (cookie === undefined) {
2372
+ cookie = getParams({ name: 'cookie' });
2373
+ }
2374
+ quit = getParams('quit') || getParams('logout');
2375
+
2376
+ if (!quit) {
2377
+ _context.next = 5;
2378
+ break;
2379
+ }
2380
+
2381
+ ajax({ method: 'post', url: _config_api__WEBPACK_IMPORTED_MODULE_1__[/* logout */ "jb"] }).then(function (res) {
2382
+ if (res.rCode === 0) {
2383
+ removeStorage();
2384
+ }
2385
+ }).catch(function () {});
2386
+ return _context.abrupt('return');
2387
+
2388
+ case 5:
2389
+ pathname = '';
2390
+
2391
+ try {
2392
+ pathname = win.top.location.pathname;
2393
+ } catch (error) {
2394
+ pathname = win.location.pathname;
2395
+ }
2396
+ if (loginPage) {
2397
+ sessionStorage.setItem('loginPage', loginPage);
2398
+ if (!startWith(loginPage, ['http', '/'], true)) {
2399
+ if (pathname !== '/') {
2400
+ path = pathname.split('/');
2401
+
2402
+ path.splice(pathname.length - 1);
2403
+ path = path.join('/');
2404
+ loginPage = path + '/' + loginPage.replace('./', '');
2405
+ } else {
2406
+ loginPage = pathname + loginPage.replace('./', '');
2418
2407
  }
2419
- });
2420
- try {
2421
- var url = delUrlParam({
2422
- url: win.top.location.href,
2423
- key: ['serverId', 'authType', 'code', 'sessionId']
2424
- });
2425
- win.top.location.href = url;
2426
- setTimeout(function () {
2427
- win.top.location.reload();
2428
- }, 200);
2429
- } catch (error) {
2430
- var _url2 = delUrlParam({
2431
- url: win.location.href,
2432
- key: ['serverId', 'authType', 'code', 'sessionId']
2433
- });
2434
- win.location.href = _url2;
2435
- setTimeout(function () {
2436
- win.location.reload();
2437
- }, 200);
2438
2408
  }
2409
+ }
2410
+ token = getStorage('token') || getStorage('Authorization');
2411
+ // const logined = getStorage('logined');
2412
+ // eslint-disable-next-line eqeqeq
2413
+
2414
+ if (!(token || cookie == true || cookie == 1)) {
2415
+ _context.next = 13;
2439
2416
  break;
2440
- case 1:
2441
- break;
2442
- case 2:
2443
- break;
2444
- case 3:
2445
- try {
2446
- var href = results.authorizeUrl.replace('{redirectUri}', encodeURIComponent(win.top.location.href));
2447
- win.top.location.href = href;
2448
- } catch (error) {
2449
- var _href = results.authorizeUrl.replace('{redirectUri}', encodeURIComponent(win.location.href));
2450
- win.location.href = _href;
2451
- }
2417
+ }
2418
+
2419
+ next && next();
2420
+ _context.next = 20;
2421
+ break;
2422
+
2423
+ case 13:
2424
+ if (!(!token && Object.prototype.hasOwnProperty.call(to.query, 'serverId') && Object.prototype.hasOwnProperty.call(to.query, 'authType'))) {
2425
+ _context.next = 19;
2452
2426
  break;
2453
- case 4:
2454
- eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"].alert(results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!', '提示', {
2455
- confirmButtonText: '确定',
2456
- type: 'error',
2457
- callback: function callback() {
2458
- sessionStorage.setItem('extUserBindHandleId', results.extUserBindHandleId);
2459
- try {
2460
- if (loginPage) {
2461
- win.top.location.replace(loginPage);
2462
- } else if (document.referrer) {
2463
- win.top.location.replace(document.referrer);
2464
- } else if (win.top.location.href.indexOf('main.html') > -1) {
2465
- win.top.location.href = './login.html';
2466
- } else {
2467
- next('/login');
2427
+ }
2428
+
2429
+ loadingInstance = eoss_element__WEBPACK_IMPORTED_MODULE_6__["Loading"].service({ text: '页面加载中', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.65)' });
2430
+ _context.next = 17;
2431
+ return ajax({
2432
+ method: 'post',
2433
+ url: _config_api__WEBPACK_IMPORTED_MODULE_1__[/* authCenter */ "b"],
2434
+ data: to.query
2435
+ }).then(function (res) {
2436
+ if (res.rCode === 0) {
2437
+ var results = res.results;
2438
+
2439
+ switch (results.statusCode) {
2440
+ case 0:
2441
+ var storage = getStorage('storage');
2442
+ setStorage({
2443
+ type: storage,
2444
+ key: {
2445
+ ssId: results.ssId,
2446
+ token: results.token,
2447
+ Authorization: results.token,
2448
+ deviceUnique: results.deviceUnique
2449
+ }
2450
+ });
2451
+ try {
2452
+ var url = delUrlParam({
2453
+ url: win.top.location.href,
2454
+ key: ['serverId', 'authType', 'code', 'sessionId']
2455
+ });
2456
+ win.top.location.href = url;
2457
+ setTimeout(function () {
2458
+ win.top.location.reload();
2459
+ }, 200);
2460
+ } catch (error) {
2461
+ var _url2 = delUrlParam({
2462
+ url: win.location.href,
2463
+ key: ['serverId', 'authType', 'code', 'sessionId']
2464
+ });
2465
+ win.location.href = _url2;
2466
+ setTimeout(function () {
2467
+ win.location.reload();
2468
+ }, 200);
2468
2469
  }
2469
- } catch (error) {
2470
- win.postMessage({ type: 1 }, '*');
2471
- }
2470
+ break;
2471
+ case 1:
2472
+ break;
2473
+ case 2:
2474
+ break;
2475
+ case 3:
2476
+ try {
2477
+ var href = results.authorizeUrl.replace('{redirectUri}', encodeURIComponent(win.top.location.href));
2478
+ win.top.location.href = href;
2479
+ } catch (error) {
2480
+ var _href = results.authorizeUrl.replace('{redirectUri}', encodeURIComponent(win.location.href));
2481
+ win.location.href = _href;
2482
+ }
2483
+ break;
2484
+ case 4:
2485
+ eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"].alert(results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!', '提示', {
2486
+ confirmButtonText: '确定',
2487
+ type: 'error',
2488
+ callback: function callback() {
2489
+ sessionStorage.setItem('extUserBindHandleId', results.extUserBindHandleId);
2490
+ try {
2491
+ if (loginPage) {
2492
+ win.top.location.replace(loginPage);
2493
+ } else if (document.referrer) {
2494
+ win.top.location.replace(document.referrer);
2495
+ } else if (win.top.location.href.indexOf('main.html') > -1) {
2496
+ win.top.location.href = './login.html';
2497
+ } else {
2498
+ next('/login');
2499
+ }
2500
+ } catch (error) {
2501
+ win.postMessage({ type: 1 }, '*');
2502
+ }
2503
+ }
2504
+ });
2505
+ break;
2506
+ default:
2472
2507
  }
2473
- });
2474
- break;
2475
- default:
2476
- }
2477
- } else {
2478
- eoss_element__WEBPACK_IMPORTED_MODULE_5__["MessageBox"].alert(res.msg, '提示', {
2479
- confirmButtonText: '确定',
2480
- type: 'error',
2481
- callback: function callback() {
2508
+ } else {
2509
+ eoss_element__WEBPACK_IMPORTED_MODULE_6__["MessageBox"].alert(res.msg, '提示', {
2510
+ confirmButtonText: '确定',
2511
+ type: 'error',
2512
+ callback: function callback() {
2513
+ try {
2514
+ if (loginPage) {
2515
+ win.top.location.replace(loginPage);
2516
+ } else if (document.referrer) {
2517
+ win.top.location.replace(document.referrer);
2518
+ } else if (win.top.location.href.indexOf('main.html') > -1) {
2519
+ win.top.location.href = './login.html';
2520
+ } else {
2521
+ next('/login');
2522
+ }
2523
+ } catch (error) {
2524
+ win.postMessage({ type: 1 }, '*');
2525
+ }
2526
+ }
2527
+ });
2528
+ }
2529
+ loadingInstance.close();
2530
+ }).catch(function (e) {
2531
+ loadingInstance.close();
2532
+ });
2533
+
2534
+ case 17:
2535
+ _context.next = 20;
2536
+ break;
2537
+
2538
+ case 19:
2539
+ if (token || to.path === '/' || to.path === '/404' || to.path === '/error' || typeof exclude === 'boolean' && exclude || exclude.indexOf(to.path) > -1 || exclude.indexOf(to.name) > -1 || to.path === '/login' || token && to.path === '/main') {
2540
+ if (redirect && (to.path === '/main' || to.path === '/login')) {
2541
+ window.location.replace(urlJoinParams({ url: '.' + to.path + '.html', param: to.query }));
2542
+ } else {
2543
+ next();
2544
+ }
2545
+ } else {
2482
2546
  try {
2483
2547
  if (loginPage) {
2484
2548
  win.top.location.replace(loginPage);
@@ -2493,35 +2557,19 @@ var isLogined = function isLogined(_ref10) {
2493
2557
  win.postMessage({ type: 1 }, '*');
2494
2558
  }
2495
2559
  }
2496
- });
2497
- }
2498
- loadingInstance.close();
2499
- }).catch(function (e) {
2500
- loadingInstance.close();
2501
- });
2502
- } else if (token || to.path === '/' || to.path === '/404' || to.path === '/error' || typeof exclude === 'boolean' && exclude || exclude.indexOf(to.path) > -1 || exclude.indexOf(to.name) > -1 || to.path === '/login' || token && to.path === '/main') {
2503
- if (redirect && (to.path === '/main' || to.path === '/login')) {
2504
- window.location.replace(urlJoinParams({ url: '.' + to.path + '.html', param: to.query }));
2505
- } else {
2506
- next();
2507
- }
2508
- } else {
2509
- try {
2510
- if (loginPage) {
2511
- win.top.location.replace(loginPage);
2512
- } else if (document.referrer) {
2513
- win.top.location.replace(document.referrer);
2514
- } else if (win.top.location.href.indexOf('main.html') > -1) {
2515
- win.top.location.href = './login.html';
2516
- } else {
2517
- next('/login');
2560
+
2561
+ case 20:
2562
+ case 'end':
2563
+ return _context.stop();
2518
2564
  }
2519
- } catch (error) {
2520
- win.postMessage({ type: 1 }, '*');
2521
2565
  }
2522
- }
2523
- }
2524
- };
2566
+ }, _callee, this);
2567
+ }));
2568
+
2569
+ return function isLogined(_x5) {
2570
+ return _ref10.apply(this, arguments);
2571
+ };
2572
+ }();
2525
2573
  var isLogged = function isLogged(res) {
2526
2574
  isLogined(res);
2527
2575
  };
@@ -2571,9 +2619,9 @@ var isObjectEqual = function isObjectEqual(obj, _obj) {
2571
2619
  * @param {string/array} [url] - 地址
2572
2620
  * @param {boolean} [single] - 是否做js沙箱隔离
2573
2621
  **/
2574
- var jointUrl = function jointUrl(_ref11) {
2575
- var url = _ref11.url,
2576
- reg = _ref11.reg;
2622
+ var jointUrl = function jointUrl(_ref12) {
2623
+ var url = _ref12.url,
2624
+ reg = _ref12.reg;
2577
2625
 
2578
2626
  if (startWith(url, ['https', 'http', 'blob:'], true) || !reg || !reg.length) {
2579
2627
  return url;
@@ -2588,13 +2636,13 @@ var jointUrl = function jointUrl(_ref11) {
2588
2636
  return startWith(url, reg) ? url : reg + url;
2589
2637
  };
2590
2638
 
2591
- var loadJs = function loadJs(_ref12) {
2592
- var url = _ref12.url,
2593
- _ref12$type = _ref12.type,
2594
- type = _ref12$type === undefined ? 'text/javascript' : _ref12$type,
2595
- id = _ref12.id,
2596
- _ref12$single = _ref12.single,
2597
- single = _ref12$single === undefined ? true : _ref12$single;
2639
+ var loadJs = function loadJs(_ref13) {
2640
+ var url = _ref13.url,
2641
+ _ref13$type = _ref13.type,
2642
+ type = _ref13$type === undefined ? 'text/javascript' : _ref13$type,
2643
+ id = _ref13.id,
2644
+ _ref13$single = _ref13.single,
2645
+ single = _ref13$single === undefined ? true : _ref13$single;
2598
2646
 
2599
2647
  return new Promise(function (resolve, reject) {
2600
2648
  var script = document.getElementById(id) || document.createElement('script');
@@ -2629,7 +2677,7 @@ var loadJs = function loadJs(_ref12) {
2629
2677
  **/
2630
2678
  var loading = function loading($loading, res) {
2631
2679
  if (!$loading) {
2632
- $loading = eoss_element__WEBPACK_IMPORTED_MODULE_5__["Loading"].service;
2680
+ $loading = eoss_element__WEBPACK_IMPORTED_MODULE_6__["Loading"].service;
2633
2681
  }
2634
2682
  if (isObject(res)) {
2635
2683
  var config = extend({}, {
@@ -2729,11 +2777,11 @@ var queryParams = function queryParams(obj) {
2729
2777
  * @param {string} [url] - 消息源的 URI
2730
2778
  * @param {function} [callback] - 回调函数
2731
2779
  **/
2732
- var receiveMessage = function receiveMessage(_ref13) {
2733
- var _ref13$data = _ref13.data,
2734
- data = _ref13$data === undefined ? {} : _ref13$data,
2735
- url = _ref13.url,
2736
- callback = _ref13.callback;
2780
+ var receiveMessage = function receiveMessage(_ref14) {
2781
+ var _ref14$data = _ref14.data,
2782
+ data = _ref14$data === undefined ? {} : _ref14$data,
2783
+ url = _ref14.url,
2784
+ callback = _ref14.callback;
2737
2785
 
2738
2786
  win.addEventListener('message', function (e) {
2739
2787
  if (url !== undefined) {
@@ -2777,9 +2825,9 @@ var removeStorage = function removeStorage(key) {
2777
2825
  * @param {string、number} [data] - 数字或字符串型数字
2778
2826
  * @param {number} [precision] - 需要的小数位数
2779
2827
  **/
2780
- var replenish = function replenish(_ref14) {
2781
- var data = _ref14.data,
2782
- precision = _ref14.precision;
2828
+ var replenish = function replenish(_ref15) {
2829
+ var data = _ref15.data,
2830
+ precision = _ref15.precision;
2783
2831
 
2784
2832
  if (data && precision && precision > 0) {
2785
2833
  var power = Math.pow(10, precision);
@@ -2925,10 +2973,10 @@ var setScale = function setScale() {
2925
2973
  * @param {object} [data] - 数据---其中type必须表示操作类型
2926
2974
  * @param {string} [url] - 指定的消息发送URI地址
2927
2975
  **/
2928
- var sendMessage = function sendMessage(_ref15) {
2929
- var _ref15$data = _ref15.data,
2930
- data = _ref15$data === undefined ? {} : _ref15$data,
2931
- url = _ref15.url;
2976
+ var sendMessage = function sendMessage(_ref16) {
2977
+ var _ref16$data = _ref16.data,
2978
+ data = _ref16$data === undefined ? {} : _ref16$data,
2979
+ url = _ref16.url;
2932
2980
 
2933
2981
  var iframes = document.getElementsByTagName('iframe');
2934
2982
  for (var i = 0; i < iframes.length; i++) {
@@ -2972,10 +3020,10 @@ var setFavicon = function setFavicon(url) {
2972
3020
  * @param {String, Array, Object} [key] - 数据的名称,array类型表示多个key保存同一个value,object类型时对象的属性名称作为key属性值作为value
2973
3021
  * @param {String} [value] - 数据的值
2974
3022
  **/
2975
- var setStorage = function setStorage(_ref16) {
2976
- var type = _ref16.type,
2977
- key = _ref16.key,
2978
- value = _ref16.value;
3023
+ var setStorage = function setStorage(_ref17) {
3024
+ var type = _ref17.type,
3025
+ key = _ref17.key,
3026
+ value = _ref17.value;
2979
3027
 
2980
3028
  if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
2981
3029
  value = JSON.stringify(value);
@@ -3022,7 +3070,7 @@ var setStorage = function setStorage(_ref16) {
3022
3070
  * @param {Function} [error] - 重连间隔时间
3023
3071
  **/
3024
3072
  function socket(option, vm) {
3025
- var socket = new _webSocket__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]();
3073
+ var socket = new _webSocket__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"]();
3026
3074
  socket.init(option, vm);
3027
3075
  return socket;
3028
3076
  }
@@ -3269,10 +3317,10 @@ var upperCase = function upperCase(text) {
3269
3317
  * @param {Object} [url] - url地址
3270
3318
  * @param {Object} [param] - 被转换的对象
3271
3319
  **/
3272
- var urlJoinParams = function urlJoinParams(_ref17) {
3273
- var url = _ref17.url,
3274
- param = _ref17.param,
3275
- timestamp = _ref17.timestamp;
3320
+ var urlJoinParams = function urlJoinParams(_ref18) {
3321
+ var url = _ref18.url,
3322
+ param = _ref18.param,
3323
+ timestamp = _ref18.timestamp;
3276
3324
 
3277
3325
  var arry = decodeURI(url).split('?');
3278
3326
  var times = new Date().getTime();
@@ -3478,8 +3526,7 @@ var watermark = function watermark(option) {
3478
3526
  });
3479
3527
 
3480
3528
  /***/ }),
3481
-
3482
- /***/ 1:
3529
+ /* 1 */
3483
3530
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3484
3531
 
3485
3532
  "use strict";
@@ -3875,57 +3922,13 @@ var sendBatch = '/notify2/sendRecord/reSendNotifyMessageBatch';
3875
3922
  var formContents = '/lowcode/admin/online/onlineForm/getOnlineFormFromCache';
3876
3923
 
3877
3924
  /***/ }),
3878
-
3879
- /***/ 10:
3880
- /***/ (function(module, exports) {
3881
-
3882
- module.exports = require("lodash");
3883
-
3884
- /***/ }),
3885
-
3886
- /***/ 11:
3887
- /***/ (function(module, exports) {
3888
-
3889
- module.exports = require("sm-crypto");
3890
-
3891
- /***/ }),
3892
-
3893
- /***/ 13:
3894
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3895
-
3896
- "use strict";
3897
- var store = {
3898
- state: {},
3899
- set: function set(name, value) {
3900
- this.state[name] = value;
3901
- },
3902
- get: function get(name) {
3903
- return this.state[name];
3904
- },
3905
- clear: function clear(name) {
3906
- this.state[name] = null;
3907
- },
3908
- remove: function remove(name) {
3909
- if (name) {
3910
- delete this.state[name];
3911
- } else {
3912
- this.state = {};
3913
- }
3914
- }
3915
- };
3916
- window.__store = store;
3917
- /* harmony default export */ __webpack_exports__["a"] = (store);
3918
-
3919
- /***/ }),
3920
-
3921
- /***/ 2:
3925
+ /* 2 */
3922
3926
  /***/ (function(module, exports) {
3923
3927
 
3924
3928
  module.exports = require("eoss-element");
3925
3929
 
3926
3930
  /***/ }),
3927
-
3928
- /***/ 3:
3931
+ /* 3 */
3929
3932
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3930
3933
 
3931
3934
  "use strict";
@@ -4029,15 +4032,258 @@ function normalizeComponent(
4029
4032
 
4030
4033
 
4031
4034
  /***/ }),
4035
+ /* 4 */
4036
+ /***/ (function(module, exports) {
4037
+
4038
+ module.exports = require("babel-runtime/regenerator");
4032
4039
 
4033
- /***/ 4:
4040
+ /***/ }),
4041
+ /* 5 */
4034
4042
  /***/ (function(module, exports) {
4035
4043
 
4036
4044
  module.exports = require("qs");
4037
4045
 
4038
4046
  /***/ }),
4047
+ /* 6 */
4048
+ /***/ (function(module, exports) {
4049
+
4050
+ module.exports = require("axios");
4051
+
4052
+ /***/ }),
4053
+ /* 7 */
4054
+ /***/ (function(module, exports) {
4039
4055
 
4040
- /***/ 48:
4056
+ module.exports = require("json-bigint");
4057
+
4058
+ /***/ }),
4059
+ /* 8 */
4060
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
4061
+
4062
+ "use strict";
4063
+ /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9);
4064
+ /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sockjs_client__WEBPACK_IMPORTED_MODULE_0__);
4065
+ /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10);
4066
+ /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(stompjs__WEBPACK_IMPORTED_MODULE_1__);
4067
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4068
+
4069
+
4070
+
4071
+
4072
+ var WebSocket = function () {
4073
+ // 构造函数
4074
+ function WebSocket() {
4075
+ _classCallCheck(this, WebSocket);
4076
+
4077
+ this.host = sessionStorage.getItem('wshost') || '';
4078
+ this.tryTimes = 1; // 重连次数
4079
+ this.callback = null; // 回调函数
4080
+ this.client = null; // stomp对象
4081
+ this.reconTimeout = null; // 重连延时器
4082
+ this.debug = true; // 调试
4083
+ this.interval = 20; // 重连间隔时间
4084
+ this.vm = null;
4085
+ this.nextDate = 0;
4086
+ this.connects = 1;
4087
+ this.recon = false;
4088
+ this.sendTimeout = null;
4089
+ this.socket = null;
4090
+ this.subscription = null;
4091
+ }
4092
+
4093
+ /** socket连接 */
4094
+
4095
+
4096
+ WebSocket.prototype.connect = function connect() {
4097
+ var _this = this;
4098
+
4099
+ if (!this.client) {
4100
+ // 连接SockJS
4101
+ this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
4102
+ this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
4103
+ }
4104
+
4105
+ // 日志不打印
4106
+ if (!this.debug) {
4107
+ this.client.debug = function () {};
4108
+ }
4109
+
4110
+ // 向服务器发起websocket连接
4111
+ this.client.connect({}, function () {
4112
+ _this.recon = true;
4113
+ // tryTimes定义重置
4114
+ _this.connects = 1;
4115
+ // 订阅消息
4116
+ _this.subscribe();
4117
+ }, function (error) {
4118
+ _this.unsubscribe();
4119
+ _this.client = null;
4120
+ var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
4121
+ if (_this.connects > 5 && diffSecond < _this.interval) {
4122
+ _this.error && _this.error(error);
4123
+ } else {
4124
+ _this.reconTimeout = setTimeout(function () {
4125
+ _this.connect();
4126
+ _this.connects++;
4127
+ }, 5000);
4128
+ }
4129
+ });
4130
+ }; // 清除订阅
4131
+
4132
+
4133
+ WebSocket.prototype.unsubscribe = function unsubscribe() {
4134
+ if (this.subscription) {
4135
+ this.subscription.unsubscribe();
4136
+ this.subscription = null;
4137
+ }
4138
+ };
4139
+ /** 订阅服务端 */
4140
+
4141
+
4142
+ WebSocket.prototype.subscribe = function subscribe() {
4143
+ var _this2 = this;
4144
+
4145
+ // 订阅服务端提供的某个topic
4146
+ this.subscription = this.client.subscribe(this.take, function (response) {
4147
+ if (response && (_this2.callback || _this2.success)) {
4148
+ var callback = _this2.callback || _this2.success;
4149
+ callback(JSON.parse(response.body));
4150
+ }
4151
+ });
4152
+ };
4153
+
4154
+ /** 赋值、初始化socket */
4155
+
4156
+
4157
+ WebSocket.prototype.init = function init(option, vm) {
4158
+ for (var i in option) {
4159
+ this[i] = option[i];
4160
+ }
4161
+ this.vm = vm;
4162
+ // 初始化连接
4163
+ this.connect();
4164
+ };
4165
+
4166
+ /** 发送消息 */
4167
+
4168
+
4169
+ WebSocket.prototype.send = function send(data) {
4170
+ var _this3 = this;
4171
+
4172
+ if (this.recon) {
4173
+ clearTimeout(this.sendTimeout);
4174
+ this.client.send(this.take, {}, typeof data === 'string' ? data : JSON.stringify(data));
4175
+ } else {
4176
+ this.sendTimeout = setTimeout(function () {
4177
+ _this3.send(data);
4178
+ }, 1000);
4179
+ }
4180
+ };
4181
+
4182
+ /** 销毁 */
4183
+
4184
+
4185
+ WebSocket.prototype.destroy = function destroy() {
4186
+ // 断开连接,清除定时器
4187
+ this.unsubscribe();
4188
+ if (this.client) {
4189
+ this.client.disconnect();
4190
+ };
4191
+ this.reconTimeout && clearTimeout(this.reconTimeout);
4192
+ this.sendTimeout && clearTimeout(this.sendTimeout);
4193
+ };
4194
+
4195
+ return WebSocket;
4196
+ }();
4197
+
4198
+ /* harmony default export */ __webpack_exports__["a"] = (WebSocket);
4199
+
4200
+ /***/ }),
4201
+ /* 9 */
4202
+ /***/ (function(module, exports) {
4203
+
4204
+ module.exports = require("sockjs-client");
4205
+
4206
+ /***/ }),
4207
+ /* 10 */
4208
+ /***/ (function(module, exports) {
4209
+
4210
+ module.exports = require("stompjs");
4211
+
4212
+ /***/ }),
4213
+ /* 11 */
4214
+ /***/ (function(module, exports) {
4215
+
4216
+ module.exports = require("lodash");
4217
+
4218
+ /***/ }),
4219
+ /* 12 */
4220
+ /***/ (function(module, exports) {
4221
+
4222
+ module.exports = require("sm-crypto");
4223
+
4224
+ /***/ }),
4225
+ /* 13 */,
4226
+ /* 14 */
4227
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
4228
+
4229
+ "use strict";
4230
+ var store = {
4231
+ state: {},
4232
+ set: function set(name, value) {
4233
+ this.state[name] = value;
4234
+ },
4235
+ get: function get(name) {
4236
+ return this.state[name];
4237
+ },
4238
+ clear: function clear(name) {
4239
+ this.state[name] = null;
4240
+ },
4241
+ remove: function remove(name) {
4242
+ if (name) {
4243
+ delete this.state[name];
4244
+ } else {
4245
+ this.state = {};
4246
+ }
4247
+ }
4248
+ };
4249
+ window.__store = store;
4250
+ /* harmony default export */ __webpack_exports__["a"] = (store);
4251
+
4252
+ /***/ }),
4253
+ /* 15 */,
4254
+ /* 16 */,
4255
+ /* 17 */,
4256
+ /* 18 */,
4257
+ /* 19 */,
4258
+ /* 20 */,
4259
+ /* 21 */,
4260
+ /* 22 */,
4261
+ /* 23 */,
4262
+ /* 24 */,
4263
+ /* 25 */,
4264
+ /* 26 */,
4265
+ /* 27 */,
4266
+ /* 28 */,
4267
+ /* 29 */,
4268
+ /* 30 */,
4269
+ /* 31 */,
4270
+ /* 32 */,
4271
+ /* 33 */,
4272
+ /* 34 */,
4273
+ /* 35 */,
4274
+ /* 36 */,
4275
+ /* 37 */,
4276
+ /* 38 */,
4277
+ /* 39 */,
4278
+ /* 40 */,
4279
+ /* 41 */,
4280
+ /* 42 */,
4281
+ /* 43 */,
4282
+ /* 44 */,
4283
+ /* 45 */,
4284
+ /* 46 */,
4285
+ /* 47 */,
4286
+ /* 48 */
4041
4287
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4042
4288
 
4043
4289
  "use strict";
@@ -4147,7 +4393,7 @@ render._withStripped = true
4147
4393
  var api = __webpack_require__(1);
4148
4394
 
4149
4395
  // EXTERNAL MODULE: ./src/utils/store.js
4150
- var store = __webpack_require__(13);
4396
+ var store = __webpack_require__(14);
4151
4397
 
4152
4398
  // EXTERNAL MODULE: ./src/utils/util.js
4153
4399
  var util = __webpack_require__(0);
@@ -4322,177 +4568,5 @@ main.install = function (Vue) {
4322
4568
 
4323
4569
  /* harmony default export */ var handle_user = __webpack_exports__["default"] = (main);
4324
4570
 
4325
- /***/ }),
4326
-
4327
- /***/ 5:
4328
- /***/ (function(module, exports) {
4329
-
4330
- module.exports = require("axios");
4331
-
4332
- /***/ }),
4333
-
4334
- /***/ 6:
4335
- /***/ (function(module, exports) {
4336
-
4337
- module.exports = require("json-bigint");
4338
-
4339
- /***/ }),
4340
-
4341
- /***/ 7:
4342
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4343
-
4344
- "use strict";
4345
- /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
4346
- /* harmony import */ var sockjs_client__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sockjs_client__WEBPACK_IMPORTED_MODULE_0__);
4347
- /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
4348
- /* harmony import */ var stompjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(stompjs__WEBPACK_IMPORTED_MODULE_1__);
4349
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4350
-
4351
-
4352
-
4353
-
4354
- var WebSocket = function () {
4355
- // 构造函数
4356
- function WebSocket() {
4357
- _classCallCheck(this, WebSocket);
4358
-
4359
- this.host = sessionStorage.getItem('wshost') || '';
4360
- this.tryTimes = 1; // 重连次数
4361
- this.callback = null; // 回调函数
4362
- this.client = null; // stomp对象
4363
- this.reconTimeout = null; // 重连延时器
4364
- this.debug = true; // 调试
4365
- this.interval = 20; // 重连间隔时间
4366
- this.vm = null;
4367
- this.nextDate = 0;
4368
- this.connects = 1;
4369
- this.recon = false;
4370
- this.sendTimeout = null;
4371
- this.socket = null;
4372
- this.subscription = null;
4373
- }
4374
-
4375
- /** socket连接 */
4376
-
4377
-
4378
- WebSocket.prototype.connect = function connect() {
4379
- var _this = this;
4380
-
4381
- if (!this.client) {
4382
- // 连接SockJS
4383
- this.socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_0___default.a(this.host + this.url, { timeout: 60000 });
4384
- this.client = stompjs__WEBPACK_IMPORTED_MODULE_1___default.a.over(this.socket);
4385
- }
4386
-
4387
- // 日志不打印
4388
- if (!this.debug) {
4389
- this.client.debug = function () {};
4390
- }
4391
-
4392
- // 向服务器发起websocket连接
4393
- this.client.connect({}, function () {
4394
- _this.recon = true;
4395
- // tryTimes定义重置
4396
- _this.connects = 1;
4397
- // 订阅消息
4398
- _this.subscribe();
4399
- }, function (error) {
4400
- _this.unsubscribe();
4401
- _this.client = null;
4402
- var diffSecond = parseInt((new Date() - _this.nextDate) / 1000, 10);
4403
- if (_this.connects > 5 && diffSecond < _this.interval) {
4404
- _this.error && _this.error(error);
4405
- } else {
4406
- _this.reconTimeout = setTimeout(function () {
4407
- _this.connect();
4408
- _this.connects++;
4409
- }, 5000);
4410
- }
4411
- });
4412
- }; // 清除订阅
4413
-
4414
-
4415
- WebSocket.prototype.unsubscribe = function unsubscribe() {
4416
- if (this.subscription) {
4417
- this.subscription.unsubscribe();
4418
- this.subscription = null;
4419
- }
4420
- };
4421
- /** 订阅服务端 */
4422
-
4423
-
4424
- WebSocket.prototype.subscribe = function subscribe() {
4425
- var _this2 = this;
4426
-
4427
- // 订阅服务端提供的某个topic
4428
- this.subscription = this.client.subscribe(this.take, function (response) {
4429
- if (response && (_this2.callback || _this2.success)) {
4430
- var callback = _this2.callback || _this2.success;
4431
- callback(JSON.parse(response.body));
4432
- }
4433
- });
4434
- };
4435
-
4436
- /** 赋值、初始化socket */
4437
-
4438
-
4439
- WebSocket.prototype.init = function init(option, vm) {
4440
- for (var i in option) {
4441
- this[i] = option[i];
4442
- }
4443
- this.vm = vm;
4444
- // 初始化连接
4445
- this.connect();
4446
- };
4447
-
4448
- /** 发送消息 */
4449
-
4450
-
4451
- WebSocket.prototype.send = function send(data) {
4452
- var _this3 = this;
4453
-
4454
- if (this.recon) {
4455
- clearTimeout(this.sendTimeout);
4456
- this.client.send(this.take, {}, typeof data === 'string' ? data : JSON.stringify(data));
4457
- } else {
4458
- this.sendTimeout = setTimeout(function () {
4459
- _this3.send(data);
4460
- }, 1000);
4461
- }
4462
- };
4463
-
4464
- /** 销毁 */
4465
-
4466
-
4467
- WebSocket.prototype.destroy = function destroy() {
4468
- // 断开连接,清除定时器
4469
- this.unsubscribe();
4470
- if (this.client) {
4471
- this.client.disconnect();
4472
- };
4473
- this.reconTimeout && clearTimeout(this.reconTimeout);
4474
- this.sendTimeout && clearTimeout(this.sendTimeout);
4475
- };
4476
-
4477
- return WebSocket;
4478
- }();
4479
-
4480
- /* harmony default export */ __webpack_exports__["a"] = (WebSocket);
4481
-
4482
- /***/ }),
4483
-
4484
- /***/ 8:
4485
- /***/ (function(module, exports) {
4486
-
4487
- module.exports = require("sockjs-client");
4488
-
4489
- /***/ }),
4490
-
4491
- /***/ 9:
4492
- /***/ (function(module, exports) {
4493
-
4494
- module.exports = require("stompjs");
4495
-
4496
4571
  /***/ })
4497
-
4498
- /******/ });
4572
+ /******/ ]);