azureLogin.vue 8.0 KB

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