From e770eb1603cb6c0194adda07fa6781cc558e9800 Mon Sep 17 00:00:00 2001 From: m0_75226990 Date: Wed, 1 Mar 2023 20:34:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E9=98=B2=E6=88=AA=E5=B1=8F=E5=8F=82?= =?UTF-8?q?=E6=95=B0open=E8=B0=83=E6=95=B4=E4=B8=BAenable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 25 +++++++++---------- .../utssdk/app-ios/index.uts | 6 ++--- .../utssdk/interface.uts | 4 +-- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 4e24a5f..93847db 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -27,7 +27,7 @@ return { title: 'Hello', memListener:null, - setUserCaptureScreenFlag: true, + setUserCaptureScreenFlag: false, setUserCaptureScreenText: '禁止截屏' } }, @@ -162,16 +162,15 @@ title:'捕获截屏事件' }) } - - }); + }); - if (uni.getSystemInfoSync().platform != "android") { - // 除android 之外的平台,直接提示监听已开启 - uni.showToast({ - icon:"none", - title:'截屏监听已开启' - }) - } + if (uni.getSystemInfoSync().platform != "android") { + // 除android 之外的平台,直接提示监听已开启 + uni.showToast({ + icon:"none", + title:'截屏监听已开启' + }) + } }, testScreenShotOff() { uni.offUserCaptureScreen(function(res) { @@ -197,7 +196,7 @@ testSetUserCaptureScreen() { let flag = this.setUserCaptureScreenFlag; uni.setUserCaptureScreen({ - open: flag, + enable: flag, success: (res) => { console.log("setUserCaptureScreen open: " + flag + " success: " + JSON.stringify(res)); }, @@ -214,9 +213,9 @@ }); this.setUserCaptureScreenFlag = !this.setUserCaptureScreenFlag; if (this.setUserCaptureScreenFlag) { - this.setUserCaptureScreenText = '禁止截屏'; - } else { this.setUserCaptureScreenText = '允许截屏'; + } else { + this.setUserCaptureScreenText = '禁止截屏'; } }, } diff --git a/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts b/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts index b8432f3..e9651e3 100644 --- a/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts +++ b/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts @@ -138,10 +138,10 @@ export const setUserCaptureScreen : SetUserCaptureScreen = function (options : S options.fail?.(res); options.complete?.(res); } else { - if (options.open == true) { - CaptureScreenTool.onAntiScreenshot(options) - } else { + if (options.enable == true) { CaptureScreenTool.offAntiScreenshot(options) + } else { + CaptureScreenTool.onAntiScreenshot(options) } } } diff --git a/uni_modules/uni-usercapturescreen/utssdk/interface.uts b/uni_modules/uni-usercapturescreen/utssdk/interface.uts index e4b5157..64b72e2 100644 --- a/uni_modules/uni-usercapturescreen/utssdk/interface.uts +++ b/uni_modules/uni-usercapturescreen/utssdk/interface.uts @@ -18,9 +18,9 @@ export type UserCaptureScreenResult = { export type SetUserCaptureScreenOption = { /** - * true: 开启防截屏 false: 关闭防截屏 + * true: 允许用户截屏 false: 不允许用户截屏,防止用户截屏到应用页面内容 */ - open : boolean; + enable : boolean; /** * 接口调用成功的回调函数 */ -- GitLab