Sfoglia il codice sorgente

31:课程选择视频优化

Long 4 giorni fa
parent
commit
857df5480b

+ 46 - 3
src/components/VideoUpload/index.vue

@@ -75,6 +75,26 @@
             @keyup.enter.native="handleLibraryQuery"
           />
         </el-form-item>
+        <el-form-item label="类型">
+          <el-select v-model="libraryQueryParams.typeId" @change="changeCateType" placeholder="请选择素材类型" clearable size="small">
+            <el-option
+              v-for="item in typeOptions"
+              :key="item.dictValue"
+              :label="item.dictLabel"
+              :value="item.dictValue"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="子类型">
+          <el-select v-model="libraryQueryParams.typeSubId" placeholder="请选择素材子类型" clearable size="small">
+            <el-option
+              v-for="item in typeSubOptions"
+              :key="item.dictValue"
+              :label="item.dictLabel"
+              :value="item.dictValue"
+            />
+          </el-select>
+        </el-form-item>
         <el-form-item>
           <el-button type="primary" icon="el-icon-search" size="mini" @click="handleLibraryQuery">搜索</el-button>
           <el-button icon="el-icon-refresh" size="mini" @click="resetLibraryQuery">重置</el-button>
@@ -129,6 +149,7 @@ import { uploadObject } from "@/utils/cos.js";
 import { uploadToOBS } from "@/utils/obs.js";
 import Pagination from "@/components/Pagination";
 import { listVideoResource } from '@/api/course/videoResource';
+import { getCateListByPid, getCatePidList } from '@/api/course/userCourseCategory'
 
 export default {
   components: {
@@ -213,8 +234,12 @@ export default {
       libraryQueryParams: {
         pageNum: 1,
         pageSize: 10,
-        resourceName: null
-      }
+        resourceName: null,
+        typeId: null,
+        typeSubId: null,
+      },
+      typeOptions: [],
+      typeSubOptions: []
     };
   },
   watch: {
@@ -230,9 +255,25 @@ export default {
     // 打开视频库对话框
     openVideoLibrary() {
       this.libraryOpen = true;
+      this.getRootTypeList()
       this.selectedVideo = null;
       this.getLibraryList();
     },
+    getRootTypeList() {
+      getCatePidList().then(response => {
+        this.typeOptions = response.data
+      });
+    },
+    async changeCateType(val) {
+      this.libraryQueryParams.typeSubId = null
+      this.typeSubOptions = []
+      if (!val) {
+        return
+      }
+      await getCateListByPid(val).then(response => {
+        this.typeSubOptions = response.data
+      })
+    },
     handleChange(file, fileList) {
       this.fileList = fileList;
       this.getVideoDuration(file.raw);
@@ -351,7 +392,9 @@ export default {
       this.libraryQueryParams = {
         pageNum: 1,
         pageSize: 10,
-        resourceName: null
+        resourceName: null,
+        typeId: null,
+        typeSubId: null
       };
       this.handleLibraryQuery();
     },

+ 42 - 0
src/views/components/course/userCourseCatalogDetails.vue

@@ -286,6 +286,26 @@
             @keyup.enter.native="resourceList"
           />
         </el-form-item>
+        <el-form-item label="类型">
+          <el-select v-model="addBatchData.queryParams.typeId" @change="changeCateType" placeholder="请选择素材类型" clearable size="small">
+            <el-option
+              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 v-model="addBatchData.queryParams.typeSubId" placeholder="请选择素材子类型" clearable size="small">
+            <el-option
+              v-for="item in addBatchData.typeSubOptions"
+              :key="item.dictValue"
+              :label="item.dictLabel"
+              :value="item.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 +399,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",
@@ -451,7 +472,12 @@ export default {
         queryParams: {
           pageNum: 1,
           pageSize: 10,
+          resourceName: null,
+          typeId: null,
+          typeSubId: null
         },
+        typeOptions: [],
+        typeSubOptions: []
       },
       // 显示搜索条件
       showSearch: true,
@@ -840,11 +866,27 @@ export default {
     },
     openAdds(){
       this.addBatchData.open = true;
+      this.getRootTypeList();
       this.addBatchData.form = {
         courseId: this.courseId,
       };
       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 => {

+ 32 - 4
src/views/course/courseQuestionBank/QuestionBank.vue

@@ -30,15 +30,25 @@
         </el-select>
       </el-form-item>
 		<el-form-item label="题目类别" prop="questionType">
-	    <el-select v-model="queryParams.questionType" placeholder="请选择类别" clearable size="small">
+	    <el-select v-model="queryParams.questionType" placeholder="请选择类别" @change="changeCateType" clearable size="small">
 	      <el-option
-	        v-for="dict in questionTypeOptions"
+	        v-for="dict in questionRootTypeOptions"
 	        :key="dict.dictValue"
 	        :label="dict.dictLabel"
 	        :value="dict.dictValue"
 	      />
 	    </el-select>
 	  </el-form-item>
+      <el-form-item label="题目子类别" prop="questionSubType" label-width="100px">
+        <el-select v-model="queryParams.questionSubType" ref="typeSelect" placeholder="请选择子类别" clearable size="small">
+          <el-option
+            v-for="item in questionSubTypeOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue"
+          />
+        </el-select>
+      </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -188,6 +198,7 @@
 
 <script>
 import { listCourseQuestionBank, getCourseQuestionBank, delCourseQuestionBank, addCourseQuestionBank, updateCourseQuestionBank, exportCourseQuestionBank } from "@/api/course/courseQuestionBank";
+import { getCateListByPid, getCatePidList, listUserCourseCategory } from '@/api/course/userCourseCategory'
 
 export default {
   name: "CourseQuestionBank",
@@ -230,6 +241,8 @@ export default {
       // 题库表格数据
       courseQuestionBankList: [],
 	  questionTypeOptions: [],
+      questionRootTypeOptions: [],
+      questionSubTypeOptions: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
@@ -244,6 +257,7 @@ export default {
         status: null,
         question: null,
 		questionType: null,
+        questionSubType: null,
         answer: null,
       },
       // 表单参数
@@ -270,13 +284,27 @@ export default {
 	this.getDicts("sys_course_question_type").then(response => {
 	  this.questionTypeOptions = response.data;
 	});
-
+    this.getCategoryType()
   },
   methods: {
     getOptionLabel(index) {
       return this.alphabet[index];
     },
-
+    getCategoryType() {
+      getCatePidList().then(response => {
+        this.questionRootTypeOptions = response.data
+      });
+    },
+    changeCateType(val) {
+      this.questionSubTypeOptions = []
+      this.queryParams.questionSubType = null
+      if (!val) {
+        return
+      }
+      getCateListByPid(val).then(response => {
+        this.questionSubTypeOptions = response.data
+      })
+    },
     //选择此课
     chooseQuestion(val){
       this.$emit('questionBankResult',val)