<!--
 * @Author: lixg lixg@dongwu-inc.com
 * @Date: 2023-02-06 18:26:23
 * @LastEditors: lixg lixg@dongwu-inc.com
 * @LastEditTime: 2023-03-17 12:19:23
 * @FilePath: /stu_h5/src/views/examination/ExternalExam.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="externalexam">
    <ReturnHead text="考试详情"></ReturnHead>
    <div class="notice">
      <div class="noticebox">
        <div class="main">
          <div class="e_title">
            【考试】{{ state.datainfo?.examinationName }}
          </div>
          <div class="et_detail">
            数据来源：
            <div class="et_time">
              {{ state.datainfo.source ? state.datainfo.source : "-" }}
            </div>
          </div>
        </div>
      </div>

      <div class="noticebox">
        <div class="btnbox">考试说明</div>
        <div class="e_form">
          {{
            state.datainfo.examinationExplain
              ? state.datainfo.examinationExplain
              : "暂无考试说明"
          }}
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import ReturnHead from "@/components/ReturnHead.vue";
import { useRequest, request } from "@/api/request";
import { EXTERNALEXAM, checkStudentExist } from "@/api/api";
import { reactive } from "vue";
import { useRoute, useRouter } from "vue-router/dist/vue-router";
const {
  query: { courseId, type, id: taskId, infoId, chapterOrStageId },
} = useRoute();
const router = useRouter();
const state = reactive({
  datainfo: {},
});
//获取基本信息
request(EXTERNALEXAM, { externalId: courseId, type })
  .then((e) => {
    useRequest(
      checkStudentExist,
      {
        targetId: infoId,
        type: type,
        chapterId: chapterOrStageId,
        courseId: taskId,
      },
      (res) => {
        console.log("判断任务是否删除", res);
        if (res.code === 7) {
          router.push({
            path: "/loseefficacy",
          });
        } else {
          if (res.code === 6) {
            router.push({
              path: "/notpath",
            });
          } else {
            state.datainfo = e.data;
          }
        }
      }
    );
  })
  .catch((err) => {
    console.log(err);
  });
</script>
<style lang="scss">
.externalexam {
  width: 100%;
  background-color: #f2f5f7;
  .notice {
    width: 100%;
    margin-top: 10px;
    font-size: 14px;
  }
  .noticebox {
    width: 100%;
    background: #fff;
    margin-bottom: 11.5px;
    .main {
      width: 90%;
      margin: 0 auto;
      padding-top: 18px;
      padding-bottom: 18px;
    }
  }
  .e_title {
    margin-bottom: 14.5px;
    font-weight: 600;
  }
  .et_detail {
    display: flex;
    margin-bottom: 11.5px;
    align-items: center;
    .et_time {
      color: #6e7b84;
    }
  }

  .btnbox {
    width: 90%;
    height: 50px;
    border-bottom: 1px solid #f1f2f3;
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    color: #0d233a;
    line-height: 24px;
    padding-left: 5%;
  }
  .e_form {
    width: 90%;
    min-height: 40px;
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #6e7b84;
    margin-left: 5%;
    line-height: 30px;
    margin-top: 20px;
  }
}
</style>
