feat: add login page
This commit is contained in:
parent
e76205c0d0
commit
2d6b06c27a
|
@ -1,5 +1,14 @@
|
|||
<template>
|
||||
<div class="error-page">
|
||||
<div class="error-page" :class="{ 'dark-mode': isDarkMode }">
|
||||
<!-- macOS Style Background -->
|
||||
<div class="background-image">
|
||||
<div class="blur-overlay"></div>
|
||||
<div class="gradient-overlay"></div>
|
||||
</div>
|
||||
|
||||
<!-- Glass Layer -->
|
||||
<div class="glass-layer"></div>
|
||||
|
||||
<!-- Windows-style Error Window -->
|
||||
<div class="error-window">
|
||||
<!-- Title Bar -->
|
||||
|
@ -30,68 +39,76 @@
|
|||
<p class="error-description">{{ $t('error.serverErrorDescription') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<!-- Action Button -->
|
||||
<div class="error-actions">
|
||||
<button class="action-btn primary" @click="goHome">
|
||||
<span class="btn-icon">🏠</span>
|
||||
{{ $t('error.goHome') }}
|
||||
</button>
|
||||
<button class="action-btn secondary" @click="refreshPage">
|
||||
<span class="btn-icon">🔄</span>
|
||||
{{ $t('error.refresh') }}
|
||||
</button>
|
||||
<button class="action-btn secondary" @click="reportError">
|
||||
<span class="btn-icon">📧</span>
|
||||
{{ $t('error.report') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Technical Details (Collapsible) -->
|
||||
<div class="technical-details">
|
||||
<button class="details-toggle" @click="toggleDetails">
|
||||
<span class="toggle-icon" :class="{ 'rotated': showDetails }">▼</span>
|
||||
{{ $t('error.technicalDetails') }}
|
||||
</button>
|
||||
<div v-if="showDetails" class="details-content">
|
||||
<div class="details-item">
|
||||
<strong>{{ $t('error.errorCode') }}:</strong> 500 - Internal Server Error
|
||||
</div>
|
||||
<div class="details-item">
|
||||
<strong>{{ $t('error.timestamp') }}:</strong> {{ currentTime }}
|
||||
</div>
|
||||
<div class="details-item">
|
||||
<strong>{{ $t('error.requestId') }}:</strong> {{ requestId }}
|
||||
</div>
|
||||
<div class="details-item">
|
||||
<strong>{{ $t('error.userAgent') }}:</strong> {{ userAgent }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Background Pattern -->
|
||||
<div class="error-background">
|
||||
<div class="pattern-grid"></div>
|
||||
<!-- Status Bar -->
|
||||
<div class="status-bar">
|
||||
<div class="status-left">
|
||||
<!-- Empty for now -->
|
||||
</div>
|
||||
<div class="status-center">
|
||||
<!-- Empty for now -->
|
||||
</div>
|
||||
<div class="status-right">
|
||||
<!-- Language Toggle -->
|
||||
<div class="language-switcher-wrapper" ref="languageSwitcherWrapper">
|
||||
<button @click="toggleLanguageMenu" class="language-switcher">
|
||||
{{ currentLanguageDisplay }}
|
||||
</button>
|
||||
<div v-if="isLanguageMenuOpen" class="language-menu">
|
||||
<ul>
|
||||
<li v-for="lang in availableLanguages" :key="lang.key" @click="selectLanguage(lang.key as 'en' | 'zh')">
|
||||
<span class="checkmark" :style="{ visibility: locale === lang.key ? 'visible' : 'hidden' }">✓</span>
|
||||
<span>{{ lang.label }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { ref, computed, onMounted, onUnmounted, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useSettingsStore } from '../../stores/settings';
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const { t, locale, setLocale } = useI18n();
|
||||
const settingsStore = useSettingsStore();
|
||||
|
||||
// Reactive state
|
||||
const showDetails = ref(false);
|
||||
const currentTime = ref('');
|
||||
const requestId = ref('');
|
||||
const userAgent = ref('');
|
||||
|
||||
// --- Language Switcher Logic ---
|
||||
const isLanguageMenuOpen = ref(false);
|
||||
const languageSwitcherWrapper = ref<HTMLElement | null>(null);
|
||||
const availableLanguages = computed(() => [
|
||||
{ key: 'en', label: 'English', display: 'EN' },
|
||||
{ key: 'zh', label: '繁體中文', display: '注' },
|
||||
]);
|
||||
|
||||
const currentLanguageDisplay = computed(() => {
|
||||
const current = availableLanguages.value.find(lang => lang.key === locale.value);
|
||||
return current?.display || '注';
|
||||
});
|
||||
|
||||
// Theme state from settings store
|
||||
const isDarkMode = computed(() => settingsStore.theme === 'dark');
|
||||
|
||||
// Computed properties
|
||||
const goHome = () => {
|
||||
router.push('/');
|
||||
|
@ -107,8 +124,20 @@ const reportError = () => {
|
|||
alert(t('error.reportSent'));
|
||||
};
|
||||
|
||||
const toggleDetails = () => {
|
||||
showDetails.value = !showDetails.value;
|
||||
// Language switcher functions
|
||||
function toggleLanguageMenu() {
|
||||
isLanguageMenuOpen.value = !isLanguageMenuOpen.value;
|
||||
}
|
||||
|
||||
function selectLanguage(lang: 'en' | 'zh') {
|
||||
setLocale(lang);
|
||||
isLanguageMenuOpen.value = false;
|
||||
}
|
||||
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (languageSwitcherWrapper.value && !languageSwitcherWrapper.value.contains(event.target as Node)) {
|
||||
isLanguageMenuOpen.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// Initialize data
|
||||
|
@ -118,6 +147,19 @@ onMounted(() => {
|
|||
userAgent.value = navigator.userAgent.substring(0, 50) + '...';
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener('click', handleClickOutside);
|
||||
});
|
||||
|
||||
// Watch for language menu state
|
||||
watch(isLanguageMenuOpen, (isOpen) => {
|
||||
if (isOpen) {
|
||||
document.addEventListener('click', handleClickOutside);
|
||||
} else {
|
||||
document.removeEventListener('click', handleClickOutside);
|
||||
}
|
||||
});
|
||||
|
||||
// Set page title
|
||||
useHead({
|
||||
title: t('error.title')
|
||||
|
@ -131,7 +173,6 @@ useHead({
|
|||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background: var(--background-desktop);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
@ -139,34 +180,68 @@ useHead({
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
.error-background {
|
||||
.background-image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0.1;
|
||||
background: linear-gradient(135deg,
|
||||
#f8fafc 0%,
|
||||
#e2e8f0 25%,
|
||||
#cbd5e1 50%,
|
||||
#94a3b8 75%,
|
||||
#64748b 100%);
|
||||
background-size: 400% 400%;
|
||||
animation: gradient-shift 15s ease infinite;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.pattern-grid {
|
||||
.glass-layer {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
|
||||
background-size: 20px 20px;
|
||||
animation: grid-move 20s linear infinite;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@keyframes grid-move {
|
||||
0% { transform: translate(0, 0); }
|
||||
100% { transform: translate(20px, 20px); }
|
||||
@keyframes gradient-shift {
|
||||
0% { background-position: 0% 50%; }
|
||||
50% { background-position: 100% 50%; }
|
||||
100% { background-position: 0% 50%; }
|
||||
}
|
||||
|
||||
.blur-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
}
|
||||
|
||||
.gradient-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(0, 0, 0, 0.1) 0%,
|
||||
rgba(0, 0, 0, 0.3) 50%,
|
||||
rgba(0, 0, 0, 0.6) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.error-window {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
z-index: 2;
|
||||
width: 90%;
|
||||
max-width: 600px;
|
||||
background: var(--window-background);
|
||||
|
@ -304,10 +379,8 @@ useHead({
|
|||
|
||||
.error-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
justify-content: center;
|
||||
margin-bottom: 32px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
|
@ -352,56 +425,92 @@ useHead({
|
|||
font-size: 16px;
|
||||
}
|
||||
|
||||
.technical-details {
|
||||
border-top: 1px solid var(--window-border-color);
|
||||
padding-top: 20px;
|
||||
|
||||
.status-bar {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 22px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
background: var(--taskbar-background);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
color: var(--taskbar-item-text-color);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
z-index: 2;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.details-toggle {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--content-text-color);
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
.status-left,
|
||||
.status-center,
|
||||
.status-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin: 0 auto;
|
||||
padding: 8px;
|
||||
border-radius: var(--rounded-button);
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.details-toggle:hover {
|
||||
background: var(--taskbar-item-background);
|
||||
.language-switcher-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.toggle-icon {
|
||||
transition: transform 0.3s ease;
|
||||
.language-switcher {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--taskbar-item-text-color);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
padding: 0 4px;
|
||||
width: 24px;
|
||||
height: 22px;
|
||||
text-align: center;
|
||||
line-height: 22px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.toggle-icon.rotated {
|
||||
transform: rotate(180deg);
|
||||
.language-menu {
|
||||
position: absolute;
|
||||
top: calc(100% + 4px);
|
||||
right: 0;
|
||||
width: 160px;
|
||||
background-color: var(--start-menu-background);
|
||||
border: 1px solid var(--start-menu-border-color);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
||||
padding: 4px;
|
||||
z-index: 10001;
|
||||
}
|
||||
|
||||
.details-content {
|
||||
margin-top: 16px;
|
||||
padding: 16px;
|
||||
background: var(--taskbar-item-background);
|
||||
border-radius: var(--rounded-button);
|
||||
text-align: left;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
.language-menu ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.details-item {
|
||||
margin-bottom: 8px;
|
||||
word-break: break-all;
|
||||
.language-menu li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease-in-out;
|
||||
}
|
||||
|
||||
.details-item:last-child {
|
||||
margin-bottom: 0;
|
||||
.language-menu li:hover {
|
||||
background-color: var(--taskbar-item-background-hover);
|
||||
}
|
||||
|
||||
.checkmark {
|
||||
width: 16px;
|
||||
text-align: center;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
|
@ -423,27 +532,164 @@ useHead({
|
|||
font-size: 24px;
|
||||
}
|
||||
|
||||
.error-actions {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
width: 100%;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
padding: 8px 16px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dark/Light theme transitions */
|
||||
.error-page {
|
||||
transition: background-color 0.3s ease;
|
||||
/* Light mode (default) */
|
||||
.background-image {
|
||||
background: linear-gradient(135deg,
|
||||
#f8fafc 0%,
|
||||
#e2e8f0 25%,
|
||||
#cbd5e1 50%,
|
||||
#94a3b8 75%,
|
||||
#64748b 100%);
|
||||
}
|
||||
|
||||
.glass-layer {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.error-window {
|
||||
transition: background-color 0.3s ease, border-color 0.3s ease;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.title-bar {
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
color: #1f2937;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.window-content {
|
||||
transition: color 0.3s ease;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.error-title {
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.error-description {
|
||||
color: #4b5563;
|
||||
}
|
||||
|
||||
.action-btn.primary {
|
||||
background: #10b981;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.action-btn.primary:hover {
|
||||
background: #059669;
|
||||
box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
|
||||
}
|
||||
|
||||
.action-btn.secondary {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
color: #374151;
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.action-btn.secondary:hover {
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.details-toggle {
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
.details-toggle:hover {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.details-content {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.details-item {
|
||||
color: #4b5563;
|
||||
}
|
||||
|
||||
/* Dark mode adjustments */
|
||||
.dark-mode .background-image {
|
||||
background: linear-gradient(135deg,
|
||||
#0f172a 0%,
|
||||
#1e293b 25%,
|
||||
#334155 50%,
|
||||
#475569 75%,
|
||||
#64748b 100%);
|
||||
}
|
||||
|
||||
.dark-mode .glass-layer {
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.dark-mode .error-window {
|
||||
background: rgba(15, 23, 42, 0.95);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.dark-mode .title-bar {
|
||||
background: rgba(15, 23, 42, 0.9);
|
||||
color: #f1f5f9;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.dark-mode .window-content {
|
||||
color: #f1f5f9;
|
||||
}
|
||||
|
||||
.dark-mode .error-title {
|
||||
color: #f1f5f9;
|
||||
}
|
||||
|
||||
.dark-mode .error-description {
|
||||
color: #cbd5e1;
|
||||
}
|
||||
|
||||
.dark-mode .action-btn.primary {
|
||||
background: #10b981;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.dark-mode .action-btn.primary:hover {
|
||||
background: #059669;
|
||||
box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
|
||||
}
|
||||
|
||||
.dark-mode .action-btn.secondary {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: #e2e8f0;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.dark-mode .action-btn.secondary:hover {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.dark-mode .details-toggle {
|
||||
color: #e2e8f0;
|
||||
}
|
||||
|
||||
.dark-mode .details-toggle:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.dark-mode .details-content {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.dark-mode .details-item {
|
||||
color: #cbd5e1;
|
||||
}
|
||||
</style>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue