diff --git a/client/dist/index.html b/client/dist/index.html index 4b77dbf..48785cb 100644 --- a/client/dist/index.html +++ b/client/dist/index.html @@ -1 +1 @@ -vue Admin Template
\ No newline at end of file +vue Admin Template
\ No newline at end of file diff --git a/client/src/api/exam.js b/client/src/api/exam.js index 903ddb3..b574dd7 100644 --- a/client/src/api/exam.js +++ b/client/src/api/exam.js @@ -27,10 +27,11 @@ export function updateQuestioncat(id, data) { //删除题目类型 export function deleteQuestioncat(id) { return request({ - url: `/exam/questioncat/${id}/`, + url: `/exam/question/${id}/`, method: 'delete' }) } + //题目列表 export function getQuestionList(query) { return request({ @@ -69,6 +70,14 @@ export function deleteQuestion(id) { method: 'delete' }) } + //批量删除题目类型 + export function deletesQuestion(data) { + return request({ + url: `/exam/question/deletes/`, + method: 'post', + data + }) + } //导入题目 export function importQuestion(data) { return request({ @@ -82,7 +91,7 @@ export function exportQuestion(data) { return request({ url: `/exam/question/export/`, method: 'get', - params: query + params: data }) } //启用题目 diff --git a/client/src/views/exam/questions.vue b/client/src/views/exam/questions.vue index cb9456a..8181cc6 100644 --- a/client/src/views/exam/questions.vue +++ b/client/src/views/exam/questions.vue @@ -36,7 +36,8 @@ Excel导入 - 导出Excel + 导出Excel + 批量删除 { loading.close() if (response.code == 200) { @@ -235,15 +236,44 @@ export default { // console.error(err); }); }, - exportQuestion() { + exportQuestions() { const loading = this.$loading({ text: '正在准备..' }); + console.log(this.listQuery) exportQuestion(this.listQuery).then(response => { loading.close() window.open(response.data.path, "_blank"); }).catch(e => { loading.close() }); }, + batchDelete() { + if (this.selects.length === 0) { + this.$message({ + message: '请选择要删除的项', + type: 'warning' + }); + return; + }else{ + // 删除前的提示 + this.$confirm("确认删除记录吗?", "提示", { + type: "warning", + }).then(() => { + console.log(this.selects) + this.deleteItems(this.selects); + this.getList()}); + } + }, + deleteItems(ids){ + let item = {ids:ids}; + deletesQuestion(item).then(response => { + if (response.code == 200) { + this.$message.success("删除成功"); + this.getList(); + } else { + this.$message.error(response.msg); + } + }); + }, changeSort(val) { if (val.order == "ascending") { this.listQuery.ordering = val.prop;