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

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

D
DCloud_LXH 已提交
16
	export type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
17

D
DCloud_LXH 已提交
18
	export type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
19

D
DCloud_LXH 已提交
20 21 22 23 24
	/**
		* uni.setUserCaptureScreen成功回调参数
		*/
	export type SetUserCaptureScreenSuccess = {
	}
25

lizhongyi_'s avatar
lizhongyi_ 已提交
26

27
	/**
D
DCloud_LXH 已提交
28 29 30 31
		* uni.setUserCaptureScreen成功回调函数定义
		*/
	export type SetUserCaptureScreenSuccessCallback = (res : SetUserCaptureScreenSuccess) => void

32
	/**
D
DCloud_LXH 已提交
33 34 35 36
		* uni.setUserCaptureScreen失败回调函数定义
		*/
	export type SetUserCaptureScreenFailCallback = (res : IUniError) => void

37
	/**
D
DCloud_LXH 已提交
38 39 40
		* uni.setUserCaptureScreen完成回调函数定义
		*/
	export type SetUserCaptureScreenCompleteCallback = (res : any) => void
D
DCloud_LXH 已提交
41

D
DCloud_LXH 已提交
42 43 44
	/**
		* uni.setUserCaptureScreen参数
		*/
45

D
DCloud_LXH 已提交
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
	export type SetUserCaptureScreenOptions = {
		/**
		* true: 允许用户截屏 false: 不允许用户截屏,防止用户截屏到应用页面内容
		*/
		enable : boolean;
		/**
		* 接口调用成功的回调函数
		*/
		// success : SetUserCaptureScreenSuccessCallback | null,
		success ?: SetUserCaptureScreenSuccessCallback,
		/**
		* 接口调用失败的回调函数
		*/
		// fail : SetUserCaptureScreenFailCallback | null,
		fail ?: SetUserCaptureScreenFailCallback,
		/**
		* 接口调用结束的回调函数(调用成功、失败都会执行)
		*/
		// complete : SetUserCaptureScreenSuccessCallback | SetUserCaptureScreenFailCallback | null
		complete ?: SetUserCaptureScreenCompleteCallback
	}
67

D
DCloud_LXH 已提交
68
	/**
D
DCloud_LXH 已提交
69 70 71
	 * 错误码
	 * - 12001 "setUserCaptureScreen:system not support"
	 * - 12010 "setUserCaptureScreen:system internal error"
72
	 */
D
DCloud_LXH 已提交
73
	export type SetUserCaptureScreenErrorCode = 12001 | 12010;
D
DCloud_LXH 已提交
74
	/**
D
DCloud_LXH 已提交
75
	 * SetUserCaptureScreen 的错误回调参数
76
	 */
D
DCloud_LXH 已提交
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
	export interface SetUserCaptureScreenFail extends IUniError {
		errCode : SetUserCaptureScreenErrorCode
	};

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

	export interface Uni {
		/**
		 * 开启截屏监听
		 *
		 * @param {UserCaptureScreenCallback} callback
		 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
		 * @uniPlatform {
		 *    "app": {
		 *        "android": {
		 *            "osVer": "4.4.4",
		 *            "uniVer": "3.7.7",
		 *            "unixVer": "3.9.0"
		 *        },
		 *        "ios": {
		 *            "osVer": "12.0",
		 *            "uniVer": "3.7.7",
		 *            "unixVer": "4.11"
		 *   	  },
			 *    "harmony": {
			 *      "osVer": "3.0",
			 *      "uniVer": "4.25",
			 *      "unixVer": "x"
			 *    }
		 *    }
		 * }
		 * @uniVersion 3.7.7
		 * @uniVueVersion 2,3  //支持的vue版本
		 * @autotest { expectCallback: true }
		 */
		onUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
		/**
		 * 关闭截屏监听
		 *
		 * @param {UserCaptureScreenCallback} callback
		 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
		 * @uniPlatform {
		 *    "app": {
		 *        "android": {
		 *            "osVer": "4.4.4",
		 *            "uniVer": "3.7.7",
		 *            "unixVer": "3.9.0"
		 *        },
		 *        "ios": {
		 *            "osVer": "12.0",
		 *            "uniVer": "3.7.7",
		 *            "unixVer": "4.11"
		 *   	  },
			 *    "harmony": {
			 *      "osVer": "3.0",
			 *      "uniVer": "4.25",,
			 *      "unixVer": "x"
			 *    }
		 *    }
		 * }
		 * @uniVersion 3.7.7
		 * @uniVueVersion 2,3  //支持的vue版本
		 * @autotest { expectCallback: true }
		 */
		offUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
		/**
		 * 设置防截屏
		 *
		 * @param {SetUserCaptureScreenOptions} options
		 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
		 * @uniPlatform {
		 *    "app": {
		 *        "android": {
		 *            "osVer": "4.4.4",
		 *            "uniVer": "3.7.7",
		 *            "unixVer": "3.9.0"
		 *        },
		 *        "ios": {
		 *            "osVer": "13.0",
		 *            "uniVer": "3.7.7",
		 *            "unixVer": "4.11"
		 *   	  },
			 *    "harmony": {
			 *      "osVer": "3.0",
			 *      "uniVer": "4.25",
			 *      "unixVer": "x"
			 *    }
		 *    }
		 * }
		 * @uniVersion 3.7.7
		 * @uniVueVersion 2,3  //支持的vue版本
		 */
		setUserCaptureScreen(options : SetUserCaptureScreenOptions) : void
	}