Browse Source

登录代理页面功能功能交互

Administrator 7 years ago
parent
commit
317e6097d5
1 changed files with 71 additions and 0 deletions
  1. 71 0
      pages/agency/index.vue

+ 71 - 0
pages/agency/index.vue

@@ -0,0 +1,71 @@
+<template>
+  <div class="logout">
+    <loading/>
+    <p>跳转中,请稍后...</p>
+  </div>
+</template>
+
+<script>
+  import Loading from '~components/common/loading/Loading.vue'
+  export default {
+    name: 'agency',
+    layout: 'mobile',
+    components: {
+      Loading
+    },
+    mounted () {
+      this.$nextTick(() => {
+        this.agency()
+      })
+    },
+    methods: {
+      agency () {
+        let param = new FormData()
+        param.append('returnURL', this.$route.query.returnURL || '')
+        param.append('appId', this.$route.query.appId || '')
+        param.append('token', this.$route.query.token || '')
+        param.append('baseURL', this.$route.query.baseURL || '')
+        param.append('isLoginAll', this.$route.query.isLoginAll || '')
+        let config = {
+          headers: {'Content-Type': 'multipart/form-data'}
+        }
+        this.$http.post('/sso/login/proxy', param, config)
+          .then(response => {
+            if (response.data.success) {
+              if (response.data.content.loginUrls) {
+                // 遍历登录url循环让各应用登录(需要跨域)
+                let param = response.data.content.data
+                let a = ''
+                for (let n in param) {
+                  a += (n + '=' + param[n] + '&')
+                }
+                for (let i in response.data.content.loginUrls) {
+                  this.$jsonp(`${response.data.content.loginUrls[i]}?` + a.substr(0, a.length - 1), function (err, data) {
+                    if (err) throw err
+                    console.log(data)
+                  })
+                }
+              }
+              setTimeout(function () {
+                window.location.href = response.data.content.returnUrl || 'http://www.ubtob.com'
+              }, 3000)
+            }
+          })
+      }
+    }
+  }
+</script>
+<style type="text/scss" lang="scss" scoped>
+  .logout{
+    p{
+      position: fixed;
+      left: 0;
+      right:0;
+      top: 54%;
+      z-index: 1000;
+      text-align: center;
+      font-size: 14px;
+      color:#333;
+    }
+  }
+</style>