azureLogin.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <div id="app">
  3. <div id="loader-wrapper">
  4. <div id="loader"></div>
  5. <div class="loader-section section-left"></div>
  6. <div class="loader-section section-right"></div>
  7. <div class="load_title">
  8. 授权成功,登录中...
  9. <br/>
  10. <div style="margin-top: 20px;">
  11. <!--<button id="back-button" onclick="javascript:window.location.href='http://localhost/cpms/index.html';">返 回</button>-->
  12. <button id="back-button" onclick="javascript:window.location.href='https://cpms.basf-ypc.net.cn/cpms/index.html';">返 回</button>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import {getAzureAccessToken, getCodeImg} from "@/api/login";
  20. import Cookies from "js-cookie";
  21. import { encrypt, decrypt } from '@/utils/jsencrypt'
  22. import LangSelect from '@/components/LangSelect'
  23. import {updatePlantproglist} from "@/api/document/plantproglist";
  24. export default {
  25. name: "AzureLogin",
  26. components: { LangSelect },
  27. data() {
  28. return {
  29. code: null,
  30. loading: false,
  31. };
  32. },
  33. created() {
  34. this.getCode();
  35. this.getAzureAccessToken();
  36. },
  37. methods: {
  38. getCode() {
  39. this.code = window.location.search.replace("?code=" , '');
  40. this.code = this.code.substring(0, this.code.indexOf("&"));
  41. },
  42. getAzureAccessToken(){
  43. getAzureAccessToken(this.code).then(response => { // 200
  44. Cookies.set('Admin-Token', response.token);
  45. this.$router.push({path: "/index" || "/404"});
  46. }).catch(err => { // 500
  47. // window.location.href = 'https://cpms.seashoreept.cn/cpms/index.html?message=' + err.message;
  48. window.location.href = 'https://cpms.basf-ypc.net.cn/cpms/index.html?message=' + err.message;
  49. });
  50. // // getAzureAccessToken(this.code).then(response => {
  51. // // window.location.href = 'http://localhost/cpms/index.html?message='+ '登录失败';
  52. // // });
  53. }
  54. }
  55. };
  56. </script>
  57. <style rel="stylesheet/scss" lang="scss">
  58. #back-button{
  59. padding: 10px 35px;
  60. }
  61. #back-button:hover{
  62. cursor: pointer;
  63. }
  64. html,
  65. body,
  66. #app {
  67. height: 100%;
  68. margin: 0px;
  69. padding: 0px;
  70. }
  71. .chromeframe {
  72. margin: 0.2em 0;
  73. background: #ccc;
  74. color: #000;
  75. padding: 0.2em 0;
  76. }
  77. #loader-wrapper {
  78. position: fixed;
  79. top: 0;
  80. left: 0;
  81. width: 100%;
  82. height: 100%;
  83. z-index: 999999;
  84. }
  85. #loader {
  86. display: block;
  87. position: relative;
  88. left: 50%;
  89. top: 50%;
  90. width: 150px;
  91. height: 150px;
  92. margin: -75px 0 0 -75px;
  93. border-radius: 50%;
  94. border: 3px solid transparent;
  95. border-top-color: #FFF;
  96. -webkit-animation: spin 2s linear infinite;
  97. -ms-animation: spin 2s linear infinite;
  98. -moz-animation: spin 2s linear infinite;
  99. -o-animation: spin 2s linear infinite;
  100. animation: spin 2s linear infinite;
  101. z-index: 1001;
  102. }
  103. #loader:before {
  104. content: "";
  105. position: absolute;
  106. top: 5px;
  107. left: 5px;
  108. right: 5px;
  109. bottom: 5px;
  110. border-radius: 50%;
  111. border: 3px solid transparent;
  112. border-top-color: #FFF;
  113. -webkit-animation: spin 3s linear infinite;
  114. -moz-animation: spin 3s linear infinite;
  115. -o-animation: spin 3s linear infinite;
  116. -ms-animation: spin 3s linear infinite;
  117. animation: spin 3s linear infinite;
  118. }
  119. #loader:after {
  120. content: "";
  121. position: absolute;
  122. top: 15px;
  123. left: 15px;
  124. right: 15px;
  125. bottom: 15px;
  126. border-radius: 50%;
  127. border: 3px solid transparent;
  128. border-top-color: #FFF;
  129. -moz-animation: spin 1.5s linear infinite;
  130. -o-animation: spin 1.5s linear infinite;
  131. -ms-animation: spin 1.5s linear infinite;
  132. -webkit-animation: spin 1.5s linear infinite;
  133. animation: spin 1.5s linear infinite;
  134. }
  135. @-webkit-keyframes spin {
  136. 0% {
  137. -webkit-transform: rotate(0deg);
  138. -ms-transform: rotate(0deg);
  139. transform: rotate(0deg);
  140. }
  141. 100% {
  142. -webkit-transform: rotate(360deg);
  143. -ms-transform: rotate(360deg);
  144. transform: rotate(360deg);
  145. }
  146. }
  147. @keyframes spin {
  148. 0% {
  149. -webkit-transform: rotate(0deg);
  150. -ms-transform: rotate(0deg);
  151. transform: rotate(0deg);
  152. }
  153. 100% {
  154. -webkit-transform: rotate(360deg);
  155. -ms-transform: rotate(360deg);
  156. transform: rotate(360deg);
  157. }
  158. }
  159. #loader-wrapper .loader-section {
  160. position: fixed;
  161. top: 0;
  162. width: 51%;
  163. height: 100%;
  164. background: #7171C6;
  165. z-index: 1000;
  166. -webkit-transform: translateX(0);
  167. -ms-transform: translateX(0);
  168. transform: translateX(0);
  169. }
  170. #loader-wrapper .loader-section.section-left {
  171. left: 0;
  172. }
  173. #loader-wrapper .loader-section.section-right {
  174. right: 0;
  175. }
  176. .loaded #loader-wrapper .loader-section.section-left {
  177. -webkit-transform: translateX(-100%);
  178. -ms-transform: translateX(-100%);
  179. transform: translateX(-100%);
  180. -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  181. transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  182. }
  183. .loaded #loader-wrapper .loader-section.section-right {
  184. -webkit-transform: translateX(100%);
  185. -ms-transform: translateX(100%);
  186. transform: translateX(100%);
  187. -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  188. transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  189. }
  190. .loaded #loader {
  191. opacity: 0;
  192. -webkit-transition: all 0.3s ease-out;
  193. transition: all 0.3s ease-out;
  194. }
  195. .loaded #loader-wrapper {
  196. visibility: hidden;
  197. -webkit-transform: translateY(-100%);
  198. -ms-transform: translateY(-100%);
  199. transform: translateY(-100%);
  200. -webkit-transition: all 0.3s 1s ease-out;
  201. transition: all 0.3s 1s ease-out;
  202. }
  203. .no-js #loader-wrapper {
  204. display: none;
  205. }
  206. .no-js h1 {
  207. color: #222222;
  208. }
  209. #loader-wrapper .load_title {
  210. font-family: 'Open Sans';
  211. color: #FFF;
  212. font-size: 19px;
  213. width: 100%;
  214. text-align: center;
  215. z-index: 9999999999999;
  216. position: absolute;
  217. top: 60%;
  218. opacity: 1;
  219. line-height: 30px;
  220. }
  221. #loader-wrapper .load_title span {
  222. font-weight: normal;
  223. font-style: italic;
  224. font-size: 13px;
  225. color: #FFF;
  226. opacity: 0.5;
  227. }
  228. .login {
  229. display: flex;
  230. justify-content: center;
  231. align-items: center;
  232. height: 100%;
  233. background-size: cover;
  234. }
  235. .title {
  236. margin: 0px auto 15px auto;
  237. text-align: center;
  238. color: #ffffff;
  239. }
  240. .login-form {
  241. position:absolute;
  242. top:50%;
  243. left:50%;
  244. transform:translate(-50%,-50%);
  245. /*实现块元素百分比下居中*/
  246. width:450px;
  247. padding:50px;
  248. background: #2a8db9db;
  249. box-sizing:border-box;
  250. box-shadow: 0px 15px 25px rgba(0,0,0,.5);
  251. border-radius:15px;
  252. .el-input {
  253. height: 38px;
  254. input {
  255. height: 38px;
  256. }
  257. }
  258. .input-icon {
  259. height: 39px;
  260. width: 14px;
  261. margin-left: 2px;
  262. }
  263. }
  264. .login-tip {
  265. font-size: 13px;
  266. text-align: center;
  267. color: #bfbfbf;
  268. }
  269. .login-code {
  270. width: 33%;
  271. height: 38px;
  272. float: right;
  273. img {
  274. cursor: pointer;
  275. vertical-align: middle;
  276. }
  277. }
  278. .el-dropdown {
  279. color: #ffffff;
  280. }
  281. .el-checkbox {
  282. color: #ffffff;
  283. }
  284. .el-login-footer {
  285. height: 40px;
  286. line-height: 40px;
  287. position: fixed;
  288. bottom: 0;
  289. width: 100%;
  290. text-align: center;
  291. color: #fff;
  292. font-family: Arial;
  293. font-size: 12px;
  294. letter-spacing: 1px;
  295. }
  296. .login-code-img {
  297. height: 38px;
  298. }
  299. </style>
  300. <style scoped>
  301. .el-button--primary {
  302. color: #FFFFFF;
  303. background-color: #40a9ff;
  304. border-color: #40a9ff;
  305. }
  306. .el-button:hover, .el-button:focus {
  307. border-color: #6abfff;
  308. background-color: #6abfff;
  309. }
  310. </style>