accompany_admin_pc/src/views/login/OauthCallBack.vue

76 lines
1.5 KiB
Vue
Raw Normal View History

2025-06-30 16:39:38 +08:00
<template>
2025-07-01 15:59:19 +08:00
<div class="callback-page">
<div class="spotlight18" data-cont="页面准备跳转中...">页面准备跳转中...</div>
</div>
2025-06-30 16:39:38 +08:00
</template>
<script setup>
2025-07-04 11:33:47 +08:00
import { setToken } from '@/utils/auth';
2025-07-01 15:59:19 +08:00
import { useAuth0 } from '@auth0/auth0-vue';
import { useMessage } from 'naive-ui';
2025-07-04 11:33:47 +08:00
2025-07-01 15:59:19 +08:00
const { getAccessTokenSilently } = useAuth0();
const router = useRouter();
const message = useMessage();
2025-06-30 16:39:38 +08:00
const oSomethingWithToken = async () => {
try {
2025-07-04 11:33:47 +08:00
const token = await getAccessTokenSilently();
setToken(token);
2025-07-01 17:50:27 +08:00
message.success('登录成功!');
router.push('/layout');
2025-07-01 15:59:19 +08:00
} catch (error) {
router.push('/');
message.error('错误!');
2025-06-30 16:39:38 +08:00
}
}
2025-07-01 15:59:19 +08:00
onMounted(() => {
2025-06-30 16:39:38 +08:00
oSomethingWithToken();
})
</script>
2025-07-01 15:59:19 +08:00
<style lang="scss" scoped>
.callback-page {
background: #d1d1d1;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
width: 100vw;
}
.spotlight18 {
color: #eaeaea;
font-size: 40px;
font-weight: 900;
text-transform: uppercase;
position: relative;
}
.spotlight18:before {
width: inherit;
height: inherit;
content: attr(data-cont);
color: transparent;
background-image: linear-gradient(90deg, #4158D0 0%, #C850C0 30%, #FFCC70 66%, #56e28d 100%);
-webkit-background-clip: text;
position: absolute;
top: 0;
left: 0;
animation: spotlight18 8s linear infinite;
}
@keyframes spotlight18 {
0% {
clip-path: ellipse(32px 32px at 0 50%);
}
50% {
clip-path: ellipse(32px 32px at 100% 50%);
}
100% {
clip-path: ellipse(32px 32px at 0 50%);
}
}
</style>