WEB/src/views/404.vue
2026-03-28 17:55:54 +08:00

304 lines
7.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="error-page">
<div class="error-wrapper">
<!-- 背景装饰 -->
<div class="decorations">
<div class="decoration-1"></div>
<div class="decoration-2"></div>
<div class="decoration-3"></div>
</div>
<!-- SVG 404 动画 -->
<div class="svg-container">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 400">
<!-- 极简404 -->
<g class="minimal-numbers">
<!-- 第一个4 - 只显示核心结构 -->
<path class="line-path" d="M120,100 L120,180" stroke="#1890ff" fill="none" stroke-width="4" stroke-linecap="round" />
<path class="line-path" d="M200,180 L120,180" stroke="#1890ff" fill="none" stroke-width="4" stroke-linecap="round" />
<path class="line-path" d="M200,100 L200,260" stroke="#1890ff" fill="none" stroke-width="4" stroke-linecap="round" />
<!-- 0 - 空心圆 -->
<circle cx="280" cy="180" r="40" fill="none" stroke="#52c41a" stroke-width="4" />
<circle cx="280" cy="180" r="15" fill="#fff" stroke="#52c41a" stroke-width="2" />
<!-- 第二个4 -->
<path d="M360,100 L360,180 M440,260 L440,260 M440,180 L360,180 M440,100 L440,260" fill="none"
stroke="#faad14" stroke-width="4" stroke-linecap="round" />
</g>
<!-- 十字线 -->
<path d="M500,100 L700,300 M500,300 L700,100" stroke="#f5222d" stroke-width="3" stroke-linecap="round"
stroke-dasharray="10,5" />
<!-- 消失点动画 -->
<g class="vanishing-point">
<circle cx="600" cy="200" r="3" fill="#1890ff">
<animate attributeName="r" values="3;20;3" dur="2s" repeatCount="indefinite" />
<animate attributeName="opacity" values="1;0;1" dur="2s" repeatCount="indefinite" />
</circle>
<!-- 扩散波纹 -->
<circle cx="600" cy="200" r="10" fill="none" stroke="#1890ff" stroke-width="1" opacity="0.5">
<animate attributeName="r" values="10;40;10" dur="2s" repeatCount="indefinite" begin="0.5s" />
<animate attributeName="opacity" values="0.5;0;0.5" dur="2s" repeatCount="indefinite" begin="0.5s" />
</circle>
<circle cx="600" cy="200" r="10" fill="none" stroke="#52c41a" stroke-width="1" opacity="0.5">
<animate attributeName="r" values="10;60;10" dur="2s" repeatCount="indefinite" begin="1s" />
<animate attributeName="opacity" values="0.5;0;0.5" dur="2s" repeatCount="indefinite" begin="1s" />
</circle>
</g>
</svg>
</div>
<div class="content">
<h2 class="title">哎呀!页面不见了</h2>
<p class="description">
您访问的页面不存在或无访问权限。
可能是链接失效、页面移除,或您的权限不足。
</p>
<div class="action-buttons">
<el-button type="primary" class="primary-btn" @click="goHome">
<el-icon><House /></el-icon>
返回首页
</el-button>
<el-button class="secondary-btn" @click="goBack">
<el-icon><RefreshLeft /></el-icon>
返回上页
</el-button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { House, RefreshLeft } from '@element-plus/icons-vue'
const router = useRouter()
const goHome = () => {
router.push('/')
}
const goBack = () => {
router.go(-1)
}
onMounted(() => {
// 添加路径动画
setTimeout(() => {
document.querySelectorAll('.path').forEach((path: any, index: number) => {
const length = path.getTotalLength()
path.style.strokeDasharray = length
path.style.strokeDashoffset = length
path.style.animation = `draw 2s ease forwards ${index * 0.3}s`
})
}, 100)
})
</script>
<style lang="scss" scoped>
.error-page {
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
padding: 40px;
position: relative;
overflow: hidden;
}
.error-wrapper {
background: rgba(255, 255, 255, 0.98);
border-radius: 30px;
padding: 60px;
max-width: 1000px;
width: 100%;
position: relative;
z-index: 1;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
animation: slideUp 0.6s ease-out;
@media (max-width: 768px) {
padding: 30px 20px;
}
}
.decorations {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
z-index: -1;
.decoration-1,
.decoration-2,
.decoration-3 {
position: absolute;
background: linear-gradient(45deg, #667eea22, #764ba222);
border-radius: 50%;
animation: float 6s ease-in-out infinite;
}
.decoration-1 {
width: 300px;
height: 300px;
top: -150px;
right: -150px;
animation-delay: 0s;
}
.decoration-2 {
width: 200px;
height: 200px;
bottom: -100px;
left: -100px;
animation-delay: 2s;
}
.decoration-3 {
width: 150px;
height: 150px;
top: 50%;
right: 30%;
animation-delay: 4s;
}
}
.svg-container {
text-align: center;
margin-bottom: 40px;
svg {
width: 100%;
max-width: 600px;
height: auto;
.path {
fill: none;
stroke: #1890ff;
stroke-width: 10;
stroke-linecap: round;
stroke-linejoin: round;
}
}
}
.content {
text-align: center;
}
.title {
font-size: 36px;
font-weight: 700;
color: #333;
margin-bottom: 20px;
background: linear-gradient(45deg, #667eea, #764ba2);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.description {
font-size: 18px;
color: #666;
margin-bottom: 40px;
line-height: 1.6;
}
.action-buttons {
margin-bottom: 50px;
.el-button {
margin: 0 10px;
padding: 15px 40px;
font-size: 16px;
border-radius: 30px;
transition: all 0.3s;
.el-icon {
margin-right: 8px;
}
&.primary-btn {
background: linear-gradient(45deg, #667eea, #764ba2);
border: none;
color: #fff;
&:hover {
transform: translateY(-3px);
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}
}
&.secondary-btn {
border: 2px solid #1890ff;
color: #1890ff;
&:hover {
background: #1890ff;
color: #fff;
transform: translateY(-3px);
}
}
}
}
/* 动画定义 */
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(50px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes draw {
to {
stroke-dashoffset: 0;
}
}
@keyframes float {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-20px);
}
}
/* 响应式调整 */
@media (max-width: 768px) {
.title {
font-size: 28px;
}
.description {
font-size: 16px;
}
.action-buttons .el-button {
display: block;
width: 100%;
margin: 10px 0;
}
}
</style>