|
|
@@ -1,27 +1,17 @@
|
|
|
<template>
|
|
|
- <h1>题库</h1>
|
|
|
+ <h1>题库</h1>
|
|
|
<el-tabs v-model="tabActiveName" @tab-click="handleTabClick" stretch>
|
|
|
<!--APPROVED-->
|
|
|
<el-tab-pane label="APPROVED" name="APPROVED">
|
|
|
<div>
|
|
|
- <el-pagination @size-change="handleSizeChange"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- :current-page="currentPage"
|
|
|
- :page-sizes="[5, 10, 15, 20]"
|
|
|
- :page-size="pageSize"
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total=this.totalNum
|
|
|
- v-if="this.questionList.length !== 0"
|
|
|
- />
|
|
|
- <approved-question-card v-for="(item,index) in questionList"
|
|
|
- :key="item.id"
|
|
|
- :question-v-o="item"
|
|
|
- :total-num="totalNum"
|
|
|
- :cur-num="index+(currentPage-1)*pageSize"
|
|
|
- @update="handleQuestionUpdate(item)"/>
|
|
|
+ <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
|
|
|
+ :page-sizes="[5, 10, 15, 20]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total=this.totalNum v-if="this.questionList.length !== 0" />
|
|
|
+ <approved-question-card v-for="(item, index) in questionList" :key="item.id" :question-v-o="item"
|
|
|
+ :total-num="totalNum" :cur-num="index + (currentPage - 1) * pageSize" @update="handleQuestionUpdate(item)" />
|
|
|
<el-backtop :bottom="50">
|
|
|
<div
|
|
|
- style="height: 100%;width: 100%;background-color: #f2f5f6;box-shadow: 0 0 6px rgba(0,0,0, .12);line-height: 40px;">
|
|
|
+ style="height: 100%;width: 100%;background-color: #f2f5f6;box-shadow: 0 0 6px rgba(0,0,0, .12);line-height: 40px;">
|
|
|
UP
|
|
|
</div>
|
|
|
</el-backtop>
|
|
|
@@ -31,26 +21,16 @@
|
|
|
<!--REFUSED-->
|
|
|
<el-tab-pane label="REFUSED" name="REFUSED">
|
|
|
<div>
|
|
|
- <el-pagination
|
|
|
- @size-change="handleSizeChange"
|
|
|
- @current-change="handleRefusedCurrentChange"
|
|
|
- :current-page="refusedCurrentPage"
|
|
|
- :page-sizes="[5, 10, 15, 20]"
|
|
|
- :page-size="pageSize"
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total=this.refusedTotalNum
|
|
|
- v-if="this.refusedQuestionList.length !== 0"
|
|
|
- />
|
|
|
- <primary-question-card
|
|
|
- v-for="(item,index) in refusedQuestionList"
|
|
|
- :key="item.id"
|
|
|
- :question-v-o="item"
|
|
|
- :total-num="refusedTotalNum"
|
|
|
- :cur-num="index+(refusedCurrentPage-1)*pageSize"
|
|
|
- @update="handleQuestionUpdate(item)"/>
|
|
|
+ <el-pagination @size-change="handleSizeChange" @current-change="handleRefusedCurrentChange"
|
|
|
+ :current-page="refusedCurrentPage" :page-sizes="[5, 10, 15, 20]" :page-size="pageSize"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper" :total=this.refusedTotalNum
|
|
|
+ v-if="this.refusedQuestionList.length !== 0" />
|
|
|
+ <primary-question-card v-for="(item, index) in refusedQuestionList" :key="item.id" :question-v-o="item"
|
|
|
+ :total-num="refusedTotalNum" :cur-num="index + (refusedCurrentPage - 1) * pageSize"
|
|
|
+ @update="handleQuestionUpdate(item)" />
|
|
|
<el-backtop :bottom="50">
|
|
|
<div
|
|
|
- style="height: 100%;width: 100%;background-color: #f2f5f6;box-shadow: 0 0 6px rgba(0,0,0, .12);line-height: 40px;">
|
|
|
+ style="height: 100%;width: 100%;background-color: #f2f5f6;box-shadow: 0 0 6px rgba(0,0,0, .12);line-height: 40px;">
|
|
|
UP
|
|
|
</div>
|
|
|
</el-backtop>
|
|
|
@@ -58,17 +38,10 @@
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
<!--修改框-->
|
|
|
- <el-drawer
|
|
|
- title="更新题目"
|
|
|
- :before-close="handleClose"
|
|
|
- v-model="dialog"
|
|
|
- direction="rtl"
|
|
|
- custom-class="question-drawer"
|
|
|
- ref="drawer"
|
|
|
- size="35%">
|
|
|
- <single-question-creator ref="QuestionUpdater"
|
|
|
- @acknowledge="handleQuestionCreatorAcknowledge"
|
|
|
- :target="creatorTarget"/>
|
|
|
+ <el-drawer title="更新题目" :before-close="handleClose" v-model="dialog" direction="rtl" custom-class="question-drawer"
|
|
|
+ ref="drawer" size="35%">
|
|
|
+ <single-question-creator ref="QuestionUpdater" @acknowledge="handleQuestionCreatorAcknowledge"
|
|
|
+ :target="creatorTarget" />
|
|
|
</el-drawer>
|
|
|
</template>
|
|
|
|
|
|
@@ -107,14 +80,14 @@ export default {
|
|
|
// 挂载时获取第一页题目列表
|
|
|
let states = 'APPROVED';
|
|
|
this.$api.getStateQuestion(states, 0, this.pageSize)
|
|
|
- .then(res => {
|
|
|
- console.log(res);
|
|
|
- this.questionList = res.data.result.content;
|
|
|
- this.totalNum = res.data.result.totalElements;
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- console.log(error);
|
|
|
- })
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.questionList = res.data.result.content;
|
|
|
+ this.totalNum = res.data.result.totalElements;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error);
|
|
|
+ })
|
|
|
},
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
@@ -124,11 +97,11 @@ export default {
|
|
|
|
|
|
handleClose(done) {
|
|
|
this.$confirm('确认关闭?')
|
|
|
- .then(_ => {
|
|
|
- done();
|
|
|
- })
|
|
|
- .catch(_ => {
|
|
|
- });
|
|
|
+ .then(_ => {
|
|
|
+ done();
|
|
|
+ })
|
|
|
+ .catch(_ => {
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
closeDialog() {
|
|
|
@@ -144,26 +117,26 @@ export default {
|
|
|
this.currentPage = val;
|
|
|
let states = 'APPROVED';
|
|
|
this.$api.getStateQuestion(states, val - 1, this.pageSize)
|
|
|
- .then(res => {
|
|
|
- console.log(res);
|
|
|
- this.questionList = res.data.result.content;
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- console.log(error);
|
|
|
- })
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.questionList = res.data.result.content;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error);
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
handleRefusedCurrentChange(val) { // 当点击新的页面时才请求新的数据
|
|
|
this.refusedCurrentPage = val;
|
|
|
let states = 'REFUSED';
|
|
|
this.$api.getStateQuestion(states, val - 1, this.pageSize)
|
|
|
- .then(res => {
|
|
|
- console.log(res);
|
|
|
- this.refusedQuestionList = res.data.result.content;
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- console.log(error);
|
|
|
- })
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.refusedQuestionList = res.data.result.content;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error);
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
handleTabClick(tabItem) {
|
|
|
@@ -171,27 +144,27 @@ export default {
|
|
|
switch (state) {
|
|
|
case "APPROVED":
|
|
|
this.$api.getStateQuestion(state, 0, this.pageSize)
|
|
|
- .then(res => {
|
|
|
- console.log(res);
|
|
|
- this.questionList = res.data.result.content;
|
|
|
- this.totalNum = res.data.result.totalElements;
|
|
|
- this.currentPage = 1;
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- console.log(error);
|
|
|
- });
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.questionList = res.data.result.content;
|
|
|
+ this.totalNum = res.data.result.totalElements;
|
|
|
+ this.currentPage = 1;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
break;
|
|
|
case "REFUSED":
|
|
|
this.$api.getStateQuestion(state, 0, this.pageSize)
|
|
|
- .then(res => {
|
|
|
- console.log(res);
|
|
|
- this.refusedQuestionList = res.data.result.content;
|
|
|
- this.refusedTotalNum = res.data.result.totalElements;
|
|
|
- this.refusedCurrentPage = 1;
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- console.log(error);
|
|
|
- })
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.refusedQuestionList = res.data.result.content;
|
|
|
+ this.refusedTotalNum = res.data.result.totalElements;
|
|
|
+ this.refusedCurrentPage = 1;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error);
|
|
|
+ })
|
|
|
break;
|
|
|
default:
|
|
|
break;
|