You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.6 KiB
71 lines
1.6 KiB
<template>
|
|
<router-view />
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { onMounted } from 'vue';
|
|
import { useUserStore } from './store';
|
|
import { authApi } from './api/auth';
|
|
|
|
const userStore = useUserStore();
|
|
|
|
onMounted(async () => {
|
|
// 如果存在token,尝试获取用户信息
|
|
if (userStore.token) {
|
|
try {
|
|
const response = await authApi.getMe();
|
|
userStore.setUser(response.user);
|
|
} catch (error) {
|
|
// token无效,清除
|
|
userStore.logout();
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style>
|
|
html, body {
|
|
margin: 0;
|
|
padding: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
/* Global styles are managed in variables.css */
|
|
#app {
|
|
min-height: 100vh;
|
|
width: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
background-color: var(--bg-body);
|
|
color: var(--color-text-main);
|
|
font-family: var(--font-family-base);
|
|
/* Slight noise texture for that analog feel */
|
|
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
|
|
}
|
|
|
|
a {
|
|
text-decoration: none;
|
|
color: inherit;
|
|
transition: var(--transition-fast);
|
|
}
|
|
|
|
a:hover {
|
|
color: var(--primary);
|
|
}
|
|
|
|
button, input, select, textarea {
|
|
font-family: inherit;
|
|
}
|
|
|
|
/* Global Transitions */
|
|
.fade-enter-active,
|
|
.fade-leave-active {
|
|
transition: opacity 0.3s ease;
|
|
}
|
|
|
|
.fade-enter-from,
|
|
.fade-leave-to {
|
|
opacity: 0;
|
|
}
|
|
</style>
|
|
|
|
|