Browse Source

增加2个搜索栏
①分类 ②子分类

yfh 1 week ago
parent
commit
69ded9ad07
1 changed files with 43 additions and 2 deletions
  1. 43 2
      src/views/components/course/userCourseCatalogDetails.vue

+ 43 - 2
src/views/components/course/userCourseCatalogDetails.vue

@@ -278,14 +278,35 @@
       <!-- 搜索条件 -->
       <el-form :inline="true" :model="addBatchData.queryParams" class="library-search">
         <el-form-item label="素材名称">
-          <el-input
-            v-model="addBatchData.queryParams.resourceName"
+          <el-input style="max-width: 180px"
+                    v-model="addBatchData.queryParams.resourceName"
             placeholder="请输入素材名称"
             clearable
             size="small"
             @keyup.enter.native="resourceList"
           />
         </el-form-item>
+        <el-form-item label="课堂分类">
+          <el-select style="max-width: 180px" v-model="addBatchData.queryParams.typeId" placeholder="请选择" clearable size="small"
+                     @change="getQuerySubCateList(addBatchData.queryParams.typeId)">
+            <el-option
+              v-for="dict in categoryOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="课堂子分类">
+          <el-select style="max-width: 180px" v-model="addBatchData.queryParams.typeSubId" placeholder="请选择" clearable size="small">
+            <el-option
+              v-for="dict in querySubCateOptions"
+              :key="dict.dictValue"
+              :label="dict.dictLabel"
+              :value="dict.dictValue"
+            />
+          </el-select>
+        </el-form-item>
         <el-form-item>
           <el-button type="primary" icon="el-icon-search" size="mini" @click="resourceList">搜索</el-button>
         </el-form-item>
@@ -379,6 +400,7 @@ import VideoUpload from "@/components/VideoUpload/index.vue";
 import { listVideoResource } from '@/api/course/videoResource';
 import {getByIds} from "@/api/course/courseQuestionBank";
 import CourseWatchComment from "./courseWatchComment.vue";
+import {getCateListByPid, getCatePidList} from "@/api/course/userCourseCategory";
 
 export default {
     name: "userCourseCatalog",
@@ -387,6 +409,8 @@ export default {
       return {
         duration: null,
         packageList:[],
+        querySubCateOptions: [],
+        categoryOptions: [],
         //课题
         package:{
           title:'',
@@ -491,11 +515,26 @@ export default {
       }
     },
     created() {
+      getCatePidList().then(response => {
+        this.categoryOptions = response.data;
+      });
+
       this.getDicts("sys_course_temp_type").then(response => {
         this.typeOptions = response.data;
       });
     },
     methods: {
+      getQuerySubCateList(pid) {
+        this.addBatchData.queryParams.typeSubId = null;
+        if (pid == '') {
+          this.querySubCateOptions = [];
+          return
+        }
+        this.addBatchData.queryParams.typeSubId = null;
+        getCateListByPid(pid).then(response => {
+          this.querySubCateOptions = response.data;
+        });
+      },
       getPickerOptions() {
         const durationInMinutes = Math.floor(this.form.duration / 60); // 将秒转换为分钟
         const endHour  = Math.floor(durationInMinutes / 60); // 起始小时
@@ -850,6 +889,8 @@ export default {
         this.addBatchData.form = {
           courseId: this.courseId,
         };
+        this.addBatchData.queryParams.typeId = null;
+        this.addBatchData.queryParams.typeSubId = null;
         this.resourceList();
       },
       resourceList(){