Bläddra i källkod

播放视频完毕刷新列表状态

chenxiong 3 år sedan
förälder
incheckning
2381549cb8

+ 5 - 10
components/course/courseChapter.vue

@@ -8,7 +8,7 @@
 		<view v-if="!down">
 			<view v-for="(itemM,indexM) in list" :key="indexM">
 				<view v-if="itemM.type!=2">
-					<courseSection :courseId="courseId"  :goodsId="goodsId" :isBuy="isBuy" :nextMenuItem="findNextSection(indexM)" :isRebuild="isRebuild" :gradeId="gradeId" :menuItem="itemM" :levelId="levelId+'-'+itemM.sectionId"></courseSection>
+					<courseSection :courseId="courseId" @playEnd="refreshList" :goodsId="goodsId" :isBuy="isBuy" :nextMenuItem="findNextSection(indexM)" :isRebuild="isRebuild" :gradeId="gradeId" :menuItem="itemM" :levelId="levelId+'-'+itemM.sectionId"></courseSection>
 					<u-line v-if="indexM<list.length-1"></u-line>
 				</view>
 				<view v-if="itemM.type==2">
@@ -43,9 +43,9 @@ import courseSection from '@/components/course/courseSection.vue';
 export default {
 	name: 'courseChapter',
 	props: {
-		learningOrder:{ //是否设置学习顺序 1 设置 0不设置
+		learningOrder:{ //是否设置学习顺序 0 设置 1不设置
 			type:Number,
-			default:0
+			default:1
 		},
 		menuItem: {
 			type: Object,
@@ -85,7 +85,6 @@ export default {
 			list:[],
 			examList:{},
 			canLearn:false, //是否全部视频看完才可以练习、测试
-			clickItem:'',
 		};
 	},
 	onLoad() {},
@@ -95,10 +94,7 @@ export default {
 		
 	},
 	onPageShow() {
-		
-		if(this.clickItem) {
-			this.refreshList();
-		}
+		this.refreshList();
 	},
 	methods: {
 		refreshList() {
@@ -115,10 +111,9 @@ export default {
 		 * 去做题
 		 */
 		async toDo(id,goodsId =0,moduleId = 0, chapterId = 0,item,index) {
-			this.clickItem = item;
 			
 			console.log(this.learningOrder)
-			if(this.learningOrder == 1) {
+			if(this.learningOrder == 0) {
 				if(this.canLearn) {
 					
 					let num = await this.bankRecordDoNum(item.typeId)

+ 2 - 2
components/course/courseModule.vue

@@ -19,9 +19,9 @@ import courseChapter from '@/components/course/courseChapter.vue';
 export default {
 	name: 'courseModule',
 	props: {
-		learningOrder:{ //是否设置学习顺序 1 设置 0不设置
+		learningOrder:{ //是否设置学习顺序 0 设置 1不设置
 			type:Number,
-			defaule:0
+			defaule:1
 		},
 		menuItem: {
 			type: Object,

+ 14 - 1
components/course/courseSection.vue

@@ -86,6 +86,11 @@ export default {
 			default: {}
 		},
 	},
+	watch:{
+		menuItem(val) {
+			console.log(val,'val')
+		}
+	},
 	data() {
 		return {
 			nowTime:0,
@@ -158,7 +163,11 @@ export default {
 				this.$store.commit('setPlayVID', {playVID  :this.menuItem.recordingUrl});
 				uni.$emit('levelId', this.levelId)
 				uni.$emit('getSection', this.menuItem)
-				
+				uni.$on('playEnd',res => {
+					console.log(1)
+					uni.$off('playEnd')
+					this.$emit('playEnd')
+				})
 			}
 			if(this.menuItem.sectionType==2){
 				//直播
@@ -181,6 +190,10 @@ export default {
 				this.$store.commit('setPlayChannelId', {playChannelId  :this.menuItem.liveUrl});
 				uni.$emit('levelId', this.levelId)
 				uni.$emit('getChannel', this.menuItem)
+				uni.$on('playEnd',res => { //绑定播放结束,刷新章节列表
+					uni.$off('playEnd')
+					this.$emit('playEnd')
+				})
 
 			}
 			

+ 1 - 1
pages/course/index.vue

@@ -47,7 +47,7 @@
 							</view>
 							<view style="display: flex;justify-content: space-between;margin-top: 13rpx;">
 								<view class="noteTag"><image src="/static/icon/wk_icon1.png" class="wk_icon"></image>
-								共 <text class="blackFont">{{item.subjectNum}}</text> 
+								共 <text class="blackFont">{{item.courseNum}}</text> 
 								<text class="margin30">课程</text>
 								<text class="blackFont">{{item.classHours}}</text> 学时</view>
 								<view class="priceTag">¥ {{item.standPrice.toFixed(2)}}</view>

+ 14 - 1
pages3/polyv/detail.vue

@@ -59,7 +59,7 @@
 					<!--章 -->
 					<view v-if="item.type == 2"><courseChapter :courseId="courseId" :learningOrder="businessData.goodsLearningOrder" :goodsId="goodsId" :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="'0-' + item.menuId"></courseChapter></view>
 					<!--节 -->
-					<view v-if="item.type == 3"><courseSection :courseId="courseId" :goodsId="goodsId" :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="'0-0-' + item.menuId"></courseSection></view>
+					<view v-if="item.type == 3"><courseSection @playEnd="sectionPlayEnd(index)" :courseId="courseId" :goodsId="goodsId" :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="'0-0-' + item.menuId"></courseSection></view>
 				</view>
 			</view>
 			<!--讲义 -->
@@ -443,6 +443,18 @@ export default {
 		});
 	},
 	methods: {
+		/**
+		 * 模块大节播放完毕,刷新列表 
+		 */
+		sectionPlayEnd(index) {
+			console.log(index)
+			this.$api.reMenuList({ courseId: this.courseId, gradeId: this.gradeId }).then(res => {
+				if (res.data.code == 200) {
+					res.data.rows[index].name = res.data.rows[index].menuName;
+					this.$set(this.menuList,index,res.data.rows[index])
+				}
+			});
+		},
 		/**
 		 * 获取业务层次详情
 		 */
@@ -962,6 +974,7 @@ export default {
 			}
 			console.log('提交接口', data);
 			this.$api.studyRecord(data).then(res => {
+				uni.$emit('playEnd'); //通知播放结束
 				self.ossAvatarUrl = ''
 				console.log(res);
 			});