eoss-ui 0.4.99 → 0.5.11

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 (123) hide show
  1. package/CHANGELOG.md +929 -0
  2. package/lib/button-group.js +118 -43
  3. package/lib/button.js +119 -44
  4. package/lib/checkbox-group.js +199 -112
  5. package/lib/data-table-form.js +118 -47
  6. package/lib/data-table.js +192 -100
  7. package/lib/date-picker.js +118 -43
  8. package/lib/dialog.js +128 -57
  9. package/lib/eoss-ui.common.js +1174 -1167
  10. package/lib/flow-group.js +118 -43
  11. package/lib/flow-list.js +137 -52
  12. package/lib/flow.js +123 -52
  13. package/lib/form.js +673 -547
  14. package/lib/handle-user.js +143 -68
  15. package/lib/handler.js +118 -43
  16. package/lib/icons.js +2 -2
  17. package/lib/index.js +1 -1
  18. package/lib/input-number.js +119 -44
  19. package/lib/input.js +121 -46
  20. package/lib/layout.js +2 -2
  21. package/lib/login.js +124 -52
  22. package/lib/main.js +299 -386
  23. package/lib/nav.js +118 -43
  24. package/lib/page.js +118 -43
  25. package/lib/player.js +120 -45
  26. package/lib/qr-code.js +118 -43
  27. package/lib/radio-group.js +148 -71
  28. package/lib/retrial-auth.js +118 -43
  29. package/lib/select-ganged.js +119 -44
  30. package/lib/select.js +143 -68
  31. package/lib/selector-panel.js +172 -90
  32. package/lib/selector.js +118 -43
  33. package/lib/sizer.js +121 -46
  34. package/lib/steps.js +118 -43
  35. package/lib/switch.js +119 -44
  36. package/lib/table-form.js +184 -109
  37. package/lib/tabs.js +118 -43
  38. package/lib/theme-chalk/index.css +1 -1
  39. package/lib/theme-chalk/pagination.css +1 -1
  40. package/lib/theme-chalk/toolbar.css +1 -1
  41. package/lib/tips.js +118 -43
  42. package/lib/toolbar.js +19 -9
  43. package/lib/tree-group.js +118 -43
  44. package/lib/tree.js +118 -43
  45. package/lib/upload.js +207 -125
  46. package/lib/utils/util.js +98 -35
  47. package/lib/wujie.js +118 -43
  48. package/lib/wxlogin.js +118 -43
  49. package/package.json +1 -1
  50. package/packages/button/src/main.vue +1 -10
  51. package/packages/data-table/src/column.vue +6 -0
  52. package/packages/data-table/src/main.vue +14 -6
  53. package/packages/flow-list/src/main.vue +4 -3
  54. package/packages/form/src/main.vue +71 -47
  55. package/packages/form/src/table.vue +12 -11
  56. package/packages/login/src/main.vue +1 -0
  57. package/packages/main/src/main.vue +118 -247
  58. package/packages/radio-group/src/main.vue +2 -5
  59. package/packages/theme-chalk/lib/base.css +1 -0
  60. package/packages/theme-chalk/lib/button-group.css +1 -0
  61. package/packages/theme-chalk/lib/button.css +0 -0
  62. package/packages/theme-chalk/lib/card.css +1 -0
  63. package/packages/theme-chalk/lib/cascader.css +0 -0
  64. package/packages/theme-chalk/lib/checkbox-group.css +1 -0
  65. package/packages/theme-chalk/lib/clients.css +1 -0
  66. package/packages/theme-chalk/lib/data-table-form.css +1 -0
  67. package/packages/theme-chalk/lib/data-table.css +1 -0
  68. package/packages/theme-chalk/lib/date-picker.css +1 -0
  69. package/packages/theme-chalk/lib/dialog.css +1 -0
  70. package/packages/theme-chalk/lib/enterprise.css +1 -0
  71. package/packages/theme-chalk/lib/error-page.css +1 -0
  72. package/packages/theme-chalk/lib/flow-chart.css +0 -0
  73. package/packages/theme-chalk/lib/flow-group.css +1 -0
  74. package/packages/theme-chalk/lib/flow-list.css +1 -0
  75. package/packages/theme-chalk/lib/flow.css +1 -0
  76. package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
  77. package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
  78. package/packages/theme-chalk/lib/form.css +1 -0
  79. package/packages/theme-chalk/lib/handle-user.css +1 -0
  80. package/packages/theme-chalk/lib/handler.css +1 -0
  81. package/packages/theme-chalk/lib/icon.css +1 -0
  82. package/packages/theme-chalk/lib/icons.css +1 -0
  83. package/packages/theme-chalk/lib/index.css +1 -0
  84. package/packages/theme-chalk/lib/input-number.css +0 -0
  85. package/packages/theme-chalk/lib/input.css +1 -0
  86. package/packages/theme-chalk/lib/label.css +1 -0
  87. package/packages/theme-chalk/lib/layout.css +1 -0
  88. package/packages/theme-chalk/lib/login.css +1 -0
  89. package/packages/theme-chalk/lib/main.css +1 -0
  90. package/packages/theme-chalk/lib/mainComp.css +0 -0
  91. package/packages/theme-chalk/lib/menu.css +1 -0
  92. package/packages/theme-chalk/lib/nav.css +1 -0
  93. package/packages/theme-chalk/lib/notify.css +0 -0
  94. package/packages/theme-chalk/lib/page.css +1 -0
  95. package/packages/theme-chalk/lib/pagination.css +1 -0
  96. package/packages/theme-chalk/lib/player.css +1 -0
  97. package/packages/theme-chalk/lib/qr-code.css +1 -0
  98. package/packages/theme-chalk/lib/radio-group.css +1 -0
  99. package/packages/theme-chalk/lib/retrial-auth.css +1 -0
  100. package/packages/theme-chalk/lib/select-ganged.css +1 -0
  101. package/packages/theme-chalk/lib/select.css +0 -0
  102. package/packages/theme-chalk/lib/selector-panel.css +1 -0
  103. package/packages/theme-chalk/lib/selector.css +1 -0
  104. package/packages/theme-chalk/lib/sizer.css +1 -0
  105. package/packages/theme-chalk/lib/steps.css +1 -0
  106. package/packages/theme-chalk/lib/switch.css +1 -0
  107. package/packages/theme-chalk/lib/table-form.css +0 -0
  108. package/packages/theme-chalk/lib/tabs-panel.css +0 -0
  109. package/packages/theme-chalk/lib/tabs.css +1 -0
  110. package/packages/theme-chalk/lib/tips.css +1 -0
  111. package/packages/theme-chalk/lib/toolbar.css +1 -0
  112. package/packages/theme-chalk/lib/tree-group.css +1 -0
  113. package/packages/theme-chalk/lib/tree.css +1 -0
  114. package/packages/theme-chalk/lib/upload.css +1 -0
  115. package/packages/theme-chalk/lib/wujie.css +0 -0
  116. package/packages/theme-chalk/lib/wxlogin.css +1 -0
  117. package/packages/theme-chalk/src/pagination.scss +8 -0
  118. package/packages/theme-chalk/src/toolbar.scss +1 -0
  119. package/packages/toolbar/src/main.vue +17 -8
  120. package/packages/upload/src/main.vue +0 -1
  121. package/src/index.js +1 -1
  122. package/src/utils/util.js +97 -37
  123. package/packages/theme-chalk/gulpfile.js +0 -25
package/src/utils/util.js CHANGED
@@ -7,10 +7,12 @@
7
7
 
8
8
  /* eslint-disable indent */
9
9
  const sm2 = require('sm-crypto').sm2;
10
- import { authCenter } from '../config/api';
10
+ import { authCenter, wss, topic } from '../config/api';
11
11
  import axios from 'axios';
12
12
  import qs from 'qs';
13
13
  import JSONbig from 'json-bigint';
14
+ import SockJS from 'sockjs-client';
15
+ import Stomp from 'stompjs';
14
16
 
15
17
  const win = window.__WUJIE_RAW_WINDOW__ ? window.__WUJIE_RAW_WINDOW__ : window;
16
18
 
@@ -661,6 +663,7 @@ const delUrlParam = function ({ url, key }) {
661
663
  key.forEach(item => {
662
664
  if (param.hasOwnProperty(item)) {
663
665
  let reg = `${item}=${param[item]}`;
666
+ console.log(reg);
664
667
  if (src.indexOf(reg + '&') > -1) {
665
668
  src = src.replace(reg + '&', '');
666
669
  } else if (src.indexOf('&' + reg) > -1) {
@@ -1685,7 +1688,7 @@ const getWeekday = function (date, type = 0) {
1685
1688
  * @param {String} [url] - url地址
1686
1689
  **/
1687
1690
 
1688
- const handlerUrl = function (url, before) {
1691
+ const handlerUrl = function (url, param, before) {
1689
1692
  let arry = url.split('?');
1690
1693
  if (arry.length > 2) {
1691
1694
  let ary = arry.splice(1, arry.length);
@@ -1707,6 +1710,10 @@ const handlerUrl = function (url, before) {
1707
1710
  } else {
1708
1711
  url += '?_tt=' + new Date().getTime();
1709
1712
  }
1713
+ if (param) {
1714
+ let str = queryParams(param);
1715
+ url += ('&' + str);
1716
+ }
1710
1717
  if (before && before === arry[0]) {
1711
1718
  let pathname = win.location.pathname;
1712
1719
  if (pathname === '/') {
@@ -1870,7 +1877,6 @@ const isLogined = function ({
1870
1877
  from,
1871
1878
  next,
1872
1879
  exclude = [],
1873
- open,
1874
1880
  cookie,
1875
1881
  loginPage,
1876
1882
  redirect
@@ -1878,24 +1884,24 @@ const isLogined = function ({
1878
1884
  if (cookie === undefined) {
1879
1885
  cookie = getParams({ name: 'cookie' });
1880
1886
  }
1887
+ let pathname = win.top.location.pathname;
1881
1888
  if (loginPage) {
1882
1889
  sessionStorage.setItem('loginPage', loginPage);
1883
1890
  if (!startWith(loginPage, ['http', '/'], true)) {
1884
- let pathname = win.top.location.pathname;
1885
1891
  if (pathname !== '/') {
1886
- pathname = pathname.split('/');
1887
- pathname.splice(pathname.length - 1);
1888
- pathname = pathname.join('/');
1889
- loginPage = pathname + '/' + loginPage.replace('./', '');
1892
+ let path = pathname.split('/');
1893
+ path.splice(pathname.length - 1);
1894
+ path = path.join('/');
1895
+ loginPage = path + '/' + loginPage.replace('./', '');
1890
1896
  } else {
1891
1897
  loginPage = pathname + loginPage.replace('./', '');
1892
1898
  }
1893
1899
  }
1894
1900
  }
1895
1901
  const token = getStorage('token') || getStorage('Authorization');
1896
- const logined = getStorage('logined');
1902
+ // const logined = getStorage('logined');
1897
1903
  // eslint-disable-next-line eqeqeq
1898
- if (token || logined || cookie == true || cookie == 1) {
1904
+ if (token || cookie == true || cookie == 1) {
1899
1905
  next && next();
1900
1906
  } else {
1901
1907
  if (
@@ -1921,40 +1927,25 @@ const isLogined = function ({
1921
1927
  deviceUnique: results.deviceUnique
1922
1928
  }
1923
1929
  });
1924
- next();
1930
+ let url = delUrlParam({
1931
+ url: win.top.location.href,
1932
+ key: ['serverId', 'authType', 'code', 'sessionId']
1933
+ });
1934
+ win.top.location.href = url;
1935
+ setTimeout(() => {
1936
+ win.top.location.reload();
1937
+ }, 200);
1925
1938
  break;
1926
1939
  case 1:
1927
1940
  break;
1928
1941
  case 2:
1929
1942
  break;
1930
1943
  case 3:
1931
- let url = win.top.location.href;
1932
1944
  const href = results.authorizeUrl.replace(
1933
1945
  '{redirectUri}',
1934
- encodeURIComponent(url)
1946
+ encodeURIComponent(win.top.location.href)
1935
1947
  );
1936
- if (to.query.openType) {
1937
- switch (to.query.openType) {
1938
- case 'self':
1939
- win.location.href = href;
1940
- break;
1941
- case 'blank':
1942
- win.open(href);
1943
- break;
1944
- case 'top':
1945
- win.top.location.href = href;
1946
- break;
1947
- case 'parent':
1948
- win.parent.location.href = href;
1949
- break;
1950
- }
1951
- } else {
1952
- if (open) {
1953
- win.open(href);
1954
- } else {
1955
- win.top.location.href = href;
1956
- }
1957
- }
1948
+ win.top.location.href = href;
1958
1949
  break;
1959
1950
  case 4:
1960
1951
  MessageBox.alert(
@@ -2004,7 +1995,8 @@ const isLogined = function ({
2004
1995
  );
2005
1996
  }
2006
1997
  }).catch(e => { });
2007
- } else if (
1998
+ } else
1999
+ if (
2008
2000
  token ||
2009
2001
  to.path === '/' ||
2010
2002
  to.path === '/404' ||
@@ -2474,6 +2466,74 @@ const setStorage = function ({ type, key, value }) {
2474
2466
  }
2475
2467
  };
2476
2468
 
2469
+ /**
2470
+ * socket
2471
+ * @desc:webSocket
2472
+ * @author huangbo
2473
+ * @date 2022年5月7日
2474
+ * @param {String} [url] - 连接地址
2475
+ * @param {String} [take] - 订阅地址
2476
+ * @param {String} [debug] - 调试
2477
+ * @param {String} [interval] - 重连间隔时间
2478
+ **/
2479
+ function socket(options) {
2480
+ let nextDate = 0;
2481
+ let connect = 1;
2482
+ return new Promise((resolve, reject) => {
2483
+ let wshost = getStorage('wshost') || '';
2484
+ let option = {
2485
+ url: wshost + wss,
2486
+ take: topic,
2487
+ debug: true,
2488
+ interval: 20
2489
+ };
2490
+ let websocket = win.websocket || {};
2491
+ if (options && isObject(options)) {
2492
+ option = { ...option, ...options };
2493
+ }
2494
+ let key = window.btoa(option.url);
2495
+ if (!websocket[key]) {
2496
+ websocket[key] = { socket: new SockJS(option.url) };
2497
+ win.websocket = websocket;
2498
+ }
2499
+
2500
+ let client = websocket[key] ? websocket[key].client : null;
2501
+ if (!client) {
2502
+ client = websocket[key].client = Stomp.over(websocket[key].socket);
2503
+ !option.debug && (client.debug = null);
2504
+ }
2505
+ client.connect(
2506
+ {},
2507
+ () => {
2508
+ client.subscribe(option.take, (response) => {
2509
+ let res = JSON.parse(response.body);
2510
+ resolve(res, () => {
2511
+ client.disconnect();
2512
+ win.top.websocket && win.top.websocket[key] && delete win.top.websocket[key];
2513
+ }, client, websocket[key]);
2514
+ });
2515
+ },
2516
+ (error) => {
2517
+ let diffSecond = parseInt((new Date() - nextDate) / 1000, 10);
2518
+ if (connect > 5 && diffSecond < option.interval) {
2519
+ client.disconnect();
2520
+ if (win.top.websocket) {
2521
+ if (Object.keys(win.top.websocket).length > 1) {
2522
+ delete win.top.websocket[key];
2523
+ } else {
2524
+ delete win.top.websocket;
2525
+ }
2526
+ }
2527
+ } else {
2528
+ win.top.websocket && win.top.websocket[key] && setTimeout(() => {
2529
+ socket(options);
2530
+ }, 5000);
2531
+ }
2532
+ reject(error);
2533
+ }
2534
+ );
2535
+ });
2536
+ }
2477
2537
  /**
2478
2538
  * sum
2479
2539
  * @desc 求和
@@ -2725,7 +2785,6 @@ const urlJoinParams = function ({ url, param, timestamp }) {
2725
2785
  params[items[0]] = items[1];
2726
2786
  });
2727
2787
  }
2728
- '&_tt=' + new Date().getTime();
2729
2788
  params = extend(true, params, param);
2730
2789
  let str = queryParams(params);
2731
2790
  if (str) {
@@ -2879,6 +2938,7 @@ export default {
2879
2938
  sendMessage,
2880
2939
  setFavicon,
2881
2940
  setStorage,
2941
+ socket,
2882
2942
  startWith,
2883
2943
  sum,
2884
2944
  takeLeft,
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- const { series, src, dest } = require('gulp');
4
- const sass = require('gulp-sass');
5
- const autoprefixer = require('gulp-autoprefixer');
6
- const cssmin = require('gulp-cssmin');
7
-
8
- function compile() {
9
- return src('./src/*.scss')
10
- .pipe(sass.sync())
11
- .pipe(autoprefixer({
12
- overrideBrowserslist: ['ie > 9', 'last 2 versions'],
13
- cascade: false
14
- }))
15
- .pipe(cssmin())
16
- .pipe(dest('./lib'));
17
- }
18
-
19
- function copyfont() {
20
- return src('./src/fonts/**')
21
- .pipe(cssmin())
22
- .pipe(dest('./lib/fonts'));
23
- }
24
-
25
- exports.build = series(compile, copyfont);