lsc 4 月之前
父节点
当前提交
6730ce3ef3
共有 1 个文件被更改,包括 154 次插入20 次删除
  1. 154 20
      src/components/pages/aiAddCourse/addCourse.vue

+ 154 - 20
src/components/pages/aiAddCourse/addCourse.vue

@@ -988,22 +988,32 @@
                   </div>
                   <div class="know_serach_box" v-if="findMatchingContentsPage != 1">
                     <span>筛选项:</span>
+                    <el-select v-model="knowFileType" placeholder="请选择类型" @change="forceUpdate()" style="width: 125px;margin-right: 10px;" clearable>
+                      <el-option v-for="(e, eIndex) in knowFileTypeArray" :key="eIndex" :label="e" :value="e">
+                      </el-option>
+                    </el-select>
                     <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: 400px; width:100%;">
-                    <div class="c_pub_button_confirm stopBtn" v-if="knowInfoDataLoading && isfindMatchingContents"
-                      @click="cancelAjax('findMatchingContents')">停止</div>
+                    <div v-loading="knowInfoDataLoading" element-loading-text="小可正在努力生成中,请稍等..."
+                      style="height: 400px; width:100%;">
+                      <div class="c_pub_button_confirm stopBtn" v-if="knowInfoDataLoading && isfindMatchingContents"
+                        @click="cancelAjax('findMatchingContents')">停止</div>
+                    <div class="add_chapters_check_box" v-if="allknowInfoData3() && allknowInfoData3().length">
+                      <div class="add_chapters_check" @click="checkAllKnowInfoData3()">
+                        <div class="chapter_upload_check" :class="{ checked: panknowInfoData3CheckAll() }"></div>
+                        <div style="margin-left: 5px">全选</div>
+                      </div>
+                    </div>
                     <div class="add_chapters_box add_c_none" style="height: 100%" v-if="
-                    knowInfoData3 &&
-                    knowInfoData3.length == 0
-                  ">
-                      <!-- <img src="../../../assets/icon/new/c_none.png" alt /> -->
-                      <span>暂时还没有内容,快去检索吧</span>
+                      allknowInfoData3() &&
+                      allknowInfoData3().length == 0
+                    ">
+                        <!-- <img src="../../../assets/icon/new/c_none.png" alt /> -->
+                        <span>暂时还没有内容,快去检索吧</span>
                     </div>
-                    <div v-else class="add_chapters_box" style="display: flex; flex-direction: column;height:100%;overflow: auto;padding: 0;">
+                    <div v-else class="add_chapters_box" style="display: flex; flex-direction: column;height:calc(100% - 50px);overflow: auto;padding: 0;">
                       <div class="chapter_upload">
                         <div class="chapter_upload_o" style="position: relative; display: flex; align-items: center; padding: 0 10px;">
                           <div class="chapter_upload_check" style="min-width: 50px; background: unset;text-align: center; font-size: 14px;">选中</div>
@@ -1014,12 +1024,12 @@
                             <div class="chapter_upload_box" style="color: #000">文件名</div>
                           </div>
                           <div class="chapter_upload_type">文件类型</div>
-                          <div class="chapter_upload_ic" style="min-width: 80px;justify-content: center; font-size: 14px;">操作</div>
+                          <div class="chapter_upload_ic" style="width:80px;min-width: 80px;justify-content: center; font-size: 14px;">操作</div>
                         </div>
                       </div>
                       <!-- @scroll="panFind" -->
                       <div class="chapter_upload_box_file">
-                        <div class="chapter_upload" v-for="(item1, index1) in knowInfoData3" :key="item1.id" @click="
+                        <div class="chapter_upload" v-for="(item1, index1) in allknowInfoData3()" :key="item1.id" @click="
                               getChapterData(
                                 $event,
                                 index1,
@@ -1075,7 +1085,7 @@
                             <div class="chapter_upload_type">
                               {{ getFileType(item1.name) }}
                             </div>
-                            <div class="chapter_upload_ic" style="min-width: 80px;justify-content: center;">
+                            <div class="chapter_upload_ic" style="width:80px;min-width: 80px;justify-content: center;margin:0 10px 0px auto;">
                               <div class="chapter_upload_noSee" v-if="item1.type == 12"></div>
                               <div class="chapter_upload_ic_check" style="margin: 0" v-if="item1.type == 3" @click.stop="
                               checkChpater3($event, index1, item1)
@@ -1107,7 +1117,20 @@
                       </svg>
                     </button>
                   </div>
-                  <div style="height: 400px; width:100%;">
+                  <div style="height: 400px; width:100%;position: relative;">
+                    <div class="add_chapters_check_box" v-if="knowInfoData2 && knowInfoData2.length">
+                      <div class="add_chapters_check" @click="checkAllKnowInfoData2()" v-if="knowInfoData2 && knowInfoData2.length">
+                        <div class="chapter_upload_check" :class="{ checked: knowFileids2.length == knowInfoData2.length }"></div>
+                        <div style="margin-left: 5px">全选</div>
+                      </div>
+                      <button  v-if="knowFileids2.length" class="c_pub_button_confirm" style="margin: 0 0 0 10px;" @click="deleteCheckAllKnowInfoData2()">删除</button>
+
+                      <button class="c_pub_button_add pub_btn_add_img" @click="addImg($event)"  style="margin: 0 0 0 auto;">
+                        上传知识库
+                        <input type="file" accept=".docx,.doc,.ppt,.pptx,.md,.txt,.pdf" multiple="multiple"
+                          style="display: none" v-if="inputShow" @change="beforeUploadInfo2($event, 20)" />
+                      </button>
+                    </div>
                     <div class="add_chapters_box add_c_none" style="height: 100%" v-if="
                       knowInfoData2 &&
                       knowInfoData2.length == 0
@@ -1115,7 +1138,7 @@
                       <!-- <img src="../../../assets/icon/new/c_none.png" alt /> -->
                       <span>暂时还没有内容,快去添加吧</span>
                     </div>
-                    <div v-else class="add_chapters_box" style="display: flex; flex-direction: column;height:100%;overflow: auto;padding: 0;" ref="rightKnow">
+                    <div v-else class="add_chapters_box" style="display: flex; flex-direction: column;height:calc(100% - 50px);overflow: auto;padding: 0;" ref="rightKnow">
                       <div class="chapter_upload">
                         <div class="chapter_upload_o" style="position: relative; display: flex; align-items: center; padding: 0 10px;">
                           <div class="chapter_upload_check" style="min-width: 50px; background: unset;text-align: center; font-size: 14px;">选中</div>
@@ -1126,7 +1149,7 @@
                             <div class="chapter_upload_box" style="color: #000">文件名</div>
                           </div>
                           <div class="chapter_upload_type">文件类型</div>
-                          <div class="chapter_upload_ic" style="min-width: 80px;justify-content: center; font-size: 14px;">操作</div>
+                          <div class="chapter_upload_ic" style="width:80px;min-width: 80px;justify-content: center; font-size: 14px;">操作</div>
                         </div>
                       </div>
                       <div class="chapter_upload_box_file">
@@ -1186,7 +1209,7 @@
                             <div class="chapter_upload_type">
                               {{ getFileType(item1.name) }}
                             </div>
-                            <div class="chapter_upload_ic" style="min-width: 80px;justify-content: center;">
+                            <div class="chapter_upload_ic" style="width:80px;min-width: 80px;justify-content: center;margin:0 10px 0px auto;">
                               <div class="chapter_upload_noSee" v-if="item1.type == 12"></div>
                               <div class="chapter_upload_ic_check" v-if="item1.type == 3" @click.stop="
                                 checkChpater3($event, index1, item1)
@@ -1207,9 +1230,27 @@
                       </div>
                       
                     </div>
+                    <div v-if="
+                  knowinfoproVisible2
+                " class="mask">
+                  <div class="progressBox">
+                    <div class="lbox">
+                      <img src="../../../assets/loading.gif" />上传中,请稍后
+                    </div>
+                    <div style="margin-bottom: 10px">
+                      <span>{{
+                        knowinfoisFinishSize2
+                        }}</span>
+                      /
+                      <span>{{
+                        knowinfoisAllSize2
+                        }}</span>
+                    </div>
                   </div>
                 </div>
-                <div v-if="
+                  </div>
+                </div>
+                <!-- <div v-if="
                   knowinfoproVisible2
                 " class="mask">
                   <div class="progressBox">
@@ -1226,7 +1267,7 @@
                         }}</span>
                     </div>
                   </div>
-                </div>
+                </div> -->
               </div>
             </div>
             <div class="whiteBg" style="background: #fff; margin: 0 0 10px;padding: 0 0 15px;"
@@ -8064,6 +8105,8 @@ export default {
       ],
       appendixLoading: false,
       interFindPan: true,
+      knowFileType: "",
+      knowFileTypeArray: ['作业', '教案', '其他'],
     };
   },
   directives: {
@@ -8413,7 +8456,7 @@ export default {
     },
     getFileType(){
       return function (name) {
-        let fileType = ['作业', '教案'];
+        let fileType = this.knowFileTypeArray;
         
         for (let type of fileType) {
           if (converter(name).includes(type)) {
@@ -8424,6 +8467,38 @@ export default {
         return '其他';
       };
     },
+    allknowInfoData3(){
+      return function () {
+        let knowInfoData = this.knowInfoData3;
+        if(this.knowFileType){
+          if(converter(this.knowFileType) == '其他'){
+            let fileType = this.knowFileTypeArray.filter(item => item != '其他');
+            knowInfoData = knowInfoData.filter(item => {
+              return !fileType.some(type => converter(item.name).includes(type));
+            });
+          }else{
+            knowInfoData = knowInfoData.filter(item => converter(item.name).includes(this.knowFileType))
+          }
+        }
+        return knowInfoData;
+      };
+    },
+    panknowInfoData3CheckAll(){
+      return function(){
+        let files = this.allknowInfoData3();
+        let count = 0
+        for(var i = 0; i < files.length; i++){
+          if(this.knowFileids3.includes(files[i].url)){
+            count++
+          }
+        }
+        if (count == files.length) {
+          return true
+        }else {
+          false
+        }
+      }
+    },
   },
   watch: {
     unitIndex(newValue, oldValue) {
@@ -12386,6 +12461,52 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
         this.knowFileids3.splice(this.knowFileids3.indexOf(fileid), 1)
       }
     },
+    checkAllKnowInfoData3(){
+      // let array = this.knowInfoData3;
+      // if(this.knowFileids3.length === array.length){
+      //   this.knowFileids3 = []; // 取消全选
+      // } else {
+      //   this.knowFileids3 = array.map(item => item.url); // 全选
+      // }
+
+      let files = this.allknowInfoData3();
+      let count = 0
+      for(var i = 0; i < files.length; i++){
+        if(this.knowFileids3.includes(files[i].url)){
+          count++
+        }
+      }
+      if (count == files.length) {
+        this.knowFileids3 = this.knowFileids3.filter(url => !files.some(file => file.url === url)); // 取消全选只取消当前文件
+      } else {
+        this.knowFileids3 = [...new Set([...this.knowFileids3, ...files.map(file => file.url)])]; // 全选并添加新文件
+      }
+    },
+    checkAllKnowInfoData2(){
+      let array = this.knowInfoData2;
+      if(this.knowFileids2.length === array.length){
+        this.knowFileids2 = []; // 取消全选
+      } else {
+        this.knowFileids2 = array.map(item => item.fileid); // 全选
+      }
+    },
+    deleteCheckAllKnowInfoData2(){
+      let _this = this;
+      _this
+        .$confirm("确定删除所选文件么?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+        .then(() => {
+          _this.knowInfoData2 = _this.knowInfoData2.filter(item => !_this.knowFileids2.includes(item.fileid))
+          _this.knowFileids2 = []
+          _this.$forceUpdate()
+        })
+        .catch(() => {
+          return;
+        });
+    },
     checkAppendixFile(url){
       if(this.appendixFiles.indexOf(url) == -1){
         this.appendixFiles.push(url)
@@ -27046,6 +27167,7 @@ ${msg}
 }
 
 .chapter_upload_type{
+  width: 80px;
   min-width: 80px;
   text-align: center;
   font-size: 14px;
@@ -30705,4 +30827,16 @@ ol {
   min-width: fit-content;
 }
 
+
+.add_chapters_check_box{
+  display: flex;
+  align-items: center;
+  height: 50px;
+}
+
+.add_chapters_check{
+  display: flex;
+  align-items: center;
+  cursor: pointer;
+}
 </style>