index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <div class="logout">
  3. <loading/>
  4. <p>跳转中,请稍后...</p>
  5. </div>
  6. </template>
  7. <script>
  8. import Loading from '~components/common/loading/Loading.vue'
  9. export default {
  10. name: 'agency',
  11. layout: 'mobile',
  12. components: {
  13. Loading
  14. },
  15. mounted () {
  16. this.$nextTick(() => {
  17. this.agency()
  18. })
  19. },
  20. methods: {
  21. agency () {
  22. let param = new FormData()
  23. param.append('returnUrl', this.$route.query.returnURL || '')
  24. param.append('appId', this.$route.query.appId || '')
  25. param.append('token', this.$route.query.token || '')
  26. param.append('baseUrl', this.$route.query.baseURL || '')
  27. param.append('spaceUU', this.$route.query.spaceUU || '')
  28. param.append('isLoginAll', this.$route.query.isLoginAll || '')
  29. let config = {
  30. headers: {'Content-Type': 'multipart/form-data'}
  31. }
  32. let url = this.$store.state.option.isMobile ? '/sso/login/mobile/proxy' : '/sso/login/proxy'
  33. this.$http.post(url, param, config)
  34. .then(response => {
  35. if (response.data.success) {
  36. if (response.data.content.loginUrls) {
  37. // 遍历登录url循环让各应用登录(需要跨域)
  38. let param = response.data.content.data
  39. let a = ''
  40. for (let n in param) {
  41. a += (n + '=' + param[n] + '&')
  42. }
  43. for (let i in response.data.content.loginUrls) {
  44. this.$jsonp(`${response.data.content.loginUrls[i]}?` + a.substr(0, a.length - 1), function (err, data) {
  45. if (err) throw err
  46. console.log(data)
  47. })
  48. }
  49. }
  50. setTimeout(function () {
  51. window.location.href = response.data.content.returnUrl || 'http://www.ubtob.com'
  52. }, 3000)
  53. }
  54. })
  55. }
  56. }
  57. }
  58. </script>
  59. <style type="text/scss" lang="scss" scoped>
  60. .logout{
  61. p{
  62. position: fixed;
  63. left: 0;
  64. right:0;
  65. top: 54%;
  66. z-index: 1000;
  67. text-align: center;
  68. font-size: 14px;
  69. color:#333;
  70. }
  71. }
  72. </style>