瀏覽代碼

Merge branch 'master' of https://gitee.com/he2802/saas_applet

Tang 3 年之前
父節點
當前提交
fc124814a9
共有 5 個文件被更改,包括 33 次插入34 次删除
  1. 1 1
      common/request.js
  2. 3 3
      components/course/courseSection.vue
  3. 2 4
      pages/wd/index.vue
  4. 5 5
      pages2/class/detail.vue
  5. 22 21
      pages2/course/detail.vue

+ 1 - 1
common/request.js

@@ -4,7 +4,7 @@ import store from '@/store/index.js'
 import api from './api.js'
 var num = 1
 
-export const BASE_URL = 'http://192.168.1.222:5055' //接口api  http://42.192.164.187:19005 http://192.168.1.222:5055
+export const BASE_URL = 'http://42.192.164.187:19005' //接口api  http://42.192.164.187:19005 http://192.168.1.222:5055
 
 
 export const BASE_IMG_URL = 'https://file-dev.xyyxt.net/' //图片上传api  'https://file.xyyxt.net/

+ 3 - 3
components/course/courseSection.vue

@@ -96,13 +96,13 @@ export default {
 			if(this.playSectionId){
 				//切换视频
 				let oldSectionId = this.playSectionId
-				eventHub.$emit('changeSection', oldSectionId)
+				uni.$emit('changeSection', oldSectionId)
 			}
 			//设置播放的节ID
 			this.$store.commit('setPlaySectionId', {playSectionId  :this.newId});
 	//		return
-			eventHub.$emit('getSection', this.menuItem)
-			eventHub.$emit('levelId', this.levelId)
+			uni.$emit('getSection', this.menuItem)
+			uni.$emit('levelId', this.levelId)
 			
 		}
 	},

+ 2 - 4
pages/wd/index.vue

@@ -130,11 +130,9 @@ export default {
 		},
 		logout() {
 			console.log(343);
-			this.$method.isLogout();
+			this.$method.exit();
 			this.isLogin = this.$method.isLogin();
-			uni.reLaunch({
-				url: '/pages/index/index'
-			});
+			
 		},
 		jumpLogin() {
 			this.$navTo.togo('/pages/login/login');

+ 5 - 5
pages2/class/detail.vue

@@ -147,7 +147,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';
@@ -219,7 +218,6 @@ export default {
 			needSeek: false //第一次播放是否需要跳转
 		};
 	},
-	onUnload() {},
 	computed: { ...mapGetters(['userInfo', 'playSectionId']) },
 	onLoad(option) {
 		this.courseId = Number(option.id);
@@ -319,17 +317,19 @@ export default {
 			this.postStudyRecord();
 			//清除正在播放的节ID
 			this.$store.commit('setPlaySectionId', { playSectionId: 0 });
+			//移除所有的事件监听器
+			uni.$off();
 		}
 	},
 	mounted() {
-		eventHub.$on('changeSection', oldSectionId => {
+		uni.$on('changeSection', oldSectionId => {
 			this.ossAvatarUrl = '';
 			this.postStudyRecord(0, oldSectionId);
 		});
-		eventHub.$on('getSection', item => {
+		uni.$on('getSection', item => {
 			this.playVideo(item);
 		});
-		eventHub.$on('levelId', item => {
+		uni.$on('levelId', item => {
 			let arr = item.split('-');
 			//点击节获取的各层级ID
 			this.moduleId = arr[0];

+ 22 - 21
pages2/course/detail.vue

@@ -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) {