eoss-ui 0.4.91 → 0.4.93

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 (58) hide show
  1. package/lib/button-group.js +56 -37
  2. package/lib/button.js +56 -37
  3. package/lib/card.js +2 -2
  4. package/lib/cascader.js +2 -2
  5. package/lib/checkbox-group.js +56 -37
  6. package/lib/clients.js +2 -2
  7. package/lib/data-table-form.js +55 -36
  8. package/lib/data-table.js +56 -37
  9. package/lib/date-picker.js +56 -37
  10. package/lib/dialog.js +55 -36
  11. package/lib/enterprise.js +2 -2
  12. package/lib/eoss-ui.common.js +321 -131
  13. package/lib/error-page.js +2 -2
  14. package/lib/flow-group.js +56 -37
  15. package/lib/flow-list.js +57 -38
  16. package/lib/flow.js +56 -37
  17. package/lib/form.js +56 -37
  18. package/lib/handle-user.js +56 -37
  19. package/lib/handler.js +56 -37
  20. package/lib/icons.js +2 -2
  21. package/lib/index.js +1 -1
  22. package/lib/input-number.js +56 -37
  23. package/lib/input.js +56 -37
  24. package/lib/label.js +2 -2
  25. package/lib/layout.js +2 -2
  26. package/lib/login.js +55 -36
  27. package/lib/main.js +327 -137
  28. package/lib/menu.js +2 -2
  29. package/lib/nav.js +56 -37
  30. package/lib/notify.js +2 -2
  31. package/lib/page.js +56 -37
  32. package/lib/pagination.js +2 -2
  33. package/lib/player.js +70 -51
  34. package/lib/qr-code.js +63 -44
  35. package/lib/radio-group.js +56 -37
  36. package/lib/retrial-auth.js +56 -37
  37. package/lib/select-ganged.js +56 -37
  38. package/lib/select.js +63 -44
  39. package/lib/selector-panel.js +63 -44
  40. package/lib/selector.js +63 -44
  41. package/lib/sizer.js +56 -37
  42. package/lib/steps.js +56 -37
  43. package/lib/switch.js +56 -37
  44. package/lib/table-form.js +56 -37
  45. package/lib/tabs-panel.js +2 -2
  46. package/lib/tabs.js +56 -37
  47. package/lib/tips.js +56 -37
  48. package/lib/toolbar.js +2 -2
  49. package/lib/tree-group.js +56 -37
  50. package/lib/tree.js +56 -37
  51. package/lib/upload.js +56 -37
  52. package/lib/utils/util.js +43 -24
  53. package/lib/wujie.js +56 -37
  54. package/lib/wxlogin.js +57 -38
  55. package/package.json +2 -2
  56. package/packages/main/src/main.vue +180 -26
  57. package/src/index.js +1 -1
  58. package/src/utils/util.js +50 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eoss-ui",
3
- "version": "0.4.91",
3
+ "version": "0.4.93",
4
4
  "description": "eoss内部业务组件",
5
5
  "main": "lib/eoss-ui.common.js",
6
6
  "files": [
@@ -95,7 +95,7 @@
95
95
  "cp-cli": "^1.0.2",
96
96
  "cross-env": "^3.1.3",
97
97
  "css-loader": "^2.1.0",
98
- "eoss-element": "^0.2.73",
98
+ "eoss-element": "^0.2.74",
99
99
  "es6-promise": "^4.0.5",
100
100
  "eslint": "4.18.2",
101
101
  "eslint-config-elemefe": "0.1.1",
@@ -253,6 +253,7 @@ import message from './message.vue';
253
253
  import notice from './notice.vue';
254
254
  import AsyncComponent from './async-component/index.vue';
255
255
  import {
256
+ authCenter,
256
257
  mainConfig,
257
258
  updateUserCustomInfo,
258
259
  getComplexApplications,
@@ -624,12 +625,9 @@ export default {
624
625
  this.homePage =
625
626
  typeof this.loadHomePage === 'string' ? this.loadHomePage : '';
626
627
  this.isHeader = util.getParams('header');
627
- this.getConfig();
628
- if (this.socket) {
629
- this.initWebSocket();
630
- }
631
628
  let sysLogoIco = sessionStorage.getItem('sysLogoIco');
632
629
  sysLogoIco && util.setFavicon(sysLogoIco);
630
+ this.isLogin();
633
631
  },
634
632
  mounted() {
635
633
  util.win.reLogin = this.handleReLogin;
@@ -644,6 +642,162 @@ export default {
644
642
  util.win.windowOpen = this.openPage;
645
643
  },
646
644
  methods: {
645
+ async isLogin() {
646
+ const query = this.$route.query;
647
+ const token =
648
+ util.getStorage('token') || util.getStorage('Authorization');
649
+
650
+ let loginPage = util.getStorage('login') || util.getStorage('loginPage');
651
+ if (loginPage) {
652
+ if (!util.startWith(loginPage, ['http', '/'], true)) {
653
+ let pathname = util.win.top.location.pathname;
654
+ if (pathname !== '/') {
655
+ pathname = pathname.split('/');
656
+ pathname.splice(pathname.length - 1);
657
+ pathname = pathname.join('/');
658
+ loginPage = pathname + '/' + loginPage.replace('./', '');
659
+ } else {
660
+ loginPage = pathname + loginPage.replace('./', '');
661
+ }
662
+ }
663
+ }
664
+ if (
665
+ !token &&
666
+ Object.prototype.hasOwnProperty.call(query, 'serverId') &&
667
+ Object.prototype.hasOwnProperty.call(query, 'authType')
668
+ ) {
669
+ let url = util.win.top.location.href;
670
+ if (query.openType) {
671
+ switch (query.openType) {
672
+ case 'self':
673
+ url = util.win.location.href;
674
+ break;
675
+ case 'blank':
676
+ url = util.win.open(url);
677
+ break;
678
+ case 'parent':
679
+ url = util.win.parent.location.href;
680
+ break;
681
+ }
682
+ }
683
+ await util
684
+ .ajax({
685
+ method: 'post',
686
+ url: authCenter,
687
+ data: query
688
+ })
689
+ .then((res) => {
690
+ if (res.rCode === 0) {
691
+ this.getConfig();
692
+ if (this.socket) {
693
+ this.initWebSocket();
694
+ }
695
+ let { results } = res;
696
+ switch (results.statusCode) {
697
+ case 0:
698
+ const storage = getStorage('storage');
699
+ setStorage({
700
+ type: storage,
701
+ key: {
702
+ ssId: results.ssId,
703
+ token: results.token,
704
+ Authorization: results.token,
705
+ deviceUnique: results.deviceUnique
706
+ }
707
+ });
708
+ break;
709
+ case 1:
710
+ break;
711
+ case 2:
712
+ break;
713
+ case 3:
714
+ const href = results.authorizeUrl.replace(
715
+ '{redirectUri}',
716
+ encodeURIComponent(url)
717
+ );
718
+ if (query.openType) {
719
+ switch (query.openType) {
720
+ case 'self':
721
+ util.win.location.href = href;
722
+ break;
723
+ case 'blank':
724
+ util.win.open(href);
725
+ break;
726
+ case 'top':
727
+ util.win.top.location.href = href;
728
+ break;
729
+ case 'parent':
730
+ util.win.parent.location.href = href;
731
+ break;
732
+ }
733
+ } else {
734
+ if (open) {
735
+ util.win.open(href);
736
+ } else {
737
+ util.win.top.location.href = href;
738
+ }
739
+ }
740
+ break;
741
+ case 4:
742
+ this.$alert(
743
+ results.msg
744
+ ? results.msg
745
+ : '账号未绑定,账号密码登录后自动绑定!',
746
+ '提示',
747
+ {
748
+ confirmButtonText: '确定',
749
+ type: 'error',
750
+ callback: () => {
751
+ sessionStorage.setItem(
752
+ 'extUserBindHandleId',
753
+ results.extUserBindHandleId
754
+ );
755
+ //window.location.href = delUrlParam({ key: 'code' });
756
+ if (loginPage) {
757
+ util.win.top.location.replace(loginPage);
758
+ } else if (document.referrer) {
759
+ util.win.top.location.replace(document.referrer);
760
+ } else if (
761
+ util.win.top.location.href.indexOf('main.html') > -1
762
+ ) {
763
+ util.win.top.location.href = './login.html';
764
+ } else {
765
+ this.$router.replace('/login');
766
+ }
767
+ }
768
+ }
769
+ );
770
+ break;
771
+ default:
772
+ }
773
+ } else {
774
+ this.$alert(res.msg, '提示', {
775
+ confirmButtonText: '确定',
776
+ type: 'error',
777
+ callback: () => {
778
+ if (loginPage) {
779
+ util.win.top.location.replace(loginPage);
780
+ } else if (document.referrer) {
781
+ util.win.top.location.replace(document.referrer);
782
+ } else if (
783
+ util.win.top.location.href.indexOf('main.html') > -1
784
+ ) {
785
+ util.win.top.location.href = './login.html';
786
+ } else {
787
+ this.$router.replace('/login');
788
+ }
789
+ }
790
+ });
791
+ }
792
+ })
793
+ .catch((e) => {});
794
+ } else {
795
+ this.getConfig();
796
+ if (this.socket) {
797
+ this.initWebSocket();
798
+ }
799
+ }
800
+ },
647
801
  menuSuccess(res) {
648
802
  // this.menus
649
803
  this.menuType = 'custom';
@@ -740,6 +894,17 @@ export default {
740
894
  this.navIds = ids;
741
895
  this.setTitle(ids[0]);
742
896
  }
897
+ } else if (sessionStorage.getItem('jump') && this.history) {
898
+ let ids = this.getId(
899
+ this.menus,
900
+ sessionStorage.getItem('jump'),
901
+ true
902
+ );
903
+ if (ids) {
904
+ this.defaultActive = ids;
905
+ this.navIds = ids;
906
+ this.setTitle(ids[0]);
907
+ }
743
908
  } else if (util.win.location.hash) {
744
909
  let hash = util.win.location.hash;
745
910
  if (hash) {
@@ -764,17 +929,6 @@ export default {
764
929
  this.setTitle(ids[0]);
765
930
  }
766
931
  }
767
- } else if (sessionStorage.getItem('jump') && this.history) {
768
- let ids = this.getId(
769
- this.menus,
770
- sessionStorage.getItem('jump'),
771
- true
772
- );
773
- if (ids) {
774
- this.defaultActive = ids;
775
- this.navIds = ids;
776
- this.setTitle(ids[0]);
777
- }
778
932
  }
779
933
  this.setMenu(this.menus);
780
934
  }
@@ -1027,6 +1181,17 @@ export default {
1027
1181
  if (ids) {
1028
1182
  this.defaultActive = ids;
1029
1183
  }
1184
+ } else if (sessionStorage.getItem('jump') && this.history) {
1185
+ let ids = this.getId(
1186
+ this.menus,
1187
+ sessionStorage.getItem('jump'),
1188
+ true
1189
+ );
1190
+ if (ids) {
1191
+ this.defaultActive = ids;
1192
+ this.navIds = ids;
1193
+ this.setTitle(ids[0]);
1194
+ }
1030
1195
  } else if (util.win.location.hash) {
1031
1196
  let hash = util.win.location.hash;
1032
1197
  if (hash) {
@@ -1055,17 +1220,6 @@ export default {
1055
1220
  this.setTitle(ids[0]);
1056
1221
  }
1057
1222
  }
1058
- } else if (sessionStorage.getItem('jump') && this.history) {
1059
- let ids = this.getId(
1060
- this.menus,
1061
- sessionStorage.getItem('jump'),
1062
- true
1063
- );
1064
- if (ids) {
1065
- this.defaultActive = ids;
1066
- this.navIds = ids;
1067
- this.setTitle(ids[0]);
1068
- }
1069
1223
  }
1070
1224
  this.setTips(this.menus);
1071
1225
  store.set('nav', this.menus);
package/src/index.js CHANGED
@@ -117,7 +117,7 @@ if (typeof window !== 'undefined' && window.Vue) {
117
117
  }
118
118
 
119
119
  export default {
120
- version: '0.4.91',
120
+ version: '0.4.93',
121
121
  install,
122
122
  Button,
123
123
  ButtonGroup,
package/src/utils/util.js CHANGED
@@ -393,11 +393,11 @@ const ajax = function ({
393
393
  }
394
394
  if (method === 'post' && format) {
395
395
  data = qs.stringify(data);
396
- if (!header['content-type']) {
396
+ if (!header['content-type'] && !header['Content-Type']) {
397
397
  header['content-type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
398
398
  }
399
399
  } else {
400
- if (!header['content-type']) {
400
+ if (!header['content-type'] && !header['Content-Type']) {
401
401
  header['content-type'] = 'application/json;charset=UTF-8';
402
402
  }
403
403
  }
@@ -1863,6 +1863,17 @@ const isLogined = function ({
1863
1863
  if (logined || cookie == true || cookie == 1) {
1864
1864
  if (loginPage) {
1865
1865
  sessionStorage.setItem('loginPage', loginPage);
1866
+ if (!startWith(loginPage, ['http', '/'], true)) {
1867
+ let pathname = win.top.location.pathname;
1868
+ if (pathname !== '/') {
1869
+ pathname = pathname.split('/');
1870
+ pathname.splice(pathname.length - 1);
1871
+ pathname = pathname.join('/');
1872
+ loginPage = pathname + '/' + loginPage.replace('./', '');
1873
+ } else {
1874
+ loginPage = pathname + loginPage.replace('./', '');
1875
+ }
1876
+ }
1866
1877
  }
1867
1878
  next();
1868
1879
  } else {
@@ -1878,7 +1889,7 @@ const isLogined = function ({
1878
1889
  url = win.location.href;
1879
1890
  break;
1880
1891
  case 'blank':
1881
- url = win.location.href;
1892
+ url = win.open(url);
1882
1893
  break;
1883
1894
  case 'parent':
1884
1895
  url = win.parent.location.href;
@@ -1939,40 +1950,51 @@ const isLogined = function ({
1939
1950
  }
1940
1951
  break;
1941
1952
  case 4:
1942
- this.$alert(
1953
+ MessageBox.alert(
1943
1954
  results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!',
1944
1955
  '提示',
1945
1956
  {
1946
1957
  confirmButtonText: '确定',
1947
- type: 'error'
1948
- }
1949
- )
1950
- .then(() => {
1951
- sessionStorage.setItem(
1952
- 'extUserBindHandleId',
1953
- results.extUserBindHandleId
1954
- );
1955
- window.location.href = delUrlParam({ key: 'code' });
1956
- if (loginPage) {
1957
- win.top.location.replace(loginPage);
1958
- } else if (document.referrer) {
1959
- win.top.location.replace(document.referrer);
1960
- } else if (win.top.location.href.indexOf('main.html') > -1) {
1961
- win.top.location.href = './login.html';
1962
- } else {
1963
- next('/login');
1958
+ type: 'error',
1959
+ callback: () => {
1960
+ sessionStorage.setItem(
1961
+ 'extUserBindHandleId',
1962
+ results.extUserBindHandleId
1963
+ );
1964
+ if (loginPage) {
1965
+ win.top.location.replace(loginPage);
1966
+ } else if (document.referrer) {
1967
+ win.top.location.replace(document.referrer);
1968
+ } else if (win.top.location.href.indexOf('main.html') > -1) {
1969
+ win.top.location.href = './login.html';
1970
+ } else {
1971
+ next('/login');
1972
+ }
1964
1973
  }
1965
- })
1966
- .catch((e) => { });
1974
+ }
1975
+ );
1967
1976
  break;
1968
1977
  default:
1969
1978
  }
1970
1979
  } else {
1971
- if (token) {
1972
- next();
1973
- } else {
1974
- alert(res.msg);
1975
- }
1980
+ MessageBox.alert(res.msg,
1981
+ '提示',
1982
+ {
1983
+ confirmButtonText: '确定',
1984
+ type: 'error',
1985
+ callback: () => {
1986
+ if (loginPage) {
1987
+ win.top.location.replace(loginPage);
1988
+ } else if (document.referrer) {
1989
+ win.top.location.replace(document.referrer);
1990
+ } else if (win.top.location.href.indexOf('main.html') > -1) {
1991
+ win.top.location.href = './login.html';
1992
+ } else {
1993
+ next('/login');
1994
+ }
1995
+ }
1996
+ }
1997
+ );
1976
1998
  }
1977
1999
  }).catch(e => { });
1978
2000
  } else if (