Browse Source

新增b2c跳转的代理页面。

yangc 8 years ago
parent
commit
57a181395b
2 changed files with 35 additions and 0 deletions
  1. 0 0
      pages/SSRProxy/loginProxy.vue
  2. 35 0
      pages/SSRProxy/logoutProxy.vue

+ 0 - 0
pages/login/proxy.vue → pages/SSRProxy/loginProxy.vue


+ 35 - 0
pages/SSRProxy/logoutProxy.vue

@@ -0,0 +1,35 @@
+<template>
+  <!-- Login 代理页面 -->
+  <div>
+  </div>
+</template>
+<script>
+  export default {
+    layout: 'login',
+    mounted () {
+      this.crossBefore()
+    },
+    methods: {
+      async crossBefore () {
+        try {
+          let { data } = await this.$http.get('/logout/crossBefore')
+          const params = data || {}
+          this.proxyLogout(params.askUrl, params.returnUrl, params.logoutUrl)
+        } catch (err) {
+          this.$router.replace('/')
+          console.log(err)
+        }
+      },
+      proxyLogout (askUrl, returnUrl, logoutUrl) {
+        this.$jsonp(`${askUrl}`, function (err, data) {
+          if (err) throw err
+          if (data.error) {
+            window.location.href = logoutUrl
+          } else {
+            window.location.href = returnUrl && returnUrl !== 'null' ? returnUrl : '/'
+          }
+        })
+      }
+    }
+  }
+</script>