Browse Source

更新播放按钮

wangxy 1 month ago
parent
commit
a48eb2d2cb
2 changed files with 54 additions and 2 deletions
  1. 13 1
      pages/admin/Kecheng/study.vue
  2. 41 1
      pages/client/Kecheng/study.vue

+ 13 - 1
pages/admin/Kecheng/study.vue

@@ -6,7 +6,9 @@
 		</view> -->
 		<!-- 播放器 -->
 		<videoPlayVue ref="videoRef" class="phone-video-box" v-if="showVideo"></videoPlayVue>
-		<view v-else class="phone-video-box master-image"></view>
+		<view v-else class="phone-video-box master-image">
+			<view class="bifaibg-icon" @click="handlePlayFirst"></view>
+		</view>
 		<!-- 中间区域 -->
 		<view class="kc-name-box">
 			<icon @click="goUpPage"></icon>
@@ -74,6 +76,16 @@
 			this.init();
 		},
 		methods: {
+			handlePlayFirst() {
+				if (this.list && this.list[0].jieList && this.list[0].jieList[0].kejianList) {
+					// 设置默认展开项
+					this.list[0].open = true;
+					this.list[0].jieList[0].open = true;
+					
+					const kejian = this.list[0].jieList[0].kejianList[0];
+					this.handlePlay(kejian)
+				}
+			},
 			goUpPage() {
 				if(this.pageFrom==='shouye'){
 					uni.redirectTo({

+ 41 - 1
pages/client/Kecheng/study.vue

@@ -8,7 +8,9 @@
 		<videoPlayVue v-if="showVideo" ref="videoRef" class="phone-video-box" @play-end="onPlayEnd" @play-play="onPlay"
 			@play-pause="onPause" @play-timeupdate="onTimeupdate"></videoPlayVue>
 			<!-- 视频背景图 -->
-		<view v-else class="phone-video-box master-image"></view>
+		<view v-else class="phone-video-box master-image">
+			<view class="bifaibg-icon" @click="handlePlayFirst"></view>
+		</view>
 		<!-- 中间区域 -->
 		<view class="kc-name-box">
 			<icon @click="goUpPage"></icon>
@@ -93,6 +95,44 @@
 			this.init();
 		},
 		methods: {
+			handlePlayFirst() {
+				let sectionPage = getKechengSectionPageFromHistory(this.operId)
+				if (sectionPage) {
+					const {
+						zhangIndex,
+						jieIndex
+					} = getCurKjIndex(sectionPage.kjId,this.operId)
+					sectionPage.iChapter = zhangIndex;
+					sectionPage.iSection = jieIndex;
+					sectionPage.kjId = sectionPage.kjId;
+					sectionPage.operId = this.operId;
+					
+					// 设置默认展开项
+					this.list[zhangIndex].open = true;
+					this.list[zhangIndex].jieList[jieIndex].open = true;
+					
+					const kejian = this.list[0].jieList && this.list[zhangIndex].jieList[jieIndex].kejianList.find(item => item.kjId ==sectionPage.kjId )
+					this.handlePlay(kejian)
+				} else {
+					if (this.list && this.list[0].jieList && this.list[0].jieList[0].kejianList) {
+						// 设置默认展开项
+						this.list[0].open = true;
+						this.list[0].jieList[0].open = true;
+						// 设置播放可见
+						const kejian = this.list[0].jieList[0].kejianList[0];
+						this.handlePlay(kejian)
+						// 更新缓存
+						sectionPage = {
+							kjId: kejian.kjId,
+							iChapter: 0,
+							iSection: 0,
+							operId: this.operId
+						}
+					}
+				}
+						
+				saveKechengSectionPage(this.operId, sectionPage)
+			},
 			onPause() {
 				clearInterval(this.timer1);
 				this.timer1 = null;