Skip to content

Commit 388f927

Browse files
author
pig
committed
查询所有试题
1 parent 70b3785 commit 388f927

22 files changed

+311
-7
lines changed

exam/src/components/student/answer.vue

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@
9090
<el-radio :label="4">{{showAnswer.answerD}}</el-radio>
9191
</el-radio-group>
9292
<div class="analysis" v-if="isPractice">
93-
<span>正确姿势:</span><span class="right">{{reduceAnswer.right}}</span>
93+
<ul>
94+
<li> <el-tag type="success">正确姿势:</el-tag><span class="right">{{reduceAnswer.right}}</span></li>
95+
<li><el-tag>题目解析:</el-tag></li>
96+
<li>{{reduceAnswer.analysis == null ? '暂无解析': reduceAnswer.analysis}}</li>
97+
</ul>
9498
</div>
9599
</div>
96100
<div class="fill" v-if="currentType == 2">
@@ -102,7 +106,11 @@
102106
</el-input>
103107
</div>
104108
<div class="analysis" v-if="isPractice">
105-
<span>正确姿势:</span><span class="right">{{topic[2][index].answer}}</span>
109+
<ul>
110+
<li> <el-tag type="success">正确姿势:</el-tag><span class="right">{{topic[2][index].answer}}</span></li>
111+
<li><el-tag>题目解析:</el-tag></li>
112+
<li>{{topic[2][index].analysis == null ? '暂无解析': topic[2][index].analysis}}</li>
113+
</ul>
106114
</div>
107115
</div>
108116
<div class="judge" v-if="currentType == 3">
@@ -111,7 +119,11 @@
111119
<el-radio :label="2">错误</el-radio>
112120
</el-radio-group>
113121
<div class="analysis" v-if="isPractice">
114-
<span>正确姿势:</span><span class="right">{{topic[3][index].answer}}</span>
122+
<ul>
123+
<li> <el-tag type="success">正确姿势:</el-tag><span class="right">{{topic[2][index].answer}}</span></li>
124+
<li><el-tag>题目解析:</el-tag></li>
125+
<li>{{topic[3][index].analysis == null ? '暂无解析': topic[3][index].analysis}}</li>
126+
</ul>
115127
</div>
116128
</div>
117129
</div>
@@ -486,6 +498,15 @@ export default {
486498
border: 1px solid #2776df;
487499
padding: 0px 6px;
488500
border-radius: 4px;
501+
margin-left: 20px;
502+
}
503+
ul li:nth-child(2) {
504+
margin: 20px 0px;
505+
}
506+
ul li:nth-child(3) {
507+
padding: 10px;
508+
background-color: #d3c6c9;
509+
border-radius: 4px;
489510
}
490511
}
491512
.analysis span:nth-child(1) {
@@ -503,10 +524,10 @@ export default {
503524
}
504525
.border {
505526
position: relative;
506-
border: 1px solid #6bb851 !important;
527+
border: 1px solid #FF90AA !important;
507528
}
508529
.bg {
509-
background-color: #2776df !important;
530+
background-color: #5188b8 !important;
510531
}
511532
.fill .el-input {
512533
display: inline-flex;
@@ -691,6 +712,7 @@ export default {
691712
}
692713
.left .l-top li:nth-child(3) a {
693714
background-color: #5188b8;
715+
border: none;
694716
}
695717
.left .l-top li:nth-child(4) a {
696718
position: relative;
@@ -717,7 +739,7 @@ export default {
717739
padding: 10px;
718740
border-radius: 50%;
719741
background-color: #fff;
720-
border: 1px solid #6bb851;
742+
border: 1px solid #FF90AA;
721743
}
722744
#answer .top {
723745
background-color: rgb(39, 118, 223);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!-- 题库管理功能介绍 -->
2+
<template>
3+
<section class="description">
4+
<p class="title">题库管理功能介绍</p>
5+
<p class="content">题库表设计和普通数据表设计有所区别。
6+
分为了三张表,分别是选择题题库表,填空题题库表,判断题题库表,
7+
每个表保存相应类型的题库,通过一张中间表,将题库和试题关联起来。
8+
这样就组成了一张完整的试卷。
9+
</p>
10+
</section>
11+
</template>
12+
13+
<style lang="scss" scoped>
14+
.description {
15+
margin-left: 40px;
16+
.title {
17+
font-size: 22px;
18+
font-weight: 400;
19+
color: rgb(31, 47, 61);
20+
}
21+
.content {
22+
width: 600px;
23+
background-color: #FAF5F2;
24+
padding: 16px 32px;
25+
border-radius: 4px;
26+
border-left: 5px solid #FDC8C8;
27+
margin: 20px 0px;
28+
}
29+
}
30+
</style>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
//查询所有题库
2+
<template>
3+
<div class="exam">
4+
<el-table :data="pagination.records" border :row-class-name="tableRowClassName">
5+
<el-table-column fixed="left" prop="subject" label="试卷名称" width="180"></el-table-column>
6+
<el-table-column prop="question" label="题目信息" width="490"></el-table-column>
7+
<el-table-column prop="section" label="所属章节" width="100"></el-table-column>
8+
<el-table-column prop="type" label="题目类型" width="200"></el-table-column>
9+
<el-table-column prop="score" label="试题分数" width="100"></el-table-column>
10+
<el-table-column prop="level" label="难度等级" width="120"></el-table-column>
11+
</el-table>
12+
<el-pagination
13+
@size-change="handleSizeChange"
14+
@current-change="handleCurrentChange"
15+
:current-page="pagination.current"
16+
:page-sizes="[6, 10]"
17+
:page-size="pagination.size"
18+
layout="total, sizes, prev, pager, next, jumper"
19+
:total="pagination.total"
20+
class="page"
21+
></el-pagination>
22+
</div>
23+
</template>
24+
25+
<script>
26+
export default {
27+
data() {
28+
return {
29+
pagination: {
30+
//分页后的考试信息
31+
current: 1, //当前页
32+
total: null, //记录条数
33+
size: 6 //每页条数
34+
}
35+
};
36+
},
37+
created() {
38+
this.getAnswerInfo();
39+
},
40+
methods: {
41+
getAnswerInfo() {
42+
//分页查询所有试卷信息
43+
this.$axios(
44+
`/api/answers/${this.pagination.current}/${this.pagination.size}`
45+
)
46+
.then(res => {
47+
this.pagination = res.data.data;
48+
console.log(res);
49+
})
50+
.catch(error => {});
51+
},
52+
//改变当前记录条数
53+
handleSizeChange(val) {
54+
this.pagination.size = val;
55+
this.getAnswerInfo();
56+
},
57+
//改变当前页码,重新发送请求
58+
handleCurrentChange(val) {
59+
this.pagination.current = val;
60+
this.getAnswerInfo();
61+
},
62+
tableRowClassName({ row, rowIndex }) {
63+
if (rowIndex % 2 == 0) {
64+
return "warning-row";
65+
} else {
66+
return "success-row";
67+
}
68+
}
69+
}
70+
};
71+
</script>
72+
<style lang="scss" scoped>
73+
.exam {
74+
padding: 0px 40px;
75+
.page {
76+
margin-top: 20px;
77+
display: flex;
78+
justify-content: center;
79+
align-items: center;
80+
}
81+
.edit {
82+
margin-left: 20px;
83+
}
84+
.el-table tr {
85+
background-color: #DD5862 !important;
86+
}
87+
}
88+
.el-table .warning-row {
89+
background: #000 !important;
90+
91+
}
92+
93+
.el-table .success-row {
94+
background: #DD5862;
95+
}
96+
97+
</style>

exam/src/router/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ export default new Router({
3232
{
3333
path: '/addExam', //添加考试
3434
component: () => import('@/components/teacher/addExam')
35+
},
36+
{
37+
path: '/answerDescription', //题库管理功能介绍
38+
component: ()=> import('@/components/teacher/answerDescription')
39+
},
40+
{
41+
path: '/selectAnswer', //查询所有题库
42+
component: () => import('@/components/teacher/selectAnswer')
3543
}
3644
]
3745
},

exam/src/vuex/store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const state = {
1717
index: '2',
1818
title: '题库管理',
1919
icon: 'icon-tiku',
20-
content:[{item1:'增加题库',path:'/addAnswer'},{item2:'修改题库',path:'/updateAnswer'},{item3:'删除题库',path:'/delCourse'}],
20+
content:[{item1:'功能介绍',path:'/answerDescription'},{item2:'所有题库',path:'/selectAnswer'},{item3:'增加题库',path:'/addAnswer'}],
2121
},
2222
{
2323
index: '3',
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.exam.controller;
2+
3+
import com.baomidou.mybatisplus.core.metadata.IPage;
4+
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5+
import com.exam.entity.ApiResult;
6+
import com.exam.entity.FillQuestion;
7+
import com.exam.entity.JudgeQuestion;
8+
import com.exam.entity.MultiQuestion;
9+
import com.exam.serviceimpl.AnswerServiceImpl;
10+
import com.exam.serviceimpl.FillQuestionServiceImpl;
11+
import com.exam.serviceimpl.JudgeQuestionServiceImpl;
12+
import com.exam.serviceimpl.MultiQuestionServiceImpl;
13+
import com.exam.util.ApiResultHandler;
14+
import com.exam.vo.AnswerVO;
15+
import org.springframework.beans.factory.annotation.Autowired;
16+
import org.springframework.web.bind.annotation.GetMapping;
17+
import org.springframework.web.bind.annotation.PathVariable;
18+
import org.springframework.web.bind.annotation.RestController;
19+
20+
import java.util.*;
21+
22+
@RestController
23+
public class AnswerController {
24+
25+
@Autowired
26+
private AnswerServiceImpl answerService;
27+
@GetMapping("/answers/{page}/{size}")
28+
public ApiResult findAllQuestion(@PathVariable("page") Integer page, @PathVariable("size") Integer size){
29+
Page<AnswerVO> answerVOPage = new Page<>(page,size);
30+
IPage<AnswerVO> answerVOIPage = answerService.findAll(answerVOPage);
31+
return ApiResultHandler.buildApiResult(200,"查询所有题库",answerVOIPage);
32+
33+
}
34+
}

springboot/src/main/java/com/exam/entity/FillQuestion.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ public class FillQuestion {
1818
private String level;
1919

2020
private String section;
21+
22+
private String analysis; //题目解析
2123
}

springboot/src/main/java/com/exam/entity/JudgeQuestion.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ public class JudgeQuestion {
1919

2020
private Integer score;
2121

22+
private String analysis; //题目解析
2223
}

springboot/src/main/java/com/exam/entity/MultiQuestion.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public class MultiQuestion {
2525

2626
private String right;
2727

28+
private String analysis; //题目解析
29+
2830
private Integer score;
2931

3032
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.exam.mapper;
2+
3+
import com.baomidou.mybatisplus.core.metadata.IPage;
4+
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5+
import com.exam.vo.AnswerVO;
6+
import org.apache.ibatis.annotations.Mapper;
7+
import org.apache.ibatis.annotations.Select;
8+
9+
10+
@Mapper
11+
public interface AnswerMapper {
12+
@Select("select question, subject, score, section,level, \"选择题\" as type from multiQuestion " +
13+
"union select question, subject, score, section,level, \"判断题\" as type from judgeQuestion " +
14+
"union select question, subject, score, section,level, \"填空题\" as type from fillQuestion")
15+
IPage<AnswerVO> findAll(Page page);
16+
}

0 commit comments

Comments
 (0)