谢杰标 пре 2 година
родитељ
комит
33cefd122d

+ 0 - 1
components/course/courseSection.vue

@@ -207,7 +207,6 @@ export default {
 
     this.isBuy &&
       uni.$on("playEnd", () => {
-        console.log("结束了");
         if (this.isActive) {
           this.$emit("playEnd");
         }

+ 7 - 0
components/myPlayer/polyvPlayer.vue

@@ -149,6 +149,10 @@ export default {
       });
     },
     wxStatechange(newstate) {
+      console.log(
+        "🚀 ~ file: polyvPlayer.vue:152 ~ wxStatechange ~ newstate:",
+        newstate
+      );
       polyvPlayerContext = this.selectComponent("#playerVideo");
       // ["playing", "pause", "ended","error"]
       let state = newstate.detail.newstate;
@@ -311,6 +315,9 @@ export default {
     },
     // 暂停播放
     playPause() {
+      if (!polyvPlayerContext) {
+        return;
+      }
       // #ifdef MP-WEIXIN
       polyvPlayerContext.pause();
       // #endif

+ 0 - 12
pages.json

@@ -903,18 +903,6 @@
             }
           }
         },
-        {
-          "path": "courseTopic/goodsTopic",
-          "style": {
-            "navigationBarTitleText": "选课中心",
-            "navigationBarBackgroundColor": "#0386FD",
-            "navigationStyle": "custom", // 隐藏系统导航栏
-            "app-plus": {
-              "titleNView": false, //禁用原生导航栏
-              "bounce": "none"
-            }
-          }
-        },
         {
           "path": "shopping/shoppingCart",
           "style": {

+ 46 - 37
pages3/polyv/detail.vue

@@ -296,6 +296,7 @@ import noteBox from "@/components/course/noteBox.vue";
 import answerBox from "@/components/course/answerBox.vue";
 import { mapGetters, mapMutations } from "vuex";
 import { lockAction } from "../../utils/lock";
+import { debounce, reload } from "../../utils/common";
 export default {
   components: {
     handoutsBox,
@@ -375,6 +376,7 @@ export default {
       isHaverebuild: false,
       isPlaying: false,
       beforeHideIsPlaying: false,
+      text: "",
     };
   },
   computed: {
@@ -443,40 +445,41 @@ export default {
     this.courseId = Number(id) || "";
     this.goodsId = Number(goodsId);
     this.gradeId = Number(gradeId);
+    uni.addInterceptor("navigateTo", {
+      success: () => {
+        this.isCache = true;
+      },
+    });
     if (skipPort) {
       await this.$method.skipLogin(skipPort);
     }
     if (this.$method.isGoLogin()) {
       return;
     }
-    lockAction();
-    this.lockTimer = setInterval(lockAction, 10000);
+    if (!this.lockTimer) {
+      lockAction();
+      this.lockTimer = setInterval(lockAction, 10000);
+    }
+
     // 公众号模板消息的数据埋点
     informId && this.clickOfficial(informId);
-    uni.addInterceptor("navigateTo", {
-      success: () => {
-        this.isCache = true;
-      },
-    });
     this.init();
   },
   async onShow() {
     if (this.isCache) {
       console.log("返回刷新数据");
       this.isCache = false;
-      // #ifdef H5
-      location.reload();
-      // #endif
+      reload(this.option);
       // #ifdef MP-WEIXIN
       this.sectionItem = {};
-      this.init();
       // #endif
       return;
     }
+
     if (this.beforeHideIsPlaying) {
       console.log("显示重新播放");
-      // 二建二造提示弹出来
-      if (this.playSecIsLearn && this.erJianErZao && this.pauseTimer == null) {
+      if (this.text) {
+        this.refPlv.playPause();
         return;
       }
       this.refPlv.resumeVideo();
@@ -492,7 +495,6 @@ export default {
     if (this.isPlaying) {
       this.refPlv.playPause();
     }
-    this.originUnload();
   },
   mounted() {},
   methods: {
@@ -679,29 +681,28 @@ export default {
           return;
         }
         this.pauseTime = Date.now();
-        console.log("开启定时器");
         this.pauseTimer = setInterval(() => {
           console.log("暂停时间", Date.now() - this.pauseTime, this.pauseTime);
-          if (Date.now() - this.pauseTime > 1 * 60 * 1000) {
+          if (Date.now() - this.pauseTime > 20 * 1000) {
             // 5 * 60 * 1000
-            let text = "暂停";
+            this.refPlv.exitFullScreen();
+            this.text = "暂停";
             if (this.showCamera) {
-              text = "拍照停留";
+              this.text = "拍照停留";
               this.closeCamera();
             }
             uni.showModal({
               title: "提示",
               showCancel: false,
-              content: `检测${text}时间过长,刷新当前页面`,
+              content: `检测${this.text}时间过长,刷新当前页面`,
               cancelText: "取消",
               confirmText: "确定",
               success: (res) => {
                 if (res.confirm) {
-                  // #ifdef H5
-                  location.reload();
-                  // #endif
+                  this.text = "";
+                  reload(this.option);
                   // #ifdef MP-WEIXIN
-                  this.courseCourseList();
+                  this.sectionItem = {};
                   // #endif
                 }
               },
@@ -726,18 +727,23 @@ export default {
     },
     // 原来的mouted内容
     originMounted() {
-      uni.$on("getSection", (item) => {
-        if (!this.refPlv) {
-          this.refPlv = this.$refs.player;
-        }
-        this.postStudyRecord(0);
-        //清除直播
-        this.studyTimer && clearInterval(this.studyTimer);
-        this.photoConfig = false;
-        this.moduleId = item.moduleId || null;
-        this.chapterId = item.chapterId || null;
-        this.playVideo(item);
-      });
+      uni.$on(
+        "getSection",
+        debounce((item) => {
+          if (!this.refPlv) {
+            this.refPlv = this.$refs.player;
+          }
+          this.refPlv.playPause();
+          this.postStudyRecord(0);
+          //清除直播
+          this.studyTimer && clearInterval(this.studyTimer);
+          this.photoConfig = false;
+          this.photoList = [];
+          this.moduleId = item.moduleId || null;
+          this.chapterId = item.chapterId || null;
+          this.playVideo(item);
+        })
+      );
       uni.$on("isRebuild", (item) => {
         this.isRebuild = item;
       });
@@ -1211,7 +1217,7 @@ export default {
     },
     //配置随机拍照时间
     configPhoto(duration) {
-      if (this.photoConfig) {
+      if (this.photoConfig && this.photoList.length) {
         return;
       }
       let totalVideoTime = this.refPlv.getDuration();
@@ -1495,7 +1501,6 @@ export default {
         return;
       }
       this.playTime = time;
-      this.clearPauseTimer();
       this.timeEvent(time);
     },
     playing() {
@@ -1504,12 +1509,14 @@ export default {
       if (!this.videoCurrentTime) {
         this.postStudyRecord(0);
       }
+      this.clearPauseTimer();
       this.studyTimer && clearInterval(this.studyTimer);
       this.studyTimer = setInterval(() => {
         this.postStudyRecord(0);
       }, 15000);
     },
     openCamera() {
+      console.log("拍照");
       this.showCamera = true;
       this.$refs["camera"].openCamera();
       this.refPlv.playPause();
@@ -1520,6 +1527,7 @@ export default {
       this.$refs["camera"].closeCamera();
     },
     pause() {
+      console.log("暂停");
       this.isPlaying = false;
       this.erJianErZaoPauseTip();
       clearInterval(this.studyTimer);
@@ -1531,6 +1539,7 @@ export default {
         icon: "none",
         title: "播放完毕",
       });
+      this.clearPauseTimer();
       clearInterval(this.studyTimer);
       await this.postStudyRecord(1);
       this.nextSection();

+ 0 - 504
pages4/courseTopic/goodsTopic.vue

@@ -1,504 +0,0 @@
-<template>
-    <view class="goods_topic">
-        <nav-bar title="选课中心"></nav-bar>
-        <view class="banner_header">
-            <image class="ban_img" src="../static/topic/banner_bg.png"></image>
-            <view class="selects" @click="back()">
-                <view class="titles">
-                    考前培训:二级建造师
-                </view>
-                <view class="icons">
-                    <u-icon name="arrow-right" color="#3E4055" size="26"></u-icon>
-                </view>
-            </view>
-            <view class="imgs">
-                <image class="banner" src="../static/topic/banner.png"></image>
-            </view>
-        </view>
-        <view class="mains">
-            <view class="titles">
-                <image class="code" src="@/static/learn/act_icon.png" ></image>
-                <text class="title">免费试听</text>
-            </view>
-            <view class="pictures" @click="toDetail()">
-                <view class="pic_imgs">
-                    <image v-if="goodsInfo.goodsCoverUrl" :src="$method.splitImgHost(goodsInfo.goodsCoverUrl)" class="basic_img"></image>
-                    <image v-else class="basic_img" src="../static/topic/basic.png" ></image>
-                </view>
-                <view class="pic_title">{{ goodsInfo.goodsName }}</view>
-            </view>
-            <view class="titles">
-                <image class="code" src="@/static/learn/act_icon.png" ></image>
-                <text class="title">推荐课程</text>
-            </view>
-            <view class="courses">
-                <view v-for="(item, index) in  courseName" :key="index" class="cou_items"
-                 :class="{nactive: courseNum == index}" @click="tochangeCourse(item, index)">{{ item.name }}</view>
-            </view>
-            <view class="lines"></view>
-            <view class="course_list">
-                <view class="clist_item">
-                    <image v-if="courseNum == 0" class="type_img" src="../static/topic/type1_one.jpg" ></image>
-                    <image v-if="courseNum == 1" class="type_img" src="../static/topic/type2_one.png" ></image>
-                    <image v-if="courseNum == 2" class="type_img" src="../static/topic/type3_one.png" ></image>
-                    <view class="type_right">
-                        <view class="type_title">全科</view>
-                        <view class="type_down">
-                            <view class="prices">{{ ['¥980', '¥1280', '¥1980'][courseNum]}}</view>
-                            <view v-if="!hideBuyState" class="tobuy" @click="togoBuy(1)">立即购买</view>
-                        </view>
-                    </view>
-                </view>
-                <view class="clist_item">
-                    <image v-if="courseNum == 0" class="type_img" src="../static/topic/type1_two.jpg" ></image>
-                    <image v-if="courseNum == 1" class="type_img" src="../static/topic/type2_two.png" ></image>
-                    <image v-if="courseNum == 2" class="type_img" src="../static/topic/type3_two.png" ></image>
-                    <view class="type_right">
-                        <view class="type_title">公共单科</view>
-                        <view class="type_down">
-                            <view class="prices">{{ ['¥350', '¥450', '¥700'][courseNum]}}</view>
-                            <view v-if="!hideBuyState" class="tobuy" @click="togoBuy(2)">立即购买</view>
-                        </view>
-                    </view>
-                </view>
-                <view class="clist_item">
-                    <image v-if="courseNum == 0" class="type_img" src="../static/topic/type1_three.jpg" ></image>
-                    <image v-if="courseNum == 1" class="type_img" src="../static/topic/type2_three.png" ></image>
-                    <image v-if="courseNum == 2" class="type_img" src="../static/topic/type3_three.png" ></image>
-                    <view class="type_right">
-                        <view class="type_title">实务单科</view>
-                        <view class="type_down">
-                            <view class="prices">{{ ['¥500', '¥700', '¥900'][courseNum]}}</view>
-                            <view v-if="!hideBuyState" class="tobuy" @click="togoBuy(3)">立即购买</view>
-                        </view>
-                    </view>
-                </view>
-            </view>
-
-            <view class="titles">
-                <image class="code" src="@/static/learn/act_icon.png" ></image>
-                <text class="title">详情</text>
-            </view>
-            <view class="details">
-                <image v-if="courseNum == 0" class="detail_img" src="../static/topic/type1_detail.png" ></image>
-                <image v-if="courseNum == 1" class="detail_img" src="../static/topic/type2_detail.png" ></image>
-                <image v-if="courseNum == 2" class="detail_img" src="../static/topic/type3_detail.png" ></image>
-            </view>
-        </view>
-
-        <!-- 弹窗 -->
-        <u-popup v-model="toggleCourseShow" mode="bottom" border-radius="40">
-			<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>
-                    </view>
-                </view>
-                <view class="pop_prices">
-                    <text v-if="skuItem.standPrice || skuItem.standPrice == 0" class="price">¥ {{ skuItem.standPrice || 0 }}</text>
-                    <text v-if="skuItem.linePrice" class="lin_price">¥ {{ skuItem.linePrice }}</text>
-                </view>
-                <view class="check_con">
-                    <scroll-view scroll-y="true" style="height: 550rpx;">
-                        <view class="course_items" v-for="(item, index) in courseSku" :key="index" :class="{nactive: skuIndex == index}" @click="selectSku(item, index)">
-                            {{ item.goodsName }}
-                        </view>
-                    </scroll-view>
-                </view>
-                <view v-if="!hideBuyState" class="right_now" @click="rightNowBuy()">立即购买</view>
-			</view>
-		</u-popup>
-    </view>
-</template>
-
-<script>
-import { mapGetters  } from 'vuex'
-export default {
-    name: 'goodsTopic',
-    data() {
-        return {
-            courseName: [
-                {
-                    name: '黄金基础班',
-                    type: 1
-                },
-                {
-                    name: '钻石强化班',
-                    type: 2
-                },
-                {
-                    name: '至尊私塾班',
-                    type: 3
-                }
-            ],
-            courseNum: 0,
-            topicId: '',
-            goodsInfo: {},
-            toggleCourseShow: false,
-            courseSku: [],
-            skuItem: {},
-            skuIndex: -1,
-        }
-    },
-    computed: { ...mapGetters(['hideBuyState']) },
-    onLoad(option) {
-        if (option.scene) {
-            let tid = decodeURIComponent(option.scene)
-            this.topicId = tid.split('=')[1]
-            
-        } else {
-            this.topicId = option.topicId
-        }
-        console.log('topicId: ', this.topicId)
-        this.getgoodsInfo()
-    },
-    methods: {
-        getgoodsInfo() {
-            this.$http({
-                url: `/app/common/get/goodsInfo/${this.topicId}`,
-                method: 'get',
-                noToken: true
-            }).then((res) => {
-                if (res.data.code == 200) {
-                    this.goodsInfo = res.data.data
-                }
-            })
-        },
-        tochangeCourse(item, index) {
-            console.log(item, index)
-            this.courseNum = index
-        },
-        back() {
-            uni.navigateBack()
-        },
-        toDetail() {
-            if (this.goodsInfo.goodsType == 2) {
-                uni.navigateTo({
-                    url: '/pages2/bank/detail?id='+this.goodsInfo.goodsId
-                })
-            } else {
-                // /pages5/liveDetail/index
-                uni.navigateTo({
-                    url: '/pages3/course/detail?id='+ this.goodsInfo.goodsId + '&goodsType=' + this.goodsInfo.goodsType
-                })
-            }
-        },
-        closePop() {
-            this.toggleCourseShow = false
-        },
-        togoBuy(subjectType) {
-            this.skuItem = {}
-            this.skuIndex = -1
-            this.$http({
-                url: '/app/common/get/goodsList',
-                method: 'get',
-                noToken: true,
-                data: {
-                    subjectType: subjectType,
-                    topicId: this.topicId,
-                    type: this.courseNum + 1
-                }
-            }).then((res) => {
-                if (res.data.code == 200) {
-                    this.toggleCourseShow = true
-                    this.courseSku = res.data.data || []
-                } else {
-                    this.$u.toast(res.data.msg)
-                }
-            })
-        },
-        selectSku(item, index) {
-            console.log('defhd', item, index)
-            this.skuItem = item
-            this.skuIndex = index
-        },
-        rightNowBuy() {
-            if (Object.keys(this.skuItem).length == 0) {
-                this.$u.toast('请选择科目')
-                return
-            }
-            if(this.$method.isGoLogin()){
-				return
-			}
-			this.$navTo.togo('/pages2/order/confirm_list?id='+this.skuItem.goodsId)
-        }
-    }
-}
-</script>
-
-
-<style lang="scss" scoped>
-@mixin dis_center {
-    display: flex;
-    align-items: center;
-    justify-content: center;
-}
-@mixin dis_around {
-    display: flex;
-    align-items: center;
-    justify-content: space-around;
-}
-.goods_topic {
-    width: 100%;
-    height: 100%;
-    background: linear-gradient(180deg, #f1f4f9 0%, #DFECFD 100%);
-    .banner_header {
-        height: 378rpx;
-        position: relative;
-        top: 0rpx;
-        left: 0rpx;
-        .ban_img {
-            width: 100%;
-            height: 378rpx;
-            position: absolute;
-            top: 0rpx;
-            left: 0rpx;
-            z-index: 99;
-        }
-        .selects {
-            margin: 32rpx 0rpx 0rpx 40rpx;
-            width: 370rpx;
-            height: 64rpx;
-            background: rgba(255,255,255,0.6);
-            border-radius: 160rpx;
-            // opacity: 0.6;
-            @include dis_around();
-            position: absolute;
-            top: 0rpx;
-            left: 0rpx;
-            z-index: 100;
-            .icons {
-                width: 36rpx;
-                height: 36rpx;
-                background: #FFFFFF;
-                border-radius: 50%;
-                @include dis_center();
-            }
-        }
-        .imgs {
-            position: absolute;
-            bottom: 0rpx;
-            left: 0rpx;
-            z-index: 100;
-            margin-left: 40rpx;
-        }
-        .banner {
-            width: 670rpx;
-            height: 250rpx;
-            display: block;
-            border-radius: 20rpx;
-        }
-    }
-    
-    .mains {
-        padding: 0rpx 40rpx 40rpx 40rpx;
-        .titles {
-            margin: 72rpx 0rpx 0rpx 10rpx;
-            .code {
-                width: 38rpx;
-                height: 24rpx;
-            }
-            .title {
-                font-size: 40rpx;
-                font-family: OPPOSans-Bold, OPPOSans;
-                font-weight: bold;
-                color: #222222;
-                margin-left: 14rpx;
-            }
-        }
-        .pictures {
-            width: 100%;
-            height: 522rpx;
-            margin-top: 32rpx;
-            .pic_imgs {
-                width: 100%;
-                height: 374rpx;
-                border-radius: 24rpx 24rpx 0rpx 0rpx;
-                .basic_img {
-                    width: 100%;
-                    height: 374rpx;
-                    border-radius: 24rpx 24rpx 0rpx 0rpx;
-                }
-            }
-            .pic_title {
-                width: 100%;
-                height: 148rpx;
-                background: #FFFFFF;
-                border-radius: 0rpx 0rpx 24rpx 24rpx;
-                font-size: 32rpx;
-                font-family: OPPOSans-Bold, OPPOSans;
-                font-weight: bold;
-                color: #222222;
-                padding: 32rpx;
-            }
-        }
-        .courses {
-            margin-top: 44rpx;
-            display: flex;
-            align-items: center;
-            height: 78rpx;
-            .cou_items {
-                font-size: 28rpx;
-                color: #969696;
-                margin-right: 48rpx;
-                position: relative;
-                top: 0rpx;
-                left: 0rpx;
-                &:nth-child(1) {
-                    margin-left: 16rpx;
-                }
-                &.nactive {
-                    font-size: 32rpx;
-                    font-weight: bold;
-                    color: #498AFE;
-                    &::after {
-                        content: '';
-                        position: absolute;
-                        bottom: -18rpx;
-                        left: 60rpx;
-                        width: 32rpx;
-                        height: 8rpx;
-                        background: #498AFE;
-                        border-radius: 180rpx;
-                    }
-                }
-                
-            }
-        }
-        .lines {
-            width: 100%;
-            height: 2rpx;
-            background: #FFFFFF;
-        }
-        .course_list {
-            width: 100%;
-            padding: 40rpx 32rpx;
-            background: #fff;
-            border-radius: 14rpx;
-            margin-top: 40rpx;
-            .clist_item {
-                height: 120rpx;
-                margin-bottom: 48rpx;
-                display: flex;
-                &:last-child {
-                    margin-bottom: 0rpx;
-                }
-                .type_img {
-                    width: 212rpx;
-                    height: 120rpx;
-                    margin-right: 24rpx;
-                    border-radius: 18rpx;
-                }
-                .type_title {
-                    font-size: 32rpx;
-                    font-weight: 500;
-                    color: #222222;
-                }
-                .type_down {
-                    width: 370rpx;
-                    margin-top: 24rpx;
-                    @include dis_center();
-                    justify-content: space-between;
-                }
-                .prices {
-                    font-size: 36rpx;
-                    font-weight: 500;
-                    color: #F67205;
-                }
-                .tobuy {
-                    width: 144rpx;
-                    height: 52rpx;
-                    line-height: 52rpx;
-                    text-align: center;
-                    background: #FFB102;
-                    border-radius: 16rpx;
-                    font-size: 26rpx;
-                    font-weight: 500;
-                    color: #FFFFFF;
-                }
-            }
-        }
-
-        .details {
-            width: 100%;
-            height: 5035rpx;
-            margin-top: 32rpx;
-            .detail_img {
-                width: 100%;
-                height: 100%;
-                display: block;
-            }
-        }
-    }
-
-    // 弹窗
-.popup_box {
-    width: 100%;
-    height: 938rpx;
-    padding: 56rpx 56rpx 0rpx;
-    .pop_prices {
-        margin-top: 50rpx;
-        margin-bottom: 40rpx;
-        .types {
-            font-size: 32rpx;
-            font-weight: bold;
-            color: #222222;
-            margin-right: 24rpx;
-        }
-        .price {
-            font-size: 36rpx;
-            font-weight: 500;
-            color: #F67205;
-        }
-        .lin_price {
-            color: #999999;
-            font-size: 30rpx;
-            text-decoration:line-through;
-            margin-left: 10rpx;
-        }
-    }
-    .headers {
-      width: 100%;
-      display: flex;
-      align-items: center;
-      justify-content: space-between;
-      .grade {
-        font-size: 40rpx;
-        font-weight: bold;
-        color: #222222;
-      }
-    }
-    .course_items {
-        width: 100%;
-        height: 96rpx;
-        background: #F8F8F8;
-        border-radius: 24rpx;
-        padding: 30rpx 32rpx;
-        font-size: 28rpx;
-        color: #222222;
-        margin-bottom: 32rpx;
-        &.nactive {
-            background: #D5E4FF;
-            color: #3F8DFD;
-        }
-        &:last-child {
-            margin-bottom: 0rpx;
-        }
-    }
-    
-    .right_now {
-        width: 100%;
-        height: 92rpx;
-        line-height: 92rpx;
-        text-align: center;
-        background: #3F8DFD;
-        border-radius: 120rpx;
-        font-size: 32rpx;
-        font-weight: 500;
-        color: #FFFFFF;
-    }
-    
-  }
-}
-</style>

BIN
pages4/static/topic/banner.png


BIN
pages4/static/topic/banner_bg.png


BIN
pages4/static/topic/basic.png


BIN
pages4/static/topic/icon_play.png


BIN
pages4/static/topic/type1_detail.png


BIN
pages4/static/topic/type1_one.jpg


BIN
pages4/static/topic/type1_three.jpg


BIN
pages4/static/topic/type1_two.jpg


BIN
pages4/static/topic/type2_detail.png


BIN
pages4/static/topic/type2_one.png


BIN
pages4/static/topic/type2_three.png


BIN
pages4/static/topic/type2_two.png


BIN
pages4/static/topic/type3_detail.png


BIN
pages4/static/topic/type3_one.png


BIN
pages4/static/topic/type3_three.png


BIN
pages4/static/topic/type3_two.png


+ 30 - 0
utils/common.js

@@ -0,0 +1,30 @@
+export function debounce(func, wait = 3000, immediate = true) {
+  let timeout;
+  return function () {
+    const context = this;
+    const args = [...arguments];
+    if (timeout) clearTimeout(timeout);
+    if (immediate) {
+      const callNow = !timeout;
+      timeout = setTimeout(() => {
+        timeout = null;
+      }, wait);
+      if (callNow) func.apply(context, args);
+    } else {
+      timeout = setTimeout(() => {
+        func.apply(context, args);
+      }, wait);
+    }
+  };
+}
+
+export function reload(option = {}) {
+  // #ifdef H5
+  location.reload();
+  // #endif
+  // #ifdef MP-WEIXIN
+  const pages = getCurrentPages();
+  const perpage = pages[pages.length - 1];
+  perpage.onLoad(option);
+  // #endif
+}