| | |
| | | <template> |
| | | <div></div> |
| | | </template> |
| | | <script> |
| | | import store from "@/store"; |
| | | export default { |
| | | data() { |
| | | return {} |
| | | }, |
| | | created() { |
| | | this.goLogin() |
| | | }, |
| | | computed: {}, |
| | | methods: { |
| | | goLogin() { |
| | | store.dispatch('TideLogin', {code : this.$route.query.code}).then(() => { |
| | | this.$router.push({ path: this.redirect || "/" }).catch(() => { }); |
| | | }) |
| | | } |
| | | } |
| | | <script setup> |
| | | import useUserStore from '@/store/modules/user' |
| | | const userStore = useUserStore() |
| | | const route = useRoute() |
| | | const router = useRouter() |
| | | const redirect = ref(undefined) |
| | | |
| | | watch(route, (newRoute) => { |
| | | redirect.value = newRoute.query && newRoute.query.redirect |
| | | }, { immediate: true }) |
| | | |
| | | function goLogin() { |
| | | console.log(redirect.value) |
| | | userStore.TideLogin({code : route.query.code}).then(() => { |
| | | router.push({ path: redirect.value || "/" }).catch(() => { }); |
| | | }) |
| | | } |
| | | goLogin() |
| | | </script> |
| | | <style scoped></style> |