|
|
@@ -2,20 +2,35 @@
|
|
|
<el-container>
|
|
|
<el-header height="220">
|
|
|
<el-row>
|
|
|
- <el-form :inline="true" :model="searchForm" class="demo-form-inline">
|
|
|
- <el-form-item>
|
|
|
- <el-select v-model="searchForm.type" placeholder="查询类型">
|
|
|
- <el-option label="稿件标题" value="1" />
|
|
|
- <el-option label="用户ID" value="2" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-input v-model="searchForm.content" placeholder="" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button size="mini" type="warning" @click="search">查询</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
+ <el-select
|
|
|
+ v-model="queryInfo.subjectId"
|
|
|
+ clearable
|
|
|
+ placeholder="请选择科目"
|
|
|
+ style="margin-left: 5px"
|
|
|
+ @change="subjectChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in allSubject"
|
|
|
+ :key="item.key"
|
|
|
+ :label="item.value"
|
|
|
+ :value="item.key"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-select v-model="queryInfo.type" clearable placeholder="请选择试题类型" @change="typeChange">
|
|
|
+ <el-option
|
|
|
+ v-for="item in allType"
|
|
|
+ :key="item.key"
|
|
|
+ :label="item.value"
|
|
|
+ :value="item.key"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-input
|
|
|
+ v-model="queryInfo.questionContent"
|
|
|
+ placeholder="题目内容"
|
|
|
+ style="margin-left: 5px;width: 220px"
|
|
|
+ prefix-icon="el-icon-search"
|
|
|
+ @blur="getQuestionInfo"
|
|
|
+ />
|
|
|
</el-row>
|
|
|
<el-row style="margin-top: 10px">
|
|
|
<el-button type="plain" icon="el-icon-plus" @click="addExamPaper">添加</el-button>
|
|
|
@@ -121,7 +136,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {getExamPapers, getExams, getPapers} from '@/api/exam'
|
|
|
+import {getExamPapers, getExamQuestionType, getExams, getExamSubjectKV, getPapers} from '@/api/exam'
|
|
|
|
|
|
export default {
|
|
|
name: 'ExamPaper',
|
|
|
@@ -139,6 +154,15 @@ export default {
|
|
|
type: '1',
|
|
|
content: null
|
|
|
},
|
|
|
+ queryInfo: {
|
|
|
+ subjectId: null,
|
|
|
+ type: null,
|
|
|
+ level: null,
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 10
|
|
|
+ },
|
|
|
+ allSubject: [],
|
|
|
+ allType: [],
|
|
|
// 开始考试的提示框
|
|
|
startExamDialog: false,
|
|
|
// 当前选中的考试的信息
|
|
|
@@ -150,6 +174,8 @@ export default {
|
|
|
created() {
|
|
|
document.title = '试卷管理'
|
|
|
this.getData(this.searchForm)
|
|
|
+ this.getSubjects()
|
|
|
+ this.getQuestionTypes()
|
|
|
},
|
|
|
methods: {
|
|
|
handleCurrentChange(pageNumber) {
|
|
|
@@ -184,6 +210,47 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ getQuestionTypes() {
|
|
|
+ getExamQuestionType().then((resp) => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.allType = resp.data
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ title: 'Tips',
|
|
|
+ message: resp.message,
|
|
|
+ type: 'error',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取所有的题库信息
|
|
|
+ getSubjects() {
|
|
|
+ getExamSubjectKV().then((resp) => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.allSubject = resp.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 试题类型变化
|
|
|
+ typeChange(val) {
|
|
|
+ this.queryInfo.type = val
|
|
|
+ this.queryInfo.pageNumber = this.currentPage
|
|
|
+ this.queryInfo.pageSize = this.pageSize
|
|
|
+ this.getQuestionInfo()
|
|
|
+ },
|
|
|
+ // 题库变化
|
|
|
+ subjectChange(val) {
|
|
|
+ this.queryInfo.subjectId = val
|
|
|
+ this.queryInfo.pageNumber = this.currentPage
|
|
|
+ this.queryInfo.pageSize = this.pageSize
|
|
|
+ this.getQuestionInfo()
|
|
|
+ },
|
|
|
+ // 试题名字筛选
|
|
|
+ contentChange() {
|
|
|
+ // 发送查询试题总数的请求
|
|
|
+ this.getQuestionInfo()
|
|
|
+ },
|
|
|
prepareExam(index, row) {
|
|
|
row.password = 12345678
|
|
|
row.type = 1
|