interface.uts 4.2 KB
Newer Older
1 2 3
/**
	* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调参数
	*/
4
export type OnUserCaptureScreenCallbackResult = {
5
	/**
6
		* 截屏文件路径(仅Android返回)
7
		*/
8
	path ?: string
9 10
}

11 12 13
/**
	* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调函数定义
	*/
14
export type UserCaptureScreenCallback = (res : OnUserCaptureScreenCallbackResult) => void
15 16

export type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
17

18
export type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
19

20 21 22 23 24 25 26 27 28 29
/**
	* uni.setUserCaptureScreen成功回调参数
	*/
export type SetUserCaptureScreenSuccess = {
}

/**
	* uni.setUserCaptureScreen失败回调参数
	*/
export type SetUserCaptureScreenFail = {
30 31
	/**
		* 错误码
32 33
		* 12001:system not support
		* 12010:system internal error
34 35 36 37 38 39 40 41 42 43 44 45
		*/
	errCode : number,
	/**
		* 调用API的名称
		*/
	errSubject : string,
	/**
		* 错误的详细信息
		*/
	errMsg : string,
}

46
/**
47 48
	* uni.setUserCaptureScreen成功回调函数定义
	*/
49 50 51
export type SetUserCaptureScreenSuccessCallback = (res : SetUserCaptureScreenSuccess) => void

/**
52 53
	* uni.setUserCaptureScreen失败回调函数定义
	*/
54 55 56
export type SetUserCaptureScreenFailCallback = (res : SetUserCaptureScreenFail) => void

/**
57 58
	* uni.setUserCaptureScreen完成回调函数定义
	*/
59 60 61 62 63
export type SetUserCaptureScreenCompleteCallback = (res : any) => void

/**
	* uni.setUserCaptureScreen参数
	*/
lizhongyi_'s avatar
lizhongyi_ 已提交
64

65
export type SetUserCaptureScreenOptions = {
66
	/**
67 68
	* true: 允许用户截屏 false: 不允许用户截屏,防止用户截屏到应用页面内容
	*/
69
	enable : boolean;
70
	/**
71 72
	* 接口调用成功的回调函数
	*/
73
	// success : SetUserCaptureScreenSuccessCallback | null,
74
	success ?: SetUserCaptureScreenSuccessCallback,
75
	/**
76 77
	* 接口调用失败的回调函数
	*/
78
	// fail : SetUserCaptureScreenFailCallback | null,
79
	fail ?: SetUserCaptureScreenFailCallback,
80
	/**
81 82
	* 接口调用结束的回调函数(调用成功、失败都会执行)
	*/
83
	// complete : SetUserCaptureScreenSuccessCallback | SetUserCaptureScreenFailCallback | null
84
	complete ?: SetUserCaptureScreenCompleteCallback
85 86
}

87
export type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void
88

89 90 91 92 93 94 95
export interface Uni {
	/**
	 * 开启截屏监听 
	 * 
	 * @param {UserCaptureScreenCallback} callback 
	 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
	 * @uniPlatform {
lizhongyi_'s avatar
lizhongyi_ 已提交
96
	 *    "app": {
97 98 99 100 101 102 103 104 105 106 107 108 109
	 *        "android": {
	 *            "osVer": "4.4.4",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "3.9.0"
	 *        },
	 *        "ios": {
	 *            "osVer": "9.0",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "3.9.0"
	 *   	  }
	 *    }
	 * }
	 * @uniVersion 3.7.7
110 111
	 * @uniVueVersion 2,3  //支持的vue版本
	 * @autotest { expectCallback: true }
112 113 114 115 116 117 118 119
	 */
	onUserCaptureScreen : OnUserCaptureScreen,
	/**
	 * 关闭截屏监听 
	 * 
	 * @param {UserCaptureScreenCallback} callback 
	 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
	 * @uniPlatform {
lizhongyi_'s avatar
lizhongyi_ 已提交
120
	 *    "app": {
121 122 123 124 125 126 127 128 129 130 131 132 133
	 *        "android": {
	 *            "osVer": "4.4.4",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "3.9.0"
	 *        },
	 *        "ios": {
	 *            "osVer": "9.0",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "3.9.0"
	 *   	  }
	 *    }
	 * }
	 * @uniVersion 3.7.7
134 135
	 * @uniVueVersion 2,3  //支持的vue版本
	 * @autotest { expectCallback: true }
136 137 138 139 140 141 142 143
	 */
	offUserCaptureScreen : OffUserCaptureScreen,
	/**
	 * 设置防截屏  
	 * 
	 * @param {SetUserCaptureScreenOptions} options 
	 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
	 * @uniPlatform {
lizhongyi_'s avatar
lizhongyi_ 已提交
144
	 *    "app": {
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
	 *        "android": {
	 *            "osVer": "4.4.4",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "3.9.0"
	 *        },
	 *        "ios": {
	 *            "osVer": "13.0",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "3.9.0"
	 *   	  }
	 *    }
	 * }
	 * @uniVersion 3.7.7
	 * @uniVueVersion 2,3  //支持的vue版本
	 */
160
	setUserCaptureScreen : SetUserCaptureScreen
161
}