Browse Source

更换course-detail - index文件

xuqiaoying 3 năm trước cách đây
mục cha
commit
543cfb35ae
1 tập tin đã thay đổi với 202 bổ sung233 xóa
  1. 202 233
      src/pages/course-detail/index.vue

+ 202 - 233
src/pages/course-detail/index.vue

@@ -58,10 +58,7 @@
                 <div class="right-box">
                   <div class="right-box__header">
                     <div class="tabs">
-                      <el-tabs
-                        v-model="courseTabIndex"
-                        @tab-click="handleClick"
-                      >
+                      <el-tabs v-model="courseTabIndex" @tab-click="handleClick">
                         <el-tab-pane
                           :name="tab.name"
                           v-for="(tab, index) in menuTab"
@@ -364,7 +361,6 @@
                                                   </div>
                                               </template>
                                             </template>
-                                            </div>
                                         </div>
                                       </div>
                                     </div>
@@ -1418,9 +1414,7 @@
                                                   items.assignRealname
                                                 }}</span
                                               >
-                                              <span style="color: #ccc">{{
-                                                items.answerText
-                                              }}</span>
+                                              <span style="color:#ccc;">{{ items.answerText }}</span>
                                             </div>
                                             <div class="time">
                                               {{
@@ -2686,25 +2680,22 @@
         </div>
       </div>
       <div v-for="(courseItem, index) in goodsTeacher" :key="index + 'one'">
-        <div class="height_style">
-          <div
-            v-for="(item, index) in courseItem.courseList"
-            :key="index + 'two'"
-          >
-            <div
-              v-if="item.show == 1"
-              class="list_style"
-              :style="
-                index % 2 != 1
-                  ? 'background-color:#F8F8F9;'
-                  : 'background-color:#fff;'
-              "
-              @click="activeFunc(item.courseId)"
-            >
-              <span style="font-weight: bold; font-size: 16px">{{
-                item.courseName
-              }}</span>
-              <!-- <span v-if="courseItem.teaList && courseItem.teaList.length > 0" v-for="(tea, index) in courseItem.teaList" :key="index">
+      <div class="height_style">
+        <div v-for="(item, index) in courseItem.courseList" :key="index + 'two'">
+        <div
+          v-if="item.show == 1"
+          class="list_style"
+          :style="
+            index % 2 != 1
+              ? 'background-color:#F8F8F9;'
+              : 'background-color:#fff;'
+          "
+          @click="activeFunc(item.courseId)"
+        >
+          <span style="font-weight: bold; font-size: 16px">{{
+            item.courseName
+          }}</span>
+          <!-- <span v-if="courseItem.teaList && courseItem.teaList.length > 0" v-for="(tea, index) in courseItem.teaList" :key="index">
             <el-button type="info" round>{{tea.aliasName}}</el-button>
           </span> -->
           <span v-if="courseItem.teaList && courseItem.teaList.length > 0" class="teacher_names">
@@ -2713,6 +2704,8 @@
             </span>
           </span>
         </div>
+        </div>
+      </div>
       </div>
     </el-dialog>
     <div id="printTable"></div>
@@ -3071,7 +3064,7 @@ export default {
       disName: false, // 姓名是否禁止输入
       disCard: false, // 身份证是否禁止输入
       clickSectionItem: {}, // 点击节的内容
-      courseTotal: 0,
+      courseTotal: 0, 
       teaIndex: 0,
       sectionExamList:[],//节试卷集合
       sectionExam:[]//节试卷集合
@@ -3132,7 +3125,7 @@ export default {
     this.orderGoodsId = this.$route.query.orderGoodsId;
     this.gradeId = this.$route.query.gradeId;
     this.sectionItem = this.$route.query;
-    console.log("this.sectionItem", this.sectionItem);
+    console.log('this.sectionItem', this.sectionItem)
     let isOther = this.$route.query.isOther || "";
 
     if (isOther) {
@@ -3267,16 +3260,16 @@ export default {
       this.dialogVisible = true;
     },
     handleClick(tab) {
-      if (tab.name == "3") {
-        this.getAnswerList(); //答疑列表
+      if (tab.name == '3') {
+        this.getAnswerList() //答疑列表
       }
     },
     /**
      * 确定选中
      */
     activeFunc(item, index) {
-      console.log("------", item, index);
-      this.teaIndex = index || 0;
+      console.log('------', item, index)
+      this.teaIndex = index || 0
       this.courseId = item;
       this.courseChange();
       this.dialogVisible = false;
@@ -3338,7 +3331,7 @@ export default {
                 this.playSectionId = res.data.sectionId;
                 this.vid = res.data.recordingUrl;
                 this.sectionItem = res.data;
-                console.log("================sectionItem", this.sectionItem);
+                console.log('================sectionItem', this.sectionItem)
                 this.playVideo(res.data);
               } else if (res.data.sectionType == 2) {
                 //直播
@@ -3551,7 +3544,7 @@ export default {
       if (fileList.length == 1) {
         fileList.splice(0, 1);
       }
-      let res = await this.faceCertificationIDCardOCR(1, file);
+      let res = await this.faceCertificationIDCardOCR(1, file)
 
       if (res.code == 500) {
         this.$message.warning("请上传正确清晰的身份证人像面照片");
@@ -4548,7 +4541,7 @@ export default {
         self.listData.forEach((item) => {
           if (item.fieldKey == "idcard") {
             this.infoForm.idcard = this.userInfo.idCard;
-            this.disCard = this.infoForm.idcard ? true : false;
+            this.disCard = this.infoForm.idcard ? true : false
           }
           if (item.fieldKey == "telphone") {
             this.infoForm.telphone = this.userInfo.telphone;
@@ -4556,7 +4549,7 @@ export default {
 
           if (item.fieldKey == "name") {
             this.infoForm.name = this.userInfo.realname || "";
-            this.disName = this.infoForm.name ? true : false;
+            this.disName = this.infoForm.name ? true : false
           }
         });
         self.isRequired = self.listData.every((ims) => {
@@ -4957,11 +4950,11 @@ export default {
         this.getNoteList(); //获取节笔记
         //更新老师信息
         this.goodsTeacher.forEach((item) => {
-          if (item.courseList.some((x) => x.courseId == this.courseId)) {
-            this.teacherList = item.teaList;
-          }
-        });
-        console.log(this.teacherList, "this.teacherList");
+            if(item.courseList.some(x => x.courseId == this.courseId)){
+              this.teacherList = item.teaList
+            }
+        })
+        console.log(this.teacherList,'this.teacherList');
         resolve();
       });
     },
@@ -5226,21 +5219,21 @@ export default {
     // 新增用户视频学习日志
     studyLog(moduleId, chapterId, sectionId) {
       this.$axios({
-        url: "/user/study/log",
-        method: "post",
+        url: '/user/study/log',
+        method: 'post',
         data: {
           goodsId: this.goodsId,
           courseId: this.courseId,
-          moduleId: moduleId || 0,
-          chapterId: chapterId || 0,
+					moduleId: moduleId || 0,
+					chapterId: chapterId || 0,
           sectionId: sectionId || 0,
           fromPlat: 2, //来源平台 1小程序 2PC网站
           goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
           orderGoodsId: this.orderGoodsId,
-        },
+        }
       }).then((res) => {
-        console.log("直播的用户学习日志:", res);
-      });
+        console.log('直播的用户学习日志:', res)
+      })
     },
     //校验节是否有试卷
     checkSectionList(item){
@@ -5275,11 +5268,7 @@ export default {
       }
       this.clickSectionItem = section
       //逻辑
-      if (
-        section.sectionType === 2 &&
-        section.liveStartTime &&
-        section.liveEndTime
-      ) {
+      if (section.sectionType === 2 && section.liveStartTime && section.liveEndTime) {
         if (section.liveStartTime > this.nowTime) {
           this.$message.warning("直播待开播");
           return;
@@ -5308,7 +5297,7 @@ export default {
 
         if (this.businessData.goodsLearningOrder == 1) {
           if (section.parent.canLearn) {
-            console.log(section.parent, "section.parent");
+            console.log(section.parent,'section.parent')
             let num = await this.bankRecordDoNum(section);
             //有次数限制
             if (section.answerNum - num > 0 && section.answerNum > 0) {
@@ -5350,11 +5339,7 @@ export default {
 
               return;
             }
-            this.studyLog(
-              (section.moduleId = 0),
-              (section.chapterId = 0),
-              section.typeId
-            );
+            this.studyLog(section.moduleId = 0, section.chapterId = 0, section.typeId)
           } else {
             this.$message({
               type: "warning",
@@ -5438,11 +5423,7 @@ export default {
 
               return;
             }
-            this.studyLog(
-              (section.moduleId = 0),
-              (section.chapterId = 0),
-              section.typeId
-            );
+            this.studyLog(section.moduleId = 0, section.chapterId = 0, section.typeId)
           } else {
             this.$message({
               type: "warning",
@@ -5491,11 +5472,7 @@ export default {
 
             return;
           }
-          this.studyLog(
-            (section.moduleId = 0),
-            (section.chapterId = 0),
-            section.typeId
-          );
+          this.studyLog(section.moduleId = 0, section.chapterId = 0, section.typeId)
         }
         return;
       }
@@ -5513,7 +5490,7 @@ export default {
           this.chapterId == (section.chapterId || 0)
         ) {
           //切换为同一频道不作为
-          console.log("切换为同一频道不作为");
+          console.log('切换为同一频道不作为')
           this.clickLock = false;
           return;
         }
@@ -5557,12 +5534,12 @@ export default {
               });
             }
           } else {
-            console.log(section, "sectionsectionsectionsectionsectionsection");
+            console.log(section,"sectionsectionsectionsectionsectionsection")
             //第一章第一节
             this.initVideo(section);
           }
         } else {
-          console.log(section, "sectionsection");
+          console.log(section,"sectionsection")
           this.initVideo(section);
         }
       }
@@ -5706,11 +5683,10 @@ export default {
           .then((res) => {
             console.log(res, "channel");
             resolve(res.data);
-          })
-          .catch((err) => {
+          }).catch(err => {
             this.clickLock = false;
-            this.$message.error(err.msg);
-          });
+            this.$message.error(err.msg)
+          })
       });
     },
     /**
@@ -5732,12 +5708,11 @@ export default {
     },
 
     async playVideo(option) {
-      console.log("asdhsuohfosufgasoug", option);
+      console.log('asdhsuohfosufgasoug', option)
       if (option.sectionType == 3) {
-        console.log("huifang");
+        console.log('huifang')
         // 回放
-        if (Object.keys(this.clickSectionItem).length) {
-          //this.clickSectionItem 判断点击节才跳转, 不判断的话一进来页面到这里就直接跳转了
+        if (Object.keys(this.clickSectionItem).length) { //this.clickSectionItem 判断点击节才跳转, 不判断的话一进来页面到这里就直接跳转了
           this.$router.push({
             path: "/living-room/" + option.liveUrl,
             query: {
@@ -5751,14 +5726,14 @@ export default {
               sectionType: 3,
               goodsName: option.name,
               vid: option.recordingUrl, // 回放vid
-            },
-          });
-          this.clickSectionItem = {};
-          return;
+            }          
+          })
+          this.clickSectionItem = {}
+          return
         }
       }
       if (option.sectionType == 1) {
-        console.log("lubo点击点击点击点击");
+        console.log('lubo点击点击点击点击')
         //录播
 
         //设置播放的节ID
@@ -5796,7 +5771,7 @@ export default {
         setTimeout(() => {
           this.clickLock = false;
         }, 3000);
-        this.studyLog(this.moduleId, this.chapterId, this.playSectionId);
+        this.studyLog(this.moduleId, this.chapterId, this.playSectionId)
         // uni.$emit("levelId", this.levelId);
         // uni.$emit("getSection", this.menuItem);
         // uni.$emit("isRebuild", this.isRebuild);
@@ -6346,7 +6321,7 @@ export default {
       console.log(this);
       console.log(PlayDuration, "PlayDuration");
       let data = {
-        fromPlat: 2, //来源平台 1小程序 2网站
+        fromPlat: 2, //来源平台 1小程序 2网站	
         photo: self.ossAvatarUrl,
         sectionId: parseInt(this.playSectionId),
         goodsId: parseInt(this.goodsId),
@@ -6388,7 +6363,7 @@ export default {
      * 获取重修列表中是否有相同对象
      */
     getSameObj(metaObj) {
-      console.log("看完视频后----", metaObj, this.reMenuList);
+      console.log('看完视频后----', metaObj, this.reMenuList)
       let newObj = false;
       if (this.reMenuList.length) {
         console.log(this.reMenuList, "this.reMenuList");
@@ -6525,19 +6500,19 @@ export default {
             let newArr = res.data.filter((item) => {
               return item.type != 2;
             });
-            if (sectionItem.parent) {
-              sectionItem.parent.canLearn = newArr.every((item) => {
-                if (item.learning == 1) {
-                  return true;
-                } else {
-                  return false;
-                }
-              });
-              res.data.forEach((section) => {
-                section.isRebuild = 1;
-                section.parent = sectionItem.parent;
-              });
-            }
+          if (sectionItem.parent) {
+            sectionItem.parent.canLearn = newArr.every((item) => {
+              if (item.learning == 1) {
+                return true;
+              } else {
+                return false;
+              }
+            });
+            res.data.forEach((section) => {
+              section.isRebuild = 1;
+              section.parent = sectionItem.parent;
+            });
+          }
             this.menuList.forEach((menu) => {
               if (menu.menuId == sectionItem.chapterId) {
                 menu.list = res.data;
@@ -6558,19 +6533,19 @@ export default {
               let newArr = res.data.filter((item) => {
                 return item.type != 2;
               });
-              if (rebuildObj.parent) {
-                rebuildObj.parent.canLearn = newArr.every((item) => {
-                  if (item.learning == 1) {
-                    return true;
-                  } else {
-                    return false;
-                  }
-                });
+            if (rebuildObj.parent) {
+              rebuildObj.parent.canLearn = newArr.every((item) => {
+                if (item.learning == 1) {
+                  return true;
+                } else {
+                  return false;
+                }
+              });
 
-                res.data.forEach((section) => {
-                  section.parent = rebuildObj.parent;
-                });
-              }
+              res.data.forEach((section) => {
+                section.parent = rebuildObj.parent;
+              });
+            }
               this.reMenuList.forEach((menu) => {
                 if (menu.menuId == rebuildObj.chapterId) {
                   menu.list = res.data;
@@ -6625,7 +6600,7 @@ export default {
         }
       } else {
         //第三层节有moduleid和chapterid都有
-        console.log("第三层第三层");
+        console.log('第三层第三层')
         this.$request
           .reSectionList({
             chapterId: sectionItem.chapterId,
@@ -6637,19 +6612,19 @@ export default {
             let newArr = res.data.filter((item) => {
               return item.type != 2;
             });
-            if (sectionItem.parent) {
-              sectionItem.parent.canLearn = newArr.every((item) => {
-                if (item.learning == 1) {
-                  return true;
-                } else {
-                  return false;
-                }
-              });
+          if (sectionItem.parent) {
+            sectionItem.parent.canLearn = newArr.every((item) => {
+              if (item.learning == 1) {
+                return true;
+              } else {
+                return false;
+              }
+            });
 
-              res.data.forEach((section) => {
-                section.parent = sectionItem.parent;
-              });
-            }
+            res.data.forEach((section) => {
+              section.parent = sectionItem.parent;
+            });
+          }
             this.menuList.forEach((menu) => {
               if (menu.list && menu.list.length) {
                 menu.list.forEach((chapter) => {
@@ -6665,7 +6640,8 @@ export default {
                 });
               }
             });
-            console.log("this.menuList", this.menuList);
+            console.log('this.menuList', this.menuList)
+            
           });
 
         if (this.menuTab.length > 1 && rebuildObj) {
@@ -6681,19 +6657,19 @@ export default {
               let newArr = res.data.filter((item) => {
                 return item.type != 2;
               });
-              if (sectionItem.parent) {
-                rebuildObj.parent.canLearn = newArr.every((item) => {
-                  if (item.learning == 1) {
-                    return true;
-                  } else {
-                    return false;
-                  }
-                });
+            if (sectionItem.parent) {
+              rebuildObj.parent.canLearn = newArr.every((item) => {
+                if (item.learning == 1) {
+                  return true;
+                } else {
+                  return false;
+                }
+              });
 
-                res.data.forEach((section) => {
-                  section.parent = rebuildObj.parent;
-                });
-              }
+              res.data.forEach((section) => {
+                section.parent = rebuildObj.parent;
+              });
+            }
               this.reMenuList.forEach((menu) => {
                 if (menu.list && menu.list.length) {
                   menu.list.forEach((chapter) => {
@@ -6701,7 +6677,7 @@ export default {
                       chapter.moduleId == rebuildObj.moduleId &&
                       chapter.chapterId == rebuildObj.chapterId
                     ) {
-                      chapter.learning = res.data[0].learning;
+                      chapter.learning = res.data[0].learning
                       chapter.list = res.data;
                     }
                   });
@@ -6835,7 +6811,7 @@ export default {
       this.$request
         .reMenuList({ courseId: this.courseId, gradeId: this.gradeId })
         .then(async (res) => {
-          console.log("--asfsdgshfduofhdug", res.rows, this.menuList);
+          console.log('--asfsdgshfduofhdug', res.rows, this.menuList)
           for (let i = 0; i < res.rows.length; i++) {
             let item = res.rows[i];
             item.id = item.menuId;
@@ -6846,15 +6822,8 @@ export default {
             item.parent = this.menuList;
           }
           self.menuList = res.rows;
-          console.log(
-            "==============self.menuList===",
-            res.rows,
-            self.menuList
-          );
-          if (
-            (this.sectionItem.recordingUrl || this.sectionItem.liveUrl) &&
-            this.needOpenNew
-          ) {
+          console.log('==============self.menuList===', res.rows, self.menuList)
+          if ((this.sectionItem.recordingUrl||this.sectionItem.liveUrl) && this.needOpenNew) {
             this.needOpenNew = false;
             if (this.sectionItem.sectionType == 1) {  
               console.log("录播",this.sectionItem)
@@ -7173,80 +7142,79 @@ export default {
         this.param.gradeId = this.gradeId;
         this.$request.courseCourseList(this.param).then(async (res) => {
           console.log(res, "resresresres");
-          //获取商品双师资模板
-          this.$request
-            .courseTeacherList({
-              goodsId: this.goodsId,
-            })
-            .then((res1) => {
-              console.log(res1, "res1");
-              if (res1.data && res1.data.length > 0) {
-                //课程老师模板
-                let teacherTel = res1.data;
-                //商品课程
-                let courses = res.rows;
-                teacherTel.forEach((tea) => {
-                  let dataList = [];
-                  let teacherList = [];
-                  courses.forEach((item) => {
-                    if (tea.courseIds.search(item.courseId) > -1) {
-                      dataList.push(item);
-                      teacherList = tea.courseList;
+                      //获取商品双师资模板
+            this.$request.courseTeacherList({
+               goodsId: this.goodsId
+            }).then((res1) => {
+              console.log(res1,'res1');
+              if(res1.data && res1.data.length > 0){
+                  //课程老师模板
+                  let teacherTel = res1.data;
+                  //商品课程
+                  let courses = res.rows;
+                  teacherTel.forEach((tea) => {
+                    let dataList = []
+                    let teacherList = []
+                      courses.forEach((item) => {
+                        let data = tea.courseList.filter(x => x.courseId == item.courseId)
+                        if(data && data.length > 0){
+                          dataList.push(item)
+                          teacherList = tea.courseList
+                        }
+                      })
+                      let result = {
+                        teaList:teacherList,
+                        courseList:dataList
+                      }
+                      this.goodsTeacher.push(result)
+                  })
+                  if(this.goodsTeacher && this.goodsTeacher.length > 0){
+                    let courseIds = []
+                    this.goodsTeacher.forEach((item) => {
+                        item.courseList.forEach((course) => {
+                          courseIds.push(course.courseId)
+                        })
+                    })
+                    if(courseIds.length > 0){
+                      courses.forEach((item) => {
+                          if(!courseIds.includes(item.courseId)){
+                              let data = {
+                                teaList:[],
+                                courseList: []
+                              }
+                              data.courseList.push(item)
+                              this.goodsTeacher.push(data)
+                          }
+                      })
                     }
-                  });
-                  let result = {
-                    teaList: teacherList,
-                    courseList: dataList,
-                  };
-                  this.goodsTeacher.push(result);
-                });
-                if (this.goodsTeacher && this.goodsTeacher.length > 0) {
-                  let courseIds = [];
-                  this.goodsTeacher.forEach((item) => {
-                    item.courseList.forEach((course) => {
-                      courseIds.push(course.courseId);
-                    });
-                  });
-                  if (courseIds.length > 0) {
-                    courses.forEach((item) => {
-                      if (!courseIds.includes(item.courseId)) {
-                        let data = {
-                          teaList: [],
-                          courseList: [],
-                        };
-                        data.courseList.push(item);
-                        this.goodsTeacher.push(data);
+                    this.goodsTeacher.forEach((item) => {
+                      if(item.courseList && item.courseList.length > 0){
+                        item.courseList[0].show = 1
                       }
-                    });
+                    })
                   }
-                  this.goodsTeacher.forEach((item) => {
-                    if (item.courseList && item.courseList.length > 0) {
-                      item.courseList[0].show = 1;
-                    }
-                  });
-                }
-              } else {
+              }else{
                 //没有双师资模板
                 res.rows.forEach((item) => {
-                  item.show = 1;
+                  item.show = 1
                   let data = {
-                    teaList: [],
-                    courseList: [],
-                  };
-                  data.courseList.push(item);
-                  this.goodsTeacher.push(data);
-                });
+                      teaList:[],
+                      courseList: []
+                  }
+                  data.courseList.push(item)
+                  this.goodsTeacher.push(data)
+                }) 
               }
-              console.log(this.goodsTeacher, "this.goodsTeacher");
-              this.goodsTeacher.forEach((item) => {
-                if (item.courseList.some((x) => x.courseId == this.courseId)) {
-                  this.teacherList = item.teaList;
-                }
-              });
-              console.log(this.teacherList, "this.teacherList");
-            });
+              console.log(this.goodsTeacher,'this.goodsTeacher');
+               this.goodsTeacher.forEach((item) => {
+                  if(item.courseList.some(x => x.courseId == this.courseId)){
+                    this.teacherList = item.teaList
+                  }
+               })
+               console.log(this.teacherList,'this.teacherList');
+            }) 
           this.courseList.push(...res.rows);
-          this.courseTotal = res.total;
+          this.courseTotal = res.total
           // console.log('courseTotal::', this.courseTotal)
           if (!this.courseId) {
             this.courseId = this.courseList[0].courseId;
@@ -7258,6 +7226,7 @@ export default {
         });
       });
     },
+    
 
     download(url, fileName) {
       let xhr = new XMLHttpRequest();
@@ -8773,25 +8742,25 @@ export default {
 }
 // 老师名字样式
 .teacher_names {
-  display: flex;
-  margin-left: 20px;
-  .names {
-    font-size: 13px;
-    color: #666666;
-    margin-right: 12px;
-    cursor: pointer;
-    // background: #F8F8F8;
-    border-radius: 4px;
-    padding: 3px 6px;
-    &.nactive {
-      color: #3f8dfd;
-      background: #f2f7ff;
+	display: flex;
+	margin-left: 20px;
+    .names {
+      font-size: 13px;
+      color: #666666;
+      margin-right: 12px;
+      cursor: pointer;
+      // background: #F8F8F8;
+      border-radius: 4px;
+      padding: 3px 6px;
+      &.nactive {
+        color: #3F8DFD;
+        background: #F2F7FF;
+      }
     }
   }
-}
 .teacherList_name {
   display: flex;
-  margin-left: 20px;
+	margin-left: 20px;
   margin-top: 10px;
   .names {
     font-size: 13px;
@@ -8802,7 +8771,7 @@ export default {
     border-radius: 4px;
     padding: 3px 6px;
     &.nactive {
-      background: #cccccc;
+      background: #CCCCCC;
     }
   }
 }