411 lines
7.6 KiB
Vue
411 lines
7.6 KiB
Vue
<script setup>
|
||
import { computed } from 'vue'
|
||
import { useRouter } from 'vue-router'
|
||
import { useI18n } from '../composables/useI18n'
|
||
|
||
// 路由
|
||
const router = useRouter()
|
||
|
||
// 国际化
|
||
const { t } = useI18n()
|
||
|
||
// 计算属性
|
||
const errorTitle = computed(() => t('error.title'))
|
||
const errorDescription = computed(() => t('error.description'))
|
||
const goHomeText = computed(() => t('error.back_home'))
|
||
|
||
// 处理返回首页
|
||
const goHome = () => {
|
||
router.push('/')
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<div class="not-found-page">
|
||
<div class="not-found-container">
|
||
<div class="error-content">
|
||
<!-- 404 数字 -->
|
||
<div class="error-number">
|
||
<span class="number">4</span>
|
||
<span class="number">0</span>
|
||
<span class="number">4</span>
|
||
</div>
|
||
|
||
<!-- 错误信息 -->
|
||
<div class="error-info">
|
||
<h1 class="error-title">{{ errorTitle }}</h1>
|
||
<p class="error-description">{{ errorDescription }}</p>
|
||
</div>
|
||
|
||
<!-- 操作按钮 -->
|
||
<div class="error-actions">
|
||
<button class="btn btn-primary" @click="goHome">
|
||
{{ goHomeText }}
|
||
</button>
|
||
<button class="btn btn-secondary" @click="$router.go(-1)">
|
||
返回上一页
|
||
</button>
|
||
</div>
|
||
|
||
<!-- 帮助信息 -->
|
||
<div class="error-help">
|
||
<p class="help-text">
|
||
如果您认为这是一个错误,请检查URL是否正确或联系我们的技术支持团队。
|
||
</p>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 装饰性插图 -->
|
||
<div class="error-visual">
|
||
<div class="illustration-container">
|
||
<div class="floating-shapes">
|
||
<div class="shape shape-1"></div>
|
||
<div class="shape shape-2"></div>
|
||
<div class="shape shape-3"></div>
|
||
<div class="shape shape-4"></div>
|
||
<div class="shape shape-5"></div>
|
||
</div>
|
||
<div class="main-illustration">
|
||
<div class="lost-icon">🔍</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.not-found-page {
|
||
min-height: 100vh;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
|
||
padding: var(--spacing-lg);
|
||
}
|
||
|
||
.not-found-container {
|
||
display: grid;
|
||
grid-template-columns: 1fr 1fr;
|
||
gap: var(--spacing-2xl);
|
||
max-width: var(--container-max-width);
|
||
width: 100%;
|
||
align-items: center;
|
||
}
|
||
|
||
.error-content {
|
||
text-align: center;
|
||
}
|
||
|
||
/* 404 数字 */
|
||
.error-number {
|
||
display: flex;
|
||
justify-content: center;
|
||
gap: var(--spacing-sm);
|
||
margin-bottom: var(--spacing-lg);
|
||
}
|
||
|
||
.number {
|
||
font-size: 8rem;
|
||
font-weight: 900;
|
||
color: var(--primary-color);
|
||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
|
||
line-height: 1;
|
||
display: inline-block;
|
||
animation: float 3s ease-in-out infinite;
|
||
}
|
||
|
||
.number:nth-child(2) {
|
||
animation-delay: 0.1s;
|
||
}
|
||
|
||
.number:nth-child(3) {
|
||
animation-delay: 0.2s;
|
||
}
|
||
|
||
/* 错误信息 */
|
||
.error-info {
|
||
margin-bottom: var(--spacing-xl);
|
||
}
|
||
|
||
.error-title {
|
||
font-size: var(--font-size-3xl);
|
||
font-weight: 700;
|
||
color: var(--text-primary);
|
||
margin: 0 0 var(--spacing-md) 0;
|
||
}
|
||
|
||
.error-description {
|
||
font-size: var(--font-size-lg);
|
||
color: var(--text-secondary);
|
||
margin: 0 0 var(--spacing-xl) 0;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
/* 操作按钮 */
|
||
.error-actions {
|
||
display: flex;
|
||
justify-content: center;
|
||
gap: var(--spacing-md);
|
||
margin-bottom: var(--spacing-xl);
|
||
}
|
||
|
||
.btn {
|
||
padding: var(--spacing-md) var(--spacing-xl);
|
||
border: none;
|
||
border-radius: var(--border-radius-lg);
|
||
font-size: var(--font-size-md);
|
||
font-weight: 600;
|
||
cursor: pointer;
|
||
transition: all 0.2s ease;
|
||
text-decoration: none;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: var(--spacing-xs);
|
||
}
|
||
|
||
.btn-primary {
|
||
background-color: var(--primary-color);
|
||
color: white;
|
||
}
|
||
|
||
.btn-primary:hover {
|
||
background-color: var(--primary-color-hover);
|
||
transform: translateY(-2px);
|
||
box-shadow: var(--shadow-lg);
|
||
}
|
||
|
||
.btn-secondary {
|
||
background-color: transparent;
|
||
color: var(--text-primary);
|
||
border: 2px solid var(--border-color);
|
||
}
|
||
|
||
.btn-secondary:hover {
|
||
background-color: var(--bg-secondary);
|
||
border-color: var(--text-secondary);
|
||
transform: translateY(-2px);
|
||
}
|
||
|
||
/* 帮助信息 */
|
||
.error-help {
|
||
max-width: 400px;
|
||
margin: 0 auto;
|
||
}
|
||
|
||
.help-text {
|
||
color: var(--text-muted);
|
||
font-size: var(--font-size-sm);
|
||
line-height: 1.5;
|
||
margin: 0;
|
||
}
|
||
|
||
/* 可视化部分 */
|
||
.error-visual {
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
}
|
||
|
||
.illustration-container {
|
||
position: relative;
|
||
width: 300px;
|
||
height: 300px;
|
||
}
|
||
|
||
.main-illustration {
|
||
position: relative;
|
||
z-index: 2;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
width: 200px;
|
||
height: 200px;
|
||
background-color: var(--bg-secondary);
|
||
border-radius: 50%;
|
||
border: 4px solid var(--primary-color);
|
||
margin: 0 auto;
|
||
animation: pulse 2s ease-in-out infinite;
|
||
}
|
||
|
||
.lost-icon {
|
||
font-size: 4rem;
|
||
animation: wiggle 2s ease-in-out infinite;
|
||
}
|
||
|
||
/* 浮动形状 */
|
||
.floating-shapes {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
|
||
.shape {
|
||
position: absolute;
|
||
border-radius: var(--border-radius-md);
|
||
background-color: var(--bg-tertiary);
|
||
opacity: 0.6;
|
||
animation: float-around 8s linear infinite;
|
||
}
|
||
|
||
.shape-1 {
|
||
width: 60px;
|
||
height: 60px;
|
||
top: 20%;
|
||
left: 10%;
|
||
animation-delay: 0s;
|
||
}
|
||
|
||
.shape-2 {
|
||
width: 40px;
|
||
height: 40px;
|
||
top: 10%;
|
||
right: 20%;
|
||
animation-delay: 1s;
|
||
}
|
||
|
||
.shape-3 {
|
||
width: 80px;
|
||
height: 80px;
|
||
bottom: 20%;
|
||
left: 20%;
|
||
animation-delay: 2s;
|
||
}
|
||
|
||
.shape-4 {
|
||
width: 50px;
|
||
height: 50px;
|
||
bottom: 30%;
|
||
right: 10%;
|
||
animation-delay: 3s;
|
||
}
|
||
|
||
.shape-5 {
|
||
width: 70px;
|
||
height: 70px;
|
||
top: 50%;
|
||
right: 30%;
|
||
animation-delay: 4s;
|
||
}
|
||
|
||
/* 动画 */
|
||
@keyframes float {
|
||
0%, 100% {
|
||
transform: translateY(0px);
|
||
}
|
||
50% {
|
||
transform: translateY(-10px);
|
||
}
|
||
}
|
||
|
||
@keyframes pulse {
|
||
0%, 100% {
|
||
transform: scale(1);
|
||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
|
||
}
|
||
50% {
|
||
transform: scale(1.05);
|
||
box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
|
||
}
|
||
}
|
||
|
||
@keyframes wiggle {
|
||
0%, 100% {
|
||
transform: rotate(0deg);
|
||
}
|
||
25% {
|
||
transform: rotate(-10deg);
|
||
}
|
||
75% {
|
||
transform: rotate(10deg);
|
||
}
|
||
}
|
||
|
||
@keyframes float-around {
|
||
0% {
|
||
transform: translateX(0) translateY(0) rotate(0deg);
|
||
}
|
||
25% {
|
||
transform: translateX(20px) translateY(-20px) rotate(90deg);
|
||
}
|
||
50% {
|
||
transform: translateX(-20px) translateY(-40px) rotate(180deg);
|
||
}
|
||
75% {
|
||
transform: translateX(-40px) translateY(-20px) rotate(270deg);
|
||
}
|
||
100% {
|
||
transform: translateX(0) translateY(0) rotate(360deg);
|
||
}
|
||
}
|
||
|
||
/* 响应式设计 */
|
||
@media (max-width: 768px) {
|
||
.not-found-container {
|
||
grid-template-columns: 1fr;
|
||
text-align: center;
|
||
gap: var(--spacing-xl);
|
||
}
|
||
|
||
.number {
|
||
font-size: 5rem;
|
||
}
|
||
|
||
.error-title {
|
||
font-size: var(--font-size-2xl);
|
||
}
|
||
|
||
.error-actions {
|
||
flex-direction: column;
|
||
align-items: center;
|
||
}
|
||
|
||
.illustration-container {
|
||
width: 250px;
|
||
height: 250px;
|
||
}
|
||
|
||
.main-illustration {
|
||
width: 150px;
|
||
height: 150px;
|
||
}
|
||
|
||
.lost-icon {
|
||
font-size: 3rem;
|
||
}
|
||
}
|
||
|
||
@media (max-width: 480px) {
|
||
.not-found-page {
|
||
padding: var(--spacing-md);
|
||
}
|
||
|
||
.number {
|
||
font-size: 4rem;
|
||
}
|
||
|
||
.error-title {
|
||
font-size: var(--font-size-xl);
|
||
}
|
||
|
||
.error-description {
|
||
font-size: var(--font-size-md);
|
||
}
|
||
|
||
.illustration-container {
|
||
width: 200px;
|
||
height: 200px;
|
||
}
|
||
|
||
.main-illustration {
|
||
width: 120px;
|
||
height: 120px;
|
||
}
|
||
|
||
.lost-icon {
|
||
font-size: 2.5rem;
|
||
}
|
||
}
|
||
</style> |