From 9ad702793a50651da47c6676b87918eab688eb47 Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期四, 04 七月 2024 16:15:51 +0800
Subject: [PATCH] feat:成绩信息
---
src/api/modules/grade.js | 4
src/views/grade/components/answer-grade/index.vue | 2
src/views/exam-list/data-list/index.vue | 1
components.d.ts | 3
src/store/modules/grade.js | 330 ++---------------------------------------------
src/views/grade-list/data-list/index.vue | 41 ++++-
6 files changed, 55 insertions(+), 326 deletions(-)
diff --git a/components.d.ts b/components.d.ts
index 74b8f47..a17ee3d 100644
--- a/components.d.ts
+++ b/components.d.ts
@@ -10,6 +10,8 @@
ElButton: typeof import('element-plus/es')['ElButton']
ElCard: typeof import('element-plus/es')['ElCard']
ElCol: typeof import('element-plus/es')['ElCol']
+ ElCollapse: typeof import('element-plus/es')['ElCollapse']
+ ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
@@ -18,6 +20,7 @@
ElPagination: typeof import('element-plus/es')['ElPagination']
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
+ ElSlider: typeof import('element-plus/es')['ElSlider']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
diff --git a/src/api/modules/grade.js b/src/api/modules/grade.js
index 584f81d..29eceff 100644
--- a/src/api/modules/grade.js
+++ b/src/api/modules/grade.js
@@ -3,4 +3,8 @@
export const getGradeList = (postData = {examName: '', pageIndex: 1, pageSize: 10}) => {
return service.post('/api/student/exampaper/answer/pageList',postData);
+}
+
+export const getGradeInfo = (id) => {
+ return service.post('/api/student/exampaper/answer/read/' + id);
}
\ No newline at end of file
diff --git a/src/store/modules/grade.js b/src/store/modules/grade.js
index 01466b0..737f735 100644
--- a/src/store/modules/grade.js
+++ b/src/store/modules/grade.js
@@ -1,329 +1,22 @@
import { ref, computed } from 'vue';
import { defineStore } from 'pinia';
export const useGradeStore = defineStore('grade', () => {
- const examInfo = ref({
- examId: 1,
- examName: '鑰冭瘯鍚嶇О',
- examType: '鑰冭瘯绫诲瀷',
- examStatus: '鑰冭瘯鐘舵��',
- examStartTime: '2021-01-01',
- examEndTime: '2021-01-01',
- examTime: 5,
- examGrade: 60
- });
+ const examInfo = ref(null);
+ const examDetail = ref([]);
const examType = ref({
1: '鍗曢�夐',
2: '澶氶�夐',
- 3: '闊抽棰�'
+ 3: '鍒ゆ柇棰�',
+ 4: '濉┖棰�',
+ 5: '绠�绛旈',
+ 6: '璇煶棰�',
+ 7: '璁$畻棰�',
+ 8: '鍒嗘瀽棰�',
});
const currentType = ref(1);
const currentIndex = ref(0);
-
-
- const examDetail = ref([
- {
- questionType: 1,
- questionList: [
- {
- "id": null,
- "questionType": 1,
- "gradeLevel": null,
- "subjectId": 2,
- "title": "1+1=锛�",
- "img": '/test_question.png',
- "items": [
- {
- "prefix": "A",
- "content": "1"
- },
- {
- "prefix": "B",
- "content": "2"
- },
- {
- "prefix": "C",
- "content": "3"
- },
- {
- "prefix": "D",
- "content": "4"
- }
- ],
- "analyze": "闂皬鏈嬪弸",
- "correct": "A",
- "right": "A",
- "score": "3",
- "difficult": 5,
- "isRight": true
- },
- {
- "id": null,
- "questionType": 1,
- "gradeLevel": null,
- "subjectId": 2,
- "title": "1+1=锛�",
- "items": [
- {
- "prefix": "A",
- "content": "1"
- },
- {
- "prefix": "B",
- "content": "2"
- },
- {
- "prefix": "C",
- "content": "3"
- },
- {
- "prefix": "D",
- "content": "4"
- }
- ],
- "analyze": "闂皬鏈嬪弸",
- "correct": "A",
- "right": "B",
- "score": "3",
- "difficult": 5,
- "isRight": false
- }
- ]
- },
- {
- questionType: 2,
- questionList: [
- {
- "id": null,
- "questionType": 1,
- "gradeLevel": null,
- "subjectId": 2,
- "title": "1+1=锛�",
- "img": '/test_question.png',
- "items": [
- {
- "prefix": "A",
- "content": "1"
- },
- {
- "prefix": "B",
- "content": "2"
- },
- {
- "prefix": "C",
- "content": "3"
- },
- {
- "prefix": "D",
- "content": "4"
- }
- ],
- "analyze": "闂皬鏈嬪弸",
- "correct": "A,B",
- "right": "A,B,C",
- "score": "5",
- "difficult": 5,
- "isRight": false
- },
- {
- "id": null,
- "questionType": 1,
- "gradeLevel": null,
- "subjectId": 2,
- "title": "1+1=锛�",
- "items": [
- {
- "prefix": "A",
- "content": "1"
- },
- {
- "prefix": "B",
- "content": "2"
- },
- {
- "prefix": "C",
- "content": "3"
- },
- {
- "prefix": "D",
- "content": "4"
- }
- ],
- "analyze": "闂皬鏈嬪弸",
- "correct": "A,D",
- "right": "B,C",
- "score": "5",
- "difficult": 5,
- "isRight": false
- },
- {
- "id": null,
- "questionType": 1,
- "gradeLevel": null,
- "subjectId": 2,
- "title": "1+1=锛�",
- "items": [
- {
- "prefix": "A",
- "content": "1"
- },
- {
- "prefix": "B",
- "content": "2"
- },
- {
- "prefix": "C",
- "content": "3"
- },
- {
- "prefix": "D",
- "content": "4"
- }
- ],
- "analyze": "闂皬鏈嬪弸",
- "correct": "A,B,D",
- "right": "B,C",
- "score": "5",
- "difficult": 5,
- "isRight": false
- },
- {
- "id": null,
- "questionType": 1,
- "gradeLevel": null,
- "subjectId": 2,
- "title": "1+1=锛�",
- "img": '/test_question.png',
- "items": [
- {
- "prefix": "A",
- "content": "1"
- },
- {
- "prefix": "B",
- "content": "2"
- },
- {
- "prefix": "C",
- "content": "3"
- },
- {
- "prefix": "D",
- "content": "4"
- }
- ],
- "analyze": "闂皬鏈嬪弸",
- "correct": "B,C",
- "right": "B,C",
- "score": "5",
- "difficult": 5,
- "isRight": true
- },
- {
- "id": null,
- "questionType": 1,
- "gradeLevel": null,
- "subjectId": 2,
- "title": "1+1=锛�",
- "items": [
- {
- "prefix": "A",
- "content": "1"
- },
- {
- "prefix": "B",
- "content": "2"
- },
- {
- "prefix": "C",
- "content": "3"
- },
- {
- "prefix": "D",
- "content": "4"
- }
- ],
- "analyze": "闂皬鏈嬪弸",
- "correct": "",
- "right": "B,C",
- "score": "5",
- "difficult": 5,
- "isRight": false
- }
- ]
- },
- {
- questionType: 3,
- questionList: [
- {
- "id": null,
- "questionType": 1,
- "gradeLevel": null,
- "subjectId": 2,
- "title": "娴嬭瘯闊抽1",
- "audioFile": '/test.mp3',
- "img": '/test_question.png',
- "items": [
- {
- "prefix": "A",
- "content": "1"
- },
- {
- "prefix": "B",
- "content": "2"
- },
- {
- "prefix": "C",
- "content": "3"
- },
- {
- "prefix": "D",
- "content": "4"
- }
- ],
- "analyze": "闂皬鏈嬪弸",
- "correct": "",
- "right": "B",
- "score": "3",
- "difficult": 5,
- "isRight": false
- },
- {
- "id": null,
- "questionType": 1,
- "gradeLevel": null,
- "subjectId": 2,
- "title": "娴嬭瘯闊抽2",
- "audioFile": '/test.mp3',
- "items": [
- {
- "prefix": "A",
- "content": "1"
- },
- {
- "prefix": "B",
- "content": "2"
- },
- {
- "prefix": "C",
- "content": "3"
- },
- {
- "prefix": "D",
- "content": "4"
- }
- ],
- "analyze": "闂皬鏈嬪弸",
- "correct": "D",
- "right": "A",
- "score": "3",
- "difficult": 5,
- "isRight": false
- }
- ]
- },
- ]);
const getActiveQuestion = computed(() => {
const temp = examDetail.value.find(item => item.questionType === currentType.value);
@@ -339,7 +32,10 @@
const setExamDetail = (detail) => {
examDetail.value = detail;
};
-
+ const initExam = () => {
+ currentIndex.value = 0;
+ currentType.value = 1;
+ }
return {
examInfo,
examDetail,
@@ -348,6 +44,8 @@
currentType,
currentIndex,
+ initExam,
+
getActiveQuestion,
setExamInfo,
diff --git a/src/views/exam-list/data-list/index.vue b/src/views/exam-list/data-list/index.vue
index 29570fe..27708ac 100644
--- a/src/views/exam-list/data-list/index.vue
+++ b/src/views/exam-list/data-list/index.vue
@@ -52,7 +52,6 @@
import { getExamInfo } from '@/api/modules/exam.js';
const examStore = useExamStore();
-
const router = useRouter();
const props = defineProps({
diff --git a/src/views/grade-list/data-list/index.vue b/src/views/grade-list/data-list/index.vue
index 5846bcc..cffad72 100644
--- a/src/views/grade-list/data-list/index.vue
+++ b/src/views/grade-list/data-list/index.vue
@@ -13,7 +13,9 @@
</div>
</div>
<div class="mid-container flex items-center my-4 text-gray-700">
- <el-icon class="mr-1"><Timer /></el-icon>
+ <el-icon class="mr-1">
+ <Timer />
+ </el-icon>
<div class="time">
浜ゅ嵎鏃堕棿: {{ item.submitTime }}
</div>
@@ -23,10 +25,10 @@
鎬诲垎: {{ item.totalScore }}
</div>
<div class="bottom-item">
- 棰樻暟: {{ item.questionCount}}
+ 棰樻暟: {{ item.questionCount }}
</div>
<div class="bottom-item">
- 绛旈鏃堕棿: {{item.doTime / 60 }}鍒嗛挓
+ 绛旈鏃堕棿: {{ item.doTime / 60 }}鍒嗛挓
</div>
</div>
@@ -37,7 +39,7 @@
</div>
<div class="right-container">
<div class="button-container">
- <el-button type="primary" size="large" @click="checkExam">鏌ョ湅璇曞嵎</el-button>
+ <el-button type="primary" size="large" @click="checkExam(item)">鏌ョ湅璇曞嵎</el-button>
</div>
</div>
</div>
@@ -48,9 +50,14 @@
</template>
<script setup>
-import {ref} from 'vue';
+import { ref } from 'vue';
import { Timer } from '@element-plus/icons-vue';
-import {useRouter} from 'vue-router';
+import { useRouter } from 'vue-router';
+import { useGradeStore } from '@/store/index.js';
+import { getGradeInfo } from '@/api/modules/grade.js';
+
+const gradeStore = useGradeStore();
+
const router = useRouter();
const props = defineProps({
dataList: {
@@ -58,6 +65,7 @@
default: () => []
}
});
+
const stateList = {
1: {
text: '鏈紑濮�',
@@ -75,8 +83,24 @@
disabled: true
}
};
-const checkExam = () => {
- router.push('/grade');
+const loading = ref(false);
+
+
+const checkExam = (item) => {
+ getGradeInfo(item.id).then((res) => {
+ const {id,examName, score,navbar,titleList} = res.data;
+ gradeStore.setExamInfo({
+ id,
+ examName,
+ score,
+ navbar
+ });
+ gradeStore.setExamDetail(titleList);
+ gradeStore.initExam();
+ router.push('/grade');
+ }).catch(err => {
+
+ });
}
</script>
@@ -86,6 +110,7 @@
width: 100%;
min-height: 120px;
}
+
.bottom-item {
margin-right: 30px;
}
diff --git a/src/views/grade/components/answer-grade/index.vue b/src/views/grade/components/answer-grade/index.vue
index c5ddc58..15a9306 100644
--- a/src/views/grade/components/answer-grade/index.vue
+++ b/src/views/grade/components/answer-grade/index.vue
@@ -2,7 +2,7 @@
<div class="grade-container flex justify-center text-white items-center shadow-md">
<el-icon class="mr-1 text-xl" size="24"><Document /></el-icon>
<div class="label mr-1">鑰冭瘯鎴愮哗:</div>
- <div class="grade font-bold text-3xl text-red-600">{{ examInfo.examGrade }}</div>
+ <div class="grade font-bold text-3xl text-red-600">{{ examInfo.score }}</div>
</div>
</template>
--
Gitblit v1.8.0