xuqiaoying hace 3 años
padre
commit
a347e53a24
Se han modificado 3 ficheros con 115 adiciones y 134 borrados
  1. 1 1
      components/course/courseChapter.vue
  2. 1 1
      components/course/courseSection.vue
  3. 113 132
      pages3/polyv/detail.vue

+ 1 - 1
components/course/courseChapter.vue

@@ -662,7 +662,7 @@ export default {
               }
               }
             });
             });
             self.list = res.data.data;
             self.list = res.data.data;
-            console.log('=======节列表==', this.list);
+            // console.log('=======节列表==', this.list);
           }
           }
         });
         });
     },
     },

+ 1 - 1
components/course/courseSection.vue

@@ -188,7 +188,7 @@ export default {
 		let sectionId = this.menuItem.sectionId || this.menuItem.menuId;
 		let sectionId = this.menuItem.sectionId || this.menuItem.menuId;
 		let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}${this.isRebuild?'isRebuild':''}`;
 		let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}${this.isRebuild?'isRebuild':''}`;
 		this.playId = playNextId;
 		this.playId = playNextId;
-		// console.log('playNextId:', this.playNextId, 'playId:', this.playId);
+		console.log('playNextId:', this.playNextId, 'playId:', this.playId);
 		uni.$off('playNext'+playNextId) //绑定前先移除之前的事件
 		uni.$off('playNext'+playNextId) //绑定前先移除之前的事件
 		uni.$once('playNext'+playNextId, async (data) => {
 		uni.$once('playNext'+playNextId, async (data) => {
 			//到时会触发每个节的监听事件,只允许当前节的接收
 			//到时会触发每个节的监听事件,只允许当前节的接收

+ 113 - 132
pages3/polyv/detail.vue

@@ -127,116 +127,87 @@
 						<view class="note">正在直播中</view>
 						<view class="note">正在直播中</view>
 						<view class="title">{{livingItem.sectionName}}</view>
 						<view class="title">{{livingItem.sectionName}}</view>
 					</view>
 					</view>
-          <!-- <view v-for="(courseItem, gTindex) in goodsTeacher" :key="gTindex">
-            <view v-for="(item, index) in courseItem.courseList" :key="index" v-show="item.subjectId === newActiveSubjectId || !newActiveSubjectId">
-                <view class="course_items"  v-if="item.show && item.show == 1">
-                    <view class="course_lefts">
-                      <view class="course_title">
-                        {{ item.courseName }}
-                      </view>
-                      <view v-if="courseItem.teaList && courseItem.teaList.length > 0" class='teacher_names' >
-                          <view v-for="(tea, tindex) in courseItem.teaList" :key="tindex" class="names"
-                          >{{tea.aliasName}}</view>
-                      </view>
-                      <view class="course_pros">
-                        学习进度
-                        <text> {{ item.stuAllNum + item.recordNum }}/{{ item.secAllNum + item.examNum}}</text>
-                      </view>
-                    </view>
-                    <view class="course_rights" @click="jump(item, gTindex, 'jump')">
-                      <view class="cicles">
-                        <u-icon name="arrow-right" color="#498AFE" size="20"></u-icon>
-                      </view>
-                      <view class="intoStudy">进入学习</view>
-                    </view>
-                </view>
-            </view>
-          </view> -->
-      <view class="all_item" v-for="(courseItem, c_index) in goodsTeacher" :key="c_index">
-        <view v-for="(cour, cou_index) in courseItem.courseList" :key="cou_index">
-            <view class="cou_title">{{ cour.courseName }}</view>
 
 
-            <view v-if="courseItem.teaList && courseItem.teaList.length > 0" class='teacher_names'>
-                <view v-for="(tea, tindex) in courseItem.teaList" :key="tindex" class="names"
-                  :class="{nactive: teacherIndex == tindex}" @click="activeFunc(tea, tindex)">
-                  {{ tea.aliasName }}
+          <view class="all_items" v-for="(courseItem, c_index) in goodsTeacher" :key="c_index">
+            <view v-for="(cour, cou_index) in courseItem.courseList" :key="cou_index">
+              <view v-if="cour.show && cour.show == 1">
+                <view v-if="courseTotal > 1" class="cou_title">{{ cour.courseName }}</view>
+                <!-- 双师制 -->
+                <view v-if="courseItem.teaList && courseItem.teaList.length > 0" class='teacher_names'>
+                  <view v-for="(tea, tindex) in courseItem.teaList" :key="tindex" class="names"
+                    :class="{nactive: teacherIndex == tindex}" @click="activeFunc(tea, tindex)">
+                    {{ tea.aliasName }}
+                  </view>
+                </view>
+                <!-- 目录列表 -->
+                <view class="menuBox onessss" v-for="(item, index) in courseItem.courseMeun" :key="index">
+                  <!--模块 -->
+                  <view v-if="item.type == 1"
+                    ><courseModule
+                      v-if="reStart"
+                      :orderGoodsId="orderGoodsId"
+                      :sectionMaxNum="goodsData.sectionMaxNum"
+                      :needOpen="item.menuIndex === index ? true : false"
+                      :courseId="courseId"
+                      :preItem="menuList[index - 1]"
+                      :learningOrder="businessData.goodsLearningOrder"
+                      :goodsId="goodsId"
+                      :gradeId="gradeId"
+                      :isBuy="true"
+                      :menuItem="item"
+                      :levelId="item.menuId"
+                      :goodsType='1'
+                      :menuAllList="menuAllList"
+                      :sectionItem="sectionItem"
+                    ></courseModule
+                  ></view>
+                  <!--章 -->
+                  <view v-if="item.type == 2"
+                    ><courseChapter
+                      v-if="reStart"
+                      :orderGoodsId="orderGoodsId"
+                      :sectionMaxNum="goodsData.sectionMaxNum"
+                      :needOpen="item.menuIndex === index ? true : false"
+                      :courseId="courseId"
+                      :preItem="menuList[index - 1]"
+                      @playEnd="sectionPlayEnd($event, index)"
+                      :learningOrder="businessData.goodsLearningOrder"
+                      :goodsId="goodsId"
+                      :gradeId="gradeId"
+                      :isBuy="true"
+                      :menuItem="item"
+                      :levelId="'0-' + item.menuId"
+                      :goodsType='1'
+                      :menuAllList="menuAllList"
+                    ></courseChapter
+                  ></view>
+                  <!--节 -->
+                  <view v-if="item.type == 3"
+                    ><courseSection
+                      ref="MoudleSection"
+                      v-if="reStart"
+                      :orderGoodsId="orderGoodsId"
+                      :sectionMaxNum="goodsData.sectionMaxNum"
+                      @playEnd="sectionPlayEnd($event, index)"
+                      :courseId="courseId"
+                      :preItem="menuList[index - 1]"
+                      :learningOrder="businessData.goodsLearningOrder"
+                      :goodsId="goodsId"
+                      :gradeId="gradeId"
+                      :isBuy="true"
+                      :menuItem="item"
+                      :levelId="'0-0-' + item.menuId"
+                      :goodsType='1'
+                      :testType="3"
+                      :menuAllList="menuAllList"
+                    ></courseSection
+                  ></view>
+                <!-- @togoBack="togoBack($event)" -->
                 </view>
                 </view>
-            </view>
-          <!-- <view v-if="teacherList && teacherList.length > 0" class='teacher_names'>
-              <view v-for="(tea, index) in teacherList" :key="index" class="names"
-                :class="{nactive: teacherIndex == index}" @click="activeFunc(tea, index)">
-                {{ tea.aliasName }}
               </view>
               </view>
-          </view> -->
-          <!-- menuList -->
-          <view class="menuBox onessss" v-for="(item, index) in courseItem.courseItem" :key="index">
-            <!--模块 -->
-            <view v-if="item.type == 1"
-              ><courseModule
-                v-if="reStart"
-								:orderGoodsId="orderGoodsId"
-                :sectionMaxNum="goodsData.sectionMaxNum"
-                :needOpen="menuIndex[0] === index ? true : false"
-                :courseId="courseId"
-                :preItem="menuList[index - 1]"
-                :learningOrder="businessData.goodsLearningOrder"
-                :goodsId="goodsId"
-                :gradeId="gradeId"
-                :isBuy="true"
-                :menuItem="item"
-                :levelId="item.menuId"
-                :goodsType='1'
-                :menuAllList="menuAllList"
-                :sectionItem="sectionItem"
-              ></courseModule
-            ></view>
-            <!--章 -->
-            <view v-if="item.type == 2"
-              ><courseChapter
-                v-if="reStart"
-								:orderGoodsId="orderGoodsId"
-                :sectionMaxNum="goodsData.sectionMaxNum"
-                :needOpen="menuIndex[0] === index ? true : false"
-                :courseId="courseId"
-                :preItem="menuList[index - 1]"
-                @playEnd="sectionPlayEnd($event, index)"
-                :learningOrder="businessData.goodsLearningOrder"
-                :goodsId="goodsId"
-                :gradeId="gradeId"
-                :isBuy="true"
-                :menuItem="item"
-                :levelId="'0-' + item.menuId"
-                :goodsType='1'
-                :menuAllList="menuAllList"
-              ></courseChapter
-            ></view>
-            <!--节 -->
-            <view v-if="item.type == 3"
-              ><courseSection
-                ref="MoudleSection"
-                v-if="reStart"
-								:orderGoodsId="orderGoodsId"
-                :sectionMaxNum="goodsData.sectionMaxNum"
-                @playEnd="sectionPlayEnd($event, index)"
-                :courseId="courseId"
-                :preItem="menuList[index - 1]"
-                :learningOrder="businessData.goodsLearningOrder"
-                :goodsId="goodsId"
-                :gradeId="gradeId"
-                :isBuy="true"
-                :menuItem="item"
-                :levelId="'0-0-' + item.menuId"
-                :goodsType='1'
-                :testType="3"
-                :menuAllList="menuAllList"
-              ></courseSection
-            ></view>
-            <!-- @togoBack="togoBack($event)" -->
-          </view>
-
-        </view>
 
 
-      </view>
+            </view>
+          </view>
         </view>
         </view>
         <!--讲义 -->
         <!--讲义 -->
         <view v-show="current == 1">
         <view v-show="current == 1">
@@ -802,7 +773,7 @@ export default {
       toggleCourseShow: false, // 切换课程弹窗
       toggleCourseShow: false, // 切换课程弹窗
       informId: '', //消息id,从公众号消息模板进来的才有
       informId: '', //消息id,从公众号消息模板进来的才有
       courseList: [], // 课程列表
       courseList: [], // 课程列表
-      // courseTotal: 0,
+      courseTotal: 0, // 课程数量
       reStart: false, // 是否显示模块/章/节
       reStart: false, // 是否显示模块/章/节
       subList: [],
       subList: [],
       subIndex: 0,
       subIndex: 0,
@@ -922,12 +893,13 @@ export default {
           if (res.data.rows.length) {
           if (res.data.rows.length) {
             this.courseBusiness(res.data.rows[0].businessId)
             this.courseBusiness(res.data.rows[0].businessId)
           }
           }
-          if(res.data.total > 1) {
+          this.courseTotal = res.data.total
+          if(res.data.total > 1) { // 多个课程
             this.getUserWatchLast()
             this.getUserWatchLast()
-            // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
           } else if(res.data.total == 1) {
           } else if(res.data.total == 1) {
             this.originOnShow()
             this.originOnShow()
             this.originMounted()
             this.originMounted()
+            this.getCourseTeacher(this.courseList)
           }
           }
         }
         }
       });
       });
@@ -1032,24 +1004,23 @@ export default {
             this.goodsTeacher.push(data)
             this.goodsTeacher.push(data)
           }) 
           }) 
         }
         }
-        console.log(this.goodsTeacher,'this.goodsTeacher', this.courseId);
-        this.goodsTeacher.forEach((item) => {
-          if(item.courseList.some(x => x.courseId == this.courseId)){
-            this.teacherList = item.teaList
-          }
-        })
-
+        // console.log(this.goodsTeacher,'this.goodsTeacher', this.courseId);
+        // this.goodsTeacher.forEach((item) => {
+        //   if(item.courseList.some(x => x.courseId == this.courseId)){
+        //     this.teacherList = item.teaList
+        //   }
+        // })
         this.goodsTeacher.forEach(async (item) => {
         this.goodsTeacher.forEach(async (item) => {
           let courseItem = await this.getMenuList(item.courseList[0].courseId)
           let courseItem = await this.getMenuList(item.courseList[0].courseId)
-          console.log('==', courseItem);
+          // console.log('==courseItem', courseItem);
           item['courseMeun'] = courseItem
           item['courseMeun'] = courseItem
         })
         })
-        console.log('===,== this.goodsTeacher', this.goodsTeacher);
+        console.log('===,== this.goodsTeacher', this.goodsTeacher, 'this.courseId:', this.courseId);
       }) 
       }) 
     },
     },
     // 原来onshow里面的内容
     // 原来onshow里面的内容
     originOnShow() {
     originOnShow() {
-      console.log('原来onshow里面的originOnShow')
+      // console.log('原来onshow里面的originOnShow')
       if(this.isOther) {
       if(this.isOther) {
         this.showMark = true;
         this.showMark = true;
         return;
         return;
@@ -1059,11 +1030,7 @@ export default {
         this.getGoodsDetail();
         this.getGoodsDetail();
         this.getAnswerList();
         this.getAnswerList();
         this.studyRecordMenuAllList();
         this.studyRecordMenuAllList();
-        // this.answerTimer = setInterval(() => {
-        //   this.getAnswerList();
-        // }, 5000);
         let noteSecond = Number(this.option.noteSecond);
         let noteSecond = Number(this.option.noteSecond);
-        // console.log('noteSecondnoteSecond:', noteSecond, this.option)
         if (noteSecond > 0) {
         if (noteSecond > 0) {
           //我的消息跳过来,播放节
           //我的消息跳过来,播放节
           let item = {
           let item = {
@@ -1683,7 +1650,6 @@ export default {
 				let nowTime = Number(new  Date().getTime()/1000).toFixed(0)
 				let nowTime = Number(new  Date().getTime()/1000).toFixed(0)
         if (res.data.data) {
         if (res.data.data) {
           this.menuAllList = res.data.data
           this.menuAllList = res.data.data
-          // console.log('======0', this.sectionItem);
 				this.livingItem = res.data.data.find(item => item.liveStartTime<=nowTime&&item.liveEndTime>nowTime);          
 				this.livingItem = res.data.data.find(item => item.liveStartTime<=nowTime&&item.liveEndTime>nowTime);          
         }
         }
 			})
 			})
@@ -2980,7 +2946,7 @@ export default {
         self.gradeId = self.goodsData.gradeId;
         self.gradeId = self.goodsData.gradeId;
         this.courseBusiness(this.goodsData.businessId);
         this.courseBusiness(this.goodsData.businessId);
         this.courseHandouts();
         this.courseHandouts();
-        self.getMenuList();
+        // self.getMenuList();
         self.getReMenuList(); //获取重修目录
         self.getReMenuList(); //获取重修目录
         setTimeout(function () {
         setTimeout(function () {
           if (!self.needProfileModal) {
           if (!self.needProfileModal) {
@@ -3093,7 +3059,7 @@ export default {
         });
         });
     },
     },
     getMenuList(courseId = this.courseId) {
     getMenuList(courseId = this.courseId) {
-      console.log('menuList的目录courseId:', courseId);
+      console.log('menuList的目录courseId:', courseId, 'this.courseId:', this.courseId, 'this.sectionItem:', this.sectionItem);
       // /course/menuList 查询课程目录结构列表
       // /course/menuList 查询课程目录结构列表
       return this.$api
       return this.$api
         .reMenuList({ courseId: courseId, gradeId: this.gradeId,orderGoodsId: this.orderGoodsId, })
         .reMenuList({ courseId: courseId, gradeId: this.gradeId,orderGoodsId: this.orderGoodsId, })
@@ -3106,18 +3072,21 @@ export default {
               item.name = item.menuName;
               item.name = item.menuName;
               item.menuType = item.type;
               item.menuType = item.type;
             }
             }
-            this.menuList = res.data.rows;
+            
             this.reStart = true
             this.reStart = true
             for (let i = 0; i < res.data.rows.length; i++) {
             for (let i = 0; i < res.data.rows.length; i++) {
+            if (courseId == this.courseId) {
               if (res.data.rows[i].type == 1) {
               if (res.data.rows[i].type == 1) {
                 // 模块
                 // 模块
                 if (Object.keys(this.sectionItem).length) {
                 if (Object.keys(this.sectionItem).length) {
                   if (res.data.rows[i].menuId == this.sectionItem.moduleId) {
                   if (res.data.rows[i].menuId == this.sectionItem.moduleId) {
-                    this.menuIndex = [i];
+                    // this.menuIndex = [i];
+                    res.data.rows[i]['menuIndex'] = i
                     break;
                     break;
                   }
                   }
                 } else {
                 } else {
-                this.menuIndex = [i];
+                // this.menuIndex = [i];
+                res.data.rows[i]['menuIndex'] = i
                 break;
                 break;
                 }
                 }
                 
                 
@@ -3125,17 +3094,21 @@ export default {
                 // 章
                 // 章
                 if (Object.keys(this.sectionItem).length) {
                 if (Object.keys(this.sectionItem).length) {
                   if (res.data.rows[i].menuId == this.sectionItem.chapterId && (!this.sectionItem.moduleId || this.sectionItem.moduleId == 0)) {
                   if (res.data.rows[i].menuId == this.sectionItem.chapterId && (!this.sectionItem.moduleId || this.sectionItem.moduleId == 0)) {
-                    this.menuIndex = [i];
+                    // this.menuIndex = [i];
+                    res.data.rows[i]['menuIndex'] = i
                     break;
                     break;
                   }
                   }
                 } else {
                 } else {
-                this.menuIndex = [i];
+                // this.menuIndex = [i];
+                res.data.rows[i]['menuIndex'] = i
                 break;
                 break;
                 }
                 }
                 
                 
               }
               }
             }
             }
-            console.log('menuList: ---', this.menuList, 'menuIndex:', this.menuIndex);
+            }
+            this.menuList = res.data.rows
+            console.log('menuList: ---', this.menuList);
           }
           }
           return Promise.resolve(this.menuList)
           return Promise.resolve(this.menuList)
         });
         });
@@ -3277,6 +3250,14 @@ export default {
     .box_in {
     .box_in {
       height: 100%;
       height: 100%;
     }
     }
+    // 课程列表
+    .all_items {
+      .cou_title {
+        color: #222;
+        font-size: 36rpx;
+        margin-bottom: 16rpx;
+      }
+    }
   }
   }
   .first_ml {
   .first_ml {
     margin: 16rpx 16rpx 16rpx 16rpx;
     margin: 16rpx 16rpx 16rpx 16rpx;