Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/components/course/userCourseCatalogDetails.vue
yfh 2 viikkoa sitten
vanhempi
commit
1090d3ed79
1 muutettua tiedostoa jossa 31 lisäystä ja 35 poistoa
  1. 31 35
      src/views/components/course/userCourseCatalogDetails.vue

+ 31 - 35
src/views/components/course/userCourseCatalogDetails.vue

@@ -280,32 +280,31 @@
       <!-- 搜索条件 -->
       <el-form :inline="true" :model="addBatchData.queryParams" class="library-search">
         <el-form-item label="素材名称">
-          <el-input style="max-width: 180px"
-                    v-model="addBatchData.queryParams.resourceName"
+          <el-input
+            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-form-item label="类型">
+          <el-select v-model="addBatchData.queryParams.typeId" @change="changeCateType" placeholder="请选择素材类型" clearable size="small">
             <el-option
-              v-for="dict in categoryOptions"
-              :key="dict.dictValue"
-              :label="dict.dictLabel"
-              :value="dict.dictValue"
+              v-for="item in addBatchData.typeOptions"
+              :key="item.dictValue"
+              :label="item.dictLabel"
+              :value="item.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-form-item label="子类">
+          <el-select 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"
+              v-for="item in addBatchData.typeSubOptions"
+              :key="item.dictValue"
+              :label="item.dictLabel"
+              :value="item.dictValue"
             />
           </el-select>
         </el-form-item>
@@ -402,7 +401,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";
+import { getCateListByPid, getCatePidList } from '@/api/course/userCourseCategory'
 
 export default {
     name: "userCourseCatalog",
@@ -411,8 +410,6 @@ export default {
       return {
         duration: null,
         packageList:[],
-        querySubCateOptions: [],
-        categoryOptions: [],
         //课题
         package:{
           title:'',
@@ -517,26 +514,11 @@ 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); // 起始小时
@@ -890,13 +872,27 @@ export default {
       },
       openAdds(){
         this.addBatchData.open = true;
+        this.getRootTypeList();
         this.addBatchData.form = {
           courseId: this.courseId,
         };
-        this.addBatchData.queryParams.typeId = null;
-        this.addBatchData.queryParams.typeSubId = null;
         this.resourceList();
       },
+      getRootTypeList() {
+        getCatePidList().then(response => {
+          this.addBatchData.typeOptions = response.data
+        });
+      },
+      async changeCateType(val) {
+        this.addBatchData.queryParams.typeSubId = null
+        this.addBatchData.typeSubOptions = []
+        if (!val) {
+          return
+        }
+        await getCateListByPid(val).then(response => {
+          this.addBatchData.typeSubOptions = response.data
+        })
+      },
       resourceList(){
         this.addBatchData.loading = true;
         listVideoResource(this.addBatchData.queryParams).then(response => {