lsc před 9 měsíci
rodič
revize
4d83b1b776
1 změnil soubory, kde provedl 106 přidání a 30 odebrání
  1. 106 30
      src/components/pages/aiAddCourse/addCourse.vue

+ 106 - 30
src/components/pages/aiAddCourse/addCourse.vue

@@ -946,14 +946,13 @@
                 </div>
               </div>
             </div>
-            <div class="whiteBg" style="background: #fff; margin: 0 0 10px;padding: 0 0 15px;"
-              v-if="(!yiKeTemplateArray.includes(templateid))">
+            <div class="whiteBg" style="background: #fff; margin: 0 0 10px;"
+              v-if="(!yiKeTemplateArray.includes(templateid))" :style="{padding: interFindPan ? '0 0 15px' : '0 0 0'}">
               <div style="position: relative;
                             background: #fff;
                             box-sizing: border-box;
-                            padding: 1px 20px 10px;
                             width: 100%;
-                            border-radius: 10px;">
+                            border-radius: 10px;" :style="{padding: interFindPan ? '1px 20px 10px' : '1px 20px 1px'}">
                 <div style="
                               display: flex;
                               flex-direction: row;
@@ -967,23 +966,34 @@
                   <div style="margin-bottom: 10px;width:100%;font-weight:bold" class="lineTitle">
                     检索资料
                     <div class="add_info_box" style="margin: 0 0 0 auto;align-items:center">
-                      <input type="text" placeholder="请输入检索关键词" class="binfo_input" v-model="searchFileName"
-                        style="width: 200px;margin: 0 5px 10px 0;min-height: 36px;box-sizing: border-box;height: 36px;" />
-                      <button class="c_pub_button_add" @click="startFindMatchingContents">
-                        点击检索资料
-                        <!-- <input type="file" accept=".docx,.doc,.ppt,.pptx,.md,.txt,.pdf" multiple="multiple" style="display: none" v-if="inputShow" @change="
-                          beforeUploadInfo2(
-                            $event,
-                            20
-                          )
-                          " /> -->
-                      </button>
+                      <button class="c_pub_button_confirm" style="margin: 0 0 0 auto;"
+                      @click="interFindPan = !interFindPan,forceUpdate2()">{{ interFindPan ? '折叠' : '展开'}}</button>
                     </div>
                   </div>
                 </div>
-                <div style="display: flex; align-items: center;">
+                <div class="know_serach" v-show="interFindPan">
+                  <div class="know_serach_box">
+                    <span>检索关键词:</span>
+                    <input type="text" placeholder="请输入检索关键词" class="binfo_input" v-model="searchFileName"
+                        style="width: 100%;margin: 0 5px 0 0;min-height: 36px;box-sizing: border-box;height: 36px;" />
+                      <button class="c_pub_button_add" @click="startFindMatchingContents">点击检索资料</button>
+                  </div>
+                  <div class="know_serach_box" v-if="getTypeC(2)">
+                    <span>筛选年级:</span>
+                    <div>{{getTypeC(2)}}</div>
+                  </div>
+                  <div class="know_serach_box" v-if="getTypeC(1)">
+                    <span>筛选学科:</span>
+                    <div>{{getTypeC(1)}}</div>
+                  </div>
+                  <div class="know_serach_box" v-if="findMatchingContentsPage != 1">
+                    <span>筛选项:</span>
+                    <button v-loading="isfindMatchingContents" class="c_pub_button_confirm" style="margin: 0 0 0 0px;" @click="panFind" v-if="findMatchingContentsPage != 1">下一页</button>
+                  </div>
+                </div>
+                <div style="display: flex; align-items: center;" v-show="interFindPan">
                   <div v-loading="knowInfoDataLoading" element-loading-text="小可正在努力生成中,请稍等..."
-                    style="height: 200px; width:100%;">
+                    style="height: 400px; width:100%;">
                     <div class="c_pub_button_confirm stopBtn" v-if="knowInfoDataLoading && isfindMatchingContents"
                       @click="cancelAjax('findMatchingContents')">停止</div>
                     <div class="add_chapters_box add_c_none" style="height: 100%" v-if="
@@ -994,7 +1004,8 @@
                       <span>暂时还没有内容,快去检索吧</span>
                     </div>
                     <div v-else class="add_chapters_box"
-                      style="display: flex; flex-direction: column;height:100%;overflow: auto;" @scroll="panFind">
+                      style="display: flex; flex-direction: column;height:100%;overflow: auto;">
+                      <!-- @scroll="panFind" -->
                       <div class="chapter_upload" v-for="(item1, index1) in knowInfoData3" :key="item1.id" @click="
                             getChapterData(
                               $event,
@@ -1111,7 +1122,7 @@
                       </svg>
                     </button>
                   </div>
-                  <div style="height: 200px; width:100%;">
+                  <div style="height: 400px; width:100%;">
                     <div class="add_chapters_box add_c_none" style="height: 100%" v-if="
                       knowInfoData2 &&
                       knowInfoData2.length == 0
@@ -8080,7 +8091,8 @@ export default {
           value: 4,
         },
       ],
-      appendixLoading: false
+      appendixLoading: false,
+      interFindPan: true,
     };
   },
   directives: {
@@ -8402,6 +8414,32 @@ export default {
         }
       }
     },
+    getTypeC(){
+      return function(index){
+        let sub = []
+        let grade = []
+        if (this.courseTypeId.length) {
+          for (var i = 0; i < this.courseTypeId.length; i++) {
+            let _sid = this.courseTypeId[i]
+            for (var j = 0; j < this.CourseTypeJson['34629907-d02f-11ec-8c78-005056b86db5'].length; j++) {
+              if (_sid == this.CourseTypeJson['34629907-d02f-11ec-8c78-005056b86db5'][j].id) {
+                sub.push(this.CourseTypeJson['34629907-d02f-11ec-8c78-005056b86db5'][j].name)
+              }
+            }
+            for (var j = 0; j < this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'].length; j++) {
+              if (_sid == this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].id) {
+                grade.push(this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].name)
+              }
+            }
+          }
+        }
+        if(index == 1){
+          return sub.join(',')
+        }else if(index == 2){
+          return grade.join(',')
+        }
+      }
+    },
   },
   watch: {
     unitIndex(newValue, oldValue) {
@@ -23772,7 +23810,7 @@ ${(_this.templateid == "4480d65a-1e48-11ef-bee5-005056b86db5" || _this.templatei
           }
           this.isTeacherTaskCancelToken2[_tindex2] = null
           callback ? callback() : ''
-          this.createTeacherAn(_tindex2, 2);
+          // this.createTeacherAn(_tindex2, 2);
           this.saveCourse()
           return;
         } else {
@@ -25558,13 +25596,19 @@ ${msg}
 
     },
     panFind(event) {
+      // if(!this.findMatchingContentsFinish){
+      //   const { scrollTop, clientHeight, scrollHeight } = event.target;
+      //   // 判断是否触底
+      //   if (scrollTop + clientHeight >= scrollHeight - 5 && !this.knowInfoDataLoading) {
+      //     this.findMatchingContentsPage++
+      //     this.findMatchingContents(); // 调用下拉刷新方法
+      //   }
+      // }
       if(!this.findMatchingContentsFinish){
-        const { scrollTop, clientHeight, scrollHeight } = event.target;
-        // 判断是否触底
-        if (scrollTop + clientHeight >= scrollHeight - 5 && !this.knowInfoDataLoading) {
-          this.findMatchingContentsPage++
-          this.findMatchingContents(); // 调用下拉刷新方法
-        }
+        this.findMatchingContentsPage++
+        this.findMatchingContents(); // 调用下拉刷新方法
+      }else{
+        this.$message.error('已获取全部数据')
       }
     },
     startFindMatchingContents(){
@@ -25576,6 +25620,13 @@ ${msg}
         this.$message.error('检索中请稍后')
         return
       }
+      if(this.isfindMatchingContents && this.findMatchingContentsPage < 10){
+        this.isfindMatchingContents.cancel('Request canceled by the user.');
+        this.isfindMatchingContents = null;
+      }else if(this.isfindMatchingContents){
+        this.$message.error('检索中请稍后')
+        return
+      }
       this.findMatchingContentsFinish = false
       this.findMatchingContentsPage = 1
       this.knowInfoData3 = []
@@ -25586,11 +25637,12 @@ ${msg}
         this.$message.error('请输入检索关键词')
         return
       }
-      if(this.knowInfoDataLoading){
+      if(this.isfindMatchingContents){
         this.$message.error('检索中请稍后')
         return
       }
       let sub = []
+      let grade = []
       if (this.courseTypeId.length) {
         for (var i = 0; i < this.courseTypeId.length; i++) {
           let _sid = this.courseTypeId[i]
@@ -25599,17 +25651,25 @@ ${msg}
               sub.push(this.CourseTypeJson['34629907-d02f-11ec-8c78-005056b86db5'][j].name)
             }
           }
+          for (var j = 0; j < this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'].length; j++) {
+            if (_sid == this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].id) {
+              grade.push(this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].name)
+            }
+          }
         }
       }
-      this.knowInfoDataLoading = true
+      if(this.findMatchingContentsPage < 2){
+        this.knowInfoDataLoading = true
+      }
       let params = {
         type: sub.join(","),
         string: this.searchFileName,
+        grade: grade.join(","),
         page: this.findMatchingContentsPage
       };
       let md = new MarkdownIt();
       this.isfindMatchingContents = this.ajax.setCancelSource()
-      this.ajax.get(this.$store.state.api + 'findMatchingContentsPage', params, this.isfindMatchingContents).then(async res => {
+      this.ajax.get(this.$store.state.api + 'findMatchingContentsPage2', params, this.isfindMatchingContents).then(async res => {
         console.log(res)
         this.isfindMatchingContents = null
         this.knowInfoDataLoading = false
@@ -25672,6 +25732,9 @@ ${msg}
           // }
           // console.log(data)
           // this.beforeUploadInfo2(data, 20)
+          if(this.findMatchingContentsPage < 10){
+            this.panFind()
+          }
         }else{
           if(this.findMatchingContentsPage == 1){
             this.$message.error('未检索出内容')
@@ -30631,5 +30694,18 @@ ol {
   margin-left: 5px;
 }
 
+.know_serach_box{
+  margin-bottom: 20px;
+  display: flex;
+  align-items: center;
+}
+
+.know_serach_box > span{
+  min-width: 100px;
+}
+
+.know_serach_box > .c_pub_button_add{
+  min-width: fit-content;
+}
 
 </style>