Browse Source

播放器基本抽取完成

谢杰标 2 years ago
parent
commit
45836592d0

+ 0 - 19
components/course/courseSection.vue

@@ -278,10 +278,6 @@ export default {
                   ? self.nextMenuItem.sectionId
                   : self.nextMenuItem.menuId;
               //设置播放的节ID
-              self.$store.commit("setPlaySectionId", { playSectionId: nextId });
-              self.$store.commit("setPlayVID", {
-                playVID: self.nextMenuItem.recordingUrl,
-              });
               let ids = self.levelId.split("-");
               ids[2] = nextId;
               uni.$emit("levelId", ids.join("-"));
@@ -292,11 +288,6 @@ export default {
                 self.nextMenuItem.sectionId > 0
                   ? self.nextMenuItem.sectionId
                   : self.nextMenuItem.menuId;
-              //设置播放的节ID
-              self.$store.commit("setPlaySectionId", { playSectionId: nextId });
-              self.$store.commit("setPlayVID", {
-                playVID: self.nextMenuItem.recordingUrl,
-              });
               let ids = self.levelId.split("-");
               ids[2] = nextId;
               self.$emit("playEnd", { isRebuild: self.isRebuild });
@@ -520,12 +511,6 @@ export default {
             this.clickLock = false;
             return;
           } else {
-            this.$store.commit("setPlaySectionId", {
-              playSectionId: this.newId,
-            });
-            this.$store.commit("setPlayVID", {
-              playVID: this.menuItem.recordingUrl,
-            });
             this.menuItem.courseId = this.courseId;
             uni.$emit("getSection", this.menuItem);
             return;
@@ -605,10 +590,6 @@ export default {
         }
         // console.log('===设置播放的节IDthis.menuItem,', this.menuItem, this.playId);
         //设置播放的节ID
-        this.$store.commit("setPlaySectionId", { playSectionId: this.newId });
-        this.$store.commit("setPlayVID", {
-          playVID: this.menuItem.recordingUrl,
-        });
         this.$store.commit("updatePlayNextId", this.playId);
         uni.$emit("levelId", this.levelId);
         uni.$emit("getSection", this.menuItem);

+ 91 - 42
components/myPlayer/polyvPlayer.vue

@@ -12,7 +12,6 @@
         :custom-cache="false"
         :object-fit="'contain'"
         @statechange="wxStatechange"
-        @fullscreenchange="fullscreenchange"
         @error="playError"
         :autoplay="autoplay"
         :page-gesture="true"
@@ -34,9 +33,7 @@
         <cover-view class="video-toast">
           <cover-view class="video-toast__text"
             >您上次看到
-            {{
-              $method.secondToDate(videoCurrentTime)
-            }},正在自动续播</cover-view
+            {{ $method.secondToDate(vct) }},正在自动续播</cover-view
           >
           <cover-view class="video-toast__btn" @click="restart()"
             >从头播放</cover-view
@@ -49,11 +46,10 @@
 
 <script>
 var polyvPlayerContext = null;
-import { mapGetters } from "vuex";
 export default {
   name: "SaasMiniprogramPolyvPlayer",
   props: {
-    vid: {
+    playVid: {
       type: String,
       defaule: "",
     },
@@ -81,13 +77,21 @@ export default {
       barTimer: null,
       vodPlayerJs: "https://player.polyv.net/resp/vod-player/latest/player.js",
       videoToastShow: false,
+      enableAutoRotation: true,
+      hasStart: false,
+      config: null,
     };
   },
   mounted() {
-    // #ifdef MP-WEIXIN
-    polyvPlayerContext = this.selectComponent("#playerVideo");
-    console.log("🚀 ~ file: polyvPlayer.vue:89 ~ mounted ~ polyvPlayerContext:", polyvPlayerContext)
-    // #endif
+    if (this.vid) {
+      this.changeVid(this.vid);
+    }
+    if (this.vct > 0) {
+      this.videoToastShow = true;
+      setTimeout(() => {
+        this.closeToast();
+      }, 3000);
+    }
   },
   methods: {
     loadPlayerScript(callback) {
@@ -135,10 +139,23 @@ export default {
       });
     },
     wxStatechange(newstate) {
-      // ["playing", "pause", "ended"]
-      const state = newstate.detail.newstate;
+      console.log("lwxStatechange", newstate);
+      // ["playing", "pause", "ended","error"]
+      let state = newstate.detail.newstate;
+      if (state == "error") {
+        state = "playerError";
+      }
+      this[state] && this[state]();
       this.$emit(state);
     },
+    playing() {
+      // #ifdef MP-WEIXIN
+      polyvPlayerContext.seek(this.videoCurrentTime || 0);
+      // #endif
+    },
+    playerError(err) {
+      console.log("播放err", err);
+    },
     h5StateChange() {
       let states = {
         s2j_onPlayerInitOver: "onPlayerInitOver", // 播放器初始化完毕时触发
@@ -167,6 +184,8 @@ export default {
       }
     },
     seekVideo(time) {
+      console.log("🚀 ~ file: polyvPlayer.vue:173 ~ seekVideo ~ time:", time);
+      time = time || 0;
       // #ifdef MP-WEIXIN
       polyvPlayerContext.seek(time);
       // #endif
@@ -190,20 +209,18 @@ export default {
       return polyvPlayerContext.j2s_getCurrentTime();
       // #endif
     },
+    // 本次看的时长
     playVideoTime() {
       if (!polyvPlayerContext) {
         return 0;
       }
       // #ifdef MP-WEIXIN
-      return polyvPlayerContext.getCurrentTime(); //获取视频当前的播放时刻
+      return polyvPlayerContext.getVideoPlayDuration();
       // #endif
       // #ifdef H5
-      return polyvPlayerContext.j2s_getCurrentTime(); //当前视频播放时刻
+      return polyvPlayerContext.j2s_realPlayVideoTime();
       // #endif
     },
-
-    // 本次看的时长
-
     // 暂停播放
     playPause() {
       // #ifdef MP-WEIXIN
@@ -213,6 +230,7 @@ export default {
       polyvPlayerContext.j2s_pauseVideo();
       // #endif
     },
+    // 退出全屏
     exitFullScreen() {
       // #ifdef MP-WEIXIN
       polyvPlayerContext.exitFullScreen();
@@ -223,12 +241,28 @@ export default {
     },
     onPlayerInitOver() {
       uni.$on("playPause", this.playPause);
+      this.$emit("loadedmetadata", polyvPlayerContext);
     },
-    onPlayStart() {
-      this.loadedmetadata();
+    onPlayStart() {},
+    loadedmetadata() {
+      if (this.hasStart) {
+        // 防止loadedmetadata事件第二次触发
+        return;
+      }
+      this.hasStart = true;
+      setTimeout(() => {
+        this.hasStart = false;
+      }, 3000);
+      // #ifdef MP-WEIXIN
+      polyvPlayerContext = this.selectComponent("#playerVideo");
+      // #endif
+      this.onPlayerInitOver();
     },
-    loadedmetadata() {},
-    changeVid() {
+    changeVid(data) {
+      if (!data) {
+        return;
+      }
+      this.config = this.$method.isObject(data) ? data : { vid: data };
       if (!this.vid) {
         return;
       }
@@ -236,7 +270,10 @@ export default {
       this.loadPlayerScript(this.loadPlayer);
       // #endif
       // #ifdef MP-WEIXIN
-      polyvPlayerContext.changeVid(this.vid);
+      if (polyvPlayerContext) {
+        polyvPlayerContext.changeVid(this.vid);
+        this.seekVideo(this.videoCurrentTime);
+      }
       // #endif
     },
     closeToast() {
@@ -249,29 +286,39 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(["playSectionId"]),
-  },
-  watch: {
-    playSectionId: {
-      handler(id, oldId) {
-        if (id) {
-          this.changeVid();
-        }
-      },
-      immediate: true,
+    vid() {
+      return this.config ? this.config.vid : this.playVid;
     },
-    videoCurrentTime: {
-      handler(time) {
-        if (time > 0) {
-          this.videoToastShow = true;
-          setTimeout(() => {
-            this.closeToast();
-          }, 3000);
-        }
-      },
-      immediate: true,
+    vct() {
+      return (
+        (this.config ? this.config.videoCurrentTime : this.videoCurrentTime) ||
+        0
+      );
     },
   },
+  watch: {
+    // vid: {
+    //   handler(id, oldId) {
+    //     console.log("🚀 ~ file: polyvPlayer.vue:271 ~ handler ~ vid:", id);
+    //     if (id) {
+    //       this.changeVid();
+    //     }
+    //   },
+    //   immediate: true,
+    // },
+    // videoCurrentTime: {
+    //   handler(time) {
+    //     console.log("🚀 ~ file: polyvPlayer.vue:285 ~ handler ~ time:", time);
+    //     if (time > 0) {
+    //       this.videoToastShow = true;
+    //       setTimeout(() => {
+    //         this.closeToast();
+    //       }, 3000);
+    //     }
+    //   },
+    //   immediate: true,
+    // },
+  },
 };
 </script>
 
@@ -281,6 +328,8 @@ export default {
   #playerVideo {
     position: relative;
     z-index: 99;
+    width: 200rpx;
+    height: 200rpx;
   }
   .video-toast {
     position: absolute;

+ 3 - 1
pages.json

@@ -1173,7 +1173,9 @@
     "navigationBarTitleText": "WeChat",
     "navigationBarBackgroundColor": "#F8F8F8",
     "backgroundColor": "#F8F8F8",
-    "usingComponents": {}
+    "usingComponents": {
+      "polyv-player": "plugin://polyv-player/player"
+    }
   },
   "tabBar": {
     "color": "#AAAAAA",

+ 680 - 556
pages2/msg/detail.vue

@@ -1,592 +1,716 @@
 <template>
-	<view>
-		<nav-bar title="消息详情"></nav-bar>
-		<view class="item">
-			<view class="title">{{ getTitleName()  }}</view>
-			<view class="time">{{ $method.timestampToTime(listData.sendTime, false) }}</view>
-			<view v-if="listData.systemStatus === 2" class="content" v-html="listData.informVo.affiche" style="width: 100%;"></view>
-			<view v-if="listData.systemStatus === 1" class="content" style="width: 100%;">{{ listData.text }}</view>
-			<view class="boxstistyle" v-if="listData.informVo">
-				<view class="lsow" style="border-bottom: 1rpx solid #eee;margin-top: 10rpx;" v-for="(item, index) in listData.informVo.informCourseVo" :key="index">
-					<view class="h4">{{ item.goodsName }}</view>
-					<view class="h33">
-						{{ item.courseName }}{{ item.moduleName ? '/' + item.moduleName : '' }}{{ item.chapterName ? '/' + item.chapterName : '' }}{{ item.sectionName }}
-					</view>
-					<view style="display: flex;align-items: center;margin:28rpx 0rpx;" @click="jumpSection(item)">
-						<image style="width: 35rpx;height: 35rpx;" src="@/static/courseIcon.png" mode=""></image>
-						<text class="timeStys">{{ $method.secondToTime(item.topicNum,false) }}</text>
-						<text class="aSty">点击可直接跳转</text>
-					</view>
-				</view>
-				<view class="lsow" style="border-bottom: 1rpx solid #eee;margin-top: 10rpx;" v-for="(item, index) in listData.informVo.informExamVo" :key="index">
-					<view class="h4">{{ item.goodsName }}</view>
-					<view class="h33">{{ item.moduleName ? '/' + item.moduleName : '' }}{{ item.chapterName ? '/' + item.chapterName : '' }}{{ item.examName }}</view>
-					<view style="display: flex;align-items: center;margin:28rpx 0rpx;" @click="jumpExam(item)">
-						<image style="width: 35rpx;height: 35rpx;" src="@/static/examIcon.png" mode=""></image>
-						<text class="timeStys">第{{ item.topicNum }}道题</text>
-						<text class="aSty">点击可直接跳转</text>
-					</view>
-				</view>
-			</view>
-		</view>
-		<view class="btn1" @click="isOk" v-if="listData.systemStatus === 2 && listData.receiptStatus === 0">我已阅读</view>
-		<view class="btn1" v-if="statusGO && listData.systemStatus === 1 && getNames(listData.remindId) !== ''" @click="jumpFuns(goodsData,listData.remindId)">{{ getNames(listData.remindId) }}</view>
-	</view>
+  <view>
+    <nav-bar title="消息详情"></nav-bar>
+    <view class="item">
+      <view class="title">{{ getTitleName() }}</view>
+      <view class="time">{{
+        $method.timestampToTime(listData.sendTime, false)
+      }}</view>
+      <view
+        v-if="listData.systemStatus === 2"
+        class="content"
+        v-html="listData.informVo.affiche"
+        style="width: 100%"
+      ></view>
+      <view
+        v-if="listData.systemStatus === 1"
+        class="content"
+        style="width: 100%"
+        >{{ listData.text }}</view
+      >
+      <view class="boxstistyle" v-if="listData.informVo">
+        <view
+          class="lsow"
+          style="border-bottom: 1rpx solid #eee; margin-top: 10rpx"
+          v-for="(item, index) in listData.informVo.informCourseVo"
+          :key="index"
+        >
+          <view class="h4">{{ item.goodsName }}</view>
+          <view class="h33">
+            {{ item.courseName
+            }}{{ item.moduleName ? "/" + item.moduleName : ""
+            }}{{ item.chapterName ? "/" + item.chapterName : ""
+            }}{{ item.sectionName }}
+          </view>
+          <view
+            style="display: flex; align-items: center; margin: 28rpx 0rpx"
+            @click="jumpSection(item)"
+          >
+            <image
+              style="width: 35rpx; height: 35rpx"
+              src="@/static/courseIcon.png"
+              mode=""
+            ></image>
+            <text class="timeStys">{{
+              $method.secondToTime(item.topicNum, false)
+            }}</text>
+            <text class="aSty">点击可直接跳转</text>
+          </view>
+        </view>
+        <view
+          class="lsow"
+          style="border-bottom: 1rpx solid #eee; margin-top: 10rpx"
+          v-for="(item, index) in listData.informVo.informExamVo"
+          :key="index"
+        >
+          <view class="h4">{{ item.goodsName }}</view>
+          <view class="h33"
+            >{{ item.moduleName ? "/" + item.moduleName : ""
+            }}{{ item.chapterName ? "/" + item.chapterName : ""
+            }}{{ item.examName }}</view
+          >
+          <view
+            style="display: flex; align-items: center; margin: 28rpx 0rpx"
+            @click="jumpExam(item)"
+          >
+            <image
+              style="width: 35rpx; height: 35rpx"
+              src="@/static/examIcon.png"
+              mode=""
+            ></image>
+            <text class="timeStys">第{{ item.topicNum }}道题</text>
+            <text class="aSty">点击可直接跳转</text>
+          </view>
+        </view>
+      </view>
+    </view>
+    <view
+      class="btn1"
+      @click="isOk"
+      v-if="listData.systemStatus === 2 && listData.receiptStatus === 0"
+      >我已阅读</view
+    >
+    <view
+      class="btn1"
+      v-if="
+        statusGO &&
+        listData.systemStatus === 1 &&
+        getNames(listData.remindId) !== ''
+      "
+      @click="jumpFuns(goodsData, listData.remindId)"
+      >{{ getNames(listData.remindId) }}</view
+    >
+  </view>
 </template>
 
 <script>
-import { mapGetters } from 'vuex';
+import { mapGetters } from "vuex";
 export default {
-	components: {},
-	data() {
-		return {
-			listData: {},
-			goodsData:{},
-			sysTime:0,
-			id: null,
-			img1: '/static/icon/msg_icon1.png',
-			img2: '/static/icon/msg_icon2.png',
-			statusGO: true,
-			orderGoodsId:0,
-		};
-	},
-	onPullDownRefresh() {},
-	onLoad(option) {
-		this.sysTime = this.$method.timest();
-		this.id = Number(option.id);
-		this.orderGoodsId = option.orderGoodsId;
-	},
-	onShow() {
-		this.getInfo();
-		/* if(this.current === 2 && this.$method.isLogin()){
+  components: {},
+  data() {
+    return {
+      listData: {},
+      goodsData: {},
+      sysTime: 0,
+      id: null,
+      img1: "/static/icon/msg_icon1.png",
+      img2: "/static/icon/msg_icon2.png",
+      statusGO: true,
+      orderGoodsId: 0,
+    };
+  },
+  onPullDownRefresh() {},
+  onLoad(option) {
+    this.sysTime = this.$method.timest();
+    this.id = Number(option.id);
+    this.orderGoodsId = option.orderGoodsId;
+  },
+  onShow() {
+    this.getInfo();
+    /* if(this.current === 2 && this.$method.isLogin()){
 			this.$refs.refMy.init();
 		} */
-	},
-	onShareAppMessage(res) {
-		var self = this;
-		return {
-			title: '中正',
-			path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount
-		};
-	},
-	methods: {
-		getTitleName() {
-			// 28-已开通商品课程2天后学员未上课,29-已开通商品课程5天后学员未上课,31-近3天学员没有学习,32-近5天学员没有学习
-			if ([28,29,31,32].includes(+this.listData.remindId)) { // 要先判断督学消息的显示
-				return this.listData.remind
-			} else {
-				return this.listData.systemStatus === 2 ? this.listData.informVo.informName : this.listData.systemStatus === 1 ? this.listData.remind : ''
-			}
-		},
-		/**
-		 * 获取系统当前时间
-		 */
-		commonSystemTime() {
-			this.$api.commonSystemTime().then(res => {
-				this.sysTime = res.data.data;
-			})
-		},
-		//跳转页面
-		async jumpFuns(item,remindId) {
-			console.log('======items', item)
-			switch (remindId) {
-				case 1:
-				case 3:
-				case 5:
-				case 6:
-				case 7:
-				case 19:
-				case 21:
-				case 22:
-				case 23:
-				case 10:
-				case 12:
-				case 18:
-				case 28:
-				case 29:
-				case 31:
-				case 32:
-					//课程
-					if(item.goodsType == 1) {
-						this.$api.orderInfo({
-							orderGoodsId:this.orderGoodsId
-						}).then(async res => {
-							console.log(res)
-							let item = res.data.data;
-							
-							let currentTime = this.$method.timest();
-							console.log(currentTime)
-							console.log(item)
-							console.log(item.serviceStartTime)
-							console.log(item.serviceEndTime)
-							console.log(currentTime < item.serviceStartTime || currentTime > item.serviceEndTime)
-							//内部系统
-							if (item.interfacePushId > 0 && item.officialStatus != 1) {
-								// ,有疑问请联系020-87085982
-								uni.showModal({
-									showCancel: false,
-									content: '机构正在为您报名中,请耐心等待!'
-								});
-								return;
-							}
-							if (this.sysTime <= item.serviceStartTime || this.sysTime >= item.serviceEndTime) {
-								uni.showToast({
-									icon: 'none',
-									title: '不在学习服务期,不能进入学习'
-								})
-								return;
-							}
-							
-							if ((item.classStartTime && this.sysTime <= item.classStartTime) || (item.classEndTime && this
-									.sysTime >= item.classEndTime)) {
-								uni.showToast({
-									icon: 'none',
-									title: '不在班级有效期,不能进入学习'
-								})
-								return
-							}
-							
-							if (item.learningStatus == 2) {
-								uni.showToast({
-									icon: 'none',
-									title: '开放学习时间待定,不能进入学习'
-								})
-								return
-							}
-							
-							if (item.classStatus == 0) {
-								uni.showToast({
-									icon: 'none',
-									title: '尚未开班,不能进入学习'
-								})
-								return
-							}
-							console.log(this.sysTime, item.learningTimeStart)
-							console.log(this.sysTime < item.learningTimeStart)
-							if (item.learningStatus == 3 && (this.sysTime < item.learningTimeStart)) {
-								uni.showToast({
-									icon: 'none',
-									title: '不在开放学习时间,不能进入学习'
-								})
-								return;
-							}
-			
-							
-							if (item.gradeStatus == 1 && item.status == 1 && (item.serviceEndTime > this.sysTime) && (item
-									.classEndTime && (item.classEndTime < this.sysTime)) && (item.periodStatus == 0 || item
-									.periodStatus == -1) && item.studyCount > 0) {
-										uni.showModal({
-											title:'提示',
-											content:'班级有效期已过期,请选择班级',
-											success:(res) => {
-												if(res.confirm) {
-													uni.navigateTo({
-														url:'../wd/class'
-													})
-												}
-											}
-										})
-								return;
-							}
-							
-							let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId,item.gradeId);
-							
-							if(rebuildStatus == 0) {
-								this.$navTo.togo('/pages2/learn/details', {
-									gradeId:item.gradeId,
-									goodsId: item.goodsId,
-									orderGoodsId:this.orderGoodsId
-								})
-								return;
-							}
-							this.$api.courseCourseList({
-								pageNum: 1,
-								pageSize: 1,
-								goodsId: item.goodsId,
-								gradeId: item.gradeId,
-								orderGoodsId: this.orderGoodsId,
-							}).then(res => {
-								if (res.data.code == 200) {
+  },
+  onShareAppMessage(res) {
+    var self = this;
+    return {
+      title: "中正",
+      path:
+        `/pages/index/index?inviteCode=` + userInfo == null
+          ? ""
+          : userInfo.userAccount,
+    };
+  },
+  methods: {
+    getTitleName() {
+      // 28-已开通商品课程2天后学员未上课,29-已开通商品课程5天后学员未上课,31-近3天学员没有学习,32-近5天学员没有学习
+      if ([28, 29, 31, 32].includes(+this.listData.remindId)) {
+        // 要先判断督学消息的显示
+        return this.listData.remind;
+      } else {
+        return this.listData.systemStatus === 2
+          ? this.listData.informVo.informName
+          : this.listData.systemStatus === 1
+          ? this.listData.remind
+          : "";
+      }
+    },
+    /**
+     * 获取系统当前时间
+     */
+    commonSystemTime() {
+      this.$api.commonSystemTime().then((res) => {
+        this.sysTime = res.data.data;
+      });
+    },
+    //跳转页面
+    async jumpFuns(item, remindId) {
+      console.log("======items", item);
+      switch (remindId) {
+        case 1:
+        case 3:
+        case 5:
+        case 6:
+        case 7:
+        case 19:
+        case 21:
+        case 22:
+        case 23:
+        case 10:
+        case 12:
+        case 18:
+        case 28:
+        case 29:
+        case 31:
+        case 32:
+          //课程
+          if (item.goodsType == 1) {
+            this.$api
+              .orderInfo({
+                orderGoodsId: this.orderGoodsId,
+              })
+              .then(async (res) => {
+                console.log(res);
+                let item = res.data.data;
 
-									if(res.data.total > 1) {
-										// this.$navTo.togo(`/pages2/wd/course?id=${item.goodsId}&gid=${item.gradeId}&orderGoodsId=${this.orderGoodsId}`);
-										uni.navigateTo({
-											url: `/pages3/polyv/detail?id=''&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}`
-										})
-									} else if(res.data.total == 1) {
-										uni.navigateTo({
-											url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${this.orderGoodsId}&gradeId=${item.gradeId}`
-										})
-									} else {
-										uni.showToast({
-											icon:'none',
-											title:'暂无可观看的视频课程'
-										})
-									}
+                let currentTime = this.$method.timest();
+                console.log(currentTime);
+                console.log(item);
+                console.log(item.serviceStartTime);
+                console.log(item.serviceEndTime);
+                console.log(
+                  currentTime < item.serviceStartTime ||
+                    currentTime > item.serviceEndTime
+                );
+                //内部系统
+                if (item.interfacePushId > 0 && item.officialStatus != 1) {
+                  // ,有疑问请联系020-87085982
+                  uni.showModal({
+                    showCancel: false,
+                    content: "机构正在为您报名中,请耐心等待!",
+                  });
+                  return;
+                }
+                if (
+                  this.sysTime <= item.serviceStartTime ||
+                  this.sysTime >= item.serviceEndTime
+                ) {
+                  uni.showToast({
+                    icon: "none",
+                    title: "不在学习服务期,不能进入学习",
+                  });
+                  return;
+                }
 
-								}
-							})
-							// if(item.courseNum == 1 ) {
-								
-							// 	this.$api.courseCourseList({
-							// 		pageNum:1,
-							// 		pageSize:1,
-							// 		goodsId:item.goodsId,
-							// 		gradeId:item.gradeId
-							// 	}).then(res => {
-							// 		if(res.data.code == 200) {
-							// 			uni.navigateTo({
-							// 				url:`/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}`
-							// 			})
-							// 		}
-							// 	});
-							// 	return;
-							// }
-							
-							// this.$navTo.togo('/pages2/wd/course', {
-							// 	id: item.goodsId,
-							// 	gid: item.gradeId
-							// });
-						})
-						
-						// arsty = '立刻学习';
-						
-					//题库
-					} else if(item.goodsType ==2) {
-						// this.$navTo.togo('/pages2/bank/question_detail', {
-						// 	id: item.goodsId
-						// });
-						uni.navigateTo({
-							url:'/pages2/bank/question_detail?id='+item.goodsId+'&orderGoodsId='+this.orderGoodsId
-						})
-					} else if (item.goodsType == 6) {
-						// 进入直播课
-						this.toLive(item)
-					}
-					
-					break;
-				case 2:
-				case 4:
-					this.$navTo.togo('/pages2/verify/input', {
-						id: item.goodsId
-					});
-					break;
-				case 24:
-					this.$navTo.togo('/pages2/verify/input2', {
-						id: item.goodsId
-					});
-					break;
-				case 11:
-				case 13:
-					var data = {
-						goodsId: item.goodsId,
-						gradeId: item.gradeId
-					};
-					this.$api.getApplysubscribe(data).then(res => {
-						if (res.data.code === 500) {
-							uni.showModal({
-								showCancel: false,
-								content: res.data.msg
-							});
-						}
-						if (res.data.code === 200) {
-							// 725,645,2232
-							this.$navTo.togo('/pages2/appointment/index', {
-								goodsId: item.goodsId,
-								gradeId: item.gradeId,
-								orderGoodsId: this.orderGoodsId,
-							});
-						}
-					});
-					break;
-				case 20:
-					this.$navTo.togo('/pages3/course/detail', {
-						id: item.goodsId,
-						goodsType: item.goodsType
-					});
-					break;
-				default:
-					break;
-			}
-		},
-		toLive(item) {
-			this.$api.courseCourseList({
-				pageNum: 1,
-				pageSize: 1,
-				goodsId: item.goodsId,
-				gradeId: 0,
-				orderGoodsId: this.orderGoodsId,
-			}).then(res => {
-				if (res.data.code == 200) {
-					if(res.data.total > 1) {
-						// uni.navigateTo({
-						// 	url:'/pages5/liveDetail/course?orderGoodsId='+this.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
-						// })
-						uni.navigateTo({
-							url:'/pages3/live/detail?orderGoodsId='+this.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId=""'
-						})
-					} else if(res.data.total == 1) {
-						uni.navigateTo({
-							url:'/pages3/live/detail?orderGoodsId='+this.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0&courseId='+ res.data.rows[0].courseId
-						})
-					} else {
-						uni.showToast({
-							icon:'none',
-							title:'暂无可观看的直播课程'
-						})
-					}
-				
-				}
-			})
-		},
-		/**
-		 * @param {Object} goodsId 商品id
-		 * 查询商品重修状态
-		 */
-		courseGoodsRebuildStatus(goodsId,gradeId) {
-			return new Promise(resolve => {
-				this.$api.courseGoodsRebuildStatus({
-					goodsId:goodsId,
-					gradeId:gradeId
-				}).then(res => {
-					resolve(res.data.data)
-				})
-			})
-		},
-		//跳转节视频
-		jumpSection(item) {
-			console.log(item)
-			item.noteSecond = Number(item.topicNum) * 60; //转秒数
-			this.$navTo.togo('/pages3/polyv/detail', {
-				id: item.courseId,
-				goodsId: item.goodsId,
-				noteSecond: item.noteSecond,
-				sectionId: item.sectionId,
-				recordingUrl: item.recordingUrl,
-				moduleId:item.moduleId || 0,
-				chapterId:item.chapterId || 0,
-				orderGoodsId: this.orderGoodsId,
-				gradeId: item.gradeId,
-			});
-		},
-		//跳转题库题目
-		jumpExam(item) {
-			console.log(item);
-			uni.navigateTo({
-				url:
-					'/pages2/bank/questionBank?current=' +
-					(item.topicNum - 1) +
-					'&id=' +
-					item.examId +
-					'&goodsid=' +
-					item.goodsId +
-					'&chapterId=' +
-					item.moduleId +
-					'&moduleId=' +
-					item.moduleId
-			});
-		},
-		isOk() {
-			this.$api.courseappinformUser({ id: this.listData.id, receiptStatus: 1 }).then(res => {
-				if (res.data.code === 200) {
-					uni.navigateBack({
-						delta: 1
-					});
-				}
-			});
-		},
-		backPage() {
-			uni.navigateBack({
-				delta: 1
-			});
-		},
-		getInfo() {
-			// /app/informUser/' + data,
-			this.$api.getappinformUserId(this.id).then(res => {
-				if (res.data.code === 200) {
-					if (res.data.data.receiptStatus === 1 && (res.data.data.remindId === 2 || res.data.data.remindId === 4 || res.data.data.remindId === 24)) {
-						this.$api.getbaseprofiletpgetInfo({ goodsId: res.data.data.goodsId }).then(k => {
-							if ((k.data.data.status === 3 && k.data.data.changeStatus === 2) || k.data.data.status === 2 || k.data.data.status === 1) {
-								this.statusGO = false;
-							}
-						});
-					}
-					if (!res.data.data.receiptStatus) {
-						this.$api.courseappinformUser({ id: res.data.data.id, receiptStatus: 1 }).then(res => {
-							if (res.data.code === 200) {
-							}
-						});
-					}
-					if (res.data.data.informVo && res.data.data.informVo.affiche) {
-						res.data.data.informVo.affiche = res.data.data.informVo.affiche.replace(/<img/gi, '<img style="max-width:100%;"');
-					}
-					
-					this.listData = res.data.data;
-					console.log('listDatalistData:', this.listData)
-					if(res.data.data.goodsId) {
-						if(res.data.data.gradeId) {
-							// /goods/'+ data,
-							this.$api.goodsDetail(res.data.data.goodsId).then(rs => {
-								this.goodsData = rs.data.data
-								if (
-									rs.data.data.goodsType === 3 &&
-									(res.data.data.remindId === 1 ||
-										res.data.data.remindId === 3 ||
-										res.data.data.remindId === 5 ||
-										res.data.data.remindId === 6 ||
-										res.data.data.remindId === 7 ||
-										res.data.data.remindId === 19 ||
-										res.data.data.remindId === 21 ||
-										res.data.data.remindId === 22)
-								) {
-									this.statusGO = false;
-								}
-							});
-							
-							
-						} else {
-							this.$api.commonGoodsDetail(res.data.data.goodsId).then(rs => {
-								this.goodsData = rs.data.data
-								if (
-									rs.data.data.goodsType === 3 &&
-									(res.data.data.remindId === 1 ||
-										res.data.data.remindId === 3 ||
-										res.data.data.remindId === 5 ||
-										res.data.data.remindId === 6 ||
-										res.data.data.remindId === 7 ||
-										res.data.data.remindId === 19 ||
-										res.data.data.remindId === 21 ||
-										res.data.data.remindId === 22)
-								) {
-									this.statusGO = false;
-								}
-							});
-						}
-					}
-					
-				}
-			});
-		},
-		change(index) {
-			this.current = index;
-		},
-		getNames(int) {
-			var arsty = '';
-			switch (int) {
-				case 1:
-				case 3:
-				case 5:
-				case 6:
-				case 7:
-				case 19:
-				case 21:
-				case 22:
-				case 23:
-				case 28:
-				case 29:
-				case 31:
-				case 32:
-					arsty = '立刻学习';
-					break;
-				case 2:
-				case 4:
-				case 24:
-					arsty = '马上填写';
-					break;
-				case 10:
-				case 12:
-				case 18:
-					arsty = '立即重学';
-					break;
-				case 11:
-					arsty = '立即预约';
-					break;
-				case 13:
-					arsty = '预约考试';
-					break;
-				case 20:
-					arsty = '重新购买';
-					break;
-				default:
-					break;
-			}
-			return arsty;
-		}
-	},
-	onReachBottom() {},
-	computed: { ...mapGetters(['userInfo']) },
-	onUnload() {
-		var pages = getCurrentPages();
-		var currPage = pages[pages.length - 1]; //当前页面
-		var prePage = pages[pages.length - 2]; //上一个页面
-		//调用上一页拉取数据的方法
-		if (prePage.route == 'pages2/msg/index') {
-			prePage.$vm.getChangeData(this.id);
-		}
-	}
+                if (
+                  (item.classStartTime &&
+                    this.sysTime <= item.classStartTime) ||
+                  (item.classEndTime && this.sysTime >= item.classEndTime)
+                ) {
+                  uni.showToast({
+                    icon: "none",
+                    title: "不在班级有效期,不能进入学习",
+                  });
+                  return;
+                }
+
+                if (item.learningStatus == 2) {
+                  uni.showToast({
+                    icon: "none",
+                    title: "开放学习时间待定,不能进入学习",
+                  });
+                  return;
+                }
+
+                if (item.classStatus == 0) {
+                  uni.showToast({
+                    icon: "none",
+                    title: "尚未开班,不能进入学习",
+                  });
+                  return;
+                }
+                console.log(this.sysTime, item.learningTimeStart);
+                console.log(this.sysTime < item.learningTimeStart);
+                if (
+                  item.learningStatus == 3 &&
+                  this.sysTime < item.learningTimeStart
+                ) {
+                  uni.showToast({
+                    icon: "none",
+                    title: "不在开放学习时间,不能进入学习",
+                  });
+                  return;
+                }
+
+                if (
+                  item.gradeStatus == 1 &&
+                  item.status == 1 &&
+                  item.serviceEndTime > this.sysTime &&
+                  item.classEndTime &&
+                  item.classEndTime < this.sysTime &&
+                  (item.periodStatus == 0 || item.periodStatus == -1) &&
+                  item.studyCount > 0
+                ) {
+                  uni.showModal({
+                    title: "提示",
+                    content: "班级有效期已过期,请选择班级",
+                    success: (res) => {
+                      if (res.confirm) {
+                        uni.navigateTo({
+                          url: "../wd/class",
+                        });
+                      }
+                    },
+                  });
+                  return;
+                }
+
+                let rebuildStatus = await this.courseGoodsRebuildStatus(
+                  item.goodsId,
+                  item.gradeId
+                );
+
+                if (rebuildStatus == 0) {
+                  this.$navTo.togo("/pages2/learn/details", {
+                    gradeId: item.gradeId,
+                    goodsId: item.goodsId,
+                    orderGoodsId: this.orderGoodsId,
+                  });
+                  return;
+                }
+                this.$api
+                  .courseCourseList({
+                    pageNum: 1,
+                    pageSize: 1,
+                    goodsId: item.goodsId,
+                    gradeId: item.gradeId,
+                    orderGoodsId: this.orderGoodsId,
+                  })
+                  .then((res) => {
+                    if (res.data.code == 200) {
+                      if (res.data.total > 1) {
+                        // this.$navTo.togo(`/pages2/wd/course?id=${item.goodsId}&gid=${item.gradeId}&orderGoodsId=${this.orderGoodsId}`);
+                        uni.navigateTo({
+                          url: `/pages3/polyv/detail?id=''&goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}`,
+                        });
+                      } else if (res.data.total == 1) {
+                        uni.navigateTo({
+                          url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&orderGoodsId=${this.orderGoodsId}&gradeId=${item.gradeId}`,
+                        });
+                      } else {
+                        uni.showToast({
+                          icon: "none",
+                          title: "暂无可观看的视频课程",
+                        });
+                      }
+                    }
+                  });
+                // if(item.courseNum == 1 ) {
+
+                // 	this.$api.courseCourseList({
+                // 		pageNum:1,
+                // 		pageSize:1,
+                // 		goodsId:item.goodsId,
+                // 		gradeId:item.gradeId
+                // 	}).then(res => {
+                // 		if(res.data.code == 200) {
+                // 			uni.navigateTo({
+                // 				url:`/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}`
+                // 			})
+                // 		}
+                // 	});
+                // 	return;
+                // }
+
+                // this.$navTo.togo('/pages2/wd/course', {
+                // 	id: item.goodsId,
+                // 	gid: item.gradeId
+                // });
+              });
+
+            // arsty = '立刻学习';
+
+            //题库
+          } else if (item.goodsType == 2) {
+            // this.$navTo.togo('/pages2/bank/question_detail', {
+            // 	id: item.goodsId
+            // });
+            uni.navigateTo({
+              url:
+                "/pages2/bank/question_detail?id=" +
+                item.goodsId +
+                "&orderGoodsId=" +
+                this.orderGoodsId,
+            });
+          } else if (item.goodsType == 6) {
+            // 进入直播课
+            this.toLive(item);
+          }
+
+          break;
+        case 2:
+        case 4:
+          this.$navTo.togo("/pages2/verify/input", {
+            id: item.goodsId,
+          });
+          break;
+        case 24:
+          this.$navTo.togo("/pages2/verify/input2", {
+            id: item.goodsId,
+          });
+          break;
+        case 11:
+        case 13:
+          var data = {
+            goodsId: item.goodsId,
+            gradeId: item.gradeId,
+          };
+          this.$api.getApplysubscribe(data).then((res) => {
+            if (res.data.code === 500) {
+              uni.showModal({
+                showCancel: false,
+                content: res.data.msg,
+              });
+            }
+            if (res.data.code === 200) {
+              // 725,645,2232
+              this.$navTo.togo("/pages2/appointment/index", {
+                goodsId: item.goodsId,
+                gradeId: item.gradeId,
+                orderGoodsId: this.orderGoodsId,
+              });
+            }
+          });
+          break;
+        case 20:
+          this.$navTo.togo("/pages3/course/detail", {
+            id: item.goodsId,
+            goodsType: item.goodsType,
+          });
+          break;
+        default:
+          break;
+      }
+    },
+    toLive(item) {
+      this.$api
+        .courseCourseList({
+          pageNum: 1,
+          pageSize: 1,
+          goodsId: item.goodsId,
+          gradeId: 0,
+          orderGoodsId: this.orderGoodsId,
+        })
+        .then((res) => {
+          if (res.data.code == 200) {
+            if (res.data.total > 1) {
+              // uni.navigateTo({
+              // 	url:'/pages5/liveDetail/course?orderGoodsId='+this.orderGoodsId+'&goodsId='+item.goodsId+'&gradeId=0'
+              // })
+              uni.navigateTo({
+                url:
+                  "/pages3/live/detail?orderGoodsId=" +
+                  this.orderGoodsId +
+                  "&goodsId=" +
+                  item.goodsId +
+                  '&gradeId=0&courseId=""',
+              });
+            } else if (res.data.total == 1) {
+              uni.navigateTo({
+                url:
+                  "/pages3/live/detail?orderGoodsId=" +
+                  this.orderGoodsId +
+                  "&goodsId=" +
+                  item.goodsId +
+                  "&gradeId=0&courseId=" +
+                  res.data.rows[0].courseId,
+              });
+            } else {
+              uni.showToast({
+                icon: "none",
+                title: "暂无可观看的直播课程",
+              });
+            }
+          }
+        });
+    },
+    /**
+     * @param {Object} goodsId 商品id
+     * 查询商品重修状态
+     */
+    courseGoodsRebuildStatus(goodsId, gradeId) {
+      return new Promise((resolve) => {
+        this.$api
+          .courseGoodsRebuildStatus({
+            goodsId: goodsId,
+            gradeId: gradeId,
+          })
+          .then((res) => {
+            resolve(res.data.data);
+          });
+      });
+    },
+    //跳转节视频
+    jumpSection(item) {
+      console.log(item);
+      item.noteSecond = Number(item.topicNum) * 60; //转秒数
+      this.$navTo.togo("/pages3/polyv/detail", {
+        id: item.courseId,
+        goodsId: item.goodsId,
+        noteSecond: item.noteSecond,
+        sectionId: item.sectionId,
+        recordingUrl: item.recordingUrl,
+        moduleId: item.moduleId || 0,
+        chapterId: item.chapterId || 0,
+        orderGoodsId: this.orderGoodsId,
+        gradeId: item.gradeId,
+      });
+    },
+    //跳转题库题目
+    jumpExam(item) {
+      console.log(item);
+      uni.navigateTo({
+        url:
+          "/pages2/bank/questionBank?current=" +
+          (item.topicNum - 1) +
+          "&id=" +
+          item.examId +
+          "&goodsid=" +
+          item.goodsId +
+          "&chapterId=" +
+          item.moduleId +
+          "&moduleId=" +
+          item.moduleId,
+      });
+    },
+    isOk() {
+      this.$api
+        .courseappinformUser({ id: this.listData.id, receiptStatus: 1 })
+        .then((res) => {
+          if (res.data.code === 200) {
+            uni.navigateBack({
+              delta: 1,
+            });
+          }
+        });
+    },
+    backPage() {
+      uni.navigateBack({
+        delta: 1,
+      });
+    },
+    getInfo() {
+      // /app/informUser/' + data,
+      this.$api.getappinformUserId(this.id).then((res) => {
+        if (res.data.code === 200) {
+          if (
+            res.data.data.receiptStatus === 1 &&
+            (res.data.data.remindId === 2 ||
+              res.data.data.remindId === 4 ||
+              res.data.data.remindId === 24)
+          ) {
+            this.$api
+              .getbaseprofiletpgetInfo({ goodsId: res.data.data.goodsId })
+              .then((k) => {
+                if (
+                  (k.data.data.status === 3 &&
+                    k.data.data.changeStatus === 2) ||
+                  k.data.data.status === 2 ||
+                  k.data.data.status === 1
+                ) {
+                  this.statusGO = false;
+                }
+              });
+          }
+          if (!res.data.data.receiptStatus) {
+            this.$api
+              .courseappinformUser({ id: res.data.data.id, receiptStatus: 1 })
+              .then((res) => {
+                if (res.data.code === 200) {
+                }
+              });
+          }
+          if (res.data.data.informVo && res.data.data.informVo.affiche) {
+            res.data.data.informVo.affiche =
+              res.data.data.informVo.affiche.replace(
+                /<img/gi,
+                '<img style="max-width:100%;"'
+              );
+          }
+
+          this.listData = res.data.data;
+          console.log("listDatalistData:", this.listData);
+          if (res.data.data.goodsId) {
+            if (res.data.data.gradeId) {
+              // /goods/'+ data,
+              this.$api.goodsDetail(res.data.data.goodsId).then((rs) => {
+                this.goodsData = rs.data.data;
+                if (
+                  rs.data.data.goodsType === 3 &&
+                  (res.data.data.remindId === 1 ||
+                    res.data.data.remindId === 3 ||
+                    res.data.data.remindId === 5 ||
+                    res.data.data.remindId === 6 ||
+                    res.data.data.remindId === 7 ||
+                    res.data.data.remindId === 19 ||
+                    res.data.data.remindId === 21 ||
+                    res.data.data.remindId === 22)
+                ) {
+                  this.statusGO = false;
+                }
+              });
+            } else {
+              this.$api.commonGoodsDetail(res.data.data.goodsId).then((rs) => {
+                this.goodsData = rs.data.data;
+                if (
+                  rs.data.data.goodsType === 3 &&
+                  (res.data.data.remindId === 1 ||
+                    res.data.data.remindId === 3 ||
+                    res.data.data.remindId === 5 ||
+                    res.data.data.remindId === 6 ||
+                    res.data.data.remindId === 7 ||
+                    res.data.data.remindId === 19 ||
+                    res.data.data.remindId === 21 ||
+                    res.data.data.remindId === 22)
+                ) {
+                  this.statusGO = false;
+                }
+              });
+            }
+          }
+        }
+      });
+    },
+    change(index) {
+      this.current = index;
+    },
+    getNames(int) {
+      var arsty = "";
+      switch (int) {
+        case 1:
+        case 3:
+        case 5:
+        case 6:
+        case 7:
+        case 19:
+        case 21:
+        case 22:
+        case 23:
+        case 28:
+        case 29:
+        case 31:
+        case 32:
+          arsty = "立刻学习";
+          break;
+        case 2:
+        case 4:
+        case 24:
+          arsty = "马上填写";
+          break;
+        case 10:
+        case 12:
+        case 18:
+          arsty = "立即重学";
+          break;
+        case 11:
+          arsty = "立即预约";
+          break;
+        case 13:
+          arsty = "预约考试";
+          break;
+        case 20:
+          arsty = "重新购买";
+          break;
+        default:
+          break;
+      }
+      return arsty;
+    },
+  },
+  onReachBottom() {},
+  computed: { ...mapGetters(["userInfo"]) },
+  onUnload() {
+    var pages = getCurrentPages();
+    var currPage = pages[pages.length - 1]; //当前页面
+    var prePage = pages[pages.length - 2]; //上一个页面
+    //调用上一页拉取数据的方法
+    if (prePage.route == "pages2/msg/index") {
+      prePage.$vm.getChangeData(this.id);
+    }
+  },
 };
 </script>
 <style>
 page {
-	background: #eaeef1;
+  background: #eaeef1;
 }
 </style>
 <style scoped>
 .lsow:last-child {
-	border-bottom: none !important;
+  border-bottom: none !important;
 }
 .timeStys {
-	margin: 0rpx 6rpx;
-	color: #007aff;
-	font-size: 28rpx;
-	font-weight: bold;
-	border-bottom: 1rpx solid #007aff;
+  margin: 0rpx 6rpx;
+  color: #007aff;
+  font-size: 28rpx;
+  font-weight: bold;
+  border-bottom: 1rpx solid #007aff;
 }
 .h4 {
-	color: #333;
-	font-size: 28rpx;
-	font-weight: bold;
+  color: #333;
+  font-size: 28rpx;
+  font-weight: bold;
 }
 .aSty {
-	color: #999;
-	font-size: 24rpx;
-	margin-left: 8rpx;
+  color: #999;
+  font-size: 24rpx;
+  margin-left: 8rpx;
 }
 .h33 {
-	font-size: 28rpx;
-	color: #666;
+  font-size: 28rpx;
+  color: #666;
 }
 .content {
-	font-size: 28rpx;
-	color: #666666;
-	line-height: 36rpx;
+  font-size: 28rpx;
+  color: #666666;
+  line-height: 36rpx;
 }
 .time {
-	font-size: 24rpx;
-	color: #999999;
-	margin: 15rpx 0;
+  font-size: 24rpx;
+  color: #999999;
+  margin: 15rpx 0;
 }
 .btn1 {
-	width: 526rpx;
-	height: 80rpx;
-	background: #007aff;
-	border-radius: 40rpx;
-	color: #ffffff;
-	font-size: 30rpx;
-	font-weight: bold;
-	text-align: center;
-	line-height: 80rpx;
-	margin: 30rpx auto;
+  width: 526rpx;
+  height: 80rpx;
+  background: #007aff;
+  border-radius: 40rpx;
+  color: #ffffff;
+  font-size: 30rpx;
+  font-weight: bold;
+  text-align: center;
+  line-height: 80rpx;
+  margin: 30rpx auto;
 }
 .item {
-	width: 100%;
-	background: #ffffff;
-	border-radius: 16rpx;
-	padding: 15rpx;
+  width: 100%;
+  background: #ffffff;
+  border-radius: 16rpx;
+  padding: 15rpx;
 }
 .title {
-	font-size: 30rpx;
-	font-weight: bold;
-	color: #333333;
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333333;
 }
-</style>
+</style>

+ 1 - 5
pages3/polyv/detail copy.vue

@@ -947,6 +947,7 @@ export default {
       return this.sectionItem.learning != 1;
     },
     orderNum() {
+      return 0
       return this.businessData.goodsLearningOrder;
     },
     list() {
@@ -4351,11 +4352,6 @@ page {
 }
 .video_box {
   position: relative;
-  #playerVideo {
-    position: relative;
-    z-index: 99;
-  }
-
   .video-toast {
     position: absolute;
     width: 686rpx;

+ 90 - 123
pages3/polyv/detail.vue

@@ -18,14 +18,15 @@
       <view v-else>
         <my-player
           ref="player"
-          :vid="playVID"
+          :playVid="playVID"
           :autoplay="autoplay"
           :allowSeek="isAllowSeek"
           :playbackRate="playbackRate"
-          :videoCurrentTime="recordObj.videoCurrentTime"
+          :videoCurrentTime="recordObj.videoCurrentTime || 0"
           @playing="playing"
           @pause="pause"
           @ended="ended"
+          @loadedmetadata="loadedmetadata"
         ></my-player>
         <view
           class="video_box"
@@ -872,6 +873,7 @@ export default {
       barTimer: null,
       isReach: false,
       noticeShow1: false,
+      refPlv: null,
     };
   },
   computed: {
@@ -886,6 +888,7 @@ export default {
       return this.sectionItem.learning != 1;
     },
     orderNum() {
+      return 0;
       return this.goodsData.goodsLearningOrder;
     },
     list() {
@@ -908,9 +911,6 @@ export default {
       }
       return list;
     },
-    $plv() {
-      return this.$refs.player;
-    },
   },
   watch: {
     showSet(n) {
@@ -1015,12 +1015,9 @@ export default {
               }
             });
             this.subList = [...allItem, ...newArr];
-            if (res.data.total > 1) {
-              this.getUserWatchLast();
-            } else if (res.data.total == 1) {
-              this.originOnShow();
-              this.originMounted();
-            }
+
+            this.originOnShow();
+            this.originMounted();
           }
         });
     },
@@ -1168,30 +1165,12 @@ export default {
       this.courseDetail();
       this.getGoodsDetail();
       await this.studyRecordMenuAllList();
-      let noteSecond = Number(this.option.noteSecond);
-      // console.log('noteSecondnoteSecond:', noteSecond, this.option)
-      if (noteSecond > 0) {
-        //我的消息跳过来,播放节
-        let item = {
-          sectionId: Number(this.option.sectionId),
-          recordingUrl: this.option.recordingUrl,
-          noteSecond: noteSecond,
-          studyDuration: noteSecond,
-        };
-        let playNextId = `moduleId${this.option.moduleId}chapterId${
-          this.option.chapterId
-        }sectionId${this.option.sectionId}${
-          this.option.isRebuild ? "isRebuild" : ""
-        }`;
-        this.$store.commit("setPlaySectionId", {
-          playSectionId: item.sectionId || item.menuId,
-        });
-        this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
-        this.$store.commit("updatePlayNextId", playNextId);
-        this.playNoteVideo(item);
-      } else {
-        this.studyRecordQueryLiveLast();
+      // 消息过来 定位某个节
+      if (this.option.noteSecond) {
+        this.initPlayVideo({ sectionType: 1, ...this.option });
+        return;
       }
+      this.studyRecordQueryLiveLast();
     },
     // 原来的mouted内容
     originMounted() {
@@ -1206,17 +1185,6 @@ export default {
         this.hasStart = false;
         this.photoConfig = false;
         this.photoIndex = 0;
-        if (polyvPlayerContext) {
-          //解决同个节视频切换问题
-          // #ifdef MP-WEIXIN
-          polyvPlayerContext.seek(0);
-          polyvPlayerContext.pause();
-          // #endif
-          // #ifdef H5
-          polyvPlayerContext.j2s_seekVideo(0);
-          polyvPlayerContext.j2s_pauseVideo(); // 暂停播放视频
-          // #endif
-        }
         //清除直播
         this.$store.commit("setPlayChannelId", { playChannelId: 0 });
         this.postStudyRecord(0, oldSectionId);
@@ -1233,9 +1201,6 @@ export default {
         this.chapterId = item.chapterId || null;
 
         this.$store.commit("setPlayChannelId", { playChannelId: 0 });
-        this.$store.commit("setPlaySectionId", {
-          playSectionId: item.sectionId || item.menuId,
-        });
         //获取拍照历史
         this.getPhotoLastRecord();
         this.playVideo(item);
@@ -1502,8 +1467,8 @@ export default {
             if (this.goodsPlayConfig && this.goodsPlayConfig.autoPlay > 0) {
               // #ifdef MP-WEIXIN
               this.autoplay = true;
-              var polyvPlayerContext = this.selectComponent("#playerVideo");
-              polyvPlayerContext.play();
+              // var polyvPlayerContext = this.selectComponent("#playerVideo");
+              // polyvPlayerContext.play();
               // #endif
               // #ifdef H5
               // polyvPlayerContext.j2s_resumeVideo()
@@ -1531,12 +1496,6 @@ export default {
       this.sectionItem = sectionItem;
       if (sectionItem.sectionType == 1) {
         //录播
-        this.$store.commit("setPlaySectionId", {
-          playSectionId: sectionItem.sectionId,
-        });
-        this.$store.commit("setPlayVID", {
-          playVID: sectionItem.recordingUrl,
-        });
         await this.getPhotoLastRecord(); // 获取拍照历史
         this.playVideo(sectionItem);
       } else if (sectionItem.sectionType == 2) {
@@ -1544,12 +1503,6 @@ export default {
         this.studyRecordGetLastLive();
       } else if (sectionItem.sectionType == 3) {
         //回放
-        this.$store.commit("setPlaySectionId", {
-          playSectionId: sectionItem.sectionId,
-        });
-        this.$store.commit("setPlayVID", {
-          playVID: sectionItem.recordingUrl,
-        });
         this.playVideo(sectionItem);
       } else if (sectionItem.doType == 2) {
         uni.showModal({
@@ -1591,7 +1544,6 @@ export default {
     },
     studyRecordQueryLiveLast() {
       // /study/record/queryLiveLast
-      console.log(4165)
       this.$api
         .studyRecordQueryLiveLast({
           gradeId: this.gradeId,
@@ -1599,15 +1551,16 @@ export default {
           courseId: this.courseId,
         })
         .then((res) => {
+          console.log("🚀 ~ file: detail.vue:1575 ~ .then ~ res:", res);
           let { data } = res.data;
-          // if (!data.sectionId) {
-          //   data = this.menuAllList[0];
-          // } else {
-          //   if (data.learning == 1 && this.orderNum == 2) {
-          //     let next = this.menuAllList.find((e) => e.studyStatus != 1);
-          //     next && (data = next);
-          //   }
-          // }
+          if (!data.sectionId) {
+            data = this.menuAllList[0];
+          } else {
+            // if (data.learning == 1 && this.orderNum == 2) {
+            //   let next = this.menuAllList.find((e) => e.studyStatus != 1);
+            //   next && (data = next);
+            // }
+          }
           this.initPlayVideo(data);
         });
     },
@@ -1895,11 +1848,7 @@ export default {
       return {};
     },
     loadedmetadata(event) {
-      if (this.hasStart) {
-        // 防止loadedmetadata事件第二次触发
-        return;
-      }
-      this.hasStart = true;
+      this.refPlv = this.$refs.player;
     },
     getPhotoLastRecord() {
       if (this.erJianErZao || !this.playSecIsLearn || this.photoNum <= 0) {
@@ -2250,24 +2199,48 @@ export default {
       if (this.timer) {
         clearInterval(this.timer);
       }
+      this.recordObj = await this.getRecordLast(item);
+
+      // 同vid切换处理
+      // if (
+      //   this.playVID == item.recordingUrl &&
+      //   this.playSectionId != item.sectionId
+      // ) {
+      //   this.refPlv.changeVid({
+      //     vid: item.recordingUrl,
+      //     videoCurrentTime: this.recordObj.videoCurrentTime,
+      //   });
+      // }
       this.$store.commit("setPlayVID", {
         playVID: item.recordingUrl,
       });
-      this.recordObj = await this.getRecordLast();
+      this.$store.commit("setPlaySectionId", {
+        playSectionId: item.sectionId,
+      });
+      if (this.refPlv) {
+        this.refPlv.changeVid({
+          vid: item.recordingUrl,
+          videoCurrentTime: this.recordObj.videoCurrentTime,
+        });
+      }
       this.startStatus = true;
     },
-    getRecordLast() {
+    getRecordLast(sectionItem) {
+      console.log(
+        "🚀 ~ file: detail.vue:2244 ~ getRecordLast ~ sectionItem:",
+        sectionItem
+      );
+      let { chapterId, sectionId, courseId, moduleId } = sectionItem;
       return new Promise((resolve) => {
         let data = {
           gradeId:
             this.gradeId || this.gradeId == 0 ? Number(this.gradeId) : null,
           goodsId:
             this.goodsId || this.goodsId == 0 ? Number(this.goodsId) : null,
-          sectionId: this.playSectionId || 0,
-          courseId:
-            this.courseId || this.courseId == 0 ? Number(this.courseId) : null,
-          chapterId: this.chapterId || 0,
-          moduleId: this.moduleId || 0,
+          sectionId: sectionId || 0,
+          courseId: courseId || courseId == 0 ? Number(courseId) : null,
+          chapterId: chapterId || 0,
+          moduleId: moduleId || 0,
           orderGoodsId: this.orderGoodsId,
         };
         this.$api.recordLast(data).then((res) => {
@@ -2486,8 +2459,9 @@ export default {
       this.postAnswer();
     },
     postStudyRecord(status = 0, sectionId = this.playSectionId) {
-      let currentTime = this.$plv.playCurrentTime();
-      let PlayDuration = this.$plv.playVideoTime();
+      console.log(this.refPlv, "this.refPlv");
+      let currentTime = this.refPlv.playCurrentTime();
+      let PlayDuration = this.refPlv.playVideoTime();
       if (currentTime < 10 && !this.ossAvatarUrl) {
         return;
       }
@@ -2690,46 +2664,37 @@ export default {
       });
     },
     timeEvent() {
-        let playTime = this.$plv.playCurrentTime();
-        this.configPhoto();
-        console.info(this.photoList, "photoList");
-        let photoTime = 0; //获取拍照秒数
-        for (let i = 0; i < this.photoList.length; i++) {
-          photoTime = Number(this.photoList[i]); //获取拍照秒数
-          if (
-            (this.erJianErZao && !this.photoHistoryList.length) ||
-            (photoTime < this.playTime && photoTime > this.playTime - 8)
-          ) {
-            //3秒区间内才触发拍照,避免拉动滚动条
-            if (this.photoHistoryList.indexOf(i) < 0) {
-              //不存在拍照历史,没有重修过,没有学过,则拍照
-              //启动拍照
-              //暂停
-              console.log("去拍照");
-              // #ifdef MP-WEIXIN
-              polyvPlayerContext.exitFullScreen();
-              polyvPlayerContext.pause();
-              // #endif
-              // #ifdef H5
-              polyvPlayerContext.j2s_pauseVideo();
-              polyvPlayerContext.toggleFullscreen();
-              // #endif
-              this.photoIndex = i;
-              if (
-                uni.getStorageSync(`tabkePhotoShow${this.goodsId}`) ==
-                this.goodsId
-              ) {
-                return this.openPhoto();
-              } else {
-                this.popupPhotoShow = true;
-                uni.setStorageSync(
-                  `tabkePhotoShow${this.goodsId}`,
-                  this.goodsId
-                ); // 本地缓存用来判断是否已经弹出过弹窗
-              }
+      this.photoTime = this.refPlv.playCurrentTime();
+      this.configPhoto();
+      console.info(this.photoList, "photoList");
+      let photoTime = 0; //获取拍照秒数
+      for (let i = 0; i < this.photoList.length; i++) {
+        photoTime = Number(this.photoList[i]); //获取拍照秒数
+        if (
+          (this.erJianErZao && !this.photoHistoryList.length) ||
+          (photoTime < this.playTime && photoTime > this.playTime - 8)
+        ) {
+          //3秒区间内才触发拍照,避免拉动滚动条
+          if (this.photoHistoryList.indexOf(i) < 0) {
+            //不存在拍照历史,没有重修过,没有学过,则拍照
+            //启动拍照
+            //暂停
+            console.log("去拍照");
+            this.refPlv.playPause();
+            this.refPlv.exitFullScreen();
+            this.photoIndex = i;
+            if (
+              uni.getStorageSync(`tabkePhotoShow${this.goodsId}`) ==
+              this.goodsId
+            ) {
+              return this.openPhoto();
+            } else {
+              this.popupPhotoShow = true;
+              uni.setStorageSync(`tabkePhotoShow${this.goodsId}`, this.goodsId); // 本地缓存用来判断是否已经弹出过弹窗
             }
           }
         }
+      }
     },
     closeToast() {
       clearTimeout(this.toastTimer);
@@ -2763,8 +2728,9 @@ export default {
       }).then((res) => {});
     },
     playing() {
+      console.log("playing");
       if (this.noticeShow) {
-        this.$plv.playPause();
+        this.refPlv.playPause();
         return;
       }
       this.timer && clearInterval(this.timer);
@@ -2798,6 +2764,7 @@ export default {
       await this.postStudyRecord(1);
       this.nextSection();
     },
+    playerError() {},
     //播放下一节
     nextSection() {
       console.log("播放下一节");