|
|
@@ -1,213 +1,136 @@
|
|
|
<template>
|
|
|
- <el-space :fill="true" direction="vertical" class="qr-wrapper">
|
|
|
- <h1>Question Repository</h1>
|
|
|
- <el-space direction="vertical" v-if="!multipleMode">
|
|
|
- <el-button v-if="!searchMode" @click="selectSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
|
|
- <el-space v-else>
|
|
|
- <el-input placeholder="请输入内容" v-model="searchContent" @keydown.enter="clickSearch">
|
|
|
- <template #append>
|
|
|
- <el-button icon="el-icon-search" @click="clickSearch"></el-button>
|
|
|
- </template>
|
|
|
- </el-input>
|
|
|
- <el-button type="danger" size="mini" @click="cancelSearch">取消</el-button>
|
|
|
- </el-space>
|
|
|
- <el-space>
|
|
|
- <el-button icon="el-icon-folder-add" type="success">新建</el-button>
|
|
|
- <el-button @click="clickMulSelect" icon="el-icon-more" type="warning">批量处理</el-button>
|
|
|
- </el-space>
|
|
|
- </el-space>
|
|
|
- <el-space v-else>
|
|
|
- <el-button type="danger" icon="el-icon-delete" @click="clickMulDelete">删除</el-button>
|
|
|
- <el-button @click="multipleMode = !multipleMode" type="info" icon="el-icon-finished">完成
|
|
|
- </el-button>
|
|
|
- </el-space>
|
|
|
- <el-space direction="vertical">
|
|
|
- <el-space>
|
|
|
- <h3>筛选</h3>
|
|
|
- <el-button type="danger" @click="clearFilter" size="mini">清空</el-button>
|
|
|
- </el-space>
|
|
|
- <el-space direction="vertical" alignment="flex-start">
|
|
|
- <qr-filter :title="typeFilter.title" :checkboxOption="typeFilter.option" :checkboxGroup="typeFilter.group"
|
|
|
- @filterChange="handleTypeFilter"/>
|
|
|
- <qr-filter :title="knowledgeFilter.title" :checkboxOption="knowledgeFilter.option"
|
|
|
- :checkboxGroup="knowledgeFilter.group"
|
|
|
- @filterChange="handleKnowledgeFilter"/>
|
|
|
- <qr-filter :title="levelFilter.title" :checkboxOption="levelFilter.option"
|
|
|
- :checkboxGroup="levelFilter.group"
|
|
|
- @filterChange="handleLevelFilter"/>
|
|
|
- <qr-sorter :choice="sorter.default" :direction="sorter.direction" :option="sorter.option"
|
|
|
- @sorterChange="handleSorter" @directionChange="handleSorterDirection"/>
|
|
|
- </el-space>
|
|
|
- </el-space>
|
|
|
- <div class="ql-container">
|
|
|
- <question-list ref="question-list"></question-list>
|
|
|
- </div>
|
|
|
- </el-space>
|
|
|
+ <h1>Question Repository</h1>
|
|
|
+ <el-button @click="createQuestion">新建题目</el-button>
|
|
|
+ <el-button @click="createQuestionByGruop">新建题目组</el-button>
|
|
|
+
|
|
|
+ <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>
|
|
|
+
|
|
|
+
|
|
|
+ <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>
|
|
|
+ </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-drawer
|
|
|
+ title="批量新建题目"
|
|
|
+ :before-close="handleClose"
|
|
|
+ v-model="dialog1"
|
|
|
+ direction="rtl"
|
|
|
+ custom-class="questionGroup-drawer"
|
|
|
+ ref="drawer"
|
|
|
+ size="35%"
|
|
|
+ >
|
|
|
+ <QuestionGroupCreater :dialog="dialog1" @closeDialog="closeDialog1"/>
|
|
|
+
|
|
|
+ </el-drawer>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import QuestionList from "@/components/QuestionItem/ListItem";
|
|
|
-import Filter from "@/components/Filter";
|
|
|
-import Sorter from "@/components/Sorter";
|
|
|
+ import axios from "axios";
|
|
|
+ import QuestionCreater from "../../../card/QuestionCreater.vue";
|
|
|
+ import QuestionGroupCreater from "../../../card/QuestionGroupCreater.vue";
|
|
|
+ import BriefQuestionCard from "../../../card/BriefQuestionCard.vue";
|
|
|
|
|
|
export default {
|
|
|
name: "QuestionRepository",
|
|
|
components: {
|
|
|
- QuestionList,
|
|
|
- "qr-filter": Filter,
|
|
|
- "qr-sorter": Sorter,
|
|
|
+ QuestionCreater,
|
|
|
+ QuestionGroupCreater,
|
|
|
+ BriefQuestionCard,
|
|
|
},
|
|
|
data() {
|
|
|
- return {
|
|
|
- // 点击批量处理,切换多选状态
|
|
|
- multipleMode: false,
|
|
|
- // 点击搜索,切换搜索状态
|
|
|
- searchMode: false,
|
|
|
- searchContent: "",
|
|
|
-
|
|
|
- // 筛选条件
|
|
|
- typeFilter: {
|
|
|
- title: "题型",
|
|
|
- group: [],
|
|
|
- option: [
|
|
|
- {
|
|
|
- label: "选择",
|
|
|
- title: "选择",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "填空",
|
|
|
- title: "填空",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- knowledgeFilter: {
|
|
|
- title: "知识点",
|
|
|
- group: [],
|
|
|
- option: [
|
|
|
- {
|
|
|
- label: "java",
|
|
|
- title: "JAVA",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "python",
|
|
|
- title: "Python",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- levelFilter: {
|
|
|
- title: "难度",
|
|
|
- group: [],
|
|
|
- option: [
|
|
|
- {
|
|
|
- label: "easy",
|
|
|
- title: "简单",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "normal",
|
|
|
- title: "中等",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "hard",
|
|
|
- title: "困难",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- sorter: {
|
|
|
- "default": "index",
|
|
|
- option: [
|
|
|
- {
|
|
|
- label: 'index',
|
|
|
- title: '序号',
|
|
|
- },
|
|
|
- {
|
|
|
- label: 'type',
|
|
|
- title: '题型',
|
|
|
- },
|
|
|
- {
|
|
|
- label: 'level',
|
|
|
- title: '难度',
|
|
|
- },
|
|
|
- ],
|
|
|
- direction: true,
|
|
|
- },
|
|
|
+ return{
|
|
|
+ info: null,
|
|
|
+ questionList: [],
|
|
|
+ dialog:false,
|
|
|
+ dialog1:false,
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 10,
|
|
|
}
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ axios.get("/api/api/question")
|
|
|
+ .then(res => {
|
|
|
+ this.info = res;
|
|
|
+ this.questionList = res.data.content
|
|
|
+ console.log(res);
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error);
|
|
|
+ }).finally(() => {
|
|
|
+ console.log("mounted completed");
|
|
|
+ })
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ },
|
|
|
methods: {
|
|
|
- // 点击批量处理
|
|
|
- clickMulSelect() {
|
|
|
- const _this = this
|
|
|
- _this.multipleMode = !_this.multipleMode
|
|
|
- },
|
|
|
-
|
|
|
- // 批量处理时点击删除
|
|
|
- clickMulDelete() {
|
|
|
- const _this = this
|
|
|
+ createQuestion(){
|
|
|
+ this.dialog = true;
|
|
|
},
|
|
|
-
|
|
|
- // 清空筛选条件
|
|
|
- clearFilter() {
|
|
|
- const _this = this
|
|
|
- _this.knowledgeFilter.group = [];
|
|
|
- _this.levelFilter.group = [];
|
|
|
- _this.typeFilter.group = [];
|
|
|
- },
|
|
|
-
|
|
|
- // 处理排序顺序的筛选
|
|
|
- handleSorterDirection() {
|
|
|
- const _this = this
|
|
|
- _this.sorter.direction = !_this.sorter.direction
|
|
|
- _this.sort(5)
|
|
|
- },
|
|
|
-
|
|
|
- // 处理题型的筛选
|
|
|
- handleTypeFilter() {
|
|
|
- console.log(1)
|
|
|
+ createQuestionByGruop(){
|
|
|
+ this.dialog1 = true;
|
|
|
},
|
|
|
-
|
|
|
- // 处理知识点的筛选
|
|
|
- handleKnowledgeFilter() {
|
|
|
- console.log(2)
|
|
|
+ handleClose(done) {
|
|
|
+ if (this.loading) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$confirm('确定要提交表单吗?')
|
|
|
+ .then(_ => {
|
|
|
+ this.loading = true;
|
|
|
+ this.timer = setTimeout(() => {
|
|
|
+ done();
|
|
|
+ // 动画关闭需要一定的时间
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loading = false;
|
|
|
+ }, 400);
|
|
|
+ }, 2000);
|
|
|
+ })
|
|
|
+ .catch(_ => {});
|
|
|
},
|
|
|
-
|
|
|
- // 处理难度的筛选
|
|
|
- handleLevelFilter() {
|
|
|
- console.log(3)
|
|
|
+ cancelForm() {
|
|
|
+ this.loading = false;
|
|
|
+ this.dialog = false;
|
|
|
+ clearTimeout(this.timer);
|
|
|
},
|
|
|
-
|
|
|
- // 处理排序条件的筛选
|
|
|
- handleSorter() {
|
|
|
- console.log(4)
|
|
|
- const _this = this
|
|
|
- _this.sorter.direction = true
|
|
|
- _this.sort(5)
|
|
|
+ closeDialog(){
|
|
|
+ this.dialog = false;
|
|
|
},
|
|
|
-
|
|
|
- // 对题目列表进行排序
|
|
|
- sort(param) {
|
|
|
- console.log(param)
|
|
|
+ closeDialog1(){
|
|
|
+ this.dialog1 = false;
|
|
|
},
|
|
|
-
|
|
|
- // 点击搜索
|
|
|
- selectSearch() {
|
|
|
- const _this = this
|
|
|
- _this.searchMode = true
|
|
|
+ handleSizeChange(val) {
|
|
|
+ console.log(`每页 ${val} 条`);
|
|
|
+ this.pageSize = val;
|
|
|
},
|
|
|
-
|
|
|
- // 取消搜索
|
|
|
- cancelSearch() {
|
|
|
- const _this = this
|
|
|
- _this.searchMode = false
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ console.log(`当前页: ${val}`);
|
|
|
+ this.currentPage = val;
|
|
|
},
|
|
|
|
|
|
- // 进行关键词搜索
|
|
|
- clickSearch(){
|
|
|
- const _this = this
|
|
|
- if(_this.searchContent === ""){
|
|
|
- alert("请输入关键词");
|
|
|
- }else{
|
|
|
- alert(_this.searchContent);
|
|
|
- }
|
|
|
- },
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
@@ -223,4 +146,8 @@ export default {
|
|
|
overflow: auto;
|
|
|
border: 1px solid black;
|
|
|
}
|
|
|
+
|
|
|
+ .search-result{
|
|
|
+ margin: 20px;
|
|
|
+ }
|
|
|
</style>
|