sso-redirect.vue 642 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <view class="">
  3. </view>
  4. </template>
  5. <script>
  6. import {
  7. useUserStore
  8. } from '@/store/modules/user'
  9. export default {
  10. data() {
  11. return {
  12. token: ''
  13. }
  14. },
  15. onLoad(e) {
  16. this.token = e.token
  17. this.init()
  18. },
  19. methods: {
  20. init() {
  21. const userStore = useUserStore()
  22. userStore.setToken(this.token)
  23. userStore.getCurrentUser().then((res) => {
  24. uni.hideLoading()
  25. uni.switchTab({
  26. url: '/pages/index/index'
  27. });
  28. this.show = false
  29. }).catch(() => {
  30. uni.hideLoading()
  31. uni.switchTab({
  32. url: '/pages/login/index'
  33. });
  34. })
  35. }
  36. }
  37. }
  38. </script>
  39. <style>
  40. </style>