ZhangXianQiang
2024-06-26 6ab6b35fe3ac1ce90711e3555b19dde8ce1e21dc
feat:对接考试
8个文件已修改
63 ■■■■ 已修改文件
src/api/modules/exam.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/exam.js 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam-list/data-list/index.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam-list/index.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/components/answer-main/answer-multiple/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/components/answer-main/answer-single/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/modules/exam.js
@@ -1,14 +1,9 @@
import service from "@/api";
export const getExamList = () => {
  return service.get('/api/v1/getExamList');
}
export const getExamInfo = () => {
  return service.get('/api/v1/getExamInfo');
}
export const getExamListV2 = (postData = {examName: ''}) => {
export const getExamList = (postData = {examName: ''}) => {
  return service.post('/api/student/exam/page',postData);
}
export const getExamInfo = (id) => {
  return service.post('/api/student/exam/start/' + id);
}
src/store/modules/exam.js
@@ -7,7 +7,12 @@
  const examType = ref({
    1: '单选题',
    2: '多选题',
    3: '音频题'
    3: '判断题',
    4: '填空题',
    5: '简答题',
    6: '语音题',
    7: '计算题',
    8: '分析题',
  });
  const currentType = ref(1);
src/views/exam-list/data-list/index.vue
@@ -5,7 +5,7 @@
        <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 }}
@@ -20,7 +20,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 +30,11 @@
              <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"
              <el-button type="primary" size="large" @click="examClick(item)"
                :disabled="stateList[item.status].disabled">开始考试</el-button>
            </div>
          </div>
@@ -68,7 +68,7 @@
    type: 'primary',
    disabled: true
  },
  2: {
  'ing': {
    text: '进行中',
    type: 'success',
    disabled: false
@@ -80,11 +80,16 @@
  }
};
const examClick = () => {
  getExamInfo().then((res) => {
    examStore.setExamInfo(res.data.examInfo);
    examStore.setExamDetail(res.data.examQuestionList);
    examStore.initExam();
const examClick = (exam) => {
  console.log(exam);
  getExamInfo(exam.id).then((res) => {
    examStore.setExamInfo({
      examName: exam.examName
    });
    examStore.setExamDetail(res.data);
    // examStore.setExamInfo(res.data.examInfo);
    // examStore.setExamDetail(res.data.examQuestionList);
    // examStore.initExam();
    router.push('/exam');
  }).catch(err => {
src/views/exam-list/index.vue
@@ -48,7 +48,7 @@
import { Search } from '@element-plus/icons-vue';
import { getExamList,getExamListV2 } from '@/api/modules/exam.js';
import { getExamList } from '@/api/modules/exam.js';
const activeName = ref('1');
@@ -60,8 +60,8 @@
const getData = () => {
  loading.value = true;
  getExamListV2().then(res => {
    // dataList.value = res.data;
  getExamList().then(res => {
    dataList.value = res.data;
    loading.value = false;
  }).catch(err => {
    loading.value = false;
src/views/exam/components/answer-main/answer-multiple/index.vue
@@ -4,7 +4,7 @@
      <ExamInfo class="mb-5" :questionIndex="currentIndex" :activeQuestion="activeQuestion"></ExamInfo>
      <div class="answer-content">
        <div class="answer-item flex" v-for="item, index in activeQuestion.items" @click="answerClick(item)"
        <div class="answer-item flex" v-for="item, index in activeQuestion.questionItemList" @click="answerClick(item)"
          :class="answerState(item)">
          <div class="answer-icon flex flex-col justify-center items-center flex-shrink-0">{{ item.prefix }}</div>
          <div class="answer-text text-gray-700">{{ item.content }}</div>
src/views/exam/components/answer-main/answer-single/index.vue
@@ -4,7 +4,7 @@
      <ExamInfo class="mb-5" :questionIndex="currentIndex" :activeQuestion="activeQuestion"></ExamInfo>
      <div class="answer-content">
        <div class="answer-item flex" v-for="item, index in activeQuestion.items" @click="answerClick(item)"
        <div class="answer-item flex" v-for="item, index in activeQuestion.questionItemList" @click="answerClick(item)"
          :class="answerState(item)">
          <div class="answer-icon flex flex-col justify-center items-center flex-shrink-0">{{ item.prefix }}</div>
          <div class="answer-text text-gray-700">{{ item.content }}</div>
src/views/exam/index.vue
@@ -156,7 +156,7 @@
const typeComponent = {
  1: AnswerSingle,
  2: AnswerMultiple,
  3: AnswerAudio,
  6: AnswerAudio,
};
const quitDialog = ref(false);
vite.config.js
@@ -34,8 +34,8 @@
        port: 3000,
        proxy: {
            '/api': {
                // target: 'http://192.168.3.88:8000',
                target: 'http://192.168.3.64:8000',
                target: 'http://192.168.3.88:8000',
                // target: 'http://192.168.3.64:8000',
                changeOrigin: true,
            }
        }