<template>
  <div class="onboarding-container">
    <!-- 动态背景装饰 -->
    <div class="decorative-background">
      <div class="gradient-circle blue"></div>
      <div class="gradient-circle purple"></div>
    </div>

    <!-- 初始状态 -->
    <div v-if="!showForm" class="initiation-card">
      <div class="welcome-section">
        <el-image 
          src="https://example.com/onboarding-illustration.svg" 
          class="welcome-illustration"
          :preview-src-list="[]">
          <div slot="error" class="image-slot">
            <i class="el-icon-user-solid"></i>
          </div>
        </el-image>
        <h2 class="welcome-title">欢迎加入团队！</h2>
        <p class="welcome-subtitle">让我们开始您的入职流程</p>
      </div>

      <div class="process-steps">
        <el-steps direction="vertical" :active="0">
          <el-step title="准备资料"></el-step>
          <el-step title="信息填写"></el-step>
          <el-step title="完成认证"></el-step>
        </el-steps>
      </div>

      <el-button 
        type="primary" 
        class="start-button"
        @click="startOnboarding"
        :loading="loading">
        {{ loading ? '正在准备表单...' : '开启入职流程' }}
        <i class="el-icon-right"></i>
      </el-button>
    </div>

    <!-- 表单状态 -->
    <transition name="el-fade-in">
      <div v-if="showForm" class="form-container">
        <el-skeleton :rows="5" animated v-if="loading" />
        
        <div v-else class="form-content">
          <div class="form-header">
            <h3>入职信息登记</h3>
            <el-progress :percentage="33" :show-text="false" />
          </div>
          
          <el-form 
            :model="employeeData" 
            class="employee-form"
            label-position="top">
            <!-- 原有表单字段 -->
          </el-form>
        </div>
      </div>
    </transition>
  </div>
</template>

<script>
export default {
  data() {
    return {
      showForm: false,
      loading: false,
      employeeData: {
        name: "",
        email: ""
      }
    }
  },
  methods: {
    async startOnboarding() {
      this.loading = true
      try {
        // 模拟API请求
        await new Promise(resolve => setTimeout(resolve, 1500))
        this.showForm = true
      } finally {
        this.loading = false
      }
    }
  }
}
</script>

<style scoped lang="scss">
.onboarding-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 2rem;
}

.decorative-background {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 0;

  .gradient-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.15;

    &.blue {
      width: 300px;
      height: 300px;
      background: linear-gradient(45deg, #409EFF, #79bbff);
      top: 20%;
      left: 10%;
    }

    &.purple {
      width: 250px;
      height: 250px;
      background: linear-gradient(45deg, #B37FEB, #9254de);
      bottom: 15%;
      right: 10%;
    }
  }
}

.initiation-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 600px;
  text-align: center;
}

.welcome-section {
  margin-bottom: 2rem;

  .welcome-illustration {
    width: 200px;
    height: 200px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: #f0f7ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #409EFF;
  }

  .welcome-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: #303133;
  }

  .welcome-subtitle {
    color: #909399;
    font-size: 1rem;
  }
}

.process-steps {
  margin: 2rem 0;
  ::v-deep .el-step__head {
    width: 24px;
    height: 24px;
  }
}

.start-button {
  width: 100%;
  height: 50px;
  font-size: 1.1rem;
  border-radius: 12px;
  transition: all 0.3s ease;

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
  }

  i {
    margin-left: 8px;
    transition: transform 0.3s ease;
  }

  &:hover i {
    transform: translateX(3px);
  }
}

.form-container {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 800px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 1;

  .form-header {
    margin-bottom: 2rem;
    h3 {
      font-size: 1.5rem;
      margin-bottom: 1rem;
    }
  }
}

@media (max-width: 768px) {
  .onboarding-container {
    padding: 1rem;
  }

  .initiation-card,
  .form-container {
    padding: 24px;
  }

  .welcome-illustration {
    width: 150px !important;
    height: 150px !important;
  }
}
</style>