Leonezhurui il y a 5 ans
Parent
commit
87ebca58e7

+ 247 - 0
OriginIndex.vue

@@ -0,0 +1,247 @@
+<template>
+    <el-space :fill="true" direction="vertical" class="qr-wrapper">
+        <h1>Question Search</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>
+
+            <div class="search-result" v-if="searchMode">
+                <BriefQuestionCard v-for="(item,index) in resultQuestions"
+                                   :questionvo="item" :total-num="resultQuestions.length" :cur-num="index"></BriefQuestionCard>
+            </div>
+
+            <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>
+</template>
+
+<script>
+    import QuestionList from "@/components/QuestionItem/ListItem";
+    import Filter from "@/components/Filter";
+    import Sorter from "@/components/Sorter";
+    import BriefQuestionCard from "../../card/BriefQuestionCard";
+    import axios from "axios";
+
+    export default {
+        name: "Search",
+        components: {
+            QuestionList,
+            "qr-filter": Filter,
+            "qr-sorter": Sorter,
+            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,
+
+                },
+                resultQuestions: [],
+            }
+        },
+        methods: {
+            // 点击批量处理
+            clickMulSelect() {
+                const _this = this
+                _this.multipleMode = !_this.multipleMode
+            },
+
+            // 批量处理时点击删除
+            clickMulDelete() {
+                const _this = this
+            },
+
+            // 清空筛选条件
+            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)
+            },
+
+            // 处理知识点的筛选
+            handleKnowledgeFilter() {
+                console.log(2)
+            },
+
+            // 处理难度的筛选
+            handleLevelFilter() {
+                console.log(3)
+            },
+
+            // 处理排序条件的筛选
+            handleSorter() {
+                console.log(4)
+                const _this = this
+                _this.sorter.direction = true
+                _this.sort(5)
+            },
+
+            // 对题目列表进行排序
+            sort(param) {
+                console.log(param)
+            },
+
+            // 点击搜索
+            selectSearch() {
+                const _this = this
+                _this.searchMode = true
+            },
+
+            // 取消搜索
+            cancelSearch() {
+                const _this = this
+                _this.searchMode = false
+            },
+
+            // 进行关键词搜索
+            clickSearch(){
+                const _this = this
+                if(_this.searchContent === ""){
+                    alert("请输入关键词");
+                }else{
+                    axios.get("/api/api/question", {
+                        params:{
+                            stem: this.searchContent
+                        }}).then(res => {
+                        console.log(res);
+                        this.resultQuestions = res.data.content
+                        this.$notify({
+                            title: '成功',
+                            message: '搜索成功',
+                            type: 'success'
+                        });
+                    }).catch(err => {
+                        console.log(err);
+                        this.$notify.error({
+                            title: '错误',
+                            message: '搜索失败'
+                        });
+                    }).finally(()=>{
+                        console.log("search completed!")
+                    })
+                }
+            },
+        },
+    }
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 0
package.json

@@ -11,6 +11,7 @@
     "axios": "^0.21.1",
     "core-js": "^3.6.5",
     "element-plus": "^1.0.2-beta.70",
+    "marked": "^3.0.2",
     "node-sass": "^4.14.1",
     "typescript": "^4.3.5",
     "vue": "^3.0.0",

+ 28 - 0
src/components/MarkdownText.vue

@@ -0,0 +1,28 @@
+<template>
+    <div v-html="markdownToHTML(trimmedRaw)" class="markdown-content"></div>
+</template>
+
+<script>
+    import {markdownToHTML} from "../utils/markdown";
+    export default {
+        name: "Markdown",
+        props: {
+            raw: String
+        },
+        data() {
+            return {
+                trimmedRaw: ''
+            }
+        },
+        methods: {
+            markdownToHTML
+        },
+        mounted() {
+            this.trimmedRaw = this.raw.trim()
+        }
+    }
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 1
src/components/Sorter.vue

@@ -1,6 +1,6 @@
 <template>
 <el-space>
-  <span>排序</span>
+<!--  <span>排序</span>-->
   <el-radio-group v-model="choice" size="mini" @change="handleSorterChange">
     <el-radio-button v-for="(item, index) in option" :label="item.label">
       {{item.title}}

+ 8 - 8
src/components/bok/SideBar.vue

@@ -9,10 +9,10 @@
         @select="handleSelect"
         @open="handleOpen"
         @close="handleClose">
-<!--      <el-menu-item index="questionSearch">-->
-<!--        <i class="el-icon-search"></i>-->
-<!--        <template #title>搜索</template>-->
-<!--      </el-menu-item>-->
+      <el-menu-item index="questionSearch">
+        <i class="el-icon-search"></i>
+        <template #title>搜索</template>
+      </el-menu-item>
       <el-menu-item index="questionRepository">
         <i class="el-icon-box"></i>
         <template #title>题库</template>
@@ -29,10 +29,10 @@
         <i class="el-icon-document"></i>
         <template #title>试卷袋</template>
       </el-menu-item>
-      <el-menu-item index="collection">
-        <i class="el-icon-collection"></i>
-        <template #title>收藏</template>
-      </el-menu-item>
+<!--      <el-menu-item index="collection">-->
+<!--        <i class="el-icon-collection"></i>-->
+<!--        <template #title>收藏</template>-->
+<!--      </el-menu-item>-->
       <el-menu-item index="setting">
         <i class="el-icon-setting"></i>
         <template #title>设置</template>

+ 6 - 4
src/components/bok/bokMain/Collection.vue

@@ -5,7 +5,7 @@
 
     <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" />
+                         :questionvo="item" :total-num="questionList.length" :cur-num="index+(currentPage-1)*pageSize" />
     </div>
 
 
@@ -14,10 +14,12 @@
               @size-change="handleSizeChange"
               @current-change="handleCurrentChange"
               :current-page="currentPage"
-              :page-sizes="[2, 5, 10, 15, 20]"
+              :page-sizes="[5, 10, 15, 20]"
               :page-size="pageSize"
               layout="total, sizes, prev, pager, next, jumper"
-              :total=this.questionList.length>
+              :total=this.questionList.length
+              v-if="this.questionList.length !== 0"
+      >
       </el-pagination>
     </div>
 
@@ -71,7 +73,7 @@ export default {
       dialog:false,
       dialog1:false,
       currentPage: 1,
-      pageSize: 2,
+      pageSize: 10,
     }
   },
   mounted() {

+ 115 - 188
src/components/bok/bokMain/QuestionRepository/index.vue

@@ -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>

+ 295 - 0
src/components/bok/bokMain/QuestionSearch.vue

@@ -0,0 +1,295 @@
+<template>
+    <el-space :fill="true" direction="vertical" class="qr-wrapper">
+        <h1>Question Search</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-space direction="vertical">
+            <el-space>
+                <h2>筛选</h2>
+                <el-button type="danger" @click="clearFilter" size="mini">清空</el-button>
+            </el-space>
+            <el-space direction="vertical" alignment="flex-start">
+                <p>tags</p>
+                <qr-filter :title="typeFilter.title" :checkboxOption="typeFilter.option"
+                           :checkboxGroup="typeFilter.group"
+                           @filterChange="handleTypeFilter"/>
+                <qr-filter :title="levelFilter.title" :checkboxOption="levelFilter.option"
+                           :checkboxGroup="levelFilter.group"
+                           @filterChange="handleLevelFilter"/>
+                <p>knowledgeId</p>
+                <!--                <qr-filter :title="knowledgeFilter.title" :checkboxOption="knowledgeFilter.option"-->
+                <!--                           :checkboxGroup="knowledgeFilter.group"-->
+                <!--                           @filterChange="handleKnowledgeFilter"/>-->
+            </el-space>
+
+            <el-space direction="vertical">
+                <el-space>
+                    <h2>排序</h2>
+                </el-space>
+                <el-space>
+                    <qr-sorter :choice="sorter.default" :direction="sorter.direction" :option="sorter.option"
+                               @sorterChange="handleSorter" @directionChange="handleSorterDirection"/>
+                </el-space>
+
+            </el-space>
+
+            <el-space>
+                <div class="search-result" v-if="searchMode">
+                    <BriefQuestionCard v-for="(item,index) in resultQuestions"
+                                       :questionvo="item" :total-num="resultQuestions.length" :cur-num="index"></BriefQuestionCard>
+                </div>
+            </el-space>
+
+        </el-space>
+    </el-space>
+</template>
+
+<script>
+    import QuestionList from "@/components/QuestionItem/ListItem";
+    import Filter from "@/components/Filter";
+    import Sorter from "@/components/Sorter";
+    import BriefQuestionCard from "../../card/BriefQuestionCard";
+    import axios from "axios";
+
+    export default {
+        name: "Search",
+        components: {
+            QuestionList,
+            "qr-filter": Filter,
+            "qr-sorter": Sorter,
+            BriefQuestionCard
+        },
+        data() {
+            return {
+                // 点击批量处理,切换多选状态
+                multipleMode: false,
+                // 点击搜索,切换搜索状态
+                searchMode: false,
+                searchContent: "",
+
+                // 筛选条件
+                typeFilter: {
+                    title: "题型",
+                    group: [],
+                    option: [
+                        {
+                            label: "选择",
+                            title: "选择",
+                        },
+                        {
+                            label: "填空",
+                            title: "填空",
+                        },
+                        {
+                            label: "判断",
+                            title: "判断",
+                        },
+                        {
+                            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,
+
+                },
+                resultQuestions: [],
+            }
+        },
+        methods: {
+            // 点击批量处理
+            clickMulSelect() {
+                const _this = this
+                _this.multipleMode = !_this.multipleMode
+            },
+
+            // 批量处理时点击删除
+            clickMulDelete() {
+                const _this = this
+            },
+
+            // 清空筛选条件
+            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)
+            },
+
+            // 处理知识点的筛选
+            handleKnowledgeFilter() {
+                console.log(2)
+            },
+
+            // 处理难度的筛选
+            handleLevelFilter() {
+                console.log(3)
+            },
+
+            // 处理排序条件的筛选
+            handleSorter() {
+                console.log(4)
+                const _this = this
+                _this.sorter.direction = true
+                _this.sort(5)
+            },
+
+            // 对题目列表进行排序
+            sort(param) {
+                console.log(param)
+            },
+
+            // 点击搜索
+            selectSearch() {
+                const _this = this
+                _this.searchMode = true
+            },
+
+            // 取消搜索
+            cancelSearch() {
+                const _this = this
+                _this.searchMode = false
+            },
+
+            // 进行关键词搜索
+            clickSearch(){
+                const _this = this
+                if(_this.searchContent === ""){
+                    alert("请输入关键词");
+                }else{
+                    let typeArray = [];
+                    let levelArray = [];
+                    if('选择' in this.typeFilter.group){
+                        typeArray.push('choice');
+                    } else if('填空' in this.typeFilter.group){
+                        typeArray.push('blank');
+                    } else if('判断' in this.typeFilter.group){
+                        typeArray.push('true_false');
+                    } else if('简答' in this.typeFilter.group){
+                        typeArray.push('short_answer');
+                    } else if('代码' in this.typeFilter.group){
+                        typeArray.push('code');
+                    }
+
+                    if('简单' in this.levelFilter.group){
+                        levelArray.push(1);
+                        levelArray.push(2);
+                    }else if('中等' in this.levelFilter.group){
+                        levelArray.push(3);
+                    }else{
+                        levelArray.push(4);
+                        levelArray.push(5);
+                    }
+
+                    this.requestQuestion(this.searchContent, [], [], [], [])
+
+                }
+            },
+            requestQuestion(stem, ...items){
+                axios.get("/api/api/question", {
+                    params:{
+                        stem: stem,
+                        tags: items[0],
+                        type: items[1],
+                        weights: items[2],
+                        knowledgeId: items[3]
+                    }}).then(res => {
+                    console.log(res);
+                    this.resultQuestions = res.data.content
+                    this.$notify({
+                        title: '成功',
+                        message: '搜索成功',
+                        type: 'success'
+                    });
+                }).catch(err => {
+                    console.log(err);
+                    this.$notify.error({
+                        title: '错误',
+                        message: '搜索失败'
+                    });
+                }).finally(()=>{
+                    console.log("search completed!")
+                })
+
+            }
+        },
+    }
+</script>
+
+<style scoped>
+
+</style>

+ 29 - 18
src/components/card/BriefQuestionCard.vue

@@ -29,7 +29,7 @@
 
         <div class="bQuestion-card-body">
             <div class="bQuestion-card-body-stem">
-                <div>题目: {{questionvo.stem}}</div>
+                <markdown-text :raw="questionvo.stem"></markdown-text>
             </div>
 
             <div class="bQuestion-card-body-options">
@@ -61,7 +61,8 @@
             </div>
 
             <div class="bQuestion-card-body-analysis" v-if="isAll">
-                <div>解析: {{questionvo.analysis}}</div>
+                <span>解析: </span>
+                <MarkdownText :raw="questionvo.analysis"></MarkdownText>
             </div>
         </div>
 
@@ -89,29 +90,32 @@
         </div>
 
     </el-card>
-<!--    <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
+            title="更新题目"
+            :before-close="handleClose"
+            v-model="dialog"
+            direction="rtl"
+            custom-class="question-drawer"
+            ref="drawer"
+            size="35%"
+    >
+        <QuestionUpdater :question="questionvo"/>
 
-<!--    </el-drawer>-->
+    </el-drawer>
 
 
 </template>
 
 <script>
     import axios from "axios";
-    import QuestionCreater from "./QuestionCreater";
+    import QuestionUpdater from "./QuestionUpdater";
+    import MarkdownText from "../MarkdownText";
+
     export default {
         name: "BriefQuestionCard",
         components:{
-            // QuestionCreater
+            QuestionUpdater,
+            MarkdownText
         },
         props: {
             questionvo: {
@@ -135,12 +139,13 @@
             return{
                 isAll: false,
                 dialog: false,
+                // stem: '题目: '+this.questionvo.stem
 
             }
         },
         methods: {
             updateQuestion(){
-                // alert("update!")
+                // alert("update!");
                 this.dialog = true;
 
             },
@@ -168,7 +173,6 @@
                         message: '已取消删除'
                     });
                 });
-                // this.$emit("reclaimQuestionList");
 
             },
             expand(){
@@ -182,7 +186,14 @@
                 }
             },
             handleClose(){
-                this.dialog = false;
+                this.$confirm('此操作将丢失填写信息, 是否继续?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+                    this.dialog = false;
+                })
+
             },
             closeDialog(){
                 this.dialog = false;

+ 0 - 50
src/components/card/ConcreteQuestionCard.vue

@@ -1,50 +0,0 @@
-<template>
-    <el-card class="box-card">
-        <template #header>
-            <div class="card-header">
-                <span>卡片名称</span>
-                <el-button class="button" type="text">操作按钮</el-button>
-            </div>
-        </template>
-        <div v-for="o in 4" :key="o" class="text item">
-            {{'列表内容 ' + o }}
-        </div>
-    </el-card>
-</template>
-
-<script>
-    export default {
-        name: "ConcreteQuestionCard",
-        data(){
-            return {
-                questionId: null,
-            }
-        },
-        mounted() {
-            const _this = this
-            let path = _this.$route.path.split("/")
-            _this.questionId = Number(path[path.length-1])
-        }
-    }
-</script>
-
-<style scoped>
-    .card-header {
-        display: flex;
-        justify-content: space-between;
-        align-items: center;
-    }
-
-    .text {
-        font-size: 14px;
-    }
-
-    .item {
-        margin-bottom: 18px;
-    }
-
-    .box-card {
-        width: 480px;
-    }
-
-</style>

+ 30 - 60
src/components/card/QuestionGroupCreater.vue

@@ -1,27 +1,11 @@
 <template>
 
     <div>
-        <el-select v-model="mode" placeholder="请选择模式">
-            <el-option
-                    v-for="item in options"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value">
-            </el-option>
-        </el-select>
-
         <div class="creator-mode-body">
-            <el-form label="json格式数据" :label-width="formLabelWidth" v-if="mode === 'data'">
-                <el-input
-                        type="textarea"
-                        :rows="3"
-                        placeholder="json数据"
-                        v-model="questionJson">
-                </el-input>
-            </el-form>
-
-            <el-upload v-else-if="mode === 'file'"
+            <el-upload
                        class="upload-demo"
+                       :auto-upload="false"
+                       :on-change="openFile"
                        drag
                        action=""
                        multiple>
@@ -33,17 +17,11 @@
                     </div>
                 </template>
             </el-upload>
-
-            <div v-else>
-                未选择模式
-            </div>
         </div>
 
-
-
         <div class="question-drawer__footer">
             <el-button @click="cancelForm">取 消</el-button>
-            <el-button type="primary" @click="submitQuestions" :loading="loading">{{ loading ? '提交中 ...' : '确 定' }}</el-button>
+            <el-button type="primary" @click="submitQuestions">确 定</el-button>
         </div>
     </div>
 
@@ -59,53 +37,45 @@
         },
         data(){
             return{
-                loading: false,
                 formLabelWidth: '100px',
                 questionJson: null,
-                options: [{
-                    value: 'data',
-                    label: 'json数据'
-                }, {
-                    value: 'file',
-                    label: 'json文件'
-                }],
-                mode: '',
             }
         },
         methods: {
             cancelForm() {
-                this.loading = false;
                 this.$emit("closeDialog")
                 clearTimeout(this.timer);
             },
             submitQuestions(){
-                if(this.mode === 'data'){
-                    let questions = JSON.parse(this.questionJson).questions;
-                    axios.post("/api/api/questions", questions)
-                        .then(res => {
-                            console.log(res);
-                            this.$notify({
-                                title: '成功',
-                                message: '创建成功',
-                                type: 'success'
-                            });
-                        }).catch(err => {
-                        console.log(err);
-                        this.$notify.error({
-                            title: '错误',
-                            message: '创建失败'
+                console.log(JSON.parse(this.questionJson));
+                let questions = JSON.parse(this.questionJson).questions;
+                axios.post("/api/api/questions", questions)
+                    .then(res => {
+                        console.log(res);
+                        this.$notify({
+                            title: '成功',
+                            message: '创建成功',
+                            type: 'success'
                         });
-                    }).finally(() => {
-                        console.log("Question created!");
-                    })
-                }else if(this.mode === 'file'){
-                    alert("file upload!")
-                }else{
-                    alert("无效!")
+                    }).catch(err => {
+                    console.log(err);
+                    this.$notify.error({
+                        title: '错误',
+                        message: '创建失败'
+                    });
+                }).finally(() => {
+                    console.log("Question created!");
+                })
+            },
+            openFile(file, fileList){
+                let reader = new FileReader();
+                reader.readAsText(file.raw);
+                reader.onload = () => {
+                    this.questionJson = reader.result;
+                    console.log(this.questionJson);
                 }
 
-
-            },
+            }
 
         },
         watch: {

+ 210 - 0
src/components/card/QuestionUpdater.vue

@@ -0,0 +1,210 @@
+<template>
+    <div class="question-drawer__content">
+
+        <el-form :model="question">
+            <el-form-item label="题目类型" :label-width="formLabelWidth">
+                <el-select v-model="question.type" placeholder="请选择">
+                    <el-option
+                            v-for="item in options"
+                            :key="item.value"
+                            :label="item.label"
+                            :value="item.value">
+                    </el-option>
+                </el-select>
+            </el-form-item>
+            <el-form-item label="题目题干" :label-width="formLabelWidth">
+                <el-input
+                        type="textarea"
+                        :rows="3"
+                        placeholder="stem"
+                        v-model="question.stem">
+                </el-input>
+            </el-form-item>
+            <el-form-item label="选项和答案" :label-width="formLabelWidth">
+                <div v-if="question.type === 'choice'">
+                    <div class="input-suffix">
+                        <el-row>
+                            <el-col :span="2"><span>A:</span></el-col>
+                            <el-col :span="16">
+                                <el-input
+                                        placeholder="A选项"
+                                        v-model="question.options.A">
+                                </el-input>
+                            </el-col>
+                        </el-row>
+                    </div>
+                    <div class="input-suffix">
+                        <el-row>
+                            <el-col :span="2"><span>B:</span></el-col>
+                            <el-col :span="16">
+                                <el-input
+                                        placeholder="B选项"
+                                        v-model="question.options.B">
+                                </el-input>
+                            </el-col>
+                        </el-row>
+                    </div>
+                    <div class="input-suffix">
+                        <el-row>
+                            <el-col :span="2"><span>C:</span></el-col>
+                            <el-col :span="16">
+                                <el-input
+                                        placeholder="C选项"
+                                        v-model="question.options.C">
+                                </el-input>
+                            </el-col>
+                        </el-row>
+                    </div>
+                    <div class="input-suffix">
+                        <el-row>
+                            <el-col :span="2"><span>D:</span></el-col>
+                            <el-col :span="16">
+                                <el-input
+                                        placeholder="D选项"
+                                        v-model="question.options.D">
+                                </el-input>
+                            </el-col>
+                        </el-row>
+                    </div>
+
+                    <div class="input-suffix-bottom">
+                        <el-row>
+                            <el-col :span="3"><span>Answer:</span></el-col>
+                            <el-col :span="15">
+                                <el-input
+                                        placeholder="Answer"
+                                        v-model="question.answer">
+                                </el-input>
+                            </el-col>
+                        </el-row>
+                    </div>
+                </div>
+                <div v-else-if="question.type === 'blank'">
+                    <p>填空题</p>
+                </div>
+                <div v-else-if="question.type === 'short_answer'">
+                    <p>简答题</p>
+                </div>
+                <div v-else-if="question.type === 'true_false'">
+                    <p>判断题</p>
+                </div>
+                <div v-else-if="question.type === 'code'">
+                    <p>编程题</p>
+                </div>
+                <div v-else>
+                    <p>未选择题目</p>
+                </div>
+            </el-form-item>
+
+            <el-form-item label="解析" :label-width="formLabelWidth">
+                <el-input
+                        type="textarea"
+                        :rows="3"
+                        placeholder="analysis"
+                        v-model="question.analysis">
+                </el-input>
+            </el-form-item>
+
+            <el-form-item label="难度" :label-width="formLabelWidth">
+                <el-select v-model="question.weight" placeholder="请选择">
+                    <el-option
+                            v-for="item in options1"
+                            :key="item.value"
+                            :label="item.label"
+                            :value="item.value">
+                    </el-option>
+                </el-select>
+            </el-form-item>
+
+            <el-form-item label="keyPoints" :label-width="formLabelWidth">
+                <el-input
+                        placeholder="keyPoints"
+                        v-model="question.keyPoints">
+                </el-input>
+            </el-form-item>
+
+            <el-form-item label="tags" :label-width="formLabelWidth">
+                <el-checkbox-group v-model="question.tags">
+                    <el-checkbox v-for="tag in chosenTags" :label="tag" :key="tag"></el-checkbox>
+                </el-checkbox-group>
+            </el-form-item>
+
+            <el-form-item label="knowledgeId" :label-width="formLabelWidth">
+                <el-input
+                        placeholder="keyPoints"
+                        v-model="myknowledgeId">
+                </el-input>
+            </el-form-item>
+
+        </el-form>
+        <div class="question-drawer__footer">
+            <el-button @click="cancelForm">取 消</el-button>
+            <el-button type="primary" @click="submitNewQuestion" :loading="loading">{{ loading ? '提交中 ...' : '确 定' }}</el-button>
+        </div>
+    </div>
+</template>
+
+<script>
+    export default {
+        name: "QuestionUpdater",
+        props: {
+            question: {
+                id: String,
+                type: String,
+                stem: String,
+                options: Map,
+                answer: String,
+                keyPoints: String,
+                analysis: String,
+                tags: Array,
+                knowledgeId: Array,
+                weight: Number,
+                createdTime: Date,
+                lastModifiedTime: Date
+            }
+        },
+        data(){
+            return{
+                formLabelWidth: '100px',
+                options: [{
+                    value: 'choice',
+                    label: '选择题'
+                }, {
+                    value: 'blank',
+                    label: '填空题'
+                }, {
+                    value: 'short_answer',
+                    label: '简答题'
+                }, {
+                    value: 'true_false',
+                    label: '判断题'
+                }, {
+                    value: 'code',
+                    label: '编程题'
+                }],
+                options1: [{
+                    value: '1',
+                    label: '难度1'
+                }, {
+                    value: '2',
+                    label: '难度2'
+                }, {
+                    value: '3',
+                    label: '难度3'
+                }, {
+                    value: '4',
+                    label: '难度4'
+                }, {
+                    value: '5',
+                    label: '难度5'
+                }],
+                chosenTags: ["Java", "软工系列", "Python", "Vue", "SpringBoot"],
+                myknowledgeId: '',
+            }
+        }
+    }
+</script>
+
+<style scoped>
+
+</style>

+ 5 - 0
src/router/index.js

@@ -27,6 +27,11 @@ const routes = [
         name: "QuestionRepository",
         component: () => import("../components/bok/bokMain/QuestionRepository/index"),
       },
+      {
+        path: "questionSearch",
+        name: "QuestionSearch",
+        component: () => import("../components/bok/bokMain/QuestionSearch"),
+      },
       {
         path: "collection",
         name: "Collection",

+ 9 - 0
src/utils/markdown.js

@@ -0,0 +1,9 @@
+import marked from 'marked'
+
+export function markdownToHTML(markdownData = '') {
+    return marked(markdownData, {
+        pedantic: false,
+        breaks: false,
+        gfm: true
+    })
+}