login.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <!DOCTYPE html>
  2. <html lang="zh_CN">
  3. <head>
  4. <title>账户登录 - U企云服</title>
  5. <link rel="icon" href="./images/icon.ico" type="image/x-icon">
  6. <style>
  7. body {
  8. margin: 0;
  9. overflow: hidden;
  10. }
  11. iframe {
  12. border: 0;
  13. }
  14. .loading-wrap {
  15. position: absolute;
  16. background-color: #fff;
  17. width: 100%;
  18. height: 100%;
  19. text-align: center;
  20. z-index: 1;
  21. }
  22. .loading{
  23. display: inline-block;
  24. width: 150px;
  25. height: 15px;
  26. margin: 0 auto;
  27. margin-top: 150px;
  28. }
  29. .loading span{
  30. display: inline-block;
  31. width: 15px;
  32. height: 100%;
  33. margin-right: 5px;
  34. border-radius: 50%;
  35. background: #34baf6;
  36. -webkit-animation: load 1.04s ease infinite;
  37. }
  38. .loading span:last-child{
  39. margin-right: 0px;
  40. }
  41. @-webkit-keyframes load{
  42. 0%{
  43. opacity: 1;
  44. -webkit-transform: scale(1.3);
  45. }
  46. 100%{
  47. opacity: 0.2;
  48. -webkit-transform: scale(.3);
  49. }
  50. }
  51. .loading span:nth-child(1){
  52. -webkit-animation-delay:0.13s;
  53. }
  54. .loading span:nth-child(2){
  55. -webkit-animation-delay:0.26s;
  56. }
  57. .loading span:nth-child(3){
  58. -webkit-animation-delay:0.39s;
  59. }
  60. .loading span:nth-child(4){
  61. -webkit-animation-delay:0.52s;
  62. }
  63. .loading span:nth-child(5){
  64. -webkit-animation-delay:0.65s;
  65. }
  66. .message {
  67. position: absolute;
  68. bottom: 150px;
  69. left: 0;
  70. width: 100%;
  71. text-align: center;
  72. color: #9c9c9c;
  73. }
  74. </style>
  75. <script src="./lib/sockjs.min.js"></script>
  76. <script src="./lib/stomp.min.js"></script>
  77. <script>
  78. var Socket = (function(){
  79. return {
  80. subscribe: function(clientId, dest) {
  81. return new Promise((resolve, reject) => {
  82. const socket = new SockJS('https://saas-api.usoftchina.com/ws');
  83. stompClient = Stomp.over(socket);
  84. stompClient.connect({}, function (frame) {
  85. stompClient.subscribe('/clients/' + clientId + dest, function (message) {
  86. stompClient.disconnect(function () {
  87. resolve(JSON.parse(message.body));
  88. });
  89. });
  90. });
  91. })
  92. },
  93. disconnect: function(resolve) {
  94. if (stompClient) {
  95. stompClient.disconnect(resolve);
  96. } else {
  97. resolve();
  98. }
  99. }
  100. }
  101. })();
  102. </script>
  103. </head>
  104. <body>
  105. <div class="loading-wrap">
  106. <div class="loading">
  107. <span></span>
  108. <span></span>
  109. <span></span>
  110. <span></span>
  111. <span></span>
  112. </div>
  113. <div class="message">
  114. 正在读取网络文件,请稍等
  115. </div>
  116. </div>
  117. <script>
  118. const ipc = require('electron').ipcRenderer;
  119. var clientId = Math.random().toString(36).substr(2);
  120. Socket.subscribe(clientId, '/sso/callback').then(function(data){
  121. var session = data.token, account = data.account;
  122. account.companies = account.companies || [];
  123. session.account = account;
  124. ipc.send('session.change', JSON.stringify(session));
  125. });
  126. var loading = document.querySelector('.loading-wrap'), frame = document.createElement("iframe");
  127. frame.setAttribute("src", "https://sso.ubtob.com/sassLogin?appId=sp&baseUrl=" +
  128. encodeURIComponent('https://saas-api.usoftchina.com/api/auth/sso/callback/' + clientId));
  129. frame.setAttribute("width", "430");
  130. frame.setAttribute("height", "539");
  131. document.body.appendChild(frame);
  132. frame.onload = function() {
  133. loading.style.display = 'none';
  134. };
  135. </script>
  136. </body>
  137. </html>