登陆页面获取逻辑修改
All checks were successful
site-dist-deploy / build-and-deploy (push) Successful in 1m46s
All checks were successful
site-dist-deploy / build-and-deploy (push) Successful in 1m46s
This commit is contained in:
parent
9e00434eb6
commit
1fa5d49572
@ -1,19 +1,3 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { onMounted } from 'vue'
|
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
|
||||||
|
|
||||||
const route = useRoute()
|
|
||||||
const router = useRouter()
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
const token = route.params.token as string
|
|
||||||
if (token) {
|
|
||||||
localStorage.setItem('Authorization', token)
|
|
||||||
}
|
|
||||||
router.replace('/user-center')
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="login-redirect">
|
<div class="login-redirect">
|
||||||
<!-- Optional: Adding a loading state for visibility during transition -->
|
<!-- Optional: Adding a loading state for visibility during transition -->
|
||||||
@ -21,6 +5,21 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { getQueryString } from '@/utils/url-utils.ts'
|
||||||
|
const router = useRouter()
|
||||||
|
onMounted(() => {
|
||||||
|
const token = getQueryString('t')
|
||||||
|
console.log(token)
|
||||||
|
if (token) {
|
||||||
|
localStorage.setItem('Authorization', token)
|
||||||
|
}
|
||||||
|
router.replace('/user-center')
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.login-redirect {
|
.login-redirect {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -29,7 +29,7 @@ const router = createRouter({
|
|||||||
component: () => import('../pages/PrivacyPolicy/index.vue'),
|
component: () => import('../pages/PrivacyPolicy/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login/:token',
|
path: '/login',
|
||||||
name: 'login-redirect',
|
name: 'login-redirect',
|
||||||
component: () => import('../pages/LoginRedirect/index.vue'),
|
component: () => import('../pages/LoginRedirect/index.vue'),
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user