xiejiebiao 2 年之前
父節點
當前提交
4dac28cc98
共有 1 個文件被更改,包括 93 次插入202 次删除
  1. 93 202
      pages3/polyv/detail.vue

+ 93 - 202
pages3/polyv/detail.vue

@@ -1,35 +1,16 @@
 <template>
   <view class="polyv_detail">
-    <uni-nav-bar
-      left-icon="back"
-      :statusBar="true"
-      fixed="true"
-      :title="detail.courseName || '课程详情'"
-      @clickLeft="clickLeft"
-    ></uni-nav-bar>
+    <uni-nav-bar left-icon="back" :statusBar="true" fixed="true" :title="detail.courseName || '课程详情'"
+      @clickLeft="clickLeft"></uni-nav-bar>
     <view id="top">
       <view class="video_box" v-if="!playVid">
-        <image
-          :src="$method.splitImgHost(goodsData.coverUrl)"
-          mode="widthFix"
-          style="width: 100%; height: 421rpx"
-        ></image>
+        <image :src="$method.splitImgHost(goodsData.coverUrl)" mode="widthFix" style="width: 100%; height: 421rpx">
+        </image>
       </view>
       <view v-else>
-        <my-player
-          ref="player"
-          :playVid="playVid"
-          :autoplay="autoplay"
-          :allowSeek="isAllowSeek"
-          :playbackRate="playbackRate"
-          :videoCurrentTime="videoCurrentTime || 0"
-          @playing="playing"
-          @pause="pause"
-          @ended="ended"
-          @loadedmetadata="loadedmetadata"
-          @timeupdate="timeupdate"
-          @playerError="playerError"
-        ></my-player>
+        <my-player ref="player" :playVid="playVid" :autoplay="autoplay" :allowSeek="isAllowSeek"
+          :playbackRate="playbackRate" :videoCurrentTime="videoCurrentTime || 0" @playing="playing" @pause="pause"
+          @ended="ended" @loadedmetadata="loadedmetadata" @timeupdate="timeupdate" @playerError="playerError"></my-player>
       </view>
       <view class="course_name">
         <view class="course_titles">
@@ -39,16 +20,8 @@
           <view class="notice_wrap" v-if="goodsData.buyNote">
             <view class="video_t1_t" @click="studyNotice"> 学员须知 </view>
           </view>
-          <view
-            class="toggle_course"
-            v-if="goodsTeacher.length > 1"
-            @click="changeCourses()"
-          >
-            <image
-              class="img"
-              src="/pages3/static/imgs/toggle.png"
-              mode="widthFix"
-            ></image>
+          <view class="toggle_course" v-if="goodsTeacher.length > 1" @click="changeCourses()">
+            <image class="img" src="/pages3/static/imgs/toggle.png" mode="widthFix"></image>
             <view class="toggle_name">切换课程</view>
             <view class="numbers">共{{ goodsTeacher.length }}门</view>
           </view>
@@ -57,15 +30,8 @@
       <u-line color="#D6D6DB" />
       <view>
         <view>
-          <u-tabs
-            :item-width="itemWidth()"
-            :list="list"
-            font-size="32"
-            bar-width="24"
-            :current="current"
-            @change="change"
-            active-color="#007AFF"
-          ></u-tabs>
+          <u-tabs :item-width="itemWidth()" :list="list" font-size="32" bar-width="24" :current="current" @change="change"
+            active-color="#007AFF"></u-tabs>
         </view>
       </view>
       <u-line color="#D6D6DB" />
@@ -74,26 +40,13 @@
       <scroll-view class="box_in" scroll-y="true">
         <!--目录 -->
         <view v-show="current == 0">
-          <view
-            class="top__header"
-            v-if="livingItem"
-            @click="goLive(livingItem)"
-          >
-            <image
-              class="img"
-              src="/pages3/static/imgs/live.png"
-              mode="widthFix"
-            ></image>
+          <view class="top__header" v-if="livingItem" @click="goLive(livingItem)">
+            <image class="img" src="/pages3/static/imgs/live.png" mode="widthFix"></image>
             <view class="note">正在直播中</view>
             <view class="title">{{ livingItem.sectionName }}</view>
           </view>
-          <course-tree
-            v-if="sectionItem.id || sectionItem.sectionId"
-            :sectionMaxNum="goodsData.sectionMaxNum"
-            :isRebuild="false"
-            :isBuy="true"
-            @isHaverebuild="isHaverebuild = true"
-          ></course-tree>
+          <course-tree v-if="sectionItem.id || sectionItem.sectionId" :sectionMaxNum="goodsData.sectionMaxNum"
+            :isRebuild="false" :isBuy="true" @isHaverebuild="isHaverebuild = true"></course-tree>
         </view>
         <!--讲义 -->
         <view v-if="current == 1">
@@ -109,57 +62,29 @@
         </view>
         <!--重修目录 -->
         <view v-if="current == 4">
-          <course-tree
-            v-if="sectionItem.id || sectionItem.sectionId"
-            :sectionMaxNum="goodsData.sectionMaxNum"
-            :isRebuild="true"
-            :isBuy="true"
-          ></course-tree>
+          <course-tree v-if="sectionItem.id || sectionItem.sectionId" :sectionMaxNum="goodsData.sectionMaxNum"
+            :isRebuild="true" :isBuy="true"></course-tree>
         </view>
       </scroll-view>
     </view>
-    <u-popup
-      v-model="noticeShow"
-      class="notice_modal"
-      mode="center"
-      border-radius="28"
-      width="650rpx"
-      height="622rpx"
-      :mask-close-able="false"
-    >
+    <u-popup v-model="noticeShow" class="notice_modal" mode="center" border-radius="28" width="650rpx" height="622rpx"
+      :mask-close-able="false">
       <view class="content">
         <view class="title">学员须知</view>
         <scroll-view scroll-y="true">
-          <view
-            class="text"
-            v-html="
-              goodsData.buyNote && goodsData.buyNote.replace(/\n|\r\n/g, '<br>')
-            "
-          >
+          <view class="text" v-html="goodsData.buyNote && goodsData.buyNote.replace(/\n|\r\n/g, '<br>')
+            ">
           </view>
         </scroll-view>
-        <view
-          class="had_read"
-          :class="{ gray: CountTo > 0 }"
-          @click="noticeConfirm()"
-        >
-          <text v-if="CountTo > 0"
-            >请阅读学员须知,{{ " " + CountTo + "s" }}后可关闭</text
-          >
+        <view class="had_read" :class="{ gray: CountTo > 0 }" @click="noticeConfirm()">
+          <text v-if="CountTo > 0">请阅读学员须知,{{ " " + CountTo + "s" }}后可关闭</text>
           <text v-else>我已阅读学员须知</text>
         </view>
       </view>
     </u-popup>
     <!-- 倒计时提交 -->
-    <u-popup
-      v-model="noticeShow1"
-      class="notice_modal"
-      mode="center"
-      border-radius="28"
-      width="650rpx"
-      height="262rpx"
-      :mask-close-able="false"
-    >
+    <u-popup v-model="noticeShow1" class="notice_modal" mode="center" border-radius="28" width="650rpx" height="262rpx"
+      :mask-close-able="false">
       <view class="content">
         <view class="title">提示</view>
         <view class="had_read">
@@ -168,15 +93,8 @@
         </view>
       </view>
     </u-popup>
-    <u-modal
-      v-model="showMark"
-      title="提示"
-      @confirm="markConfirm"
-      @cancel="toBack"
-      confirm-text="复制学习网址"
-      :show-cancel-button="true"
-      cancel-text="关闭"
-    >
+    <u-modal v-model="showMark" title="提示" @confirm="markConfirm" @cancel="toBack" confirm-text="复制学习网址"
+      :show-cancel-button="true" cancel-text="关闭">
       <view class="slot-content">
         <view>您的学习账号已经开通,请按照步骤操作,进行学习。</view>
         <view>1.复制学习地址:{{ markContent }}</view>
@@ -188,36 +106,18 @@
     </u-modal>
 
     <!-- 切换课程弹窗 -->
-    <u-popup
-      v-model="toggleCourseShow"
-      mode="bottom"
-      border-radius="40"
-      :mask-close-able="false"
-    >
+    <u-popup v-model="toggleCourseShow" mode="bottom" border-radius="40" :mask-close-able="false">
       <view class="popup_box">
         <view class="check_head">
           <view class="headers">
             <view class="grade">切换课程</view>
-            <u-icon
-              name="close"
-              color="#9C9C9C"
-              size="40"
-              @click="closePop()"
-            ></u-icon>
+            <u-icon name="close" color="#9C9C9C" size="40" @click="closePop()"></u-icon>
           </view>
           <view class="coruse_num">共{{ goodsTeacher.length }}门</view>
           <view class="menuSel">
             <scroll-view class="sub_sliper" scroll-x="true">
-              <view
-                v-for="(item, index) in subList"
-                :key="index"
-                style="margin-right: 50rpx; display: inline-block"
-              >
-                <view
-                  class="r_t1"
-                  :class="{ nactive: subIndex == index }"
-                  @click="cMenu(item, index)"
-                >
+              <view v-for="(item, index) in subList" :key="index" style="margin-right: 50rpx; display: inline-block">
+                <view class="r_t1" :class="{ nactive: subIndex == index }" @click="cMenu(item, index)">
                   {{ item.subjectName }}
                 </view>
               </view>
@@ -228,48 +128,28 @@
         <view class="check_con">
           <scroll-view scroll-y="true" style="height: 700rpx">
             <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 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 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
-                      >
+                        }}</text>
                     </view>
                   </view>
-                  <view
-                    class="course_rights"
-                    @click="jump(item, gTindex, 'jump')"
-                  >
+                  <view class="course_rights" @click="jump(item, gTindex, 'jump')">
                     <view class="cicles">
-                      <u-icon
-                        name="arrow-right"
-                        color="#498AFE"
-                        size="20"
-                      ></u-icon>
+                      <u-icon name="arrow-right" color="#498AFE" size="20"></u-icon>
                     </view>
                     <view class="intoStudy">进入学习</view>
                   </view>
@@ -482,7 +362,7 @@ export default {
     }
     this.originUnload();
   },
-  mounted() {},
+  mounted() { },
   methods: {
     ...mapMutations(["updateChapterOpen", "updateLiveLast"]),
     async init() {
@@ -494,25 +374,14 @@ export default {
       // #endif
       // 锁
       lockAction();
+      uni.addInterceptor("navigateTo", {
+        success() {
+          this.isCache = true;
+        },
+      });
       this.lockTimer = setInterval(lockAction, 10000);
-      this.isCanLearn()
-        .then((res) => {
-          this.courseCourseList();
-          uni.addInterceptor("navigateTo", {
-            invoke({ url }) {
-              console.log(
-                "🚀 ~ file: detail.vue:503 ~ invoke ~ url:",
-                url.includes("/pages2/class/questionBank")
-              );
-              this.isCache = url.includes("/pages2/class/questionBank");
-            },
-          });
-        })
-        .catch(() => {
-          setTimeout(() => {
-            this.isCache = true; // onshowc重新触发校验
-          }, 2000);
-        });
+      await this.isCanLearn()
+      this.courseCourseList();
     },
     // 七大员是否能进入学习
     async qCheckIsCanLearn() {
@@ -1010,29 +879,29 @@ export default {
       // buyCourse 是否购买课程:1是 0否
       let encode = encodeURIComponent(
         this.config.hostLive +
-          "/pages/live/index?token=" +
-          uni.getStorageSync("token") +
-          "&userInfo=" +
-          JSON.stringify(this.userInfo) +
-          "&channelId=" +
-          item.liveUrl +
-          "&gradeId=" +
-          this.gradeId +
-          "&courseId=" +
-          this.courseId +
-          "&goodsId=" +
-          this.goodsId +
-          "&orderGoodsId=" +
-          this.orderGoodsId +
-          "&sectionId=" +
-          sectionId +
-          "&chapterId=" +
-          chapterId +
-          "&moduleId=" +
-          moduleId +
-          "&buyCourse=1" +
-          "&ident=" +
-          uuid
+        "/pages/live/index?token=" +
+        uni.getStorageSync("token") +
+        "&userInfo=" +
+        JSON.stringify(this.userInfo) +
+        "&channelId=" +
+        item.liveUrl +
+        "&gradeId=" +
+        this.gradeId +
+        "&courseId=" +
+        this.courseId +
+        "&goodsId=" +
+        this.goodsId +
+        "&orderGoodsId=" +
+        this.orderGoodsId +
+        "&sectionId=" +
+        sectionId +
+        "&chapterId=" +
+        chapterId +
+        "&moduleId=" +
+        moduleId +
+        "&buyCourse=1" +
+        "&ident=" +
+        uuid
       );
       uni.navigateTo({
         url: `../../pages/webview/index?url=` + encode,
@@ -1493,7 +1362,7 @@ export default {
           fromPlat: 1, //来源平台 1小程序 2PC网站
           goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
         },
-      }).then((res) => {});
+      }).then((res) => { });
     },
     timeupdate(time) {
       if (this.noticeShow) {
@@ -1727,6 +1596,7 @@ export default {
 
 <style lang="scss" scope>
 @import "./css/detail.scss";
+
 .top {
   &__header {
     position: relative;
@@ -1760,10 +1630,12 @@ export default {
     }
   }
 }
+
 #top {
   position: relative;
   z-index: 99;
 }
+
 .polyv_detail {
   display: flex;
   flex-direction: column;
@@ -1771,6 +1643,7 @@ export default {
   position: relative;
   top: 0;
   left: 0;
+
   .pops {
     position: absolute;
     top: 0;
@@ -1781,14 +1654,17 @@ export default {
     height: 300rpx;
     z-index: 9999;
   }
+
   .box {
     flex: 1;
     overflow: hidden;
     margin: 16rpx 16rpx 100rpx 16rpx;
+
     .box_in {
       height: 100%;
     }
   }
+
   .first_ml {
     margin: 16rpx 16rpx 16rpx 16rpx;
   }
@@ -1802,6 +1678,7 @@ export default {
 page {
   background: #eaeef1;
 }
+
 .ts {
   font-size: 24rpx;
   color: #999;
@@ -1809,6 +1686,7 @@ page {
   padding-right: 29rpx;
   padding-left: 34rpx;
 }
+
 .content {
   padding: 24rpx;
   text-align: left;
@@ -1818,10 +1696,12 @@ page {
   font-size: 22rpx;
   color: #000000;
 }
+
 .sc {
   width: 29rpx;
   height: 29rpx;
 }
+
 .buy {
   width: 138rpx;
   height: 48rpx;
@@ -1835,6 +1715,7 @@ page {
   position: absolute;
   right: 30rpx;
 }
+
 .video_body {
   padding-bottom: 96rpx;
 }
@@ -1845,6 +1726,7 @@ page {
   text-align: center;
   margin: 10rpx 0;
 }
+
 .t2 {
   font-size: 24rpx;
   font-family: PingFang SC;
@@ -1852,6 +1734,7 @@ page {
   line-height: 36rpx;
   margin: 15rpx;
 }
+
 .r_t2 {
   width: 201rpx;
   height: 49rpx;
@@ -1865,6 +1748,7 @@ page {
   align-items: center;
   padding: 5rpx;
 }
+
 .scroll_box {
   width: 100%;
   height: 60rpx;
@@ -1874,15 +1758,18 @@ page {
   overflow: hidden;
   margin: 15rpx 0;
 }
+
 .r_sliper {
   padding: 0 20rpx;
 }
+
 .top_line {
   width: 6rpx;
   height: 22rpx;
   background: #32467b;
   margin-right: 10rpx;
 }
+
 .video_t2 {
   font-size: 24rpx;
   font-family: PingFang SC;
@@ -1900,6 +1787,7 @@ page {
   bottom: 0;
   margin: auto;
 }
+
 .video_box {
   position: relative;
 }
@@ -1922,6 +1810,7 @@ page {
       font-weight: bold;
       margin-bottom: 24rpx;
     }
+
     .text {
       height: 340rpx;
       line-height: 40rpx;
@@ -1929,6 +1818,7 @@ page {
       font-size: 32rpx;
       color: #222;
     }
+
     .had_read {
       width: 100%;
       height: 88rpx;
@@ -1940,6 +1830,7 @@ page {
       font-weight: 500;
       color: #fff;
       margin-top: 20rpx;
+
       &.gray {
         background: #bbbec5;
       }