<script setup lang="ts">
import type { PaperType } from '@/types'
interface Props {
  data: PaperType
}
defineProps<Props>()

const { query } = useRoute()
const courseId = $ref(query.course_id as string)
const semesterId = $ref(query.semester_id as string)
</script>

<template>
  <div class="course-exam-item" :key="data.id">
    <p>
      <router-link
        :to="`/course/exam?course_id=${courseId}&semester_id=${semesterId}&paper_id=${data.id}&type=1&paper_title=${data.paper_title}`"
        target="_blank"
        >{{ data.paper_title }}</router-link
      >
    </p>
    <router-link
      :to="`/course/exam/result?course_id=${courseId}&semester_id=${semesterId}&paper_id=${data.id}&type=1&paper_title=${data.paper_title}`"
      target="_blank"
      v-if="data.paper_status === 2 || data.paper_status === 3"
    >
      <el-button round size="small">查看报告</el-button>
    </router-link>
  </div>
</template>

<style lang="scss" scoped>
.course-exam-item {
  display: flex;
  align-items: center;
  height: 48px;
  border-bottom: 1px solid #e6e6e6;
  p {
    flex: 1;
    line-height: 48px;
  }
  &:hover {
    color: var(--main-color);
  }

  .actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
</style>
