XSLu08042 il y a 3 semaines
Parent
commit
f4a5b4d87d

+ 51 - 0
pages_course/components/yk-screenRecord/yk-screenRecord.vue

@@ -15,6 +15,13 @@
 		onUnload() {
 			this.AllowScreenshots()
 		},
+		beforeDestroy() {
+			uni.showToast({
+				title: '2223',
+				icon: 'error'
+			})
+			this.AllowScreenshots()
+		},
 		methods: {
 			screenInit() {
 				let _this = this;
@@ -90,6 +97,50 @@
 			},
 			//安卓端允许截屏  
 			AllowScreenshots() {
+				uni.getSystemInfo({
+					success: function(e) {
+						// #ifdef MP-WEIXIN
+						if (e.platform == 'android') {
+							//微信小程序在安卓手机上 禁止截屏/录屏(注意:禁止后录屏动作还是会进行,但录屏后的视频是黑屏的)
+							wx.setVisualEffectOnCapture({
+								visualEffect: 'none', //传入 hidden 则表示在截屏/录屏时隐藏屏幕
+								success: (res) => {
+									console.log(res)
+								},
+								fail: (err) => {
+									console.log(err)
+								},
+								complete: (res) => {
+									console.log(res)
+								}
+							})
+						} else {
+							//微信小程序在IOS手机上,注意:目前微信小程序在ios上也只能通过监听录屏状态,然后通过添加view层来进行阻止,截屏暂时无法实现
+							//监听用户录屏事件
+							wx.onScreenRecordingStateChanged(function(res) {
+								if (res.state == 'start') {
+									_this.isRecording = false
+								} else {
+									_this.isRecording = false
+								}
+							})
+							//查询用户是否在录屏
+							wx.getScreenRecordingState({
+								success: (res) => {
+									if (res.state == 'on') {
+										_this.isRecording = false
+									} else if (res.state == 'off') {
+										_this.isRecording = false
+									}
+								},
+								fail: (err) => {
+									_this.isRecording = false
+								}
+							})
+						}
+						// #endif
+					}
+				})
 				let osname = plus.os.name;
 				if (osname == "Android") {
 					var activity = plus.android.runtimeMainActivity();

+ 3 - 3
pages_course/videoDetail.vue

@@ -127,7 +127,7 @@
 					<descInfo ref="descInfo" :isLogin="isLogin" :isAddKf="isAddKf" :courseInfo="courseInfo"></descInfo>
 				</template>
 				<!-- 问题 -->
-				<template v-if="isLogin&&isAddKf==1">
+				<template v-if="isLogin&&isAddKf==1&&linkType!=1">
 					<ques ref="ques" :urlOption="urlOption" :courseNote="courseNote" :showNote="showNote" :treatmentPackage="treatmentPackage" :showTreatment="showTreatment" :quesList="quesList" :openCommentStatus="openCommentStatus" @handleAnswer="handleAnswer" @showBtnType="showBtnType"></ques>
 				</template>
 			</view>
@@ -237,7 +237,7 @@
 			<view class="footer-btn" v-if="!isLogin || isAddKf !=1" @click="submit">
 				<text>立即学习</text>
 			</view>
-			<view v-if="isLogin&&isAddKf==1&&currentTab==1&&quesList&&quesList.length>0&&showBtn==0" class="footer-btn footer-btn-border" @click="submit">
+			<view v-if="isLogin&&isAddKf==1&&linkType!=1&&currentTab==1&&quesList&&quesList.length>0&&showBtn==0" class="footer-btn footer-btn-border" @click="submit">
 				<!-- <image class="footer-btn-img" :src="baseUrl+'/images/red_envelope_btnimg.png'" mode="aspectFill"></image> -->
 				<text>提交答案领取奖励</text>
 			</view>
@@ -357,7 +357,7 @@
 				uuId: "",
 				isEnded: false,
 				// 是否允许拖动进度条
-				linkType: 0,
+				linkType: 0, // 1表示应急链接
 				ip: null,
 				checked: true,
 				isFinish: 0, // 是否完课