diff --git a/pages/index/index.vue b/pages/index/index.vue index 4e24a5f427f951c3f59b9a99cf09ad41b305c00b..93847db613ebab7e157390c365c81ca2fcf43d76 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 b8432f331c30b53ef9026307aa296c94c59a04f4..e9651e383392e5d21b59ec6c8a4bd0aad1d38ed4 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 e4b5157a7127cb745a859a1244de26698d0ab6e0..64b72e22e582c59ce92d85f89aff303b248af0b7 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; /** * 接口调用成功的回调函数 */