middle.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <el-row style="background-color: rgb(241, 242, 246);height: calc(100vh - 84px);">
  3. <el-row>
  4. <el-image :src="Background" />
  5. </el-row>
  6. <el-row class="routerCardPar">
  7. <template v-for="(system, index) in systemList">
  8. <el-card :key="system.id" class="routerCard" @click.native="sso(system.systemUrl)">
  9. <img :src="system.storage.url">
  10. <!-- <img src="@/assets/images/hyxt.png" />-->
  11. <span>{{ system.systemName }}</span>
  12. </el-card>
  13. </template>
  14. </el-row>
  15. </el-row>
  16. </template>
  17. <script>
  18. import { ssoGetUser } from '@/api/login'
  19. import { mapGetters } from 'vuex'
  20. import crudDmSystem from '@/api/dm/system/dmSystem'
  21. import Background from '@/assets/images/bg.png'
  22. import { encrypt } from '@/utils/rsaEncrypt'
  23. export default {
  24. name: 'Sso',
  25. data() {
  26. const token = this.$route.query.token
  27. console.log(token)
  28. return {
  29. token: token,
  30. systemList: [],
  31. Background: Background
  32. }
  33. },
  34. computed: {
  35. ...mapGetters([
  36. 'user',
  37. 'userPassword'
  38. ])
  39. },
  40. created() {
  41. console.log(this.token)
  42. this.getUser(this.token)
  43. },
  44. methods: {
  45. getUser(token) {
  46. ssoGetUser(token).then(res => {
  47. const user = {
  48. username: res.data.data.user.username,
  49. password: res.data.data.user.ossPassword
  50. }
  51. this.$store.dispatch('Sso', user).then(() => {
  52. crudDmSystem.queryByUserId(res.data.data.user.id).then(res => {
  53. console.log('res', res)
  54. this.systemList = res
  55. })
  56. })
  57. })
  58. },
  59. sso(url) {
  60. const username = encrypt(this.user.username)
  61. const password = this.userPassword
  62. // location.href = `${url}/#/sso?username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`
  63. const aEle = document.createElement('a')
  64. aEle.href = `${url}/#/sso?username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`
  65. aEle.target = '_blank'
  66. aEle.click()
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. >>> .el-col:nth-child(5n + 1) {
  73. margin-left: 0;
  74. }
  75. >>> .el-col:nth-child(n + 6) {
  76. margin-top: 20px;
  77. }
  78. .routerCardPar {
  79. /*padding: 0 20%;*/
  80. width: 900px;
  81. margin: 20px auto 0 auto;
  82. display: flex;
  83. justify-content: flex-start;
  84. flex-wrap: wrap;
  85. .routerCard {
  86. cursor: pointer;
  87. width: 200px;
  88. display: inline-block;
  89. margin-bottom: 20px;
  90. &:not(:nth-child(4n)) {
  91. margin-right: 30px;
  92. }
  93. ::v-deep .el-card__body {
  94. display: flex;
  95. flex-direction: column;
  96. justify-content: center;
  97. align-items: center;
  98. img {
  99. width: 60px;
  100. }
  101. span {
  102. display: block;
  103. margin-top: 15px;
  104. }
  105. }
  106. }
  107. }
  108. .content {
  109. padding: 20px;
  110. display: flex;
  111. flex-direction: column;
  112. justify-content: space-around;
  113. align-items: center;
  114. span {
  115. font-size: 16px;
  116. font-weight: 600;
  117. margin-bottom: 15px;
  118. }
  119. ::v-deep .el-button {
  120. width: 60%;
  121. }
  122. }
  123. .time {
  124. font-size: 13px;
  125. color: #999;
  126. }
  127. .bottom {
  128. margin-top: 13px;
  129. line-height: 12px;
  130. }
  131. .button {
  132. padding: 0;
  133. float: right;
  134. }
  135. .image {
  136. width: 100%;
  137. display: block;
  138. }
  139. .clearfix:before,
  140. .clearfix:after {
  141. display: table;
  142. content: "";
  143. }
  144. .clearfix:after {
  145. clear: both
  146. }
  147. </style>