Browse Source

重构中

谢杰标 2 năm trước cách đây
mục cha
commit
a4e64f0d1b

+ 10 - 6
components/course/courseSection.vue

@@ -641,12 +641,7 @@ export default {
     },
   },
   computed: {
-    ...mapGetters([
-      "playSectionId",
-      "userInfo",
-      "liveLast",
-      "config",
-    ]),
+    ...mapGetters(["playSectionId", "userInfo", "liveLast", "config"]),
     isActive() {
       let moduleId = this.menuItem.moduleId || 0;
       let chapterId = this.menuItem.chapterId || 0;
@@ -654,6 +649,15 @@ export default {
       let moduleId1 = this.sectionItem.moduleId || 0;
       let chapterId1 = this.sectionItem.chapterId || 0;
       let sectionId1 = this.sectionItem.sectionId || this.sectionItem.menuId;
+      console.log(
+        "isActive",
+        moduleId,
+        moduleId1,
+        chapterId,
+        chapterId1,
+        sectionId,
+        sectionId1
+      );
       return (
         moduleId == moduleId1 &&
         chapterId == chapterId1 &&

+ 3 - 0
components/course/courseTree.vue

@@ -159,6 +159,9 @@ export default {
           if (res.data.code == 200) {
             for (let i = 0; i < res.data.rows.length; i++) {
               let item = res.data.rows[i];
+              if (item.rebuild) {
+                this.$emit("isHaverebuild");
+              }
               item.down = true;
               item.id = item.menuId;
               item.name = item.menuName;

+ 26 - 0
components/popup/camera.vue

@@ -187,13 +187,37 @@ export default {
     reTakeOrClose(type = 0) {
       type ? this.reTake() : this.closeCamera();
     },
+    exitFullscreen() {
+      if (
+        !!(
+          document.webkitIsFullScreen ||
+          document.mozFullScreen ||
+          document.msFullscreenElement ||
+          document.fullscreenElement
+        )
+      ) {
+        try {
+          var de = document;
+          if (de.exitFullscreen) {
+            de.exitFullscreen();
+          } else if (de.mozCancelFullScreen) {
+            de.mozCancelFullScreen();
+          } else if (de.webkitCancelFullScreen) {
+            de.webkitCancelFullScreen();
+          }
+        } catch (err) {}
+      }
+    },
     closeCamera() {
       this.isShow = false;
       this.showSet = false;
       this.popupPhotoShow = false;
     },
+
     openCamera() {
       this.uploadLock = false;
+      // 退出全屏
+      this.exitFullscreen();
       // 同一个商品只谈一次提示
       let popupList = uni.getStorageSync("popupList") || [];
       if (!popupList.includes(this.goodsId)) {
@@ -389,8 +413,10 @@ export default {
         title: "提示",
         content:
           "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
+
         cancelText: "取消",
         confirmText: "确定",
+        showCancel: false,
         success: (res) => {
           if (res.confirm) {
             uni.navigateBack();

+ 20 - 524
pages3/polyv/detail.vue

@@ -102,6 +102,7 @@
             :goodsType="1"
             :menuAllList="menuAllList"
             :sectionItem="sectionItem"
+            @isHaverebuild="isHaverebuild = true"
           ></course-tree>
         </view>
         <!--讲义 -->
@@ -358,7 +359,6 @@ export default {
       gradeId: 0,
       chapterId: 0,
       moduleId: 0,
-      reMenuList: [],
       recordObj: {},
       photoIndex: 0,
       isTaking: true, //是否正在拍照
@@ -400,6 +400,7 @@ export default {
       noticeShow1: false,
       refPlv: null,
       isCache: true,
+      isHaverebuild: false,
     };
   },
   computed: {
@@ -433,7 +434,8 @@ export default {
           name: "答疑",
         },
       ];
-      if (this.reMenuList.length > 0) {
+
+      if (this.isHaverebuild) {
         list.push({ name: "重修目录" });
       }
       return list;
@@ -453,6 +455,9 @@ export default {
       }
       return this.courseList.find((e) => e.courseId == this.courseId);
     },
+    sectionId() {
+      return this.sectionItem.sectionId || this.sectionItem.id;
+    },
   },
   async onLoad(option) {
     if (option.isOther) {
@@ -724,7 +729,6 @@ export default {
     },
     // 原来onshow里面的内容
     async originOnShow() {
-      this.getReMenuList();
       await this.studyRecordMenuAllList();
       // 消息过来 定位某个节
       if (this.option.noteSecond) {
@@ -765,7 +769,6 @@ export default {
         this.sectionItem = item;
         this.moduleId = item.moduleId || null;
         this.chapterId = item.chapterId || null;
-
         this.$store.commit("setPlayChannelId", { playChannelId: 0 });
         this.playVideo(item);
       });
@@ -899,14 +902,6 @@ export default {
       this.courseId = item.courseId;
       this.originOnShow();
     },
-    async nextCourses(item, type) {
-      this.vid = "";
-      this.hasStart = true;
-      await this.originUnload();
-      this.courseId = item.courseId;
-      this.gradeId = item.gradeId;
-      this.toggleCourseShow = false;
-    },
     clickLeft() {
       // uni.navigateBack()
       uni.switchTab({
@@ -980,7 +975,7 @@ export default {
     async initPlayVideo(sectionItem) {
       this.moduleId = sectionItem.moduleId;
       this.chapterId = sectionItem.chapterId;
-      this.sectionItem = sectionItem
+      this.sectionItem = sectionItem;
       if (sectionItem.sectionType == 1) {
         //录播
         this.playVideo(sectionItem);
@@ -1062,7 +1057,10 @@ export default {
           courseId: this.courseId,
         })
         .then((res) => {
-          console.log("🚀 ~ file: detail.vue:1071 ~ .then ~ res:", res)
+          console.log(
+            "🚀 ~ file: detail.vue:1071 ~ .then ~ res:",
+            res.data.data
+          );
           let { data } = res.data;
           if (!data.sectionId) {
             data = this.menuAllList[0];
@@ -1074,121 +1072,6 @@ export default {
           this.initPlayVideo(data);
         });
     },
-    /**
-     * 模块大节播放完毕,刷新列表
-     */
-    sectionPlayEnd(isRebuild, index) {
-      if (this.reMenuList.length > 0) {
-        //有重修目录
-        if (isRebuild.isRebuild) {
-          //从重修点击
-          this.$api
-            .reMenuList({
-              orderGoodsId: this.orderGoodsId,
-              courseId: this.courseId,
-              rebuild: 1,
-              gradeId: this.gradeId,
-            })
-            .then((res) => {
-              if (res.data.code == 200) {
-                if (res.data.rows.length) {
-                  res.data.rows[index].name = res.data.rows[index].menuName;
-                  this.$set(this.reMenuList, index, res.data.rows[index]);
-                  for (let i = 0; i < res.data.rows.length; i++) {
-                    let item = res.data.rows[i];
-                    item.down = true;
-                    item.id = item.menuId;
-                    item.name = item.menuName;
-                  }
-                  this.reMenuList = [];
-                  this.$nextTick(() => {
-                    this.reMenuList = res.data.rows;
-                    // console.log(this.reMenuList,'this.reMenuList1')
-                  });
-                } else {
-                  this.reMenuList = [];
-                }
-              }
-            });
-
-          this.$api
-            .reMenuList({
-              courseId: this.courseId,
-              gradeId: this.gradeId,
-              orderGoodsId: this.orderGoodsId,
-            })
-            .then((res) => {
-              if (res.data.code == 200) {
-                for (let i = 0; i < res.data.rows.length; i++) {
-                  let item = res.data.rows[i];
-                  item.down = true;
-                  item.id = item.menuId;
-                  item.name = item.menuName;
-                  item.menuType = item.type;
-                }
-                this.menuList = [];
-                this.$nextTick(() => {
-                  this.menuList = res.data.rows;
-                });
-              }
-            });
-        } else {
-          //从普通目录点击
-          this.$api
-            .reMenuList({
-              courseId: this.courseId,
-              gradeId: this.gradeId,
-              orderGoodsId: this.orderGoodsId,
-            })
-            .then((res) => {
-              if (res.data.code == 200) {
-                res.data.rows[index].name = res.data.rows[index].menuName;
-                res.data.rows[index].id = res.data.rows[index].menuId;
-                this.$set(this.menuList, index, res.data.rows[index]);
-              }
-            });
-
-          this.$api
-            .reMenuList({
-              orderGoodsId: this.orderGoodsId,
-              courseId: this.courseId,
-              rebuild: 1,
-              gradeId: this.gradeId,
-            })
-            .then((res) => {
-              if (res.data.code == 200) {
-                if (res.data.rows.length) {
-                  // for (let i = 0; i < res.data.rows.length; i++) {
-                  // 	let item = res.data.rows[i];
-                  // 	item.down = true;
-                  // 	item.id = item.menuId;
-                  // 	item.name = item.menuName;
-                  // }
-                  // this.reMenuList = res.data.rows;
-                } else {
-                  this.reMenuList = [];
-                }
-              }
-            });
-        }
-      } else {
-        console.log("--模块大节播放完毕,刷新列表-");
-        //没有重修目录
-        this.$api
-          .reMenuList({
-            courseId: this.courseId,
-            gradeId: this.gradeId,
-            orderGoodsId: this.orderGoodsId,
-          })
-          .then((res) => {
-            if (res.data.code == 200) {
-              res.data.rows[index].name = res.data.rows[index].menuName;
-              res.data.rows[index].id = res.data.rows[index].menuId;
-              this.$set(this.menuList, index, res.data.rows[index]);
-            }
-          });
-      }
-    },
     goLive(item) {
       let moduleId = item.moduleId || 0;
       let chapterId = item.chapterId || 0;
@@ -1331,15 +1214,6 @@ export default {
     itemWidth() {
       return 100 / this.list.length + "%";
     },
-    findMenuNextSection(index) {
-      for (let i = index + 1; i < this.reMenuList.length; i++) {
-        let item = this.reMenuList[i];
-        if (item.type == 3) {
-          return item;
-        }
-      }
-      return {};
-    },
     loadedmetadata(event) {
       this.refPlv = this.$refs.player;
       // this.openCamera()
@@ -1375,7 +1249,7 @@ export default {
     postCoursePhotoRecord(postTime = false) {
       return new Promise((resolve, reject) => {
         let data = {
-          ...this.params("orderGoodsId", "goodsId", "courseId", "gradeId"),
+          ...this.params(["orderGoodsId", "goodsId", "courseId", "gradeId"]),
           photo: this.ossAvatarUrl,
           sectionId: this.playSectionId,
           photoTime: this.playTime || 0,
@@ -1491,18 +1365,6 @@ export default {
       }
       return photoList;
     },
-    getLiveUid(channelId) {
-      let self = this;
-      return new Promise((resolve) => {
-        let data = {
-          channelId: channelId,
-          orderGoodsId: this.orderGoodsId,
-        };
-        self.$api.polyvSign(data).then((res) => {
-          resolve(res.data.data);
-        });
-      });
-    },
     studyNotice() {
       this.noticeShow = true;
     },
@@ -1583,12 +1445,12 @@ export default {
                 uni.navigateBack();
               },
             });
-            return Promise.reject(123);
+            return Promise.reject();
           }
         }
       });
     },
-    postStudyRecord(status = 0, sectionId = this.playSectionId) {
+    postStudyRecord(status = 0, sectionId = this.sectionId) {
       if (!this.refPlv) {
         return;
       }
@@ -1602,13 +1464,13 @@ export default {
       }
       let self = this;
       let data = {
-        ...this.params(
+        ...this.params([
           "orderGoodsId",
           "goodsId",
           "courseId",
           "erJianErZao",
-          "gradeId"
-        ),
+          "gradeId",
+        ]),
         fromPlat: 1, //来源平台 1小程序 2网站
         photo: self.ossAvatarUrl,
         sectionId: sectionId || 0,
@@ -1868,11 +1730,6 @@ export default {
     error(e) {
       console.log(e.detail);
     },
-    //关闭相机
-    closePhoto() {
-      this.photoPopup = false;
-      this.enableAutoRotation = true;
-    },
     async userConfirmInfoDetail() {
       let info = await this.$api.userConfirmInfoDetail({
         orderGoodsId: this.orderGoodsId,
@@ -1945,77 +1802,9 @@ export default {
         }
       }
     },
-    getReMenuList() {
-      let self = this;
-      this.$api
-        .reMenuList({
-          orderGoodsId: this.orderGoodsId,
-          courseId: this.courseId,
-          rebuild: 1,
-          gradeId: this.gradeId,
-        })
-        .then((res) => {
-          if (res.data.code == 200) {
-            for (let i = 0; i < res.data.rows.length; i++) {
-              let item = res.data.rows[i];
-              item.down = true;
-              item.id = item.menuId;
-              item.name = item.menuName;
-            }
-            self.reMenuList = res.data.rows;
-            this.current = 0;
-            if (self.reMenuList.length > 0) {
-              if (Object.keys(this.sectionItem).length) {
-                let playNextIdisRebuild = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}isRebuild`;
-                this.$store.commit("updatePlayNextId", playNextIdisRebuild);
-              }
-            } else {
-              if (Object.keys(this.sectionItem).length) {
-                let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
-                this.$store.commit("updatePlayNextId", playNextId);
-              }
-            }
-          }
-        });
-    },
-    courseDetail() {
-      this.$api.courseDetail(this.courseId).then((res) => {
-        if (res.data.code == 200) {
-          this.detail = res.data.data;
-        }
-      });
-    },
-    open(item) {
-      item.showChildren = !item.showChildren;
-    },
     change(index) {
       this.current = index;
     },
-    /**
-     * 退出全屏
-     */
-    exitFullscreen() {
-      try {
-        var de = document;
-        if (de.exitFullscreen) {
-          de.exitFullscreen();
-        } else if (de.mozCancelFullScreen) {
-          de.mozCancelFullScreen();
-        } else if (de.webkitCancelFullScreen) {
-          de.webkitCancelFullScreen();
-        }
-      } catch (err) {}
-    },
-
-    fullele() {
-      return (
-        document.fullscreenElement ||
-        document.webkitFullscreenElement ||
-        document.msFullscreenElement ||
-        document.mozFullScreenElement ||
-        null
-      );
-    },
     paramsFn(
       keys = ["orderGoodsId", "goodsId", "courseId", "gradeId", "sectionItem"]
     ) {
@@ -2098,121 +1887,15 @@ export default {
     margin: 16rpx 16rpx 16rpx 16rpx;
   }
 }
-.btnSet {
-  width: 440rpx;
-  height: 80rpx;
-  background: #007aff;
-  border-radius: 40rpx;
-  color: #ffffff;
-  font-size: 28rpx;
-  line-height: 80rpx;
-}
-
-.lecture-content {
-  background: #fff;
-  margin-top: 10rpx;
-  padding: 10rpx;
-  border-radius: 16rpx;
-}
 
-.tBox {
-  display: flex;
-  align-items: center;
-  padding-top: 10rpx;
-}
 .title {
   font-size: 24rpx;
   color: #999999;
 }
 
-.t_content1 {
-  color: #007aff;
-  margin-left: 10rpx;
-}
-.tag1 {
-  border: 2rpx solid #007aff;
-  border-radius: 8rpx;
-  font-size: 20rpx;
-  color: #007aff;
-  padding: 5rpx;
-}
-.b_title {
-  color: #333333;
-  font-size: 30rpx;
-  font-weight: bold;
-}
 page {
   background: #eaeef1;
 }
-.menuBox {
-  width: 100%;
-  background: #ffffff;
-  border-radius: 16rpx;
-  padding: 0rpx 20rpx;
-  margin-bottom: 20rpx;
-}
-.btnspric {
-  border-top: 1rpx solid #eee;
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  height: 108rpx;
-  padding-left: 43rpx;
-  padding-right: 32rpx;
-}
-.btnspric > .lefprL {
-  font-size: 36rpx;
-  color: #0c141f;
-  font-weight: bold;
-}
-.btnspric > .lefprR {
-  padding: 0rpx 24rpx;
-  height: 60rpx;
-  line-height: 60rpx;
-  text-align: center;
-  color: #fff;
-  background: #32467b;
-  border-radius: 24rpx;
-  box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
-}
-.yhj,
-.hdyhj {
-  padding: 24rpx 29rpx 24rpx 34rpx;
-}
-.yhj {
-  border-bottom: 16rpx solid #f9f9f9;
-}
-.yhjtit {
-  font-size: 30rpx;
-  color: #0c141f;
-  font-weight: 500;
-  margin-bottom: 14rpx;
-}
-.yhjList {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  margin-bottom: 14rpx;
-}
-.yhjList > .yhjLefts {
-  display: flex;
-  align-items: center;
-}
-.yhjLefts > .yhl {
-  color: #32467b;
-  font-size: 30rpx;
-  margin-right: 31rpx;
-}
-.yhjLefts > .yhbq {
-  font-size: 24rpx;
-  color: #ff9500;
-  border-radius: 18rpx;
-  background-color: rgba(255, 149, 0, 0.2);
-  border: 2rpx solid #ff9500;
-  height: 38rpx;
-  line-height: 38rpx;
-  padding: 0rpx 16rpx;
-}
 .ts {
   font-size: 24rpx;
   color: #999;
@@ -2220,120 +1903,11 @@ page {
   padding-right: 29rpx;
   padding-left: 34rpx;
 }
-.yh {
-  padding-top: 20rpx;
-}
-.yh > .yhtitle {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  padding-right: 29rpx;
-  padding-left: 34rpx;
-}
-.priceBxs {
-  display: flex;
-  align-items: center;
-}
-.priceBxs > .pricleft {
-  border-radius: 24rpx;
-  border: 1rpx solid #e91313;
-  background-color: rgba(233, 19, 19, 0.1);
-  padding: 0rpx 18rpx;
-  height: 49rpx;
-  line-height: 49rpx;
-  text-align: center;
-  font-size: 30rpx;
-  font-weight: 500;
-  color: #e91313;
-  margin-right: 13rpx;
-}
-.topBox {
-  padding: 32rpx 32rpx 24rpx;
-  border-bottom: 1rpx solid #eeeeee;
-}
-.topBox > .boldFonstType {
-  font-weight: 500;
-  font-size: 30rpx;
-  margin: 16rpx 0rpx 23rpx;
-}
-.topBox > .firstTopL {
-  display: flex;
-  align-items: center;
-}
-.topBox > .firstTopL > .imageBs {
-  width: 331rpx;
-  height: 160rpx;
-  border-radius: 6rpx;
-  overflow: hidden;
-  margin-right: 8rpx;
-  box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
-}
-.topBox > .firstTopL > .imageBs > image {
-  width: 100%;
-  height: 100%;
-}
-.topBox > .firstTopL > .textBs {
-  font-size: 30rpx;
-  font-weight: bold;
-  color: #0c141f;
-}
 .content {
   padding: 24rpx;
   text-align: left;
 }
-.catalogBox {
-  display: flex;
-  align-items: center;
-  flex-wrap: nowrap;
-  overflow-x: auto;
-  padding-left: 38rpx;
-  max-height: 305rpx;
-  overflow-y: auto;
-  transition: all 0.4s;
-}
-.catalogBox > .catalogA {
-  min-width: 200rpx;
-  height: 48rpx;
-  line-height: 48rpx;
-  // text-align: center;
-  border: 2rpx solid transparent;
-  white-space: nowrap;
-  text-overflow: ellipsis;
-  overflow: hidden;
-  word-break: break-all;
-  border-radius: 10rpx;
-  background: rgba(22, 119, 255, 0.05);
-  padding-left: 19rpx;
-  box-sizing: border-box;
-  padding-right: 15rpx;
-  margin-right: 16rpx;
-  margin-bottom: 20rpx;
-  margin-top: 15rpx;
-  font-size: 24rpx;
-  color: #666;
-}
-.catalogBox > .activesq {
-  border-color: #1677ff;
-}
-.changeCatalogBox {
-  display: block;
-}
-.catalogBox::-webkit-scrollbar {
-  display: none; /* Chrome Safari */
-}
-.price_t2 {
-  font-size: 18rpx;
-  font-family: PingFang SC;
-  font-weight: 500;
-  text-decoration: line-through;
-  color: #999999;
-}
-.price_t1 {
-  font-size: 33rpx;
-  font-family: PingFang SC;
-  font-weight: bold;
-  color: #e91313;
-}
+
 .sc_t {
   font-size: 22rpx;
   color: #000000;
@@ -2358,31 +1932,13 @@ page {
 .video_body {
   padding-bottom: 96rpx;
 }
-.footer_tab {
-  position: fixed;
-  bottom: 0;
-  height: 96rpx;
-  width: 100%;
-  background-color: #ffffff;
-}
+
 .tj_box {
   width: 50%;
   display: inline-block;
   text-align: center;
   margin: 10rpx 0;
 }
-.teacher_t {
-  font-size: 24rpx;
-  font-family: PingFang SC;
-  font-weight: 400;
-  color: #666666;
-  line-height: 36rpx;
-  margin-left: 15rpx;
-}
-.teacher_img {
-  width: 87rpx;
-  height: 129rpx;
-}
 .t2 {
   font-size: 24rpx;
   font-family: PingFang SC;
@@ -2441,9 +1997,6 @@ page {
 .video_box {
   position: relative;
 }
-.rotoct {
-  transform: rotate(90deg);
-}
 
 .slot-content {
   padding: 0 20rpx;
@@ -2487,61 +2040,4 @@ page {
     }
   }
 }
-.full_mulu {
-  position: absolute;
-  top: 100rpx;
-  right: 20rpx;
-  width: 700rpx;
-  height: 515rpx;
-  color: #333;
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  z-index: 99999;
-  .mulus {
-    width: 623rpx;
-    // height: 515rpx;
-    height: 400rpx;
-    overflow-y: scroll;
-    // overflow: scroll;
-  }
-  .mulu_box_in {
-    background-color: #b7b7b7;
-    border-radius: 16rpx;
-    // transition: all 0.5s;
-    &::after {
-      content: "";
-      width: 0;
-      height: 0;
-      position: absolute;
-      top: 235rpx;
-      right: 27px;
-      border-top: 16rpx solid transparent;
-      border-right: 16rpx solid transparent;
-      border-left: 16rpx solid #b7b7b7;
-      border-bottom: 16rpx solid transparent;
-    }
-  }
-  .mulu_box_out {
-    // visibility: hidden;
-    display: none;
-  }
-  .menuBox_mulu {
-    // width: 100%;
-    background: #ffffff;
-    border-radius: 16rpx;
-    padding: 0rpx 20rpx;
-    margin-bottom: 20rpx;
-  }
-  .ml_img {
-    position: absolute;
-    right: 0;
-    top: 100rpx;
-  }
-  .items {
-    width: 620rpx;
-    height: 100rpx;
-    border: 1rpx solid red;
-  }
-}
 </style>