<template>
  <div class="study-plan-page">
    <div class="page-header">
      <h1>学习计划</h1>
      <p class="page-description">制定学习计划，完成学习任务，提升思政素养</p>
    </div>

    <div class="plan-tabs">
      <div 
        class="plan-tab" 
        v-for="tab in tabs" 
        :key="tab.key"
        :class="{ active: activeTab === tab.key }"
        @click="activeTab = tab.key"
      >
        {{ tab.label }}
      </div>
    </div>

    <div class="plan-content">
      <component :is="currentComponent" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, computed } from 'vue';
import StudyTasks from './components/StudyTasks.vue';
import CourseCenter from './components/CourseCenter.vue';

const activeTab = ref('tasks');

const tabs = [
  { key: 'tasks', label: '学习任务' },
  { key: 'courses', label: '课程中心' }
];

const componentMap: Record<string, any> = {
  'tasks': StudyTasks,
  'courses': CourseCenter
};

const currentComponent = computed(() => componentMap[activeTab.value]);
</script>

<style lang="scss" scoped>
.study-plan-page {
  min-height: 100vh;
  background: #f5f5f5;
  padding: 20px;
}

.page-header {
  background: white;
  padding: 40px;
  border-radius: 8px;
  margin-bottom: 20px;
  
  h1 {
    font-size: 32px;
    font-weight: 600;
    color: #141F38;
    margin-bottom: 8px;
  }
}

.page-description {
  font-size: 16px;
  color: #666;
}

.plan-tabs {
  background: white;
  padding: 0 40px;
  display: flex;
  gap: 8px;
  border-radius: 8px 8px 0 0;
}

.plan-tab {
  padding: 16px 24px;
  cursor: pointer;
  font-size: 16px;
  color: #666;
  position: relative;
  transition: all 0.3s;
  
  &:hover {
    color: #C62828;
  }
  
  &.active {
    color: #C62828;
    font-weight: 600;
    
    &::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: #C62828;
    }
  }
}

.plan-content {
  background: white;
  border-radius: 0 0 8px 8px;
}
</style>

