chenxiong 3 vuotta sitten
vanhempi
commit
81faac8a95
2 muutettua tiedostoa jossa 16 lisäystä ja 4 poistoa
  1. 8 4
      components/course/courseSection.vue
  2. 8 0
      store/index.js

+ 8 - 4
components/course/courseSection.vue

@@ -6,9 +6,9 @@
 				<view class="tag tagColor2" v-if="menuItem.sectionType==2">直播</view>
 				<view class="tag tagColor3" v-if="menuItem.sectionType==3">回放</view>
 				<view class="t_content">
-					<view v-if="menuItem.sectionType==1" :class="playSectionId==newId?'color1':''">{{menuItem.name}}</view>
-					<view v-if="menuItem.sectionType==2" :class="playSectionId==newId?'color2':''">{{menuItem.name}}</view>
-					<view v-if="menuItem.sectionType==3" :class="playSectionId==newId?'color3':''">{{menuItem.name}}</view>
+					<view v-if="menuItem.sectionType==1" :class="playSectionId==newId && playNextId==playId?'color1':''">{{menuItem.name}}</view>
+					<view v-if="menuItem.sectionType==2" :class="playSectionId==newId && playNextId==playId?'color2':''">{{menuItem.name}}</view>
+					<view v-if="menuItem.sectionType==3" :class="playSectionId==newId && playNextId==playId?'color3':''">{{menuItem.name}}</view>
 					<view style="font-size: 20rpx;color: #FF3B30;" v-if="menuItem.sectionType==2 && menuItem.liveStartTime">
 						<view v-if="menuItem.liveStartTime>nowTime">
 							<text>{{$method.timestampToTime(menuItem.liveStartTime, isDay =false)}}</text>-
@@ -102,6 +102,7 @@ export default {
 		return {
 			nowTime:0,
 			newId:0,
+			playId:'',
 			clickLock:false, //点击锁,防止连续点击多次
 		};
 	},
@@ -119,6 +120,7 @@ export default {
 		let chapterId = this.menuItem.chapterId || 0;
 		let sectionId = this.menuItem.sectionId || this.menuItem.menuId;
 		let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}${this.isRebuild?'isRebuild':''}`;
+		this.playId = playNextId;
 		uni.$off('playNext'+playNextId) //绑定前先移除之前的事件
 		uni.$once('playNext'+playNextId, (data) => {
 			//到时会触发每个节的监听事件,只允许当前节的接收
@@ -262,6 +264,7 @@ export default {
 				//设置播放的节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)
 				uni.$emit('isRebuild',this.isRebuild)
@@ -294,6 +297,7 @@ export default {
 				//设置播放的节ID
 				this.$store.commit('setPlaySectionId', {playSectionId  :this.newId});
 				this.$store.commit('setPlayChannelId', {playChannelId  :this.menuItem.liveUrl});
+				this.$store.commit('updatePlayNextId',this.playId)
 				uni.$emit('levelId', this.levelId)
 				uni.$emit('getChannel', this.menuItem)
 				uni.$emit('isRebuild',this.isRebuild)
@@ -308,7 +312,7 @@ export default {
 			}
 		}
 	},
-	computed: { ...mapGetters(['playSectionId','playChannelId','playVID']) }
+	computed: { ...mapGetters(['playSectionId','playChannelId','playVID','playNextId']) }
 	
 };
 </script>

+ 8 - 0
store/index.js

@@ -8,6 +8,7 @@ const store = new Vuex.Store({
 		token: '',
 		avatarUrl: '',
 		userName: '',
+		playNextId:'', //正在播放的节id
 		userInfo: null,
 		dictObj: null,
 		chapterOpen:true,
@@ -53,6 +54,9 @@ const store = new Vuex.Store({
 		allowLoading: state => {
 			return state.allowLoading
 		},
+		playNextId: state => {
+			return state.playNextId
+		},
 		chapterOpen: state => {
 			return state.chapterOpen
 		},
@@ -92,6 +96,10 @@ const store = new Vuex.Store({
 		updateAllowLoading(state,isShowloading) {
 			state.allowLoading = isShowloading
 		},
+		updatePlayNextId(state,str) {
+			console.log(str,'str')
+			state.playNextId = str
+		},
 		updateChapterOpen(state,boolean) {
 			state.chapterOpen = boolean
 		},