wangguoyu před 2 měsíci
rodič
revize
d88482ee39
2 změnil soubory, kde provedl 97 přidání a 22 odebrání
  1. 63 11
      components/questionJiexi/questionJiexi.vue
  2. 34 11
      pages/study/lookShipin.vue

+ 63 - 11
components/questionJiexi/questionJiexi.vue

@@ -2,7 +2,7 @@
 	<view>
 		<uni-popup ref="popupRef" :animation="false" :is-mask-click="false"
 			mask-background-color="rgba(255, 255, 255, 0.6);" class="ezy-popup-width-all">
-			<view class="ezy-dajx-page"  :style="{backgroundImage: 'url(' + courseBjFun() + ')'}">
+			<view class="ezy-dajx-page" :style="{backgroundImage: 'url(' + courseBjFun() + ')'}">
 				<view class="icon-title-navBar-box">
 					<view @click="handleBack" class="nav-bar-icon"></view>
 					<view class="nav-bar-title">单元测试</view>
@@ -29,6 +29,16 @@
 				</view>
 			</view>
 		</uni-popup>
+		<uni-popup ref="popupRef2" :animation="false" :is-mask-click="false"
+			mask-background-color="rgba(51, 137, 217, 0.65);">
+			<view class="course-finish-dialog">
+				<view class="text-score">{{credit}}</view>
+				<view class="course-btn-box">
+					<view @click="goBack" class="return-btn"></view>
+					<view @click="goNext" class="continue-btn"></view>
+				</view>
+			</view>
+		</uni-popup>
 	</view>
 </template>
 <script>
@@ -42,7 +52,7 @@
 	export default {
 		props: {
 			cardId: {
-				type: [String,Number],
+				type: [String, Number],
 				default: 1
 			}
 		},
@@ -66,6 +76,21 @@
 			this.hideFlag = 'hide'
 		},
 		methods: {
+			playEnd(data) {
+				console.log('data', data);
+				console.log('111111');
+				plus.screen.lockOrientation('portrait-primary');
+				this.$refs.popupRef2.open();
+			},
+			goBack() {
+				plus.screen.unlockOrientation();
+				this.$refs.popupRef2.close();
+				this.$refs.popupRef.close()
+			},
+			goNext() {
+				plus.screen.unlockOrientation();
+				this.$refs.popupRef2.close();
+			},
 			showPopup(item) {
 				this.data = item;
 				this.videoId = item.jiangjie
@@ -104,7 +129,7 @@
 						break;
 				}
 			}
-		
+
 		},
 		created() {
 			// console.log("getLive")
@@ -129,6 +154,7 @@
 				playAuth: '',
 				videoId: '',
 				progressMarkers: [],
+				isFullScreen: false,
 				seekTime: '',
 				isFirst: -1,
 			}
@@ -171,12 +197,20 @@
 					return;
 				}
 				this.player = null;
+				let that = this
 				//配置播放器
 				var player = new Aliplayer({
 					id: "wgy-player-test",
 					"vid": this.videoId,
 					"playauth": this.playAuth,
-					extraInfo: { poster: 'noposter' },
+					extraInfo: {
+						poster: 'noposter'
+					},
+					fullscreenEvents: {
+						fullscreenChange: (isFull) => {
+							this.isFullScreen = isFull
+						}
+					},
 					// "playConfig": {
 					// 	"EncryptType": 'AliyunVoDEncryption'
 					// },
@@ -210,11 +244,11 @@
 									"y": 12
 								},
 								{
-								          "name": "timeDisplay",
-								          "align": "tr",
-								          "x": 10,
-								          "y": 5
-								        }
+									"name": "timeDisplay",
+									"align": "tr",
+									"x": 10,
+									"y": 5
+								}
 							]
 						}
 					],
@@ -237,12 +271,30 @@
 				this.player = player;
 				player.one('canplay', function() {
 					console.log('canplay', this.player.tag);
+
 					player.tag.play();
 
 				});
-				this.isFirst ++;
-			},
+				player.on('ended', function(data) {
+					that.exitFullScreen();
+					that.$ownerInstance.callMethod('playEnd', {
+						data: 'end'
+					})
 
+				});
+				this.isFirst++;
+			},
+			exitFullScreen() {
+				if (document.exitFullscreen) {
+					document.exitFullscreen(); // 标准方法
+				} else if (document.mozCancelFullScreen) { // Firefox
+					document.mozCancelFullScreen();
+				} else if (document.webkitExitFullscreen) { // Chrome, Safari & Opera
+					document.webkitExitFullscreen();
+				} else if (document.msExitFullscreen) { // IE/Edge
+					document.msExitFullscreen();
+				}
+			},
 
 			loadWebPlayerSDK() {
 				return new Promise((resolve, reject) => {

+ 34 - 11
pages/study/lookShipin.vue

@@ -55,7 +55,7 @@
 		videoWancheng
 	} from "@/api/shipin.js"
 	import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
-		import tipBigDialog from '@/components/dialog/tipBigDialog.vue';
+	import tipBigDialog from '@/components/dialog/tipBigDialog.vue';
 	import svipDialog from './svipDialog.vue';
 	import {
 		toast,
@@ -65,6 +65,7 @@
 		userZhangNextInfo,
 	} from "@/api/learnPlan.js"
 	import cacheManager from "@/utils/cacheManager.js";
+
 	export default {
 		data() {
 			return {
@@ -100,7 +101,7 @@
 				this.nianji = youkeData.nianji
 				this.zhangId = youkeData.zhangId
 				this.cardId = youkeData.cardId
-				this.tipFlag=youkeData.tipFlag
+				this.tipFlag = youkeData.tipFlag
 				this.shipinTitle = youkeData.jieName
 				this.progressMarkers = youkeData.jieList.jiedianList || []
 				this.getLiveYk(); //获取播放凭证
@@ -181,6 +182,9 @@
 				})
 			},
 			playEnd(data) {
+				console.log('data', data);
+				console.log('111111');
+				plus.screen.lockOrientation('portrait-primary');
 				const AuthCode = getUserIdentity();
 				console.log(AuthCode);
 				if (AuthCode == 'Visitor') {
@@ -209,11 +213,12 @@
 
 			},
 			goBack() {
+				plus.screen.unlockOrientation(); 
 				this.$refs.popupRef.close();
 				this.goUpPage()
 			},
 			goNext() {
-				debugger
+				plus.screen.unlockOrientation(); 
 				this.$refs.popupRef.close();
 				if (!cacheManager.get('auth')) {
 					console.log(this);
@@ -227,14 +232,14 @@
 					// }
 					//	debugger
 					Number(this.jieId++)
-					console.log('this.pageData',this.pageData);
+					console.log('this.pageData', this.pageData);
 					let currentObject = this.cacheZhangInfo.zhangList[this.cacheCurrentZhangIndex].jieList.find(item =>
 						item.jieId == this.jieId);
-						if(currentObject){
-							this.pageData = {
-								...currentObject
-							}
+					if (currentObject) {
+						this.pageData = {
+							...currentObject
 						}
+					}
 					// lastFlag是否是本章最后一节,0否1是  type,1视频,2试题
 					if (this.pageData.lastFlag == 1 && this.pageData.type == 2) {
 						uni.redirectTo({
@@ -277,7 +282,7 @@
 				if (!cacheManager.get('auth')) {
 					uni.redirectTo({
 						url: '/pages/study/index?cardId=' + this.cardId + '&nianji=' + this.nianji + '&zhangId=' +
-							this.zhangId+ '&tipFlag=' + this.tipFlag
+							this.zhangId + '&tipFlag=' + this.tipFlag
 					})
 				} else {
 					uni.redirectTo({
@@ -324,6 +329,7 @@
 				playAuth: '',
 				videoId: '',
 				progressMarkers: [],
+				isFullScreen: false,
 				seekTime: ''
 
 			}
@@ -412,6 +418,11 @@
 					extraInfo: {
 						poster: 'noposter'
 					},
+					fullscreenEvents: {
+						fullscreenChange: (isFull) => {
+							this.isFullScreen = isFull
+						}
+					},
 					//cover: 'https://img.alicdn.com/tps/TB1EXIhOFXXXXcIaXXXXXXXXXXX-760-340.jpg',
 					// "vid": '',
 					// "playauth": '',
@@ -480,7 +491,9 @@
 					player.tag.play();
 
 				});
-				player.on('ended', function() {
+
+				player.on('ended', function(data) {
+					that.exitFullScreen();
 					that.$ownerInstance.callMethod('playEnd', {
 						data: 'end'
 					})
@@ -489,7 +502,17 @@
 					// });
 				});
 			},
-
+			exitFullScreen() {
+				if (document.exitFullscreen) {
+					document.exitFullscreen(); // 标准方法
+				} else if (document.mozCancelFullScreen) { // Firefox
+					document.mozCancelFullScreen();
+				} else if (document.webkitExitFullscreen) { // Chrome, Safari & Opera
+					document.webkitExitFullscreen();
+				} else if (document.msExitFullscreen) { // IE/Edge
+					document.msExitFullscreen();
+				}
+			},
 
 			loadWebPlayerSDK() {
 				return new Promise((resolve, reject) => {