eoss-ui 0.4.92 → 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 +54 -35
  2. package/lib/button.js +54 -35
  3. package/lib/card.js +2 -2
  4. package/lib/cascader.js +2 -2
  5. package/lib/checkbox-group.js +54 -35
  6. package/lib/clients.js +2 -2
  7. package/lib/data-table-form.js +53 -34
  8. package/lib/data-table.js +54 -35
  9. package/lib/date-picker.js +54 -35
  10. package/lib/dialog.js +53 -34
  11. package/lib/enterprise.js +2 -2
  12. package/lib/eoss-ui.common.js +300 -110
  13. package/lib/error-page.js +2 -2
  14. package/lib/flow-group.js +54 -35
  15. package/lib/flow-list.js +55 -36
  16. package/lib/flow.js +54 -35
  17. package/lib/form.js +54 -35
  18. package/lib/handle-user.js +54 -35
  19. package/lib/handler.js +54 -35
  20. package/lib/icons.js +2 -2
  21. package/lib/index.js +1 -1
  22. package/lib/input-number.js +54 -35
  23. package/lib/input.js +54 -35
  24. package/lib/label.js +2 -2
  25. package/lib/layout.js +2 -2
  26. package/lib/login.js +53 -34
  27. package/lib/main.js +306 -116
  28. package/lib/menu.js +2 -2
  29. package/lib/nav.js +54 -35
  30. package/lib/notify.js +2 -2
  31. package/lib/page.js +54 -35
  32. package/lib/pagination.js +2 -2
  33. package/lib/player.js +68 -49
  34. package/lib/qr-code.js +61 -42
  35. package/lib/radio-group.js +54 -35
  36. package/lib/retrial-auth.js +54 -35
  37. package/lib/select-ganged.js +54 -35
  38. package/lib/select.js +61 -42
  39. package/lib/selector-panel.js +61 -42
  40. package/lib/selector.js +61 -42
  41. package/lib/sizer.js +54 -35
  42. package/lib/steps.js +54 -35
  43. package/lib/switch.js +54 -35
  44. package/lib/table-form.js +54 -35
  45. package/lib/tabs-panel.js +2 -2
  46. package/lib/tabs.js +54 -35
  47. package/lib/tips.js +54 -35
  48. package/lib/toolbar.js +2 -2
  49. package/lib/tree-group.js +54 -35
  50. package/lib/tree.js +54 -35
  51. package/lib/upload.js +54 -35
  52. package/lib/utils/util.js +41 -22
  53. package/lib/wujie.js +54 -35
  54. package/lib/wxlogin.js +55 -36
  55. package/package.json +2 -2
  56. package/packages/main/src/main.vue +158 -4
  57. package/src/index.js +1 -1
  58. package/src/utils/util.js +48 -26
@@ -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';
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.92',
120
+ version: '0.4.93',
121
121
  install,
122
122
  Button,
123
123
  ButtonGroup,
package/src/utils/util.js CHANGED
@@ -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 (