interface.uts 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /**
  2. * uni.onUserCaptureScreen/uni.offUserCaptureScreen回调参数
  3. */
  4. export type OnUserCaptureScreenCallbackResult = {
  5. /**
  6. * 截屏文件路径(仅Android返回)
  7. */
  8. path ?: string
  9. }
  10. /**
  11. * uni.onUserCaptureScreen/uni.offUserCaptureScreen回调函数定义
  12. */
  13. export type UserCaptureScreenCallback = (res : OnUserCaptureScreenCallbackResult) => void
  14. export type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
  15. export type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
  16. /**
  17. * uni.setUserCaptureScreen成功回调参数
  18. */
  19. export type SetUserCaptureScreenSuccess = {
  20. }
  21. /**
  22. * uni.setUserCaptureScreen成功回调函数定义
  23. */
  24. export type SetUserCaptureScreenSuccessCallback = (res : SetUserCaptureScreenSuccess) => void
  25. /**
  26. * uni.setUserCaptureScreen失败回调函数定义
  27. */
  28. export type SetUserCaptureScreenFailCallback = (res : IUniError) => void
  29. /**
  30. * uni.setUserCaptureScreen完成回调函数定义
  31. */
  32. export type SetUserCaptureScreenCompleteCallback = (res : any) => void
  33. /**
  34. * uni.setUserCaptureScreen参数
  35. */
  36. export type SetUserCaptureScreenOptions = {
  37. /**
  38. * true: 允许用户截屏 false: 不允许用户截屏,防止用户截屏到应用页面内容
  39. */
  40. enable : boolean;
  41. /**
  42. * 接口调用成功的回调函数
  43. */
  44. // success : SetUserCaptureScreenSuccessCallback | null,
  45. success ?: SetUserCaptureScreenSuccessCallback,
  46. /**
  47. * 接口调用失败的回调函数
  48. */
  49. // fail : SetUserCaptureScreenFailCallback | null,
  50. fail ?: SetUserCaptureScreenFailCallback,
  51. /**
  52. * 接口调用结束的回调函数(调用成功、失败都会执行)
  53. */
  54. // complete : SetUserCaptureScreenSuccessCallback | SetUserCaptureScreenFailCallback | null
  55. complete ?: SetUserCaptureScreenCompleteCallback
  56. }
  57. /**
  58. * 错误码
  59. * - 12001 "setUserCaptureScreen:system not support"
  60. * - 12010 "setUserCaptureScreen:system internal error"
  61. */
  62. export type SetUserCaptureScreenErrorCode = 12001 | 12010;
  63. /**
  64. * SetUserCaptureScreen 的错误回调参数
  65. */
  66. export interface SetUserCaptureScreenFail extends IUniError {
  67. errCode : SetUserCaptureScreenErrorCode
  68. };
  69. export type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void
  70. export interface Uni {
  71. /**
  72. * 开启截屏监听
  73. *
  74. * @param {UserCaptureScreenCallback} callback
  75. * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
  76. * @uniPlatform {
  77. * "app": {
  78. * "android": {
  79. * "osVer": "4.4.4",
  80. * "uniVer": "3.7.7",
  81. * "unixVer": "3.9.0"
  82. * },
  83. * "ios": {
  84. * "osVer": "12.0",
  85. * "uniVer": "3.7.7",
  86. * "unixVer": "4.11"
  87. * },
  88. * "harmony": {
  89. * "osVer": "3.0",
  90. * "uniVer": "4.25",
  91. * "unixVer": "x"
  92. * }
  93. * }
  94. * }
  95. * @uniVersion 3.7.7
  96. * @uniVueVersion 2,3 //支持的vue版本
  97. * @autotest { expectCallback: true }
  98. */
  99. onUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
  100. /**
  101. * 关闭截屏监听
  102. *
  103. * @param {UserCaptureScreenCallback} callback
  104. * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
  105. * @uniPlatform {
  106. * "app": {
  107. * "android": {
  108. * "osVer": "4.4.4",
  109. * "uniVer": "3.7.7",
  110. * "unixVer": "3.9.0"
  111. * },
  112. * "ios": {
  113. * "osVer": "12.0",
  114. * "uniVer": "3.7.7",
  115. * "unixVer": "4.11"
  116. * },
  117. * "harmony": {
  118. * "osVer": "3.0",
  119. * "uniVer": "4.25",,
  120. * "unixVer": "x"
  121. * }
  122. * }
  123. * }
  124. * @uniVersion 3.7.7
  125. * @uniVueVersion 2,3 //支持的vue版本
  126. * @autotest { expectCallback: true }
  127. */
  128. offUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
  129. /**
  130. * 设置防截屏
  131. *
  132. * @param {SetUserCaptureScreenOptions} options
  133. * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
  134. * @uniPlatform {
  135. * "app": {
  136. * "android": {
  137. * "osVer": "4.4.4",
  138. * "uniVer": "3.7.7",
  139. * "unixVer": "3.9.0"
  140. * },
  141. * "ios": {
  142. * "osVer": "13.0",
  143. * "uniVer": "3.7.7",
  144. * "unixVer": "4.11"
  145. * },
  146. * "harmony": {
  147. * "osVer": "3.0",
  148. * "uniVer": "4.25",
  149. * "unixVer": "x"
  150. * }
  151. * }
  152. * }
  153. * @uniVersion 3.7.7
  154. * @uniVueVersion 2,3 //支持的vue版本
  155. */
  156. setUserCaptureScreen(options : SetUserCaptureScreenOptions) : void
  157. }