Преглед на файлове

Merge branch 'master' of http://1.14.104.71:10880/root/his_user_miniapp

yzx преди 3 седмици
родител
ревизия
6dcdb07fb8
променени са 1 файла, в които са добавени 37 реда и са изтрити 11 реда
  1. 37 11
      pages_course/video.vue

+ 37 - 11
pages_course/video.vue

@@ -333,6 +333,7 @@
 				danmuboxHeight: 0,
 				user: {},
 				crtShow: true,
+				isCheckRealUrl: false
 			}
 		},
 		filters: {
@@ -388,6 +389,11 @@
 			// #ifndef H5
 			uni.onKeyboardHeightChange(this.keyboardHeightChange);
 			// #endif
+			if(this.socket!=null){
+				this.socket.close()
+				clearInterval(this.pingpangTimes)
+				this.socket = null
+			}
 		},
 		onShow() {
 			this.tipsOpen = false
@@ -730,7 +736,7 @@
 				this.$isLoginCourse().then(
 					res => {
 						if(res){
-							if (this.isAddKf == 1) {
+							if (this.isAddKf == 1&&this.isCheckRealUrl) {
 								// 答题
 								// 您已提交过答案,请领取红包
 								this.courseAnswer()
@@ -784,6 +790,7 @@
 					} = obj;
 					return rest;
 				});
+				if(!this.isCheckRealUrl) return;
 				const param = {
 					...this.urlOption,
 					questions: questions,
@@ -834,6 +841,7 @@
 			},
 			closeAnswerPopup() {
 				this.$refs.answerPopup.close()
+				if(!this.isCheckRealUrl) return;
 				if (this.errTitle == '恭喜你,回答正确') {
 					const param = {
 						...this.urlOption,
@@ -905,16 +913,27 @@
 				getIsAddKf(this.urlOption).then(res => {
 						if (res.code == 200) {
 							this.isAddKf = 1
+							this.isCheckRealUrl = true
 							this.getH5CourseVideoDetails()
 						} else if (res.code == 400) {
 							this.isAddKf = 0
+							this.isCheckRealUrl = false
 							this.qrcode = res.qrcode
 							this.qrcodeMsg = res.msg
 							this.$refs.kfPopup.open()
 						} else if (res.code == 504) {
 							// 登录
+							this.isCheckRealUrl = false
 							this.goLogin()
+						} else if (res.code == 566) {
+							this.isAddKf = 1
+							this.isCheckRealUrl = true
+							// 官方群发通用链接
+							const url = res.courseLink.realLink.split('?course=')[1]
+							this.urlOption = JSON.parse(url)
+							this.getH5CourseVideoDetails()
 						} else {
+							this.isCheckRealUrl = false
 							this.isAddKf = 0
 							uni.showToast({
 								title: res.msg,
@@ -929,7 +948,7 @@
 				this.$refs.kfPopup.close()
 			},
 			getFinishCourseVideo() {
-				if (!this.playTime) return
+				if (!this.playTime || !this.isCheckRealUrl) return
 				// {videoId: this.videoId,duration:this.playTime}
 				const param = {
 					duration: this.playTime,
@@ -939,6 +958,7 @@
 			},
 			// 每十分钟获得积分
 			getIntegralByH5Video() {
+				if(!this.isCheckRealUrl) return
 				const param = {
 					duration: this.playTime,
 					...this.urlOption
@@ -957,6 +977,7 @@
 			},
 			// 缓冲
 			getInternetTraffic() {
+				if(!this.isCheckRealUrl) return
 				const playVideoTime = Math.ceil(this.playTime / this.duration * 100) // 播放百分比
 				if(this.bufferRate == 0 || this.bufferRate < playVideoTime) {
 					this.bufferRate = playVideoTime
@@ -1033,10 +1054,10 @@
 						this.isExpire = false
 						// 如果响应中包含真实链接,则跳转到真实链接
 						// window.location.href = res.realLink +"&sortLink="+this.sortLink+"&code="+this.code+"&time="+new Date().getTime()
-						if (this.isLogin && this.isAddKf == 1) {
+						if (this.isLogin && this.isAddKf == 1&&this.isCheckRealUrl) {
 							this.getH5CourseVideoDetails()
 						}
-						if (this.videoId && this.isAddKf != 1) {
+						if (this.videoId &&(this.isAddKf != 1 || !this.isCheckRealUrl)) {
 							this.$isLoginCourse().then(
 								isLogin => {
 									this.isLogin = isLogin
@@ -1251,13 +1272,18 @@
 				if (!this.player) {
 					this.player = uni.createVideoContext('video-content-box');
 				}
-				setTimeout(()=>{
-					this.player.sendDanmu({
-						text: content.content,
-						color: "#FF0000",
-						time: this.playTime
-					})
-				},100)
+				this.player.sendDanmu({
+					text: content.content,
+					color: "#FF0000",
+					time: this.playTime + 1
+				})
+				// setTimeout(()=>{
+				// 	this.player.sendDanmu({
+				// 		text: content.content,
+				// 		color: "#FF0000",
+				// 		time: this.playTime
+				// 	})
+				// },100)
 			}
 		}
 	}