xiangpei
2024-10-31 fbd9c491ebe32558c8fcefffeaa103d2fcb79a27
src/views/exam-list/data-list/index.vue
@@ -5,12 +5,13 @@
        <div class="item flex justify-between items-center">
          <div class="left-container flex flex-col justify-between">
            <div class="top-container flex items-center">
              <div class="title mr-5 text-xl font-bold">{{ item.name }}</div>
              <div class="title mr-5 text-xl font-bold">{{ item.examName }}</div>
              <div class="tag">
                <el-tag :type="stateList[item.status].type" effect="light" round>
                  {{ stateList[item.status].text }}
                </el-tag>
              </div>
              <div v-if="!item.isContinue" style="margin-left: 15px">您已提交试卷</div>
            </div>
            <div class="mid-container flex items-center my-4 text-gray-700">
              <el-icon class="mr-1">
@@ -20,7 +21,7 @@
                考试时间: {{ item.startTime }} ~ {{ item.endTime }}
              </div>
            </div>
            <div class="bottom-container flex text-sm text-gray-400">
            <!-- <div class="bottom-container flex text-sm text-gray-400">
              <div class="bottom-item">
                总分: {{ item.examScore }}
              </div>
@@ -30,11 +31,12 @@
              <div class="bottom-item">
                答题时间: {{ item.examTime }}分钟
              </div>
            </div>
            </div> -->
          </div>
          <div class="right-container">
            <div class="button-container">
              <el-button type="primary" size="large" @click="examClick" :disabled="stateList[item.status].disabled">开始考试</el-button>
              <el-button type="primary" size="large" @click="examClick(item)"
                :disabled="stateList[item.status].disabled || !item.isContinue">开始考试</el-button>
            </div>
          </div>
        </div>
@@ -47,6 +49,10 @@
import { ref } from 'vue';
import { Timer } from '@element-plus/icons-vue';
import { useRouter } from 'vue-router';
import { useExamStore } from '@/store/index.js';
import { getExamInfo } from '@/api/modules/exam.js';
const examStore = useExamStore();
const router = useRouter();
const props = defineProps({
@@ -57,25 +63,42 @@
});
const stateList = {
  1: {
  'not_start': {
    text: '未开始',
    type: 'primary',
    disabled: true
  },
  2: {
  'ing': {
    text: '进行中',
    type: 'success',
    disabled: false
  },
  3: {
  'finished': {
    text: '已结束',
    type: 'info',
    disabled: true
  },
  'cancel': {
    text: '已作废',
    type: 'danger',
    disabled: true
  }
};
const examClick = () => {
  router.push('/exam');
const examClick = (exam) => {
  console.log(exam);
  getExamInfo(exam.id).then((res) => {
    examStore.setExamInfo({
      id: res.data.id,
      examName: res.data.examName,
      suggestTime: res.data.suggestTime,
    });
    examStore.setExamDetail(res.data.titleList);
    examStore.initExam(res.data.titleList[0].questionType);
    router.push('/exam');
  }).catch(err => {
  });
}
</script>
@@ -89,4 +112,4 @@
.bottom-item {
  margin-right: 30px;
}
</style>
</style>