Browse Source

Merge branch 'iteration-20240426-screen' into online

lex 1 year ago
parent
commit
a05f13b613
1 changed files with 36 additions and 16 deletions
  1. 36 16
      src/views/coursewarePlay/index.tsx

+ 36 - 16
src/views/coursewarePlay/index.tsx

@@ -122,7 +122,8 @@ export default defineComponent({
 
       videoState: 'init' as 'init' | 'play',
       videoItemRef: null as any,
-      animationState: 'start' as 'start' | 'end'
+      animationState: 'start' as 'start' | 'end',
+      disableScreenRecordingFlag: '0' // 是否禁止录屏
     })
     const activeData = reactive({
       isAutoPlay: true, // 是否自动播放
@@ -251,7 +252,9 @@ export default defineComponent({
           }
         })
         //检测是否录屏
-        // handleLimitScreenRecord()
+        if (data.disableScreenRecordingFlag === '1') {
+          handleLimitScreenRecord()
+        }
         setTimeout(() => {
           data.animationState = 'end'
         }, 500)
@@ -407,7 +410,23 @@ export default defineComponent({
         })
       }
     }
+
+    // 获取支付渠道
+    const sysParamConfig = async () => {
+      try {
+        const res = await request.get('/api-student/sysParamConfig/queryByParamName', {
+          params: {
+            paramName: 'disable_screen_recording_flag'
+          }
+        })
+        data.disableScreenRecordingFlag = res.data.paramValue || ''
+      } catch {
+        //
+      }
+    }
     onMounted(async () => {
+      await sysParamConfig()
+
       if (state.platformType === 'STUDENT') {
         await getLookVideoData()
       }
@@ -431,20 +450,21 @@ export default defineComponent({
       getCourseSchedule()
       window.addEventListener('message', iframeHandle)
 
-      // //禁止录屏 ios
-      // listenerMessage('setVideoPlayer', (result) => {
-      //   if (result?.content?.status == 'pause') {
-      //     handleLimitScreenRecord()
-      //   }
-      // })
-
-      // // 安卓
-      // postMessage({
-      //   api: 'limitScreenRecord',
-      //   content: {
-      //     type: 1
-      //   }
-      // })
+      if (data.disableScreenRecordingFlag === '1') {
+        //禁止录屏 ios
+        listenerMessage('setVideoPlayer', (result) => {
+          if (result?.content?.status == 'pause') {
+            handleLimitScreenRecord()
+          }
+        })
+        // 安卓
+        postMessage({
+          api: 'limitScreenRecord',
+          content: {
+            type: 1
+          }
+        })
+      }
     })
 
     onBeforeUnmount(() => {