diff --git a/src/App.vue b/src/App.vue index 81c0af2..ccfcc42 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,6 +4,7 @@ import { onMounted } from '@vue/runtime-core'; import Account from './components/Account.vue'; const isLogin = ref(false); +const isLoading = ref(true); const userName = ref(''); const email = ref(''); const activeNav = ref('profile'); @@ -46,12 +47,18 @@ function BearerVerify() { }).then(res => { res.json().then( (data) => { - ;(isLogin.value = true), (userName.value = data.UserName), (email.value = data.Email) + isLogin.value = true; + userName.value = data.UserName; + email.value = data.Email; + isLoading.value = false; } ) + }).catch(() => { + isLoading.value = false; }) } else { isLogin.value = false; + isLoading.value = false; } } @@ -71,61 +78,69 @@ function setActiveNav(name) { \ No newline at end of file diff --git a/src/style.css b/src/style.css index 6548b01..bb03a8f 100644 --- a/src/style.css +++ b/src/style.css @@ -386,4 +386,34 @@ a { .user-info { display: none; } +} + +/* 加载状态 */ +.loading-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + min-height: 100vh; + gap: 16px; +} + +.loading-spinner { + width: 40px; + height: 40px; + border: 3px solid var(--border-color); + border-top-color: var(--primary-color); + border-radius: 50%; + animation: spin 0.8s linear infinite; +} + +.loading-text { + color: var(--text-secondary); + font-size: 14px; +} + +@keyframes spin { + to { + transform: rotate(360deg); + } } \ No newline at end of file