huangjianlei hace 1 año
padre
commit
6f8cbcf4bb
Se han modificado 5 ficheros con 426 adiciones y 446 borrados
  1. 2 2
      common/config.js
  2. 233 294
      components/myPlayer2/tcPlayer.vue
  3. 151 132
      pages/learn/index.vue
  4. 32 18
      pages3/polyv/detail.vue
  5. 8 0
      pages5/webview/detaillink.vue

+ 2 - 2
common/config.js

@@ -1,7 +1,7 @@
 // test 测试环境
 const test = {
-	// BASE_URL: "https://testapi.xyyxt.net",
-	BASE_URL: "http://120.79.166.78:19012",
+	BASE_URL: "https://testapi.xyyxt.net",
+	// BASE_URL: "http://120.79.166.78:19012",
 	BASE_IMG_URL: "https://file-dev.xyyxt.net/",
 	domain: "h.xyyxt.net",
 	tenantId: "867735392558919680", //详粤云学堂

+ 233 - 294
components/myPlayer2/tcPlayer.vue

@@ -50,11 +50,9 @@
 				videoToastShow: false,
 				config: null,
 				Elevideo: false,
-				isInitSeek: false,
 				needSeek: false, // 是否有记录需要跳转播放
 				playTime: 0,
-				PlayStart: 0,
-				isSeeking: false
+				PlayStart: 0, // 是否初次播放(因为腾讯视频没有初次播放事件)
 			};
 		},
 		created() {
@@ -90,307 +88,248 @@
 				console.log("腾讯视频是否自动播放", this.autoplay)
 				console.log("腾讯视频是否允许拖拽进度条", this.progressControl)
 				this.$api.tcVideoSign(this.fileId).then(async (res) => {
-					console.log('请求腾讯视频参数', res)
-					let option = {
-						preload: "auto",
-						fakeFullscreen: true,
-						// licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1323759362_1/v_cube.license',
-						plugins: {
-							ContinuePlay: {
-								auto: true, // 是否禁用续播功能,取值:{true,false}。
-							},
-							SafeCheck: true // 安全检查
-						},
-						autoplay: this.autoplay, // 自动播放
-						playbackRates: playbackRate,
-						controlBar: {
-							progressControl: this.progressControl, // 是否禁止拖拽(隐藏)进度条
-							playbackRateMenuButton: playbackRateIndex // 是否显示倍速切换的按钮。
-						},
-						// sources: [{
-						// 	src: 'https://1500005692.vod2.myqcloud.com/43843706vodtranscq1500005692/62656d94387702300542496289/v.f100240.m3u8',
-						// }],
+							console.log("请求腾讯视频参数", res)
+								let option = {
+									preload: "auto",
+									fakeFullscreen: true,
+									// licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1323759362_1/v_cube.license',
+									plugins: {
+										SafeCheck: true // 安全检查
+									},
+									autoplay: this.autoplay, // 自动播放
+									playbackRates: playbackRate,
+									controlBar: {
+										progressControl: this.progressControl, // 是否禁止拖拽(隐藏)进度条
+										playbackRateMenuButton: playbackRateIndex // 是否显示倍速切换的按钮。
+									},
+									// sources: [{
+									// 	src: 'https://1500005692.vod2.myqcloud.com/43843706vodtranscq1500005692/62656d94387702300542496289/v.f100240.m3u8',
+									// }],
 
-						fileID: this.fileId,
-						appID: res.data.data.appID,
-						psign: res.data.data.psign,
-						licenseUrl: res.data.data.licenseUrl,
-					};
-					if (tcPlayerContext) {
-						tcPlayerContext.loadVideoByID({
-							fileID: this.fileId,
-							appID: res.data.data.appID,
-							psign: res.data.data.psign
-						});
-						tcPlayerContext.currentTime(
-							this.currentTime || 0);
-					} else {
-						uni.getSystemInfo({
-							success: (res) => {
-								// // *****高度宽度的单位都是px 
-								// console.log(res.screenHeight); // 屏幕高度,包含导航栏
-								// console.log(res.windowHeight); // 能够使用的窗口高度,不包含导航栏
-								// console.log(res.screenWidth); // 屏幕宽度
-								// console.log(res.windowWidth); // 能够使用的窗口宽度
-								// // 能够使用的窗口高度,将px转换rpx
-								// this.windowHeight = (res.windowHeight * (750 / res.windowWidth))
-								// console.log(this.windowHeight)
-								option = {
-									width: res.windowWidth,
-									height: 218,
-									...option,
+									fileID: this.fileId,
+									appID: res.data.data.appID,
+									psign: res.data.data.psign,
+									licenseUrl: res.data.data.licenseUrl,
 								};
-							}
-						})
-						let player_tencent = document.createElement("video");
-						player_tencent.style.width = "100%";
-						player_tencent.id = "player-tencent";
-						player_tencent.setAttribute("playsinline", true);
-						player_tencent.setAttribute("webkit-playsinline", true);
-						document
-							.getElementById("player2")
-							.insertAdjacentElement("afterend", player_tencent);
-						tcPlayerContext = TCPlayer("player-tencent", option);
-						tcPlayerContext.currentTime(
-							this.currentTime || 0);
-						this.h5StateChange();
-					}
-				});
-			},
-			playing() {
-				// if (this.isSeeking) return;
-				console.log("腾讯视频恢复播放");
-				if (!this.PlayStart) {
-					this.onPlayStart();
-				}
-				// 设置播放时间会重复触发
-				if (this.needSeek) {
-					this.videoToastShow = true;
-					setTimeout(() => {
+								if (tcPlayerContext) {
+									tcPlayerContext.loadVideoByID({
+										fileID: this.fileId,
+										appID: res.data.data.appID,
+										psign: res.data.data.psign
+									});
+									tcPlayerContext.currentTime(
+										this.currentTime || 0);
+								} else {
+									// 获取当前设备的信息
+									uni.getSystemInfo({
+										success: (res) => {
+											// 高度宽度的单位都是px 
+											// console.log(res.screenHeight); // 屏幕高度,包含导航栏
+											// console.log(res.windowHeight); // 能够使用的窗口高度,不包含导航栏
+											// console.log(res.screenWidth); // 屏幕宽度
+											// console.log(res.windowWidth); // 能够使用的窗口宽度
+											// 能够使用的窗口高度,将px转换rpx
+											// let windowHeight = (res.windowHeight * (750 / res.windowWidth));
+											option = {
+												width: res.windowWidth,
+												height: 218,
+												...option,
+											};
+										}
+									})
+									let player_tencent = document.createElement("video");
+									player_tencent.style.width = "100%";
+									player_tencent.id = "player-tencent";
+									player_tencent.setAttribute("playsinline", true); // 设置允许行内播放
+									player_tencent.setAttribute("webkit-playsinline", true); // 设置允许行内播放
+									document
+										.getElementById("player2")
+										.insertAdjacentElement("afterend", player_tencent);
+									tcPlayerContext = TCPlayer("player-tencent", option);
+									tcPlayerContext.currentTime(
+										this.currentTime || 0);
+									this.h5StateChange();
+								}
+							});
+					},
+					// 视频播放或由暂停恢复播放时触发
+					playing() {
+						console.log("腾讯视频恢复播放");
+						if (!this.PlayStart) {
+							this.onPlayStart();
+						}
+						// 设置播放时间会重复触发
+						if (this.needSeek) {
+							this.videoToastShow = true;
+							setTimeout(() => {
+								this.closeToast();
+							}, 3000);
+							this.$emit("studyLog");
+							this.needSeek = false;
+						}
+						if (!this.Elevideo) {
+							this.Elevideo = true;
+							tcPlayerContext.on("timeupdate", this.timeupdate);
+						}
+					},
+					// 视频恢复播放
+					resumeVideo() {
+						tcPlayerContext.play();
+					},
+					// 视频播放错误
+					playerError(err) {
+						console.log("腾讯视频播放err", err);
+					},
+					// 视频计时器
+					timeupdate(e) {
+						let time = 0;
+						if (!this.PlayStart) return
+						time = this.PlayStart == 1 ? (this.currentTime || 0) : this.playCurrentTime();
+						this.PlayStart++
+						this.$emit("timeupdate", time);
+					},
+					// 绑定事件
+					h5StateChange() {
+						let states = {
+							loadstart: "onPlayerInitOver", // 播放器初始化完毕时触发
+							pause: "pause", // 视频暂停时触发
+							playing: "playing", // 视频初次播放或由暂停恢复播放时触发
+							ended: "ended", // 当前视频播放完毕时触发
+							error: "playerError", // 播放出现错误时触发
+						};
+						let that = this;
+						for (const key in states) {
+							tcPlayerContext.on(key, function() {
+								that[states[key]] && that[states[key]](...arguments);
+								that.$emit(states[key]);
+							});
+						}
+					},
+					// 新增用户视频学习日志
+					studyLog() {},
+					// 选定时间播放
+					seekVideo(time) {
+						time = time || 0;
+						tcPlayerContext.currentTime(time);
+					},
+					// 重头播放
+					restart() {
+						this.seekVideo(0);
 						this.closeToast();
-					}, 3000);
-					this.$emit("studyLog");
-					this.needSeek = false;
-				}
-				// if (!this.Elevideo) {
-				// 	this.Elevideo = document.querySelector("video.plv-player-video");
-				// 	this.Elevideo &&
-				// 		this.Elevideo.addEventListener("timeupdate", this.timeupdate);
-				// }
-				if (!this.Elevideo) {
-					this.Elevideo = true;
-					tcPlayerContext.on("timeupdate", this.timeupdate);
-				}
-			},
-			// onSeeking() {
-			// 	if (!this.needSeek) {
-			// 		console.log("触发拖拽");
-			// 		this.isSeeking = true;
-			// 		this.$emit('isSeeking', this.isSeeking);
-			// 	}
-			// },
-			// onSeeked() {
-			// 	console.log("触发拖拽结束");
-			// 	this.isSeeking = false;
-			// 	this.$emit('isSeeking', this.isSeeking);
-			// },
-			resumeVideo() {
-				tcPlayerContext.play();
-			},
-			playerError(err) {
-				console.log("腾讯视频播放err", err);
-			},
-			timeupdate(e) {
-				// if (this.isSeeking) return;
-				let time = 0;
-				if (!this.PlayStart) return
-				time = this.PlayStart == 1 ? (this.currentTime || 0) : this.playCurrentTime();
-
-				// if (!this.isInitSeek) {
-				// 	if (time >= this.ct) {
-				// 		this.isInitSeek = true;
-				// 	} else {
-				// 		return;
-				// 	}
-				// }
-				// this.onVideoSeek1(time);
-
-				this.PlayStart++
-				this.$emit("timeupdate", time);
-			},
-			h5StateChange() {
-				let states = {
-					loadstart: "onPlayerInitOver", // 播放器初始化完毕时触发
-					pause: "pause", // 视频暂停时触发
-					playing: "playing", // 视频初次播放或由暂停恢复播放时触发
-					// seeking: "onSeeking",
-					// seeked: "onSeeked",
-					ended: "ended", // 当前视频播放完毕时触发
-					error: "playerError", // 播放出现错误时触发
-				};
-				let that = this;
-				for (const key in states) {
-					tcPlayerContext.on(key, function() {
-						that[states[key]] && that[states[key]](...arguments);
-						that.$emit(states[key]);
-					});
-				}
-			},
-			onVideoSeek(start, end, vid) {
-				// if (this.allowSeek == "off") {
-				//   return;
-				// }
-				// if (end - this.playTime > 10) {
-				//   this.seekVideo(start);
-				// }
-			},
-			// 新增用户视频学习日志
-			studyLog() {
-				// this.$http({
-				// 	url: "/user/study/log",
-				// 	method: "post",
-				// 	data: {
-				// 		goodsId: this.goodsId,
-				// 		courseId: this.courseId,
-				// 		moduleId: this.moduleId || 0,
-				// 		chapterId: this.chapterId || 0,
-				// 		sectionId: this.playSectionId || 0,
-				// 		fromPlat: 1, //来源平台 1小程序 2PC网站
-				// 		goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
-				// 		orderGoodsId: this.orderGoodsId,
-				// 	},
-				// }).then((res) => {});
-			},
-			onVideoSeek1(time) {
-				if (!this.progressControl) {
-					if (Math.abs(time - this.playTime) > 5) {
-						console.log("进度条回拉", this.playTime, this.ct);
-						this.seekVideo(this.playTime);
-					} else {
-						this.playTime = time;
-					}
-				}
-			},
-			seekVideo(time) {
-				time = time || 0;
-				tcPlayerContext.currentTime(time);
-			},
-			restart() {
-				this.seekVideo(0);
-				this.closeToast();
-			},
-			// 播放时刻
-			playCurrentTime() {
-				if (!tcPlayerContext) {
-					return 0;
-				}
-				return tcPlayerContext.currentTime();
-			},
-			getDuration() {
-				return tcPlayerContext.duration();
-			},
-			// 本次看的时长
-			playVideoTime() {
-				if (!tcPlayerContext) {
-					return 0;
-				}
-				return tcPlayerContext.currentTime();
-			},
-			// 暂停播放
-			playPause() {
-				if (!tcPlayerContext) {
-					return;
-				}
-				tcPlayerContext.pause();
-			},
-			// 退出全屏
-			exitFullScreen() {
-				if (!tcPlayerContext) {
-					return;
-				}
-				if (
-					!!(
-						document.webkitIsFullScreen ||
-						document.mozFullScreen ||
-						document.msFullscreenElement ||
-						document.fullscreenElement
-					)
-				) {
-					try {
-						var de = document;
-						if (de.exitFullscreen) {
-							de.exitFullscreen();
-						} else if (de.mozCancelFullScreen) {
-							de.mozCancelFullScreen();
-						} else if (de.webkitCancelFullScreen) {
-							de.webkitCancelFullScreen();
+					},
+					// 播放时刻
+					playCurrentTime() {
+						if (!tcPlayerContext) {
+							return 0;
 						}
-					} catch (err) {}
-				}
-			},
-			onPlayerInitOver() {
-				console.log("腾讯视频加载完毕");
-				uni.$on("playPause", this.playPause);
-				this.$emit("loadedmetadata", tcPlayerContext);
-			},
-			onPlayStart() {
-				console.log("腾讯视频初次播放");
-				this.PlayStart = 1;
+						return tcPlayerContext.currentTime();
+					},
+					// 视频总时长
+					getDuration() {
+						return tcPlayerContext.duration();
+					},
+					// 本次看的时长
+					playVideoTime() {
+						if (!tcPlayerContext) {
+							return 0;
+						}
+						return tcPlayerContext.currentTime();
+					},
+					// 暂停播放
+					playPause() {
+						if (!tcPlayerContext) {
+							return;
+						}
+						tcPlayerContext.pause();
+					},
+					// 退出全屏
+					exitFullScreen() {
+						if (!tcPlayerContext) {
+							return;
+						}
+						if (
+							!!(
+								document.webkitIsFullScreen ||
+								document.mozFullScreen ||
+								document.msFullscreenElement ||
+								document.fullscreenElement
+							)
+						) {
+							try {
+								var de = document;
+								if (de.exitFullscreen) {
+									de.exitFullscreen();
+								} else if (de.mozCancelFullScreen) {
+									de.mozCancelFullScreen();
+								} else if (de.webkitCancelFullScreen) {
+									de.webkitCancelFullScreen();
+								}
+							} catch (err) {}
+						}
+					},
+					// 视频加载完毕
+					onPlayerInitOver() {
+						console.log("腾讯视频加载完毕");
+						uni.$on("playPause", this.playPause);
+						this.$emit("loadedmetadata", tcPlayerContext);
+					},
+					// 视频初次播放
+					onPlayStart() {
+						console.log("腾讯视频初次播放");
+						this.PlayStart = 1;
+					},
+					// 切换视频
+					changeFileId(data) {
+						console.log('调用腾讯视频changeFileId')
+						if (!data) {
+							return;
+						}
+						this.config = this.$method.isObject(data) ?
+							data : {
+								fileId: data,
+								currentTime: this.currentTime
+							};
+						if (!this.fileId) {
+							return;
+						}
+						this.PlayStart = 0;
+						this.loadPlayerScript(this.loadPlayer);
+					},
+					closeToast() {
+						this.videoToastShow = false;
+					},
 			},
-			changeFileId(data) {
-				console.log('调用腾讯视频changeFileId')
-				if (!data) {
-					return;
+			// 销毁组件
+			destroyed() {
+				if (tcPlayerContext) {
+					tcPlayerContext.off();
+					tcPlayerContext.dispose();
 				}
-				this.config = this.$method.isObject(data) ?
-					data : {
-						fileId: data,
-						currentTime: this.currentTime
-					};
-				if (!this.fileId) {
-					return;
-				}
-				this.PlayStart = 0;
-				this.loadPlayerScript(this.loadPlayer);
-			},
-			closeToast() {
-				this.videoToastShow = false;
-			},
-		},
-		destroyed() {
-			if (tcPlayerContext) {
-				tcPlayerContext.off();
-				tcPlayerContext.dispose();
-			}
-			// // #ifdef H5
-			// this.Elevideo &&
-			// 	this.Elevideo.removeEventListener("timeupdate", this.timeupdate, false);
-			// // #endif
-			tcPlayerContext = null;
-		},
-		computed: {
-			fileId() {
-				return this.config ? this.config.fileId : this.playFileId;
+				tcPlayerContext = null;
 			},
-			ct() {
-				return (
-					(this.config ? this.config.currentTime : this.currentTime) ||
-					0
-				);
+			computed: {
+				fileId() {
+					return this.config ? this.config.fileId : this.playFileId;
+				},
+				ct() {
+					return (
+						(this.config ? this.config.currentTime : this.currentTime) ||
+						0
+					);
+				},
 			},
-		},
-		watch: {
-			ct: {
-				handler(time) {
-					if (time > 0) {
-						this.needSeek = true;
-						this.playTime = time;
-					}
+			watch: {
+				ct: {
+					handler(time) {
+						if (time > 0) {
+							this.needSeek = true;
+							this.playTime = time;
+						}
+					},
+					immediate: true,
 				},
-				immediate: true,
 			},
-		},
-	};
+		};
 </script>
 
 <style lang="scss" scoped>

+ 151 - 132
pages/learn/index.vue

@@ -887,49 +887,52 @@
 
 				// 进入视频课
 				this.activeItem = item;
-				this.$api
-					.orderGetViewSign(item.orderGoodsId)
-					.then((res) => {
-						console.log('请求的viewSign', res.data.data.viewSign)
-						item.viewSign = res.data.data.viewSign;
-					})
+				// let playSource = 1;
+				// this.$api
+				// 	.orderGetViewSign(item.orderGoodsId)
+				// 	.then((res) => {
+				// 		console.log('学习中心请求的viewSign', res.data.data.viewSign)
+				// 		playSource = res.data.data.viewSign;
+				// 	})
 				if (item.interfaceAccountId > 0) {
 					//学习账号已开通
 
 					if (item.learnStatus > 0) {
 						//跳转第三方h5
-						if (item.viewSign == 2) {
-							// #ifdef H5
-							uni.navigateTo({
-								url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}&isOther=1&viewSign=${item.viewSign}`,
-							});
-							// #endif
-							// #ifdef MP-WEIXIN
-							this.$api
-								.courseSkipPort()
-								.then((res) => {
-									console.log("请求的域名", res.data.data.domain)
-									let obj = {
-										goodsId: item.goodsId,
-										orderGoodsId: item.orderGoodsId,
-										gradeId: item.gradeId,
-										isOther: 1,
-										viewSign: item.viewSign,
-										skipPort: res.data.data.skipPort,
-									}
-									let webViewUrl = encodeURIComponent(res.data.data.domain +
-										'/pages3/polyv/detail?obj=' +
-										JSON.stringify(obj))
-									uni.navigateTo({
-										url: `/pages5/webview/detaillink?url=${webViewUrl}`
-									})
-								})
-							// #endif
-						} else {
-							uni.navigateTo({
-								url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}&isOther=1`,
-							});
-						}
+						// if (playSource == 2) {
+						// 	// #ifdef H5
+						// 	uni.navigateTo({
+						// 		url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}&isOther=1`,
+						// 	});
+						// 	// #endif
+						// 	// #ifdef MP-WEIXIN
+						// 	this.$api
+						// 		.courseSkipPort()
+						// 		.then((res) => {
+						// 			console.log("请求的域名", res.data.data.domain)
+						// 			let obj = {
+						// 				goodsId: item.goodsId,
+						// 				orderGoodsId: item.orderGoodsId,
+						// 				gradeId: item.gradeId,
+						// 				isOther: 1,
+						// 				skipPort: res.data.data.skipPort,
+						// 			}
+						// 			let webViewUrl = encodeURIComponent(res.data.data.domain +
+						// 				'/pages3/polyv/detail?obj=' +
+						// 				JSON.stringify(obj))
+						// 			uni.navigateTo({
+						// 				url: `/pages5/webview/detaillink?url=${webViewUrl}`
+						// 			})
+						// 		})
+						// 	// #endif
+						// } else {
+						// 	uni.navigateTo({
+						// 		url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}&isOther=1`,
+						// 	});
+						// }
+						uni.navigateTo({
+							url: `/pages3/polyv/detail?goodsId=${item.goodsId}&orderGoodsId=${item.orderGoodsId}&gradeId=${item.gradeId}&isOther=1`,
+						});
 						return;
 					} else {
 						const text = this.eduPhone ? ",有疑问,请联系" + this.eduPhone : "";
@@ -1049,101 +1052,117 @@
 					}).then((res) => {
 						if (res.data.code == 200) {
 							if (res.data.total > 1) {
-								if (item.viewSign == 2) {
-									// #ifdef H5
-									uni.navigateTo({
-										url: `/pages3/polyv/detail?id=''&goodsId=${
-										          item.goodsId
-										        }&orderGoodsId=${item.orderGoodsId}&gradeId=${
-										          item.gradeId
-										        }&periodWaitTime=${item.periodWaitTime ? 1 : ""}&isQ=${
-										          item.orderYear ? 1 : ""
-										        }&viewSign=${item.viewSign}`,
-									});
-									// #endif
-									// #ifdef MP-WEIXIN
-									this.$api
-										.courseSkipPort()
-										.then((res) => {
-											console.log("请求的域名", res.data.data.domain)
-											let obj = {
-												id: '',
-												goodsId: item.goodsId,
-												orderGoodsId: item.orderGoodsId,
-												gradeId: item.gradeId,
-												periodWaitTime: item.periodWaitTime ? 1 : "",
-												isQ: item.orderYear ? 1 : "",
-												viewSign: item.viewSign,
-												skipPort: res.data.data.skipPort
-											}
-											let webViewUrl = encodeURIComponent(
-												res.data.data.domain +
-												'/pages3/polyv/detail?obj=' +
-												JSON.stringify(obj))
-											uni.navigateTo({
-												url: `/pages5/webview/detaillink?url=${webViewUrl}`
-											})
-										})
-									// #endif
-								} else {
-									uni.navigateTo({
-										url: `/pages3/polyv/detail?id=''&goodsId=${
-										          item.goodsId
-										        }&orderGoodsId=${item.orderGoodsId}&gradeId=${
-										          item.gradeId
-										        }&periodWaitTime=${item.periodWaitTime ? 1 : ""}&isQ=${
-										          item.orderYear ? 1 : ""
-										        }`,
-									});
-								}
+								// if (playSource == 2) {
+								// 	// #ifdef H5
+								// 	uni.navigateTo({
+								// 		url: `/pages3/polyv/detail?id=''&goodsId=${
+								// 		          item.goodsId
+								// 		        }&orderGoodsId=${item.orderGoodsId}&gradeId=${
+								// 		          item.gradeId
+								// 		        }&periodWaitTime=${item.periodWaitTime ? 1 : ""}&isQ=${
+								// 		          item.orderYear ? 1 : ""
+								// 		        }`,
+								// 	});
+								// 	// #endif
+								// 	// #ifdef MP-WEIXIN
+								// 	this.$api
+								// 		.courseSkipPort()
+								// 		.then((res) => {
+								// 			console.log("请求的域名", res.data.data.domain)
+								// 			let obj = {
+								// 				id: '',
+								// 				goodsId: item.goodsId,
+								// 				orderGoodsId: item.orderGoodsId,
+								// 				gradeId: item.gradeId,
+								// 				periodWaitTime: item.periodWaitTime ? 1 : "",
+								// 				isQ: item.orderYear ? 1 : "",
+								// 				skipPort: res.data.data.skipPort
+								// 			}
+								// 			let webViewUrl = encodeURIComponent(
+								// 				res.data.data.domain +
+								// 				'/pages3/polyv/detail?obj=' +
+								// 				JSON.stringify(obj))
+								// 			uni.navigateTo({
+								// 				url: `/pages5/webview/detaillink?url=${webViewUrl}`
+								// 			})
+								// 		})
+								// 	// #endif
+								// } else {
+								// 	uni.navigateTo({
+								// 		url: `/pages3/polyv/detail?id=''&goodsId=${
+								// 		          item.goodsId
+								// 		        }&orderGoodsId=${item.orderGoodsId}&gradeId=${
+								// 		          item.gradeId
+								// 		        }&periodWaitTime=${item.periodWaitTime ? 1 : ""}&isQ=${
+								// 		          item.orderYear ? 1 : ""
+								// 		        }`,
+								// 	});
+								// }
+								uni.navigateTo({
+									url: `/pages3/polyv/detail?id=''&goodsId=${
+									          item.goodsId
+									        }&orderGoodsId=${item.orderGoodsId}&gradeId=${
+									          item.gradeId
+									        }&periodWaitTime=${item.periodWaitTime ? 1 : ""}&isQ=${
+									          item.orderYear ? 1 : ""
+									        }`,
+								});
 							} else if (res.data.total == 1) {
-								if (item.viewSign == 2) {
-									// #ifdef H5
-									uni.navigateTo({
-										url: `/pages3/polyv/detail?id=${
-										          res.data.rows[0].courseId
-										        }&goodsId=${item.goodsId}&orderGoodsId=${
-										          item.orderGoodsId
-										        }&gradeId=${item.gradeId}&periodWaitTime=${
-										          item.periodWaitTime ? "" : 1
-										        }&isQ=${item.orderYear ? 1 : ""}&viewSign=${item.viewSign}`,
-									});
-									// #endif
-									// #ifdef MP-WEIXIN
-									this.$api
-										.courseSkipPort()
-										.then((resForDetail) => {
-											console.log("请求的域名", resForDetail.data.data.domain)
-											let obj = {
-												id: res.data.rows[0].courseId,
-												goodsId: item.goodsId,
-												orderGoodsId: item.orderGoodsId,
-												gradeId: item.gradeId,
-												periodWaitTime: item.periodWaitTime ? "" : 1,
-												isQ: item.orderYear ? 1 : "",
-												viewSign: item.viewSign,
-												skipPort: resForDetail.data.data.skipPort
-											}
-											let webViewUrl = encodeURIComponent(
-												resForDetail.data.data.domain +
-												'/pages3/polyv/detail?obj=' +
-												JSON.stringify(obj))
-											uni.navigateTo({
-												url: `/pages5/webview/detaillink?url=${webViewUrl}`
-											})
-										})
-									// #endif
-								} else {
-									uni.navigateTo({
-										url: `/pages3/polyv/detail?id=${
-										          res.data.rows[0].courseId
-										        }&goodsId=${item.goodsId}&orderGoodsId=${
-										          item.orderGoodsId
-										        }&gradeId=${item.gradeId}&periodWaitTime=${
-										          item.periodWaitTime ? "" : 1
-										        }&isQ=${item.orderYear ? 1 : ""}`,
-									});
-								}
+								// if (playSource == 2) {
+								// 	// #ifdef H5
+								// 	uni.navigateTo({
+								// 		url: `/pages3/polyv/detail?id=${
+								// 		          res.data.rows[0].courseId
+								// 		        }&goodsId=${item.goodsId}&orderGoodsId=${
+								// 		          item.orderGoodsId
+								// 		        }&gradeId=${item.gradeId}&periodWaitTime=${
+								// 		          item.periodWaitTime ? "" : 1
+								// 		        }&isQ=${item.orderYear ? 1 : ""}`,
+								// 	});
+								// 	// #endif
+								// 	// #ifdef MP-WEIXIN
+								// 	this.$api
+								// 		.courseSkipPort()
+								// 		.then((resForDetail) => {
+								// 			console.log("请求的域名", resForDetail.data.data.domain)
+								// 			let obj = {
+								// 				id: res.data.rows[0].courseId,
+								// 				goodsId: item.goodsId,
+								// 				orderGoodsId: item.orderGoodsId,
+								// 				gradeId: item.gradeId,
+								// 				periodWaitTime: item.periodWaitTime ? "" : 1,
+								// 				isQ: item.orderYear ? 1 : "",
+								// 				skipPort: resForDetail.data.data.skipPort
+								// 			}
+								// 			let webViewUrl = encodeURIComponent(
+								// 				resForDetail.data.data.domain +
+								// 				'/pages3/polyv/detail?obj=' +
+								// 				JSON.stringify(obj))
+								// 			uni.navigateTo({
+								// 				url: `/pages5/webview/detaillink?url=${webViewUrl}`
+								// 			})
+								// 		})
+								// 	// #endif
+								// } else {
+								// 	uni.navigateTo({
+								// 		url: `/pages3/polyv/detail?id=${
+								// 		          res.data.rows[0].courseId
+								// 		        }&goodsId=${item.goodsId}&orderGoodsId=${
+								// 		          item.orderGoodsId
+								// 		        }&gradeId=${item.gradeId}&periodWaitTime=${
+								// 		          item.periodWaitTime ? "" : 1
+								// 		        }&isQ=${item.orderYear ? 1 : ""}`,
+								// 	});
+								// }
+								uni.navigateTo({
+									url: `/pages3/polyv/detail?id=${
+									          res.data.rows[0].courseId
+									        }&goodsId=${item.goodsId}&orderGoodsId=${
+									          item.orderGoodsId
+									        }&gradeId=${item.gradeId}&periodWaitTime=${
+									          item.periodWaitTime ? "" : 1
+									        }&isQ=${item.orderYear ? 1 : ""}`,
+								});
 							} else {
 								uni.showToast({
 									icon: "none",

+ 32 - 18
pages3/polyv/detail.vue

@@ -218,6 +218,7 @@
 				showSet: false,
 				courseId: 0,
 				current: 0,
+				playSource: 1,
 				vid: "",
 				goodsId: 0,
 				goodsData: {},
@@ -241,7 +242,6 @@
 				photoConfig: false, //是否配置好拍照次数
 				photoHistoryList: [], //已拍照历史的下标点
 				sectionItem: {},
-				// playSource: 2,
 				isShowBar: true,
 				isRebuild: false, //视频是否从重修目录点击
 				livingItem: "",
@@ -274,9 +274,7 @@
 				beforeHideIsPlaying: false,
 				isLeave: false,
 				text: "",
-				throttleFn: throttle(this.postStudyRecord, 15000),
-				// isSeekingIndex: false,
-				playSource: 1
+				throttleFn: throttle(this.postStudyRecord, 15000)
 			};
 		},
 		computed: {
@@ -338,17 +336,38 @@
 			},
 		},
 		async onLoad(option) {
-			//腾讯播放器webview处理逻辑
+			// 针对腾讯商品并且是webview重载后的对URl参数的处理
 			if (option.obj) {
 				this.isShowBar = false;
 				console.log("检测option.obj", option)
 				console.log("解析后的option.obj", JSON.parse(decodeURIComponent(option.obj)))
 				option = JSON.parse(decodeURIComponent(option.obj));
 			}
-			if(option.viewSign == '2') {
-				console.log("检测ViewSign", option.viewSign, this.playSource)
-				this.playSource = option.viewSign;
-			}
+			// 请求商品类型并判断是否是小程序环境
+			this.$api.orderGetViewSign(Number(option.orderGoodsId)).then((res) => {
+				this.playSource = res.data.data.viewSign;
+				if (this.playSource == 2) {
+					// #ifdef MP-WEIXIN
+					this.$api
+						.courseSkipPort()
+						.then((res2) => {
+							console.log("详情页请求的域名", res2.data.data.domain, res2.data.data.skipPort)
+							let obj = {
+								skipPort: res2.data.data.skipPort,
+								...option
+							}
+							let webViewUrl = encodeURIComponent(
+								'http://192.168.1.213:8080' +
+								'/pages3/polyv/detail?obj=' +
+								JSON.stringify(obj))
+							uni.redirectTo({
+								url: `/pages5/webview/detaillink?url=${webViewUrl}`
+							})
+						})
+					return;
+					// #endif
+				}
+			})
 			if (option.isOther) {
 				this.showMark = true;
 				return;
@@ -423,6 +442,8 @@
 				this.$api.lockDelLock({
 					action: "jxjy",
 					uuid: this.$method.getUuid(),
+				}).then(res => {
+					console.log("删除登录", res)
 				});
 			}
 		},
@@ -433,8 +454,7 @@
 				this.refPlv.playPause();
 			}
 		},
-		mounted() {
-		},
+		mounted() {},
 		methods: {
 			...mapMutations(["updateChapterOpen", "updateLiveLast"]),
 			async init() {
@@ -1488,7 +1508,6 @@
 				this.timeEvent(time);
 			},
 			playing() {
-				// if (this.isSeekingIndex) return;
 				//特殊设备跳过拍照停止学习
 				if (this.showCamera) {
 					this.refPlv.playPause();
@@ -1498,10 +1517,6 @@
 				this.isPlaying = true;
 				this.clearPauseTimer();
 			},
-			// isSeeking(event) {
-			// 	console.log("搜寻进度条", event)
-			// 	this.isSeekingIndex = event;
-			// },
 			openCamera() {
 				if (this.showCamera) return;
 				this.showCamera = true;
@@ -1513,13 +1528,11 @@
 				this.showCamera = false;
 			},
 			pause() {
-				// if (this.isSeekingIndex) return;
 				console.log("视频暂停");
 				this.isPlaying = false;
 				this.erJianErZaoPauseTip();
 			},
 			async ended() {
-				// if (this.isSeekingIndex) return;
 				console.log("视频播放完毕");
 				this.isPlaying = false;
 				uni.showToast({
@@ -1655,6 +1668,7 @@
 					data
 				} = await this.$api.goodsDetail(this.goodsId);
 				this.goodsData = data.data;
+
 				if (data.data.firstChoiceStatus) {
 					uni.redirectTo({
 						url: `/pages3/polyv/preference?courseId=${this.courseId}&goodsId=${data.data.goodsId}&orderGoodsId=${this.orderGoodsId}&gradeId=${data.data.gradeId}&periodWaitTime=${this.option.periodWaitTime ? 1 : ""}&isQ=${this.option.isQ}&minClassHour=${data.data.minClassHour || 0}`,

+ 8 - 0
pages5/webview/detaillink.vue

@@ -24,6 +24,14 @@
 			// #ifdef H5
 			metaSetScalable();
 			// #endif
+		},
+		onUnload() {
+			this.$api.lockDelLock({
+				action: "jxjy",
+				uuid: this.$method.getUuid(),
+			}).then(res => {
+				console.log("删除登录", res)
+			});
 		}
 	};
 </script>