Browse Source

feat: 增加题目列表搜索功能

yhd12345 3 years ago
parent
commit
8e2088afc3
1 changed files with 60 additions and 0 deletions
  1. 60 0
      src/views/EvalPage/QuestionList.vue

+ 60 - 0
src/views/EvalPage/QuestionList.vue

@@ -39,6 +39,56 @@
       <el-card class="box-card">
         <span style="font-size: 20px">试题列表</span>
         <el-divider></el-divider>
+        <el-row>
+          <el-col :span="8"></el-col>
+          <el-col :span="8"></el-col>
+          <el-col :span="8">
+            <el-input
+                v-model="stem"
+                class="w-50 m-2"
+                size="small"
+                placeholder="根据题目内容查找"
+                @input="onSearch"
+            >
+              <template #prefix>
+                <el-icon>
+                  <Search />
+                </el-icon>
+              </template>
+            </el-input>
+          </el-col>
+<!--          <el-col :span="8">-->
+
+<!--            <el-input-->
+<!--                v-model="tags"-->
+<!--                class="w-50 m-2"-->
+<!--                placeholder="根据标签查找"-->
+<!--                size="small"-->
+<!--                @input="onSearch"-->
+<!--            >-->
+<!--            <template #prefix>-->
+<!--              <el-icon>-->
+<!--                <Search />-->
+<!--              </el-icon>-->
+<!--            </template>-->
+<!--            </el-input>-->
+<!--          </el-col>-->
+<!--          <el-col :span="8">-->
+<!--            <el-input-->
+<!--                v-model="knowledgeName"-->
+<!--                class="w-50 m-2"-->
+<!--                placeholder="根据关键词查找"-->
+<!--                size="small"-->
+<!--                @input="onSearch"-->
+<!--            >-->
+<!--              <template #prefix>-->
+<!--                <el-icon>-->
+<!--                  <Search />-->
+<!--                </el-icon>-->
+<!--              </template>-->
+<!--            </el-input>-->
+<!--          </el-col>-->
+        </el-row>
         <el-table ref="questionsTable" :data="questions" :row-key="getRowKeys" style="width: 100%"
                   @select="handleSelect" @select-all="handleSelectAll">
           <el-table-column type="selection" align="center" :reserve-selection="true" width="55"/>
@@ -70,6 +120,7 @@
 import markdownText from "@/views/EvalPage/MarkdownText.vue";
 import {toRaw} from "vue";
 import {ElMessage} from "element-plus";
+import * as ELIcons from "@element-plus/icons-vue";
 
 export default {
   name: "QuestionList",
@@ -113,6 +164,9 @@ export default {
   },
   methods: {
     fetchData() {
+      console.log(this.stem);
+      console.log(this.tags);
+      console.log(this.knowledgeName);
       this.$apis.getQuestionList(
           {pageSize: this.pageSize, pageNum: this.pageNum},
           this.stem,
@@ -227,6 +281,12 @@ export default {
       this.loading = true;
       this.fetchData();
     },
+
+    onSearch() {
+      this.pageNum=1;
+      this.fetchData();
+    },
+
     onLeave() {
       this.$emit("leave");
     }