Ver código fonte

Merge branch '2024鹅状元' of https://gogs.mtavip.com/wangguoyu/uniProject into 2024鹅状元

tanxue 5 meses atrás
pai
commit
ce4843c613
2 arquivos alterados com 115 adições e 94 exclusões
  1. 57 49
      components/questionJiexi/questionJiexi.vue
  2. 58 45
      pages/study/lookShipin.vue

+ 57 - 49
components/questionJiexi/questionJiexi.vue

@@ -13,17 +13,15 @@
 						<view class="slfx-title"></view>
 						<view class="slfx-content"> {{data.answer}}</view>
 						<!-- <view class="slfx-content"> {{data.answer}}</view> -->
-		
+
 						<!-- 视频讲解 -->
 						<view class="spjj-title"></view>
 						<view class="spjj-video-box">
 							<!-- 这里放视频 ↓ -->
-							<view class="spjj-video" ref="videoContent" id="wgy-player-test" 
-							:playAuth="playAuth"
-								:change:playAuth="renderScript.receiveMsg" 
-								:videoId="videoId"
-									:change:videoId="renderScript.videoIdFun" 
-								 :seekTime="seekTime"
+							<view class="spjj-video" ref="videoContent" id="wgy-player-test" :playAuth="playAuth"
+								:change:playAuth="renderScript.receiveMsg" :videoId="videoId"
+								:change:videoId="renderScript.videoIdFun" :hideFlag="hideFlag"
+								:change:hideFlag="renderScript.hideFlagFun" :seekTime="seekTime"
 								:change:seekTime="renderScript.seekTimeFun">
 							</view>
 						</view>
@@ -43,7 +41,7 @@
 		getVideoAuth,
 		getVideoRefresh
 	} from "@/api/shipin.js"
-	export default { 
+	export default {
 		data() {
 			return {
 				pageData: null, //上个页面获取的视频参数(视频id)
@@ -51,20 +49,29 @@
 				progressMarkers: [],
 				videoId: "", //阿里云视频id
 				seekTime: '',
-				data:{}
+				hideFlag: 'show',
+				data: {}
 
 			}
 		},
+		onHide() {
+			console.log('onHideonHideonHideonHide');
+			this.hideFlag = 'hide'
+		},
+		onUnload() {
+			console.log('onUnloadonUnloadonUnloadonUnloadonUnload');
+			this.hideFlag = 'hide'
+		},
 		methods: {
-			showPopup(item){
+			showPopup(item) {
 				this.data = item;
 				this.videoId = item.jiangjie
 				//this.videoId = 'b997f16cb9cb474cb93526cff77d8801'
-			//	this.progressMarkers = item.progressMarkers
+				//	this.progressMarkers = item.progressMarkers
 				this.getLive(); //获取播放凭证
 				this.$refs.popupRef.open()
 			},
-			handleBack(item){
+			handleBack(item) {
 				this.$refs.popupRef.close()
 			},
 			getLive() {
@@ -79,7 +86,7 @@
 				console.log(data)
 				this.seekTime = data.offset
 			},
-		
+
 
 		},
 		created() {
@@ -122,6 +129,9 @@
 					this.videoId = newValue
 				}
 			},
+			hideFlagFun(newValue, oldValue, ownerInstance, instance) {
+				this.player.pause()
+			},
 			progressMarkersMsg(newValue, oldValue, ownerInstance, instance) {
 				if (newValue) {
 					this.progressMarkers = newValue
@@ -135,8 +145,8 @@
 					this.player.seek(newValue)
 					//	this.player.seek(newValue)
 				}
-			}, 
-			playAli() { 
+			},
+			playAli() {
 				//配置播放器
 				var player = new Aliplayer({
 					id: "wgy-player-test",
@@ -145,40 +155,38 @@
 					// "playConfig": {
 					// 	"EncryptType": 'AliyunVoDEncryption'
 					// },
-					"skinLayout": [
-					   {
-					     "name": "bigPlayButton",
-					     "align": "blabs",
-					     "x": 30,
-					     "y": 80
-					   },
-					   {
-					     "name": "controlBar",
-					     "align": "blabs",
-					     "x": 0,
-					     "y": 0,
-					     "children": [
-					       {
-					         "name": "progress",
-					         "align": "blabs",
-					         "x": 0,
-					         "y": 44
-					       },
-					       {
-					                "name": "playButton",
-					                "align": "tl",
-					                "x": 15,
-					                "y": 12
-					              },
-					       {
-					         "name": "fullScreenButton",
-					         "align": "tr",
-					         "x": 10,
-					         "y": 12
-					       }
-					     ]
-					   }
-					 ],
+					"skinLayout": [{
+							"name": "bigPlayButton",
+							"align": "blabs",
+							"x": 30,
+							"y": 80
+						},
+						{
+							"name": "controlBar",
+							"align": "blabs",
+							"x": 0,
+							"y": 0,
+							"children": [{
+									"name": "progress",
+									"align": "blabs",
+									"x": 0,
+									"y": 44
+								},
+								{
+									"name": "playButton",
+									"align": "tl",
+									"x": 15,
+									"y": 12
+								},
+								{
+									"name": "fullScreenButton",
+									"align": "tr",
+									"x": 10,
+									"y": 12
+								}
+							]
+						}
+					],
 					"qualitySort": "asc",
 					"format": "mp4",
 					"mediaType": "video",

+ 58 - 45
pages/study/lookShipin.vue

@@ -5,9 +5,10 @@
 			<text class="nav-bar-title">视频播放</text>
 		</view>
 		<view ref="videoContent" id="wgy-player-test" :playAuth="playAuth" :change:playAuth="renderScript.receiveMsg"
-			:videoId="videoId" :change:videoId="renderScript.videoIdFun"
-			:progressMarkers="progressMarkers" :change:progressMarkers="renderScript.progressMarkersMsg"
-			:seekTime="seekTime" :change:seekTime="renderScript.seekTimeFun" class="course-video-box">
+			:videoId="videoId" :change:videoId="renderScript.videoIdFun" :hideFlag="hideFlag"
+			:change:hideFlag="renderScript.hideFlagFun" :progressMarkers="progressMarkers"
+			:change:progressMarkers="renderScript.progressMarkersMsg" :seekTime="seekTime"
+			:change:seekTime="renderScript.seekTimeFun" class="course-video-box">
 		</view>
 		<view class="course-content-border">
 			<view class="course-content-box">
@@ -60,6 +61,7 @@
 				playAuth: "", //播放凭证
 				progressMarkers: [],
 				jieName: '',
+				hideFlag: 'show',
 				videoId: "", //阿里云视频id
 				seekTime: ''
 			}
@@ -77,17 +79,25 @@
 			this.getLive(); //获取播放凭证
 			//uni.$on('playEnd', this.playEnd);
 		},
+		onHide() {
+			console.log('onHideonHideonHideonHide');
+			this.hideFlag = 'hide'
+		},
+		onUnload() {
+			console.log('onUnloadonUnloadonUnloadonUnloadonUnload');
+			this.hideFlag = 'hide'
+		},
 		methods: {
 			playEnd(data) {
-			 this.$refs.popupRef.open();
+				this.$refs.popupRef.open();
 			},
 			goBack() {
-			 this.$refs.popupRef.close();
-			 this.goUpPage()
+				this.$refs.popupRef.close();
+				this.goUpPage()
 			},
 			goNext() {
-			 this.$refs.popupRef.close();
-			 toast("暂无此功能");
+				this.$refs.popupRef.close();
+				toast("暂无此功能");
 				return false
 			},
 			getLive() {
@@ -141,7 +151,7 @@
 			}
 		},
 		methods: {
-			
+
 			receiveMsg(newValue, oldValue, ownerInstance, instance) {
 				// console.log('service层中的options发生变化')
 				// console.log('新值', newValue)
@@ -155,11 +165,14 @@
 					this.playAli()
 				}
 			},
-				videoIdFun(newValue, oldValue, ownerInstance, instance) {
+			videoIdFun(newValue, oldValue, ownerInstance, instance) {
 				if (newValue) {
 					this.videoId = newValue
 				}
 			},
+			hideFlagFun(newValue, oldValue, ownerInstance, instance) {
+				this.player.pause()
+			},
 			progressMarkersMsg(newValue, oldValue, ownerInstance, instance) {
 
 				if (newValue) {
@@ -214,40 +227,38 @@
 					// "playConfig": {
 					// 	"EncryptType": 'AliyunVoDEncryption'
 					// },
-				 "skinLayout": [
-				    {
-				      "name": "bigPlayButton",
-				      "align": "blabs",
-				      "x": 30,
-				      "y": 80
-				    },
-				    {
-				      "name": "controlBar",
-				      "align": "blabs",
-				      "x": 0,
-				      "y": 0,
-				      "children": [
-				        {
-				          "name": "progress",
-				          "align": "blabs",
-				          "x": 0,
-				          "y": 44
-				        },
-				        {
-				                 "name": "playButton",
-				                 "align": "tl",
-				                 "x": 15,
-				                 "y": 12
-				               },
-				        {
-				          "name": "fullScreenButton",
-				          "align": "tr",
-				          "x": 10,
-				          "y": 12
-				        }
-				      ]
-				    }
-				  ],
+					"skinLayout": [{
+							"name": "bigPlayButton",
+							"align": "blabs",
+							"x": 30,
+							"y": 80
+						},
+						{
+							"name": "controlBar",
+							"align": "blabs",
+							"x": 0,
+							"y": 0,
+							"children": [{
+									"name": "progress",
+									"align": "blabs",
+									"x": 0,
+									"y": 44
+								},
+								{
+									"name": "playButton",
+									"align": "tl",
+									"x": 15,
+									"y": 12
+								},
+								{
+									"name": "fullScreenButton",
+									"align": "tr",
+									"x": 10,
+									"y": 12
+								}
+							]
+						}
+					],
 					"qualitySort": "asc",
 					"format": "mp4",
 					"mediaType": "video",
@@ -271,7 +282,9 @@
 
 				});
 				player.on('ended', function() {
-				that.$ownerInstance.callMethod('playEnd', {data:'end'})
+					that.$ownerInstance.callMethod('playEnd', {
+						data: 'end'
+					})
 					// uni.$emit('playEnd', {
 					// 	data: 'end'
 					// });