|
|
@@ -1,155 +1,210 @@
|
|
|
<template>
|
|
|
- <h1>Question Repository</h1>
|
|
|
-
|
|
|
- <div>
|
|
|
- <el-button>新建题目</el-button>
|
|
|
- <el-button @click="createQuestion">新建题目组</el-button>
|
|
|
- </div>
|
|
|
-
|
|
|
- <el-divider/>
|
|
|
-
|
|
|
- <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"
|
|
|
- />
|
|
|
- <primary-question-card v-for="(item,index) in questionList"
|
|
|
- :key="item.id"
|
|
|
- :question-v-o="item"
|
|
|
- :total-num="totalNum"
|
|
|
- :cur-num="index+(currentPage-1)*pageSize"/>
|
|
|
-
|
|
|
- <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;">
|
|
|
- UP
|
|
|
+ <h1>题库</h1>
|
|
|
+ <el-tabs v-model="tabActiveName" @tab-click="handleTabClick" stretch>
|
|
|
+ <!--APPROVED-->
|
|
|
+ <el-tab-pane label="APPROVED" name="APPROVED">
|
|
|
+<!-- <div>-->
|
|
|
+<!-- <el-button>新建题目</el-button>-->
|
|
|
+<!-- <el-button @click="createQuestion">新建题目组</el-button>-->
|
|
|
+<!-- </div>-->
|
|
|
+<!-- <el-divider/>-->
|
|
|
+ <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"
|
|
|
+ />
|
|
|
+ <primary-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;">
|
|
|
+ UP
|
|
|
+ </div>
|
|
|
+ </el-backtop>
|
|
|
</div>
|
|
|
- </el-backtop>
|
|
|
- </div>
|
|
|
-
|
|
|
- <el-drawer
|
|
|
- title="新建题目"
|
|
|
- :before-close="handleClose"
|
|
|
- v-model="dialog"
|
|
|
- direction="rtl"
|
|
|
- custom-class="question-drawer"
|
|
|
- ref="drawer"
|
|
|
- size="35%"
|
|
|
- >
|
|
|
- <QuestionCreater :dialog="dialog" @closeDialog="closeDialog"/>
|
|
|
- </el-drawer>
|
|
|
-
|
|
|
+ </el-tab-pane>
|
|
|
+ <!--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-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;">
|
|
|
+ UP
|
|
|
+ </div>
|
|
|
+ </el-backtop>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ <!--修改框-->
|
|
|
<el-drawer
|
|
|
- title="批量新建题目"
|
|
|
- :before-close="handleClose"
|
|
|
- v-model="dialog1"
|
|
|
- direction="rtl"
|
|
|
- custom-class="questionGroup-drawer"
|
|
|
- ref="drawer"
|
|
|
- size="35%"
|
|
|
- >
|
|
|
- <QuestionGroupCreater :dialog="dialog1" @closeDialog="closeDialog1"/>
|
|
|
+ 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>
|
|
|
|
|
|
<script>
|
|
|
-import QuestionGroupCreater from "../../../components/QuestionGroupCreater.vue";
|
|
|
-import QuestionCreater from "@/components/QuestionCreater";
|
|
|
-import BriefQuestionCard from "../../../components/BriefQuestionCard.vue";
|
|
|
import PrimaryQuestionCard from "@/components/QuestionCard/PrimaryQuestionCard";
|
|
|
+import SingleQuestionCreator from "@/components/QuestionCreator/SingleQuestionCreator";
|
|
|
|
|
|
export default {
|
|
|
name: "QuestionRepository",
|
|
|
components: {
|
|
|
- QuestionGroupCreater,
|
|
|
- BriefQuestionCard,
|
|
|
+ SingleQuestionCreator,
|
|
|
PrimaryQuestionCard,
|
|
|
- QuestionCreater
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- info: null,
|
|
|
+ dialog: true,
|
|
|
+ pageSize: 20,
|
|
|
+
|
|
|
questionList: [],
|
|
|
- dialog: false,
|
|
|
- dialog1: false,
|
|
|
currentPage: 1,
|
|
|
- pageSize: 20,
|
|
|
totalNum: 0,
|
|
|
+
|
|
|
+ refusedQuestionList: [],
|
|
|
+ refusedCurrentPage: 1,
|
|
|
+ refusedTotalNum: 0,
|
|
|
+
|
|
|
+ tabActiveName: "APPROVED",
|
|
|
+
|
|
|
+ creatorTarget: "update",
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- // console.log(this.questionList)
|
|
|
-
|
|
|
+ this.dialog = false;
|
|
|
// 挂载时获取第一页题目列表
|
|
|
let states = 'APPROVED';
|
|
|
this.$api.getStateQuestion(states, 0, this.pageSize)
|
|
|
- .then(res => {
|
|
|
- // console.log("QuestionRepository/index");
|
|
|
- // 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: {
|
|
|
- createQuestion() {
|
|
|
- this.dialog = true;
|
|
|
- },
|
|
|
-
|
|
|
- createQuestionByGruop() {
|
|
|
- this.dialog1 = true;
|
|
|
- },
|
|
|
+ // createQuestion() {
|
|
|
+ // this.dialog = true;
|
|
|
+ // },
|
|
|
|
|
|
handleClose(done) {
|
|
|
- // if (this.loading) {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // this.$confirm('确定要提交表单吗?')
|
|
|
- // .then(_ => {
|
|
|
- // this.loading = true;
|
|
|
- // this.timer = setTimeout(() => {
|
|
|
- // done();
|
|
|
- // // 动画关闭需要一定的时间
|
|
|
- // setTimeout(() => {
|
|
|
- // this.loading = false;
|
|
|
- // }, 400);
|
|
|
- // }, 2000);
|
|
|
- // })
|
|
|
- // .catch(_ => {
|
|
|
- // });
|
|
|
+ this.$confirm('确认关闭?')
|
|
|
+ .then(_ => {
|
|
|
+ done();
|
|
|
+ })
|
|
|
+ .catch(_ => {
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
closeDialog() {
|
|
|
this.dialog = false;
|
|
|
},
|
|
|
|
|
|
- closeDialog1() {
|
|
|
- this.dialog1 = false;
|
|
|
- },
|
|
|
-
|
|
|
handleSizeChange(val) {
|
|
|
// console.log(`QuestionRepository/index-handleSizeChange 每页 ${val} 条`);
|
|
|
this.pageSize = val;
|
|
|
},
|
|
|
|
|
|
handleCurrentChange(val) { // 当点击新的页面时才请求新的数据
|
|
|
- // console.log(`QuestionRepository/index-handleCurrentChange 当前页: ${val}`);
|
|
|
this.currentPage = val;
|
|
|
let states = 'APPROVED';
|
|
|
this.$api.getStateQuestion(states, val - 1, this.pageSize)
|
|
|
- .then(res => {
|
|
|
- // console.log("handleCurrentChange-result");
|
|
|
- // 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.currentPage = val;
|
|
|
+ let states = 'REFUSED';
|
|
|
+ this.$api.getStateQuestion(states, val - 1, this.pageSize)
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.questionList = res.data.result.content;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error);
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ handleTabClick(tabItem) {
|
|
|
+ let state = tabItem.props.label;
|
|
|
+ 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);
|
|
|
+ });
|
|
|
+ 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);
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ handleQuestionUpdate(item) {
|
|
|
+ this.dialog = true;
|
|
|
+ this.$refs.QuestionUpdater.setForm(item);
|
|
|
+ },
|
|
|
+
|
|
|
+ handleQuestionCreatorAcknowledge() {
|
|
|
+ this.dialog = false;
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
@@ -162,9 +217,10 @@ export default {
|
|
|
|
|
|
.el-drawer {
|
|
|
overflow-y: auto;
|
|
|
+ padding: 0 20px;
|
|
|
}
|
|
|
|
|
|
-.el-dialog{
|
|
|
+.el-dialog {
|
|
|
margin: auto auto 15vh;
|
|
|
}
|
|
|
</style>
|