<template>
  <div class="liuyanlist">
    <back title="考试记录"></back>
    <!-- <div class="list" v-for="(item,index) in list.exam_bu" :key="index" v-if="item.num != 0">
        <div class="shijian">
          <p>补考</p>
          <a @click="goDetail(item.id, 2)">考卷回顾</a>
        </div>
        <p class="neirong" v-if="item.num == 1">
          练习题&emsp;{{item.name}}
        </p>
        <p class="neirong" v-if="item.num == 2">
          模拟题
        </p>
        <p class="neirong" v-if="item.num == 3">
          正式题
        </p>
        <p class="neirong" v-if="item.is_end == 0">
          考试未完成或已超时
        </p>
        <p class="neirong" v-if="item.is_end == 1">
          分数：{{item.score}}分(<span v-if="item.is_standard == 1">通过</span><span v-if="item.is_standard == 0">未通过</span>) <br/>
          考试时间：{{item.start_time | format}} 至 {{item.end_time | format}}
        </p>
      </div> -->

    <template v-for="(item, index) in list.exam">
      <div class="list" :key="index" v-if="item.num != 0">
        <div class="shijian">
          <p>考试</p>
          <a @click="goDetail(item.id, 1)">考卷回顾</a>
        </div>
        <p class="neirong" v-if="item.num == 1">练习题&emsp;{{ item.name }}</p>
        <p class="neirong" v-if="item.num == 2">模拟题</p>
        <p class="neirong" v-if="item.num == 3">正式题</p>
        <p class="neirong" v-if="item.is_end == 0">考试未完成或已超时</p>
        <p class="neirong" v-if="item.is_end == 1">
          分数：{{ item.score }}分(<span v-if="item.is_standard == 1">通过</span
          ><span v-if="item.is_standard == 0">未通过</span>) <br />
          考试时间：{{ item.start_time | format }} 至 {{ item.end_time | format }}
        </p>
      </div>
    </template>

    <!-- <div class="list" v-for="(item,index) in list.exam" :key="index" v-if="item.num != 0">
        <div class="shijian">
          <p>考试</p>
          <a @click="goDetail(item.id, 1)">考卷回顾</a>
        </div>
        <p class="neirong" v-if="item.num == 1">
          练习题&emsp;{{item.name}}
        </p>
        <p class="neirong" v-if="item.num == 2">
          模拟题
        </p>
        <p class="neirong" v-if="item.num == 3">
          正式题
        </p>
        <p class="neirong" v-if="item.is_end == 0">
          考试未完成或已超时
        </p>
        <p class="neirong" v-if="item.is_end == 1">
          分数：{{item.score}}分(<span v-if="item.is_standard == 1">通过</span><span v-if="item.is_standard == 0">未通过</span>) <br/>
          考试时间：{{item.start_time | format}} 至 {{item.end_time | format}}
        </p>
      </div> -->
  </div>
</template>

<script>
import Back from "../common/Back";
import { getStore } from "@/utils/storage";
import { Toast } from "mint-ui";
export default {
  name: "ExamList",
  components: { Back },
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    this.getPageData();
  },
  methods: {
    getPageData() {
      this.getData("/Member/getExam", {
        token: getStore("token"),
        num: this.$route.query.num,
      }).then(
        (data) => {
          if (data.code == 1) {
            this.list = data.data;
          } else {
            Toast(data.msg);
          }
        },
        (err) => {}
      );
    },
    goDetail(id, type) {
      this.$router.push({ path: "/examDetail?id=" + id + "&type=" + type });
    },
  },
};
</script>

<style lang="scss" scoped>
.liuyanlist {
  padding-top: 5rem;
  .list {
    width: 90%;
    margin: 1.5rem auto;
    border-bottom: 0.05rem solid #9c9c9c;
    text-align: left;
    padding-bottom: 1rem;
    .shijian {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 1.46rem;
      font-family: MicrosoftYaHei;
      font-weight: 400;
      margin-bottom: 1rem;
      p:nth-child(1) {
        color: #9e9e9e;
      }
      a {
        color: #0375e4;
      }
    }
    .neirong {
      font-size: 1.35rem;
      font-family: MicrosoftYaHei;
      font-weight: 400;
      word-break: break-word;
      line-height: 2rem;
    }
  }
}
</style>
