Splash.vue 6.34 KB
<template>
  <div class="splash-container" :class="{ 'fade-out': isLeaving }">
    <div class="splash-content">
      <!-- 背景装饰 -->
      <div class="bg-decoration">
        <div class="lotus-pattern animate-float"></div>
        <div class="cloud-pattern animate-drift"></div>
      </div>
      
      <!-- 主要内容 -->
      <div class="main-content">
        <!-- Logo区域 -->
        <div class="logo-section animate-fade-in-up">
          <div class="logo-circle">
            <div class="dharma-wheel animate-rotate">
              <div class="wheel-center"></div>
              <div class="wheel-spokes"></div>
            </div>
          </div>
          <h1 class="app-title">三坛大戒</h1>
          <p class="app-subtitle">传承千年佛法 弘扬戒律精神</p>
        </div>
        
        <!-- 加载动画 -->
        <div class="loading-section animate-fade-in-up-delay">
          <div class="loading-dots">
            <span></span>
            <span></span>
            <span></span>
          </div>
          <p class="loading-text">正在加载...</p>
        </div>
      </div>
      
      <!-- 底部信息 -->
      <div class="footer-info animate-fade-in">
        <p class="version">版本 1.0.0</p>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const isLeaving = ref(false)

onMounted(() => {
  // 3秒后开始离开动画,然后跳转到首页
  setTimeout(() => {
    isLeaving.value = true
    // 等待淡出动画完成后跳转
    setTimeout(() => {
      router.push('/home')
    }, 500)
  }, 2500)
})
</script>

<style scoped>
.splash-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, #fffbeb, #fed7aa);
  background-image: 
    radial-gradient(circle at 20% 20%, rgba(251, 191, 36, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(245, 158, 11, 0.1) 0%, transparent 50%);
  transition: opacity 0.5s ease-out;
}

.splash-container.fade-out {
  opacity: 0;
}

.splash-content {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 3rem 2rem;
}

.bg-decoration {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.lotus-pattern {
  position: absolute;
  top: 2.5rem;
  right: 2.5rem;
  width: 8rem;
  height: 8rem;
  opacity: 0.1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 20c-5 0-10 5-10 15s5 15 10 15 10-5 10-15-5-15-10-15z' fill='%23f59e0b'/%3E%3Cpath d='M35 35c-5-3-12-1-15 5s-1 12 5 15 12 1 15-5 1-12-5-15z' fill='%23f59e0b'/%3E%3Cpath d='M65 35c5-3 12-1 15 5s1 12-5 15-12 1-15-5-1-12 5-15z' fill='%23f59e0b'/%3E%3C/svg%3E");
}

.cloud-pattern {
  position: absolute;
  bottom: 5rem;
  left: 2.5rem;
  width: 6rem;
  height: 4rem;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 60'%3E%3Cpath d='M20 40c-8 0-15-7-15-15s7-15 15-15c2 0 4 0 6 1 3-6 9-10 16-10s13 4 16 10c2-1 4-1 6-1 8 0 15 7 15 15s-7 15-15 15H20z' fill='%23f59e0b'/%3E%3C/svg%3E");
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.logo-section {
  text-align: center;
  margin-bottom: 4rem;
}

.logo-circle {
  position: relative;
  width: 8rem;
  height: 8rem;
  margin: 0 auto 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: float 3s ease-in-out infinite;
}

.dharma-wheel {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  border-radius: 50%;
  background: white;
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-center {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
}

.wheel-spokes {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.wheel-spokes::before,
.wheel-spokes::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4rem;
  height: 0.125rem;
  background: linear-gradient(to right, #f59e0b, #ea580c);
  transform: translate(-50%, -50%);
}

.wheel-spokes::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.wheel-spokes::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.app-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 0.5rem;
  font-family: 'PingFang SC', 'Hiragino Sans GB', sans-serif;
}

.app-subtitle {
  font-size: 1.125rem;
  color: #b45309;
  opacity: 0.8;
}

.loading-section {
  text-align: center;
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.loading-dots span {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background-color: #f59e0b;
  animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.loading-text {
  color: #b45309;
  font-size: 0.875rem;
}

.footer-info {
  text-align: center;
}

.version {
  color: #d97706;
  font-size: 0.75rem;
  opacity: 0.6;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes drift {
  0%, 100% {
    transform: translateX(0px);
  }
  50% {
    transform: translateX(20px);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out;
}

.animate-fade-in-up-delay {
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

.animate-fade-in {
  animation: fadeInUp 0.8s ease-out 0.6s both;
}

.animate-rotate {
  animation: rotate 8s linear infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-drift {
  animation: drift 4s ease-in-out infinite;
}
</style>