pageTransferPage.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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">正在加载系统资源,请耐心等待</div>
  8. </div>
  9. </div>
  10. </template>
  11. <script>
  12. import {loginBySso, authorize, isTenantExist, limsLoginBy} from "@/api/login";
  13. import {Base64} from "js-base64";
  14. export default {
  15. name: "loading",
  16. props: [],
  17. components: {},
  18. data() {
  19. return {
  20. token: "",
  21. tenantId: null,
  22. };
  23. },
  24. computed: {},
  25. methods: {
  26. // 存储配置信息
  27. setConfig(config) {
  28. let {
  29. loginPageTitle,
  30. loginPageDescription,
  31. loginPageLogo,
  32. loginPageBackgroundImage,
  33. windowTitle,
  34. windowLogo,
  35. } = config;
  36. if (loginPageTitle) {
  37. window.sessionStorage.setItem("title", loginPageTitle);
  38. } else {
  39. window.sessionStorage.removeItem("title");
  40. }
  41. if (loginPageLogo) {
  42. window.sessionStorage.setItem("logo", loginPageLogo);
  43. } else {
  44. window.sessionStorage.removeItem("logo");
  45. }
  46. },
  47. // 获取配置信息
  48. async getConfig(tenantCode) {
  49. if (tenantCode != null) {
  50. // 得到tenantId 查询裤中是否存在该租户
  51. let res = await isTenantExist({tenantCode: tenantCode});
  52. console.log("isTenantExist", res.data.tenantId);
  53. if (res == undefined) {
  54. this.$router.push({path: "/401"});
  55. } else if (res?.data?.tenantId) {
  56. this.tenantId = res.data.tenantId
  57. // 判断当前编号是否存在库中
  58. // this.tenantId = res.data.tenantId;
  59. // this.loginForm.tenantID = this.tenantId;
  60. if (res?.data?.loginPageConfiguration) {
  61. this.setConfig(res.data.loginPageConfiguration || {});
  62. } else {
  63. window.sessionStorage.removeItem("title");
  64. window.sessionStorage.removeItem("logo");
  65. }
  66. } else {
  67. console.log("租户有问题!");
  68. // 当前访问链接中的租户编号不存在
  69. this.$router.push({path: "/401"});
  70. }
  71. } else {
  72. this.$router.push({path: "/401"});
  73. }
  74. },
  75. async initUserInfo() {
  76. let userInfo = this.$route.query.userInfo;
  77. console.log("dddddddddddddddddddddddddddddddddddddddddddddd")
  78. if (userInfo) {
  79. let loginData = Base64.decode(userInfo).split("#");
  80. console.log()
  81. let tenantId = loginData[0];
  82. let tenantCode = loginData[1];
  83. let userName = loginData[2];
  84. try {
  85. await this.getConfig(tenantCode);
  86. // 登录
  87. console.log("tenantId我发送的请求",tenantId)
  88. let res = await limsLoginBy(userName,tenantId);
  89. if (res.code == 200) {
  90. // 存储token 用户信息
  91. this.$store
  92. .dispatch("LoginBySso", {
  93. username: userName,
  94. token: res.token,
  95. })
  96. .then(() => {
  97. this.$router
  98. .push({path: this.redirect || "/"})
  99. .catch(() => {
  100. });
  101. });
  102. } else {
  103. this.$message.error("网络异常,请重新跳转");
  104. await this.$router.push("/401");
  105. }
  106. } catch (error) {
  107. this.$message.error("网络异常,请重新跳转");
  108. this.$router.push("/401");
  109. }
  110. } else {
  111. this.$message.error("参数异常,请重新跳转");
  112. this.$router.push("/401");
  113. }
  114. },
  115. },
  116. mounted() {
  117. console.log(this.$route.query.userInfo)
  118. if (this.$route.query.userInfo) {
  119. this.initUserInfo();
  120. }
  121. },
  122. };
  123. </script>
  124. <style scoped lang="scss">
  125. html,
  126. body,
  127. #app {
  128. height: 100%;
  129. margin: 0px;
  130. padding: 0px;
  131. }
  132. .chromeframe {
  133. margin: 0.2em 0;
  134. background: #ccc;
  135. color: #000;
  136. padding: 0.2em 0;
  137. }
  138. #loader-wrapper {
  139. position: fixed;
  140. top: 0;
  141. left: 0;
  142. width: 100%;
  143. height: 100%;
  144. z-index: 999999;
  145. }
  146. #loader {
  147. display: block;
  148. position: relative;
  149. left: 50%;
  150. top: 50%;
  151. width: 150px;
  152. height: 150px;
  153. margin: -75px 0 0 -75px;
  154. border-radius: 50%;
  155. border: 3px solid transparent;
  156. border-top-color: #fff;
  157. -webkit-animation: spin 2s linear infinite;
  158. -ms-animation: spin 2s linear infinite;
  159. -moz-animation: spin 2s linear infinite;
  160. -o-animation: spin 2s linear infinite;
  161. animation: spin 2s linear infinite;
  162. z-index: 1001;
  163. }
  164. #loader:before {
  165. content: "";
  166. position: absolute;
  167. top: 5px;
  168. left: 5px;
  169. right: 5px;
  170. bottom: 5px;
  171. border-radius: 50%;
  172. border: 3px solid transparent;
  173. border-top-color: #fff;
  174. -webkit-animation: spin 3s linear infinite;
  175. -moz-animation: spin 3s linear infinite;
  176. -o-animation: spin 3s linear infinite;
  177. -ms-animation: spin 3s linear infinite;
  178. animation: spin 3s linear infinite;
  179. }
  180. #loader:after {
  181. content: "";
  182. position: absolute;
  183. top: 15px;
  184. left: 15px;
  185. right: 15px;
  186. bottom: 15px;
  187. border-radius: 50%;
  188. border: 3px solid transparent;
  189. border-top-color: #fff;
  190. -moz-animation: spin 1.5s linear infinite;
  191. -o-animation: spin 1.5s linear infinite;
  192. -ms-animation: spin 1.5s linear infinite;
  193. -webkit-animation: spin 1.5s linear infinite;
  194. animation: spin 1.5s linear infinite;
  195. }
  196. @-webkit-keyframes spin {
  197. 0% {
  198. -webkit-transform: rotate(0deg);
  199. -ms-transform: rotate(0deg);
  200. transform: rotate(0deg);
  201. }
  202. 100% {
  203. -webkit-transform: rotate(360deg);
  204. -ms-transform: rotate(360deg);
  205. transform: rotate(360deg);
  206. }
  207. }
  208. @keyframes spin {
  209. 0% {
  210. -webkit-transform: rotate(0deg);
  211. -ms-transform: rotate(0deg);
  212. transform: rotate(0deg);
  213. }
  214. 100% {
  215. -webkit-transform: rotate(360deg);
  216. -ms-transform: rotate(360deg);
  217. transform: rotate(360deg);
  218. }
  219. }
  220. #loader-wrapper .loader-section {
  221. position: fixed;
  222. top: 0;
  223. width: 51%;
  224. height: 100%;
  225. background: #7171c6;
  226. z-index: 1000;
  227. -webkit-transform: translateX(0);
  228. -ms-transform: translateX(0);
  229. transform: translateX(0);
  230. }
  231. #loader-wrapper .loader-section.section-left {
  232. left: 0;
  233. }
  234. #loader-wrapper .loader-section.section-right {
  235. right: 0;
  236. }
  237. .loaded #loader-wrapper .loader-section.section-left {
  238. -webkit-transform: translateX(-100%);
  239. -ms-transform: translateX(-100%);
  240. transform: translateX(-100%);
  241. -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  242. transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  243. }
  244. .loaded #loader-wrapper .loader-section.section-right {
  245. -webkit-transform: translateX(100%);
  246. -ms-transform: translateX(100%);
  247. transform: translateX(100%);
  248. -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  249. transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  250. }
  251. .loaded #loader {
  252. opacity: 0;
  253. -webkit-transition: all 0.3s ease-out;
  254. transition: all 0.3s ease-out;
  255. }
  256. .loaded #loader-wrapper {
  257. visibility: hidden;
  258. -webkit-transform: translateY(-100%);
  259. -ms-transform: translateY(-100%);
  260. transform: translateY(-100%);
  261. -webkit-transition: all 0.3s 1s ease-out;
  262. transition: all 0.3s 1s ease-out;
  263. }
  264. .no-js #loader-wrapper {
  265. display: none;
  266. }
  267. .no-js h1 {
  268. color: #222222;
  269. }
  270. #loader-wrapper .load_title {
  271. font-family: "Open Sans";
  272. color: #fff;
  273. font-size: 19px;
  274. width: 100%;
  275. text-align: center;
  276. z-index: 9999999999999;
  277. position: absolute;
  278. top: 60%;
  279. opacity: 1;
  280. line-height: 30px;
  281. }
  282. #loader-wrapper .load_title span {
  283. font-weight: normal;
  284. font-style: italic;
  285. font-size: 13px;
  286. color: #fff;
  287. opacity: 0.5;
  288. }
  289. </style>