<template>
  <div class="exam-notice-page">
    <!-- 考试中心标题 -->
    <div class="exam-center-header">
      <div class="container">
        <h1 class="center-title">考试中心</h1>
        <p class="center-subtitle">诚信考试规范，考试过程规范，严格监考规范</p>
      </div>
    </div>

    <!-- 主要内容区域 -->
    <div class="main-content">
      <div class="container">
        <div class="content-layout">
          <!-- 左侧导航 -->
          <div class="sidebar">
            <div class="nav-menu">
              <div class="nav-item active">
                <span class="nav-icon">📋</span>
                <span class="nav-text">考前须知</span>
              </div>
            </div>
          </div>

          <!-- 右侧内容 -->
          <div class="content-area">
            <div class="notice-card">
              <div class="notice-header">
                <h2 class="notice-title">考前须知</h2>
                <div class="notice-meta">
                  <span class="publish-time">发布时间：2024年12月31日</span>
                  <span class="view-count">浏览次数：{{ viewCount }}</span>
                </div>
              </div>

              <div class="notice-content">
                <div class="notice-item">
                  <span class="item-number">1.</span>
                  <span class="item-text">考试时间为：2024年8月31日-9月30日，考试期间考生可自行安排时间考试，考试时长为120分钟。</span>
                </div>

                <div class="notice-item">
                  <span class="item-number">2.</span>
                  <span class="item-text">考生应诚实守信，自觉遵守考试纪律，禁止一切一切作弊行为。</span>
                </div>

                <div class="notice-item">
                  <span class="item-number">3.</span>
                  <span class="item-text">考试过程中考生需确保网络环境良好，设备、光线充足等，自备答题纸。</span>
                </div>

                <div class="notice-item">
                  <span class="item-number">4.</span>
                  <span class="item-text">考试期间若遇到网络中断等异常，考生应保持冷静并及时联系监考老师，监考老师会根据实际情况进行处理，考生、监考老师务必在考试过程中保持良好的沟通配合，确保考试的顺利进行。</span>
                </div>

                <div class="notice-item">
                  <span class="item-number">5.</span>
                  <span class="item-text">考生应提前调试好考试设备，确保考试设备正常运行，不得因设备故障等问题影响考试。</span>
                </div>

                <div class="notice-item">
                  <span class="item-number">6.</span>
                  <span class="item-text">考试时，请考生自觉关闭手机等，并将随身物品放在指定位置，考生需，24小时，确保良好的网络环境和充足的电量，在考试期间考生不得离开考试场地上述规定执行。</span>
                </div>

                <div class="notice-item">
                  <span class="item-number">7.</span>
                  <span class="item-text">考生应提前熟悉考试流程，作弊考试操作流程，确保能够正常参加考试。</span>
                </div>

                <div class="notice-item">
                  <span class="item-number">8.</span>
                  <span class="item-text">违反人员者，将按相关规定，暂停考试资格或取消，禁止参与考试。</span>
                </div>

                <div class="notice-item">
                  <span class="item-number">9.</span>
                  <span class="item-text">请认真阅读本人考试须知，严格遵守考试纪律，诚实考试，如有疑问请及时联系，监考老师进行咨询。</span>
                </div>

                <div class="notice-item">
                  <span class="item-number">10.</span>
                  <span class="item-text">考生应在考试完毕后及时提交试卷并确认提交成功，考生、考生应在规定时间内完成考试，逾期、监考老师将强制，并对《考试违规》进行处罚。</span>
                </div>

                <div class="notice-item">
                  <span class="item-number">11.</span>
                  <span class="item-text">考试过程中若出现工作异常且自行解决困难时请及时联系，考试技术热线：www.baidu.com。</span>
                </div>

                <div class="notice-item">
                  <span class="item-number">12.</span>
                  <span class="item-text">咨询电话：咨询电话：0871-65635521。</span>
                </div>
              </div>

              <div class="notice-actions">
                <button class="btn-secondary" @click="goBack">
                  返回上级，开始考试（10）
                </button>
                <button class="btn-primary" @click="startExam">
                  我已阅读，开始考试
                </button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'

const route = useRoute()
const router = useRouter()

// 路由参数
const courseId = ref(Number(route.params.courseId))
const sectionId = ref(Number(route.params.sectionId))
const courseName = ref(route.query.courseName as string || '课程名称')
const examName = ref(route.query.examName as string || '考试')

// 页面数据
const viewCount = ref(1024)

// 返回上级
const goBack = () => {
  router.push(`/course/${courseId.value}`)
}

// 开始考试
const startExam = () => {
  // 跳转到正式考试页面，添加fromNotice参数
  router.push({
    name: 'Exam',
    params: {
      courseId: courseId.value,
      sectionId: sectionId.value
    },
    query: {
      courseName: courseName.value,
      examName: examName.value,
      fromNotice: 'true'
    }
  })
}

onMounted(() => {
  console.log('考前须知页面加载完成')
  console.log('课程ID:', courseId.value)
  console.log('章节ID:', sectionId.value)
  console.log('考试名称:', examName.value)
})
</script>

<style scoped>
.exam-notice-page {
  min-height: 100vh;
  background-color: #f5f5f5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 考试中心标题 */
.exam-center-header {
  background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
  color: white;
  padding: 40px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.exam-center-header::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 100%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 200"><circle cx="250" cy="50" r="30" fill="rgba(255,255,255,0.1)"/><circle cx="200" cy="120" r="20" fill="rgba(255,255,255,0.08)"/><circle cx="280" cy="150" r="25" fill="rgba(255,255,255,0.06)"/></svg>') no-repeat center;
}

.center-title {
  font-size: 36px;
  font-weight: bold;
  margin: 0 0 10px 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.center-subtitle {
  font-size: 16px;
  margin: 0;
  opacity: 0.9;
}

/* 主要内容区域 */
.main-content {
  padding: 30px 0;
}

.content-layout {
  display: flex;
  gap: 30px;
}

/* 左侧导航 */
.sidebar {
  width: 200px;
  flex-shrink: 0;
}

.nav-menu {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-menu .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.nav-menu .nav-item.active {
  background: #e6f7ff;
  color: #1890ff;
}

.nav-icon {
  font-size: 16px;
}

.nav-text {
  font-size: 14px;
  font-weight: 500;
}

/* 右侧内容区域 */
.content-area {
  flex: 1;
}

.notice-card {
  background: white;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.notice-header {
  border-bottom: 1px solid #e8e8e8;
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.notice-title {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0 0 12px 0;
}

.notice-meta {
  display: flex;
  gap: 30px;
  font-size: 14px;
  color: #666;
}

.notice-content {
  margin-bottom: 40px;
}

.notice-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 16px;
  line-height: 1.6;
}

.item-number {
  color: #333;
  font-weight: 500;
  margin-right: 8px;
  flex-shrink: 0;
}

.item-text {
  color: #333;
  font-size: 14px;
}

.notice-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid #e8e8e8;
}

.btn-secondary {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #d9d9d9;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-secondary:hover {
  background: #e6f7ff;
  border-color: #1890ff;
  color: #1890ff;
}

.btn-primary {
  background: #1890ff;
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s;
}

.btn-primary:hover {
  background: #40a9ff;
}



/* 响应式设计 */
@media (max-width: 768px) {
  .content-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .notice-actions {
    flex-direction: column;
  }
}
</style>
