登陆页面获取逻辑修改
All checks were successful
site-dist-deploy / build-and-deploy (push) Successful in 1m46s

This commit is contained in:
speakeloudest 2026-03-07 11:47:45 +02:00
parent 9e00434eb6
commit 1fa5d49572
2 changed files with 16 additions and 17 deletions

View File

@ -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;

View File

@ -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'),
}, },