logout.vue 726 B

12345678910111213141516171819202122232425262728293031323334
  1. <template>
  2. <!-- Login 代理页面 -->
  3. <div>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. layout: 'login',
  9. mounted () {
  10. this.crossBefore()
  11. },
  12. methods: {
  13. async crossBefore () {
  14. try {
  15. let { data } = await this.$http.get('/logout/crossBefore')
  16. const params = data || {}
  17. this.proxyLogout(params.askUrl, params.returnUrl)
  18. } catch (err) {
  19. this.$router.replace('/')
  20. console.log(err)
  21. }
  22. },
  23. proxyLogout (askUrl, returnUrl) {
  24. this.$jsonp(`${askUrl}`, function (err, data) {
  25. if (err) throw err
  26. console.log(data)
  27. window.location.href = returnUrl && returnUrl !== 'null' ? returnUrl : '/'
  28. })
  29. }
  30. }
  31. }
  32. </script>