|
@@ -80,7 +80,6 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import eventHub from '@/common/eventHub.js';
|
|
|
import courseModule from '@/components/course/courseModule.vue';
|
|
|
import courseChapter from '@/components/course/courseChapter.vue';
|
|
|
import courseSection from '@/components/course/courseSection.vue';
|
|
@@ -116,9 +115,6 @@ export default {
|
|
|
timer:null,
|
|
|
startTime:0
|
|
|
};
|
|
|
- },
|
|
|
- onUnload() {
|
|
|
-
|
|
|
},
|
|
|
computed: { ...mapGetters(['userInfo','goodsAuditionConfigIdList','playSectionId']) },
|
|
|
onLoad(option) {
|
|
@@ -126,38 +122,43 @@ export default {
|
|
|
this.getDetail()
|
|
|
this.goodsCourseList()
|
|
|
},
|
|
|
+ onUnload(option) {
|
|
|
+ this.$store.commit('setPlaySectionId', {playSectionId :0});
|
|
|
+ //移除所有的事件监听器
|
|
|
+ uni.$off();
|
|
|
+ },
|
|
|
mounted() {
|
|
|
- eventHub.$on('getSection', item => {
|
|
|
- console.log('播放')
|
|
|
+ let self = this
|
|
|
+ uni.$on('getSection', item => {
|
|
|
//播放试听
|
|
|
- this.listenSecond = 0
|
|
|
- for (var itemChild of this.listenConfigList) {
|
|
|
- if(itemChild.sectionId==this.playSectionId){
|
|
|
+ self.listenSecond = 0
|
|
|
+ for (var itemChild of self.listenConfigList) {
|
|
|
+ if(itemChild.sectionId==self.playSectionId){
|
|
|
if(itemChild.auditionMinute>0){
|
|
|
- this.listenSecond = itemChild.auditionMinute *60 //试听秒数
|
|
|
+ self.listenSecond = itemChild.auditionMinute *60 //试听秒数
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if(this.listenSecond>0){
|
|
|
- if(this.timer){
|
|
|
- clearInterval(this.timer);
|
|
|
+ if(self.listenSecond>0){
|
|
|
+ if(self.timer){
|
|
|
+ clearInterval(self.timer);
|
|
|
}
|
|
|
- if(this.vid){
|
|
|
+ if(self.vid){
|
|
|
//切换视频
|
|
|
- var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
+ var polyvPlayerContext = self.selectComponent('#playerVideo');
|
|
|
polyvPlayerContext.changeVid(item.recordingUrl)
|
|
|
}else{
|
|
|
- this.vid = item.recordingUrl
|
|
|
+ self.vid = item.recordingUrl
|
|
|
}
|
|
|
|
|
|
- this.startStatus = true
|
|
|
- this.startTime = 0
|
|
|
+ self.startStatus = true
|
|
|
+ self.startTime = 0
|
|
|
}else{
|
|
|
- this.$u.toast('试听配置错误');
|
|
|
+
|
|
|
+ self.$u.toast('试听配置错误');
|
|
|
}
|
|
|
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
onStateChange(newstate, oldstate) {
|