|
|
@@ -1,26 +1,50 @@
|
|
|
<template>
|
|
|
- <h1>Question Repository</h1>
|
|
|
- <el-button @click="createQuestion">新建题目</el-button>
|
|
|
- <el-button @click="createQuestionByGruop">新建题目组</el-button>
|
|
|
+ <div class="index-title">
|
|
|
+ <h1>Question Repository</h1>
|
|
|
+ </div>
|
|
|
|
|
|
- <div class="QuestionBody">
|
|
|
- <BriefQuestionCard v-for="(item,index) in questionList.slice((currentPage-1)*pageSize,currentPage*pageSize)"
|
|
|
- :questionvo="item" :total-num="questionList.length" :cur-num="index+(currentPage-1)*pageSize" />
|
|
|
+ <div class="index-operation">
|
|
|
+ <el-button @click="createQuestion">新建题目</el-button>
|
|
|
+ <el-button @click="createQuestionByGruop">新建题目组</el-button>
|
|
|
</div>
|
|
|
|
|
|
+ <div class="index-body">
|
|
|
+ <div class="el-pagination-body">
|
|
|
+ <el-pagination
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ v-model:current-page="currentPage"
|
|
|
+ :page-sizes="[5, 10, 15, 20]"
|
|
|
+ v-model:page-size="pageSize"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total=this.totalNum
|
|
|
+ v-if="this.questionList.length !== 0"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="QuestionBody">
|
|
|
+ <BriefQuestionCard v-for="(item,index) in questionList"
|
|
|
+ :key="index"
|
|
|
+ :questionvo="item" :total-num="totalNum" :cur-num="index+(currentPage-1)*pageSize" />
|
|
|
+ </div>
|
|
|
|
|
|
- <div class="el-pagination">
|
|
|
- <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.questionList.length
|
|
|
- v-if="this.questionList.length !== 0"
|
|
|
- >
|
|
|
- </el-pagination>
|
|
|
+<!-- <el-backtop target=".index-body" :bottom="100">-->
|
|
|
+<!-- <div-->
|
|
|
+<!-- style="{-->
|
|
|
+<!-- height: 100%;-->
|
|
|
+<!-- width: 100%;-->
|
|
|
+<!-- background-color: #f2f5f6;-->
|
|
|
+<!-- box-shadow: 0 0 6px rgba(0,0,0, .12);-->
|
|
|
+<!-- text-align: center;-->
|
|
|
+<!-- line-height: 40px;-->
|
|
|
+<!-- color: #1989fa;-->
|
|
|
+<!-- }"-->
|
|
|
+<!-- >-->
|
|
|
+<!-- UP-->
|
|
|
+<!-- </div>-->
|
|
|
+<!-- </el-backtop>-->
|
|
|
+ <el-backtop></el-backtop>
|
|
|
</div>
|
|
|
|
|
|
<el-drawer
|
|
|
@@ -70,15 +94,20 @@ export default {
|
|
|
dialog:false,
|
|
|
dialog1:false,
|
|
|
currentPage: 1,
|
|
|
- pageSize: 10,
|
|
|
+ pageSize: 20,
|
|
|
+ totalNum: 0,
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- axios.get("/api/api/question")
|
|
|
+ axios.get("/api/api/pageQuestion", {
|
|
|
+ params:{
|
|
|
+ offset: 0,
|
|
|
+ pageSize: this.pageSize
|
|
|
+ }})
|
|
|
.then(res => {
|
|
|
- this.info = res;
|
|
|
- this.questionList = res.data.content
|
|
|
console.log(res);
|
|
|
+ this.questionList = res.data.content;
|
|
|
+ this.totalNum = res.data.totalElements;
|
|
|
}).catch(error => {
|
|
|
console.log(error);
|
|
|
}).finally(() => {
|
|
|
@@ -129,26 +158,34 @@ export default {
|
|
|
},
|
|
|
handleCurrentChange(val) {
|
|
|
console.log(`当前页: ${val}`);
|
|
|
+ axios.get("/api/api/pageQuestion", {
|
|
|
+ params:{
|
|
|
+ offset: val-1,
|
|
|
+ pageSize: this.pageSize
|
|
|
+ }})
|
|
|
+ .then(res => {
|
|
|
+ this.questionList = res.data.content;
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error);
|
|
|
+ }).finally(() => {
|
|
|
+ console.log("change page completed");
|
|
|
+ });
|
|
|
this.currentPage = val;
|
|
|
},
|
|
|
-
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ // questionList(newval, val){
|
|
|
+ // console.log("Watch changes!");
|
|
|
+ // console.log(newval);
|
|
|
+ // console.log(val);
|
|
|
+ // }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
-.qr-wrapper {
|
|
|
- /*width: 80%;*/
|
|
|
-}
|
|
|
-
|
|
|
-.ql-container {
|
|
|
- height: auto;
|
|
|
- width: auto;
|
|
|
- overflow: auto;
|
|
|
- border: 1px solid black;
|
|
|
-}
|
|
|
-
|
|
|
- .search-result{
|
|
|
- margin: 20px;
|
|
|
+ .el-pagination-body{
|
|
|
+ margin: 20px auto;
|
|
|
}
|
|
|
+
|
|
|
</style>
|