提交 b92e6430 编写于 作者: lizhongyi_'s avatar lizhongyi_

调整uni-usercapturescree 防截屏参数

上级 7a9e40e8
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
return { return {
title: 'Hello', title: 'Hello',
memListener:null, memListener:null,
setUserCaptureScreenFlag: true, setUserCaptureScreenFlag: false,
setUserCaptureScreenText: '禁止截屏' setUserCaptureScreenText: '禁止截屏'
} }
}, },
...@@ -162,16 +162,15 @@ ...@@ -162,16 +162,15 @@
title:'捕获截屏事件' title:'捕获截屏事件'
}) })
} }
});
});
if (uni.getSystemInfoSync().platform != "android") { if (uni.getSystemInfoSync().platform != "android") {
// 除android 之外的平台,直接提示监听已开启 // 除android 之外的平台,直接提示监听已开启
uni.showToast({ uni.showToast({
icon:"none", icon:"none",
title:'截屏监听已开启' title:'截屏监听已开启'
}) })
} }
}, },
testScreenShotOff() { testScreenShotOff() {
uni.offUserCaptureScreen(function(res) { uni.offUserCaptureScreen(function(res) {
...@@ -197,7 +196,7 @@ ...@@ -197,7 +196,7 @@
testSetUserCaptureScreen() { testSetUserCaptureScreen() {
let flag = this.setUserCaptureScreenFlag; let flag = this.setUserCaptureScreenFlag;
uni.setUserCaptureScreen({ uni.setUserCaptureScreen({
open: flag, enable: flag,
success: (res) => { success: (res) => {
console.log("setUserCaptureScreen open: " + flag + " success: " + JSON.stringify(res)); console.log("setUserCaptureScreen open: " + flag + " success: " + JSON.stringify(res));
}, },
...@@ -214,9 +213,9 @@ ...@@ -214,9 +213,9 @@
}); });
this.setUserCaptureScreenFlag = !this.setUserCaptureScreenFlag; this.setUserCaptureScreenFlag = !this.setUserCaptureScreenFlag;
if (this.setUserCaptureScreenFlag) { if (this.setUserCaptureScreenFlag) {
this.setUserCaptureScreenText = '禁止截屏';
} else {
this.setUserCaptureScreenText = '允许截屏'; this.setUserCaptureScreenText = '允许截屏';
} else {
this.setUserCaptureScreenText = '禁止截屏';
} }
}, },
} }
......
...@@ -138,10 +138,10 @@ export const setUserCaptureScreen : SetUserCaptureScreen = function (options : S ...@@ -138,10 +138,10 @@ export const setUserCaptureScreen : SetUserCaptureScreen = function (options : S
options.fail?.(res); options.fail?.(res);
options.complete?.(res); options.complete?.(res);
} else { } else {
if (options.open == true) { if (options.enable == true) {
CaptureScreenTool.onAntiScreenshot(options)
} else {
CaptureScreenTool.offAntiScreenshot(options) CaptureScreenTool.offAntiScreenshot(options)
} else {
CaptureScreenTool.onAntiScreenshot(options)
} }
} }
} }
......
...@@ -18,9 +18,9 @@ export type UserCaptureScreenResult = { ...@@ -18,9 +18,9 @@ export type UserCaptureScreenResult = {
export type SetUserCaptureScreenOption = { export type SetUserCaptureScreenOption = {
/** /**
* true: 开启防截屏 false: 关闭防截屏 * true: 允许用户截屏 false: 不允许用户截屏,防止用户截屏到应用页面内容
*/ */
open : boolean; enable : boolean;
/** /**
* 接口调用成功的回调函数 * 接口调用成功的回调函数
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册