From 6ab6b35fe3ac1ce90711e3555b19dde8ce1e21dc Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期三, 26 六月 2024 17:43:12 +0800
Subject: [PATCH] feat:对接考试

---
 src/views/exam/components/answer-main/answer-multiple/index.vue |    2 
 src/store/modules/exam.js                                       |    7 +++
 src/views/exam-list/data-list/index.vue                         |   25 +++++++-----
 src/views/exam-list/index.vue                                   |    6 +-
 src/views/exam/components/answer-main/answer-single/index.vue   |    2 
 vite.config.js                                                  |    4 +-
 src/api/modules/exam.js                                         |   15 ++-----
 src/views/exam/index.vue                                        |    2 
 8 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/src/api/modules/exam.js b/src/api/modules/exam.js
index 1df7671..ce76409 100644
--- a/src/api/modules/exam.js
+++ b/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);
 }
\ No newline at end of file
diff --git a/src/store/modules/exam.js b/src/store/modules/exam.js
index ca976a6..b54d2ad 100644
--- a/src/store/modules/exam.js
+++ b/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);
diff --git a/src/views/exam-list/data-list/index.vue b/src/views/exam-list/data-list/index.vue
index 47c3163..12feff2 100644
--- a/src/views/exam-list/data-list/index.vue
+++ b/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 => {
 
diff --git a/src/views/exam-list/index.vue b/src/views/exam-list/index.vue
index b7a0e42..289ae0f 100644
--- a/src/views/exam-list/index.vue
+++ b/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;
diff --git a/src/views/exam/components/answer-main/answer-multiple/index.vue b/src/views/exam/components/answer-main/answer-multiple/index.vue
index b127aff..530e87d 100644
--- a/src/views/exam/components/answer-main/answer-multiple/index.vue
+++ b/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>
diff --git a/src/views/exam/components/answer-main/answer-single/index.vue b/src/views/exam/components/answer-main/answer-single/index.vue
index 705d1d0..87ee164 100644
--- a/src/views/exam/components/answer-main/answer-single/index.vue
+++ b/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>
diff --git a/src/views/exam/index.vue b/src/views/exam/index.vue
index ce873c5..68a463e 100644
--- a/src/views/exam/index.vue
+++ b/src/views/exam/index.vue
@@ -156,7 +156,7 @@
 const typeComponent = {
   1: AnswerSingle,
   2: AnswerMultiple,
-  3: AnswerAudio,
+  6: AnswerAudio,
 };
 
 const quitDialog = ref(false);
diff --git a/vite.config.js b/vite.config.js
index 84001a6..5686722 100644
--- a/vite.config.js
+++ b/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,
             }
         }

--
Gitblit v1.8.0