@dcloudio/uni-app-x 0.7.58 → 0.7.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/package.json +6 -2
  2. package/types/index.d.ts +1 -0
  3. package/types/native/CSSStyleDeclaration.d.ts +31 -6
  4. package/types/native/DOMRect.d.ts +60 -10
  5. package/types/native/IUniElement.d.ts +459 -0
  6. package/types/native/UniElement.d.ts +3 -2
  7. package/types/native/UniPage.d.ts +2 -2
  8. package/types/native/UniWebViewContentHeightChangeEvent.d.ts +31 -0
  9. package/types/native/UniWebViewElement.d.ts +3 -1
  10. package/types/native/global.d.ts +8 -0
  11. package/types/native/index.d.ts +1 -0
  12. package/types/uni/env/index.d.ts +5 -5
  13. package/types/uni/uts-plugin-api/.temp/uni-actionSheet/utssdk/interface.uts +554 -0
  14. package/types/uni/uts-plugin-api/.temp/uni-addPhoneContact/utssdk/interface.uts +224 -0
  15. package/types/uni/uts-plugin-api/.temp/uni-arrayBufferToBase64/utssdk/interface.uts +77 -0
  16. package/types/uni/uts-plugin-api/.temp/uni-authentication/utssdk/interface.uts +365 -0
  17. package/types/uni/uts-plugin-api/.temp/uni-base64ToArrayBuffer/utssdk/interface.uts +77 -0
  18. package/types/uni/uts-plugin-api/.temp/uni-canvas/utssdk/interface.uts +972 -0
  19. package/types/uni/uts-plugin-api/.temp/uni-chooseLocation/utssdk/interface.uts +410 -0
  20. package/types/uni/uts-plugin-api/.temp/uni-chooseMedia/utssdk/interface.uts +459 -0
  21. package/types/uni/uts-plugin-api/.temp/uni-clipboard/utssdk/interface.uts +203 -0
  22. package/types/uni/uts-plugin-api/.temp/uni-createInnerAudioContext/utssdk/interface.uts +2613 -0
  23. package/types/uni/uts-plugin-api/.temp/uni-createIntersectionObserver/utssdk/interface.uts +152 -0
  24. package/types/uni/uts-plugin-api/.temp/uni-createRequestPermissionListener/utssdk/interface.uts +61 -0
  25. package/types/uni/uts-plugin-api/.temp/uni-createSelectorQuery/utssdk/interface.uts +548 -0
  26. package/types/uni/uts-plugin-api/.temp/uni-createWebviewContext/utssdk/interface.uts +137 -0
  27. package/types/uni/uts-plugin-api/.temp/uni-dialogPage/utssdk/interface.uts +1380 -0
  28. package/types/uni/uts-plugin-api/.temp/uni-document/utssdk/interface.uts +76 -0
  29. package/types/uni/uts-plugin-api/.temp/uni-event/utssdk/interface.uts +338 -0
  30. package/types/uni/uts-plugin-api/.temp/uni-exit/utssdk/interface.uts +102 -0
  31. package/types/uni/uts-plugin-api/.temp/uni-file/utssdk/interface.uts +384 -0
  32. package/types/uni/uts-plugin-api/.temp/uni-fileSystemManager/utssdk/interface.uts +5316 -0
  33. package/types/uni/uts-plugin-api/.temp/uni-getAccessibilityInfo/utssdk/interface.uts +35 -0
  34. package/types/uni/uts-plugin-api/.temp/uni-getAppAuthorizeSetting/utssdk/interface.uts +616 -0
  35. package/types/uni/uts-plugin-api/.temp/uni-getAppBaseInfo/utssdk/interface.uts +2157 -0
  36. package/types/uni/uts-plugin-api/.temp/uni-getBackgroundAudioManager/utssdk/interface.uts +895 -0
  37. package/types/uni/uts-plugin-api/.temp/uni-getDeviceInfo/utssdk/interface.uts +1755 -0
  38. package/types/uni/uts-plugin-api/.temp/uni-getElementById/utssdk/interface.uts +82 -0
  39. package/types/uni/uts-plugin-api/.temp/uni-getEnterOptionsSync/utssdk/interface.uts +295 -0
  40. package/types/uni/uts-plugin-api/.temp/uni-getLaunchOptionsSync/utssdk/interface.uts +299 -0
  41. package/types/uni/uts-plugin-api/.temp/uni-getLocation/utssdk/interface.uts +1764 -0
  42. package/types/uni/uts-plugin-api/.temp/uni-getLocation-system/utssdk/interface.uts +1 -0
  43. package/types/uni/uts-plugin-api/.temp/uni-getLocation-tencent/utssdk/interface.uts +1 -0
  44. package/types/uni/uts-plugin-api/.temp/uni-getLocation-tencent-uni1/utssdk/interface.uts +736 -0
  45. package/types/uni/uts-plugin-api/.temp/uni-getNetworkType/utssdk/interface.uts +274 -0
  46. package/types/uni/uts-plugin-api/.temp/uni-getPerformance/utssdk/interface.uts +198 -0
  47. package/types/uni/uts-plugin-api/.temp/uni-getProvider/utssdk/interface.uts +634 -0
  48. package/types/uni/uts-plugin-api/.temp/uni-getRecorderManager/utssdk/interface.uts +980 -0
  49. package/types/uni/uts-plugin-api/.temp/uni-getSystemInfo/utssdk/interface.uts +5550 -0
  50. package/types/uni/uts-plugin-api/.temp/uni-getSystemSetting/utssdk/interface.uts +501 -0
  51. package/types/uni/uts-plugin-api/.temp/uni-installApk/utssdk/interface.uts +83 -0
  52. package/types/uni/uts-plugin-api/.temp/uni-interceptor/utssdk/interface.uts +169 -0
  53. package/types/uni/uts-plugin-api/.temp/uni-keyboard/utssdk/interface.uts +102 -0
  54. package/types/uni/uts-plugin-api/.temp/uni-loadFontFace/utssdk/interface.uts +580 -0
  55. package/types/uni/uts-plugin-api/.temp/uni-makePhoneCall/utssdk/interface.uts +100 -0
  56. package/types/uni/uts-plugin-api/.temp/uni-media/utssdk/interface.uts +2980 -0
  57. package/types/uni/uts-plugin-api/.temp/uni-modal/utssdk/interface.uts +190 -0
  58. package/types/uni/uts-plugin-api/.temp/uni-navigationBar/utssdk/interface.uts +1002 -0
  59. package/types/uni/uts-plugin-api/.temp/uni-network/utssdk/interface.uts +3620 -0
  60. package/types/uni/uts-plugin-api/.temp/uni-oauth/utssdk/interface.uts +1592 -0
  61. package/types/uni/uts-plugin-api/.temp/uni-oauth-huawei/utssdk/interface.uts +1 -0
  62. package/types/uni/uts-plugin-api/.temp/uni-openAppAuthorizeSetting/utssdk/interface.uts +254 -0
  63. package/types/uni/uts-plugin-api/.temp/uni-openDocument/utssdk/interface.uts +112 -0
  64. package/types/uni/uts-plugin-api/.temp/uni-pageScrollTo/utssdk/interface.uts +153 -0
  65. package/types/uni/uts-plugin-api/.temp/uni-payment/utssdk/interface.uts +833 -0
  66. package/types/uni/uts-plugin-api/.temp/uni-payment-alipay/utssdk/interface.uts +1 -0
  67. package/types/uni/uts-plugin-api/.temp/uni-payment-huawei/utssdk/interface.uts +1 -0
  68. package/types/uni/uts-plugin-api/.temp/uni-payment-wxpay/utssdk/interface.uts +3 -0
  69. package/types/uni/uts-plugin-api/.temp/uni-previewImage/utssdk/interface.uts +518 -0
  70. package/types/uni/uts-plugin-api/.temp/uni-privacy/utssdk/interface.uts +560 -0
  71. package/types/uni/uts-plugin-api/.temp/uni-prompt/utssdk/interface.uts +2607 -0
  72. package/types/uni/uts-plugin-api/.temp/uni-pullDownRefresh/utssdk/interface.uts +189 -0
  73. package/types/uni/uts-plugin-api/.temp/uni-requestMerchantTransfer/utssdk/interface.uts +710 -0
  74. package/types/uni/uts-plugin-api/.temp/uni-route/utssdk/interface.uts +2695 -0
  75. package/types/uni/uts-plugin-api/.temp/uni-rpx2px/utssdk/interface.uts +80 -0
  76. package/types/uni/uts-plugin-api/.temp/uni-scanCode/utssdk/interface.uts +130 -0
  77. package/types/uni/uts-plugin-api/.temp/uni-shareWithSystem/utssdk/interface.uts +719 -0
  78. package/types/uni/uts-plugin-api/.temp/uni-sse/utssdk/interface.uts +277 -0
  79. package/types/uni/uts-plugin-api/.temp/uni-storage/utssdk/interface.uts +1020 -0
  80. package/types/uni/uts-plugin-api/.temp/uni-tabBar/utssdk/interface.uts +1148 -0
  81. package/types/uni/uts-plugin-api/.temp/uni-theme/utssdk/interface.uts +1059 -0
  82. package/types/uni/uts-plugin-api/.temp/uni-virtualPayment/utssdk/interface.uts +1660 -0
  83. package/types/uni/uts-plugin-api/.temp/uni-websocket/utssdk/interface.uts +1941 -0
  84. package/types/uni/uts-plugin-api/global.d.ts +3 -0
  85. package/types/uni/uts-plugin-api/index.d.ts +3 -0
  86. package/types/uni/uts-plugin-api/lib/uni-barcode-scanning/utssdk/global.d.ts +8 -0
  87. package/types/uni/uts-plugin-api/lib/uni-barcode-scanning/utssdk/index.d.ts +4 -0
  88. package/types/uni/uts-plugin-api/lib/uni-barcode-scanning/utssdk/interface.d.ts +0 -0
  89. package/types/uni/uts-plugin-api/lib/uni-clipboard/utssdk/global.d.ts +4 -0
  90. package/types/uni/uts-plugin-api/lib/uni-clipboard/utssdk/index.d.ts +2 -0
  91. package/types/uni/uts-plugin-api/lib/uni-clipboard/utssdk/interface.d.ts +16 -6
  92. package/types/uni/uts-plugin-api/lib/uni-createInnerAudioContext/utssdk/interface.d.ts +1 -1
  93. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/global.d.ts +2 -0
  94. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/index.d.ts +1 -0
  95. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/interface.d.ts +45 -0
  96. package/types/uni/uts-plugin-api/lib/uni-file/utssdk/interface.d.ts +3 -0
  97. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/interface.d.ts +238 -233
  98. package/types/uni/uts-plugin-api/lib/uni-getBackgroundAudioManager/utssdk/interface.d.ts +1 -1
  99. package/types/uni/uts-plugin-api/lib/uni-getProvider/utssdk/interface.d.ts +28 -1
  100. package/types/uni/uts-plugin-api/lib/uni-getSystemInfo/utssdk/interface.d.ts +0 -9
  101. package/types/uni/uts-plugin-api/lib/uni-keyboard/utssdk/interface.d.ts +67 -239
  102. package/types/uni/uts-plugin-api/lib/uni-loadFontFace/utssdk/interface.d.ts +24 -4
  103. package/types/uni/uts-plugin-api/lib/uni-makePhoneCall/utssdk/global.d.ts +4 -0
  104. package/types/uni/uts-plugin-api/lib/uni-makePhoneCall/utssdk/index.d.ts +2 -0
  105. package/types/uni/uts-plugin-api/lib/uni-makePhoneCall/utssdk/interface.d.ts +293 -179
  106. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +118 -78
  107. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/global.d.ts +8 -0
  108. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/index.d.ts +4 -0
  109. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/interface.d.ts +3932 -3514
  110. package/types/uni/uts-plugin-api/lib/uni-openDocument/utssdk/global.d.ts +4 -0
  111. package/types/uni/uts-plugin-api/lib/uni-openDocument/utssdk/index.d.ts +2 -0
  112. package/types/uni/uts-plugin-api/lib/uni-openDocument/utssdk/interface.d.ts +778 -290
  113. package/types/uni/uts-plugin-api/lib/uni-recorder/utssdk/global.d.ts +4 -0
  114. package/types/uni/uts-plugin-api/lib/uni-recorder/utssdk/index.d.ts +2 -0
  115. package/types/uni/uts-plugin-api/lib/uni-recorder/utssdk/interface.d.ts +2254 -1281
  116. package/types/uni/uts-plugin-api/lib/uni-scanCode/utssdk/interface.d.ts +1 -1
  117. package/types/uni/uts-plugin-api/lib/uni-share/utssdk/global.d.ts +36 -0
  118. package/types/uni/uts-plugin-api/lib/uni-share/utssdk/index.d.ts +17 -0
  119. package/types/uni/uts-plugin-api/lib/uni-share/utssdk/interface.d.ts +180 -0
  120. package/types/uni/uts-plugin-api/lib/uni-share-weixin/utssdk/global.d.ts +8 -0
  121. package/types/uni/uts-plugin-api/lib/uni-share-weixin/utssdk/index.d.ts +4 -0
  122. package/types/uni/uts-plugin-api/lib/uni-share-weixin/utssdk/interface.d.ts +1 -0
  123. package/types/uni/uts-plugin-api/lib/uni-sse/utssdk/interface.d.ts +2 -2
  124. package/types/uni/uts-plugin-api/lib/uni-theme/utssdk/interface.d.ts +126 -67
  125. package/types/uni/uts-plugin-biz/.temp/uni-ad/utssdk/interface.uts +726 -0
  126. package/types/uni/uts-plugin-biz/.temp/uni-crash/utssdk/interface.uts +89 -0
  127. package/types/uni/uts-plugin-biz/.temp/uni-facialRecognitionVerify/utssdk/interface.uts +212 -0
  128. package/types/uni/uts-plugin-biz/.temp/uni-map-tencent/utssdk/interface.uts +2359 -0
  129. package/types/uni/uts-plugin-biz/.temp/uni-push/utssdk/interface.uts +960 -0
  130. package/types/uni/uts-plugin-biz/.temp/uni-secure-network/utssdk/interface.uts +204 -0
  131. package/types/uni/uts-plugin-biz/.temp/uni-verify/utssdk/interface.uts +730 -0
  132. package/types/uni/uts-plugin-component/.temp/uni-camera/utssdk/interface.uts +221 -0
  133. package/types/uni/uts-plugin-component/.temp/uni-video/utssdk/interface.uts +935 -0
  134. package/types/uni/uts-plugin-component/lib/uni-camera/utssdk/global.d.ts +16 -0
  135. package/types/uni/uts-plugin-component/lib/uni-camera/utssdk/index.d.ts +8 -0
  136. package/types/uni/uts-plugin-component/lib/uni-camera/utssdk/interface.d.ts +203 -1
  137. package/types/uni-cloud/interface.d.ts +229 -0
  138. package/types/vite.d.ts +269 -0
@@ -0,0 +1,3620 @@
1
+ export type Request<T> = (param: RequestOptions<T>) => RequestTask;
2
+
3
+ /**
4
+ * 网络请求参数
5
+ */
6
+ export type RequestOptions<T> = {
7
+ /**
8
+ * 开发者服务器接口地址
9
+ *
10
+ * @uniPlatform
11
+ {
12
+ "app": {
13
+ "android": {
14
+ "osVer": "5.0",
15
+ "uniVer": "√",
16
+ "uniUtsPlugin": "3.91",
17
+ "unixVer": "3.91",
18
+ "unixUtsPlugin": "3.91"
19
+ },
20
+ "ios": {
21
+ "osVer": "12.0",
22
+ "uniVer": "√",
23
+ "uniUtsPlugin": "4.11",
24
+ "unixVer": "4.11",
25
+ "unixUtsPlugin": "4.11"
26
+ },
27
+ "harmony": {
28
+ "osVer": "3.0",
29
+ "uniVer": "4.23",
30
+ "unixVer": "4.61"
31
+ }
32
+ },
33
+ * "mp": {
34
+ * "weixin": {
35
+ * "hostVer": "√",
36
+ * "uniVer": "√",
37
+ * "unixVer": "4.41"
38
+ * },
39
+ * "alipay": {
40
+ * "hostVer": "√",
41
+ * "uniVer": "√",
42
+ * "unixVer": "x"
43
+ * },
44
+ * "baidu": {
45
+ * "hostVer": "√",
46
+ * "uniVer": "√",
47
+ * "unixVer": "x"
48
+ * },
49
+ * "toutiao": {
50
+ * "hostVer": "√",
51
+ * "uniVer": "√",
52
+ * "unixVer": "x"
53
+ * },
54
+ * "lark": {
55
+ * "hostVer": "√",
56
+ * "uniVer": "√",
57
+ * "unixVer": "x"
58
+ * },
59
+ * "qq": {
60
+ * "hostVer": "√",
61
+ * "uniVer": "√",
62
+ * "unixVer": "x"
63
+ * },
64
+ * "kuaishou": {
65
+ * "hostVer": "√",
66
+ * "uniVer": "√",
67
+ * "unixVer": "x"
68
+ * },
69
+ * "jd": {
70
+ * "hostVer": "√",
71
+ * "uniVer": "√",
72
+ * "unixVer": "x"
73
+ * }
74
+ * },
75
+ "web": {
76
+ "uniVer": "√",
77
+ "unixVer": "4.0"
78
+ }
79
+ }
80
+ */
81
+ url: string,
82
+ /**
83
+ * 请求的参数 在`app-android端,参数类型只能为`UTSJSONObject`或者`string`类型,app-android平台从 4.51版本开始支持ArrayBuffer
84
+ * @type {RequestDataOptions}
85
+ * @defaultValue null
86
+ * @uniPlatform
87
+ {
88
+ "app": {
89
+ "android": {
90
+ "osVer": "5.0",
91
+ "uniVer": "√",
92
+ "uniUtsPlugin": "3.91",
93
+ "unixVer": "3.91",
94
+ "unixUtsPlugin": "3.91"
95
+ },
96
+ "ios": {
97
+ "osVer": "12.0",
98
+ "uniVer": "√",
99
+ "uniUtsPlugin": "4.11",
100
+ "unixVer": "4.11",
101
+ "unixUtsPlugin": "4.11"
102
+ },
103
+ "harmony": {
104
+ "osVer": "3.0",
105
+ "uniVer": "4.23",
106
+ "unixVer": "4.61"
107
+ }
108
+ },
109
+ * "mp": {
110
+ * "weixin": {
111
+ * "hostVer": "√",
112
+ * "uniVer": "√",
113
+ * "unixVer": "4.41"
114
+ * },
115
+ * "alipay": {
116
+ * "hostVer": "√",
117
+ * "uniVer": "√",
118
+ * "unixVer": "x"
119
+ * },
120
+ * "baidu": {
121
+ * "hostVer": "√",
122
+ * "uniVer": "√",
123
+ * "unixVer": "x"
124
+ * },
125
+ * "toutiao": {
126
+ * "hostVer": "√",
127
+ * "uniVer": "√",
128
+ * "unixVer": "x"
129
+ * },
130
+ * "lark": {
131
+ * "hostVer": "√",
132
+ * "uniVer": "√",
133
+ * "unixVer": "x"
134
+ * },
135
+ * "qq": {
136
+ * "hostVer": "√",
137
+ * "uniVer": "√",
138
+ * "unixVer": "x"
139
+ * },
140
+ * "kuaishou": {
141
+ * "hostVer": "√",
142
+ * "uniVer": "√",
143
+ * "unixVer": "x"
144
+ * },
145
+ * "jd": {
146
+ * "hostVer": "√",
147
+ * "uniVer": "√",
148
+ * "unixVer": "x"
149
+ * }
150
+ * },
151
+ "web": {
152
+ "uniVer": "√",
153
+ "unixVer": "4.0"
154
+ }
155
+ }
156
+ */
157
+ data?: any | null,
158
+ /**
159
+ * 设置请求的 header,header 中不能设置 Referer
160
+ * @defaultValue null
161
+ * @uniPlatform
162
+ {
163
+ "app": {
164
+ "android": {
165
+ "osVer": "5.0",
166
+ "uniVer": "√",
167
+ "uniUtsPlugin": "3.91",
168
+ "unixVer": "3.91",
169
+ "unixUtsPlugin": "3.91"
170
+ },
171
+ "ios": {
172
+ "osVer": "12.0",
173
+ "uniVer": "√",
174
+ "uniUtsPlugin": "4.11",
175
+ "unixVer": "4.11",
176
+ "unixUtsPlugin": "4.11"
177
+ },
178
+ "harmony": {
179
+ "osVer": "3.0",
180
+ "uniVer": "4.23",
181
+ "unixVer": "4.61"
182
+ }
183
+ },
184
+ * "mp": {
185
+ * "weixin": {
186
+ * "hostVer": "√",
187
+ * "uniVer": "√",
188
+ * "unixVer": "4.41"
189
+ * },
190
+ * "alipay": {
191
+ * "hostVer": "√",
192
+ * "uniVer": "√",
193
+ * "unixVer": "x"
194
+ * },
195
+ * "baidu": {
196
+ * "hostVer": "√",
197
+ * "uniVer": "√",
198
+ * "unixVer": "x"
199
+ * },
200
+ * "toutiao": {
201
+ * "hostVer": "√",
202
+ * "uniVer": "√",
203
+ * "unixVer": "x"
204
+ * },
205
+ * "lark": {
206
+ * "hostVer": "√",
207
+ * "uniVer": "√",
208
+ * "unixVer": "x"
209
+ * },
210
+ * "qq": {
211
+ * "hostVer": "√",
212
+ * "uniVer": "√",
213
+ * "unixVer": "x"
214
+ * },
215
+ * "kuaishou": {
216
+ * "hostVer": "√",
217
+ * "uniVer": "√",
218
+ * "unixVer": "x"
219
+ * },
220
+ * "jd": {
221
+ * "hostVer": "√",
222
+ * "uniVer": "√",
223
+ * "unixVer": "x"
224
+ * }
225
+ * },
226
+ "web": {
227
+ "uniVer": "√",
228
+ "unixVer": "4.0"
229
+ }
230
+ }
231
+ */
232
+ header?: UTSJSONObject | null,
233
+ /**
234
+ * 请求方法,如果设置的值不在取值范围内,会以GET方法进行请求。
235
+ * @defaultValue "GET"
236
+ * @uniPlatform
237
+ {
238
+ "app": {
239
+ "android": {
240
+ "osVer": "5.0",
241
+ "uniVer": "√",
242
+ "uniUtsPlugin": "3.91",
243
+ "unixVer": "3.91",
244
+ "unixUtsPlugin": "3.91"
245
+ },
246
+ "ios": {
247
+ "osVer": "12.0",
248
+ "uniVer": "√",
249
+ "uniUtsPlugin": "4.11",
250
+ "unixVer": "4.11",
251
+ "unixUtsPlugin": "4.11"
252
+ },
253
+ "harmony": {
254
+ "osVer": "3.0",
255
+ "uniVer": "4.23",
256
+ "unixVer": "4.61"
257
+ }
258
+ },
259
+ * "mp": {
260
+ * "weixin": {
261
+ * "hostVer": "√",
262
+ * "uniVer": "√",
263
+ * "unixVer": "4.41"
264
+ * },
265
+ * "alipay": {
266
+ * "hostVer": "√",
267
+ * "uniVer": "√",
268
+ * "unixVer": "x"
269
+ * },
270
+ * "baidu": {
271
+ * "hostVer": "√",
272
+ * "uniVer": "√",
273
+ * "unixVer": "x"
274
+ * },
275
+ * "toutiao": {
276
+ * "hostVer": "√",
277
+ * "uniVer": "√",
278
+ * "unixVer": "x"
279
+ * },
280
+ * "lark": {
281
+ * "hostVer": "√",
282
+ * "uniVer": "√",
283
+ * "unixVer": "x"
284
+ * },
285
+ * "qq": {
286
+ * "hostVer": "√",
287
+ * "uniVer": "√",
288
+ * "unixVer": "x"
289
+ * },
290
+ * "kuaishou": {
291
+ * "hostVer": "√",
292
+ * "uniVer": "√",
293
+ * "unixVer": "x"
294
+ * },
295
+ * "jd": {
296
+ * "hostVer": "√",
297
+ * "uniVer": "√",
298
+ * "unixVer": "x"
299
+ * }
300
+ * },
301
+ "web": {
302
+ "uniVer": "√",
303
+ "unixVer": "4.0"
304
+ }
305
+ }
306
+ */
307
+ method?: RequestMethod | null,
308
+ /**
309
+ * 超时时间,单位 ms
310
+ * @defaultValue 60000
311
+ * @uniPlatform
312
+ {
313
+ "app": {
314
+ "android": {
315
+ "osVer": "5.0",
316
+ "uniVer": "√",
317
+ "uniUtsPlugin": "3.91",
318
+ "unixVer": "3.91",
319
+ "unixUtsPlugin": "3.91"
320
+ },
321
+ "ios": {
322
+ "osVer": "12.0",
323
+ "uniVer": "√",
324
+ "uniUtsPlugin": "4.11",
325
+ "unixVer": "4.11",
326
+ "unixUtsPlugin": "4.11"
327
+ }
328
+ },
329
+ * "mp": {
330
+ * "weixin": {
331
+ * "hostVer": "√",
332
+ * "uniVer": "√",
333
+ * "unixVer": "4.41"
334
+ * },
335
+ * "alipay": {
336
+ * "hostVer": "√",
337
+ * "uniVer": "√",
338
+ * "unixVer": "x"
339
+ * },
340
+ * "baidu": {
341
+ * "hostVer": "√",
342
+ * "uniVer": "√",
343
+ * "unixVer": "x"
344
+ * },
345
+ * "toutiao": {
346
+ * "hostVer": "√",
347
+ * "uniVer": "√",
348
+ * "unixVer": "x"
349
+ * },
350
+ * "lark": {
351
+ * "hostVer": "√",
352
+ * "uniVer": "√",
353
+ * "unixVer": "x"
354
+ * },
355
+ * "qq": {
356
+ * "hostVer": "√",
357
+ * "uniVer": "√",
358
+ * "unixVer": "x"
359
+ * },
360
+ * "kuaishou": {
361
+ * "hostVer": "√",
362
+ * "uniVer": "√",
363
+ * "unixVer": "x"
364
+ * },
365
+ * "jd": {
366
+ * "hostVer": "√",
367
+ * "uniVer": "√",
368
+ * "unixVer": "x"
369
+ * }
370
+ * }
371
+ }
372
+ */
373
+ timeout?: number | null,
374
+ /**
375
+ * 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse
376
+ * @defaultValue "json"
377
+ * @deprecated 不支持
378
+ * @autodoc false
379
+ */
380
+ dataType?: string | null,
381
+ /**
382
+ * 设置响应的数据类型。
383
+ *
384
+ * @deprecated 不支持
385
+ * @autodoc false
386
+ */
387
+ responseType?: string | null,
388
+ /**
389
+ * 验证 ssl 证书
390
+ *
391
+ * @deprecated 不支持
392
+ * @autodoc false
393
+ */
394
+ sslVerify?: boolean | null,
395
+ /**
396
+ * 跨域请求时是否携带凭证(cookies)
397
+ *
398
+ * @uniPlatform
399
+ {
400
+ "app": {
401
+ "android": {
402
+ "osVer": "4.4",
403
+ "uniVer": "√",
404
+ "uniUtsPlugin": "x",
405
+ "unixVer": "x",
406
+ "unixUtsPlugin": "x"
407
+ },
408
+ "ios": {
409
+ "osVer": "12.0",
410
+ "uniVer": "√",
411
+ "uniUtsPlugin": "x",
412
+ "unixVer": "x",
413
+ "unixUtsPlugin": "x"
414
+ },
415
+ "harmony": {
416
+ "osVer": "x",
417
+ "uniVer": "x",
418
+ "unixVer": "x"
419
+ }
420
+ },
421
+ * "mp": {
422
+ * "weixin": {
423
+ * "hostVer": "√",
424
+ * "uniVer": "√",
425
+ * "unixVer": "4.41"
426
+ * },
427
+ * "alipay": {
428
+ * "hostVer": "√",
429
+ * "uniVer": "√",
430
+ * "unixVer": "x"
431
+ * },
432
+ * "baidu": {
433
+ * "hostVer": "√",
434
+ * "uniVer": "√",
435
+ * "unixVer": "x"
436
+ * },
437
+ * "toutiao": {
438
+ * "hostVer": "√",
439
+ * "uniVer": "√",
440
+ * "unixVer": "x"
441
+ * },
442
+ * "lark": {
443
+ * "hostVer": "√",
444
+ * "uniVer": "√",
445
+ * "unixVer": "x"
446
+ * },
447
+ * "qq": {
448
+ * "hostVer": "√",
449
+ * "uniVer": "√",
450
+ * "unixVer": "x"
451
+ * },
452
+ * "kuaishou": {
453
+ * "hostVer": "√",
454
+ * "uniVer": "√",
455
+ * "unixVer": "x"
456
+ * },
457
+ * "jd": {
458
+ * "hostVer": "√",
459
+ * "uniVer": "√",
460
+ * "unixVer": "x"
461
+ * }
462
+ * },
463
+ "web": {
464
+ "uniVer": "√",
465
+ "unixVer": "4.0"
466
+ }
467
+ }
468
+ */
469
+ withCredentials?: boolean | null,
470
+ /**
471
+ * DNS解析时优先使用ipv4
472
+ * @defaultValue false
473
+ * @uniPlatform
474
+ {
475
+ "app": {
476
+ "android": {
477
+ "osVer": "5.0",
478
+ "uniVer": "√",
479
+ "uniUtsPlugin": "x",
480
+ "unixVer": "x",
481
+ "unixUtsPlugin": "x"
482
+ },
483
+ "ios": {
484
+ "osVer": "12.0",
485
+ "uniVer": "√",
486
+ "uniUtsPlugin": "x",
487
+ "unixVer": "x",
488
+ "unixUtsPlugin": "x"
489
+ },
490
+ "harmony": {
491
+ "osVer": "x",
492
+ "uniVer": "x",
493
+ "unixVer": "x"
494
+ }
495
+ },
496
+ * "mp": {
497
+ * "weixin": {
498
+ * "hostVer": "√",
499
+ * "uniVer": "√",
500
+ * "unixVer": "4.41"
501
+ * },
502
+ * "alipay": {
503
+ * "hostVer": "√",
504
+ * "uniVer": "√",
505
+ * "unixVer": "x"
506
+ * },
507
+ * "baidu": {
508
+ * "hostVer": "√",
509
+ * "uniVer": "√",
510
+ * "unixVer": "x"
511
+ * },
512
+ * "toutiao": {
513
+ * "hostVer": "√",
514
+ * "uniVer": "√",
515
+ * "unixVer": "x"
516
+ * },
517
+ * "lark": {
518
+ * "hostVer": "√",
519
+ * "uniVer": "√",
520
+ * "unixVer": "x"
521
+ * },
522
+ * "qq": {
523
+ * "hostVer": "√",
524
+ * "uniVer": "√",
525
+ * "unixVer": "x"
526
+ * },
527
+ * "kuaishou": {
528
+ * "hostVer": "√",
529
+ * "uniVer": "√",
530
+ * "unixVer": "x"
531
+ * },
532
+ * "jd": {
533
+ * "hostVer": "√",
534
+ * "uniVer": "√",
535
+ * "unixVer": "x"
536
+ * }
537
+ * },
538
+ "web": {
539
+ "uniVer": "x",
540
+ "unixVer": "x"
541
+ }
542
+ }
543
+ */
544
+ firstIpv4?: boolean | null,
545
+ /**
546
+ * 网络请求成功回调。
547
+ * @defaultValue null
548
+ */
549
+ success?: RequestSuccessCallback<T> | null,
550
+ /**
551
+ * 网络请求失败回调。
552
+ * @defaultValue null
553
+ */
554
+ fail?: RequestFailCallback | null,
555
+ /**
556
+ * 网络请求完成回调,成功或者失败都会调用。
557
+ * @defaultValue null
558
+ */
559
+ complete?: RequestCompleteCallback | null
560
+ }
561
+
562
+ export type RequestSuccess<T> = {
563
+ /**
564
+ * 开发者服务器返回的数据
565
+ * @type {RequestDataOptions}
566
+ * @uniPlatform
567
+ {
568
+ "app": {
569
+ "android": {
570
+ "osVer": "5.0",
571
+ "uniVer": "√",
572
+ "uniUtsPlugin": "3.91",
573
+ "unixVer": "3.91",
574
+ "unixUtsPlugin": "3.91"
575
+ },
576
+ "ios": {
577
+ "osVer": "12.0",
578
+ "uniVer": "√",
579
+ "uniUtsPlugin": "4.11",
580
+ "unixVer": "4.11",
581
+ "unixUtsPlugin": "4.11"
582
+ },
583
+ "harmony": {
584
+ "osVer": "3.0",
585
+ "uniVer": "4.23",
586
+ "unixVer": "4.61"
587
+ }
588
+ },
589
+ * "mp": {
590
+ * "weixin": {
591
+ * "hostVer": "√",
592
+ * "uniVer": "√",
593
+ * "unixVer": "4.41"
594
+ * },
595
+ * "alipay": {
596
+ * "hostVer": "√",
597
+ * "uniVer": "√",
598
+ * "unixVer": "x"
599
+ * },
600
+ * "baidu": {
601
+ * "hostVer": "√",
602
+ * "uniVer": "√",
603
+ * "unixVer": "x"
604
+ * },
605
+ * "toutiao": {
606
+ * "hostVer": "√",
607
+ * "uniVer": "√",
608
+ * "unixVer": "x"
609
+ * },
610
+ * "lark": {
611
+ * "hostVer": "√",
612
+ * "uniVer": "√",
613
+ * "unixVer": "x"
614
+ * },
615
+ * "qq": {
616
+ * "hostVer": "√",
617
+ * "uniVer": "√",
618
+ * "unixVer": "x"
619
+ * },
620
+ * "kuaishou": {
621
+ * "hostVer": "√",
622
+ * "uniVer": "√",
623
+ * "unixVer": "x"
624
+ * },
625
+ * "jd": {
626
+ * "hostVer": "√",
627
+ * "uniVer": "√",
628
+ * "unixVer": "x"
629
+ * }
630
+ * },
631
+ "web": {
632
+ "uniVer": "√",
633
+ "unixVer": "4.0"
634
+ }
635
+ }
636
+ */
637
+ data: T | null,
638
+ /**
639
+ * 开发者服务器返回的 HTTP 状态码
640
+ * @uniPlatform
641
+ {
642
+ "app": {
643
+ "android": {
644
+ "osVer": "5.0",
645
+ "uniVer": "√",
646
+ "uniUtsPlugin": "3.91",
647
+ "unixVer": "3.91",
648
+ "unixUtsPlugin": "3.91"
649
+ },
650
+ "ios": {
651
+ "osVer": "12.0",
652
+ "uniVer": "√",
653
+ "uniUtsPlugin": "4.11",
654
+ "unixVer": "4.11",
655
+ "unixUtsPlugin": "4.11"
656
+ },
657
+ "harmony": {
658
+ "osVer": "3.0",
659
+ "uniVer": "4.23",
660
+ "unixVer": "4.61"
661
+ }
662
+ },
663
+ * "mp": {
664
+ * "weixin": {
665
+ * "hostVer": "√",
666
+ * "uniVer": "√",
667
+ * "unixVer": "4.41"
668
+ * },
669
+ * "alipay": {
670
+ * "hostVer": "√",
671
+ * "uniVer": "√",
672
+ * "unixVer": "x"
673
+ * },
674
+ * "baidu": {
675
+ * "hostVer": "√",
676
+ * "uniVer": "√",
677
+ * "unixVer": "x"
678
+ * },
679
+ * "toutiao": {
680
+ * "hostVer": "√",
681
+ * "uniVer": "√",
682
+ * "unixVer": "x"
683
+ * },
684
+ * "lark": {
685
+ * "hostVer": "√",
686
+ * "uniVer": "√",
687
+ * "unixVer": "x"
688
+ * },
689
+ * "qq": {
690
+ * "hostVer": "√",
691
+ * "uniVer": "√",
692
+ * "unixVer": "x"
693
+ * },
694
+ * "kuaishou": {
695
+ * "hostVer": "√",
696
+ * "uniVer": "√",
697
+ * "unixVer": "x"
698
+ * },
699
+ * "jd": {
700
+ * "hostVer": "√",
701
+ * "uniVer": "√",
702
+ * "unixVer": "x"
703
+ * }
704
+ * },
705
+ "web": {
706
+ "uniVer": "√",
707
+ "unixVer": "4.0"
708
+ }
709
+ }
710
+ */
711
+ statusCode: number,
712
+ /**
713
+ * 开发者服务器返回的 HTTP Response Header
714
+ * @uniPlatform
715
+ {
716
+ "app": {
717
+ "android": {
718
+ "osVer": "5.0",
719
+ "uniVer": "√",
720
+ "uniUtsPlugin": "3.91",
721
+ "unixVer": "3.91",
722
+ "unixUtsPlugin": "3.91"
723
+ },
724
+ "ios": {
725
+ "osVer": "12.0",
726
+ "uniVer": "√",
727
+ "uniUtsPlugin": "4.11",
728
+ "unixVer": "4.11",
729
+ "unixUtsPlugin": "4.11"
730
+ },
731
+ "harmony": {
732
+ "osVer": "3.0",
733
+ "uniVer": "4.23",
734
+ "unixVer": "4.61"
735
+ }
736
+ },
737
+ * "mp": {
738
+ * "weixin": {
739
+ * "hostVer": "√",
740
+ * "uniVer": "√",
741
+ * "unixVer": "4.41"
742
+ * },
743
+ * "alipay": {
744
+ * "hostVer": "√",
745
+ * "uniVer": "√",
746
+ * "unixVer": "x"
747
+ * },
748
+ * "baidu": {
749
+ * "hostVer": "√",
750
+ * "uniVer": "√",
751
+ * "unixVer": "x"
752
+ * },
753
+ * "toutiao": {
754
+ * "hostVer": "√",
755
+ * "uniVer": "√",
756
+ * "unixVer": "x"
757
+ * },
758
+ * "lark": {
759
+ * "hostVer": "√",
760
+ * "uniVer": "√",
761
+ * "unixVer": "x"
762
+ * },
763
+ * "qq": {
764
+ * "hostVer": "√",
765
+ * "uniVer": "√",
766
+ * "unixVer": "x"
767
+ * },
768
+ * "kuaishou": {
769
+ * "hostVer": "√",
770
+ * "uniVer": "√",
771
+ * "unixVer": "x"
772
+ * },
773
+ * "jd": {
774
+ * "hostVer": "√",
775
+ * "uniVer": "√",
776
+ * "unixVer": "x"
777
+ * }
778
+ * },
779
+ "web": {
780
+ "uniVer": "√",
781
+ "unixVer": "4.0"
782
+ }
783
+ }
784
+ */
785
+ header: any,
786
+ /**
787
+ * 开发者服务器返回的 cookies,格式为字符串数组
788
+ * @uniPlatform
789
+ {
790
+ "app": {
791
+ "android": {
792
+ "osVer": "5.0",
793
+ "uniVer": "√",
794
+ "uniUtsPlugin": "3.91",
795
+ "unixVer": "3.91",
796
+ "unixUtsPlugin": "3.91"
797
+ },
798
+ "ios": {
799
+ "osVer": "12.0",
800
+ "uniVer": "√",
801
+ "uniUtsPlugin": "4.11",
802
+ "unixVer": "4.11",
803
+ "unixUtsPlugin": "4.11"
804
+ },
805
+ "harmony": {
806
+ "osVer": "3.0",
807
+ "uniVer": "4.23",
808
+ "unixVer": "4.61"
809
+ }
810
+ },
811
+ "web": {
812
+ "uniVer": "x",
813
+ "unixVer": "x"
814
+ }
815
+ }
816
+ */
817
+ cookies: Array<string>
818
+ }
819
+
820
+ /**
821
+ * 请求方法
822
+ */
823
+ export type RequestMethod =
824
+ /**
825
+ * GET方法请求一个指定资源的表示形式,使用 GET 的请求应该只被用于获取数据。
826
+ */
827
+ "GET" |
828
+ /**
829
+ * POST方法用于将实体提交到指定的资源,通常导致在服务器上的状态变化或副作用。
830
+ */
831
+ "POST" |
832
+ /**
833
+ * PUT方法用有效载荷请求替换目标资源的所有当前表示。
834
+ */
835
+ "PUT" |
836
+ /**
837
+ * PATCH方法用于对资源应用部分修改。
838
+ */
839
+ "PATCH" |
840
+ /**
841
+ * DELETE方法删除指定的资源。
842
+ */
843
+ "DELETE" |
844
+ /**
845
+ * HEAD方法请求一个与GET请求的响应相同的响应,但没有响应体。
846
+ */
847
+ "HEAD" |
848
+ /**
849
+ * OPTIONS 方法用于描述目标资源的通信选项。
850
+ */
851
+ "OPTIONS";
852
+
853
+ /**
854
+ * 错误码
855
+ */
856
+ export type RequestErrorCode =
857
+ /**
858
+ * 接口超时
859
+ */
860
+ 5 |
861
+ /**
862
+ * 服务端系统错误
863
+ */
864
+ 1000 |
865
+ /**
866
+ * json数据解析错误
867
+ */
868
+ 100001 |
869
+ /**
870
+ * 错误信息json解析失败
871
+ */
872
+ 100002 |
873
+ /**
874
+ * 网络中断
875
+ */
876
+ 600003 |
877
+ /**
878
+ * data参数类型不合法
879
+ */
880
+ 600008 |
881
+ /**
882
+ * URL格式不合法
883
+ */
884
+ 600009 |
885
+ /**
886
+ * request系统错误
887
+ */
888
+ 602001;
889
+
890
+ /**
891
+ * 网络请求失败的错误回调参数
892
+ */
893
+ export interface RequestFail extends IUniError {
894
+ errCode: RequestErrorCode
895
+ };
896
+ export type RequestSuccessCallback<T> = (option: RequestSuccess<T>) => void;
897
+ export type RequestFailCallback = (option: RequestFail) => void;
898
+ export type RequestCompleteCallback = (option: any) => void;
899
+
900
+
901
+ export interface RequestTask {
902
+ /**
903
+ * 中断网络请求。
904
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/request.html
905
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/request.html
906
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/request.html
907
+ * @uniPlatform
908
+ {
909
+ "app": {
910
+ "android": {
911
+ "osVer": "5.0",
912
+ "uniVer": "√",
913
+ "uniUtsPlugin": "3.91",
914
+ "unixVer": "3.91",
915
+ "unixUtsPlugin": "3.91"
916
+ },
917
+ "ios": {
918
+ "osVer": "12.0",
919
+ "uniVer": "√",
920
+ "uniUtsPlugin": "4.11",
921
+ "unixVer": "4.11",
922
+ "unixUtsPlugin": "4.11"
923
+ },
924
+ "harmony": {
925
+ "osVer": "3.0",
926
+ "uniVer": "4.23",
927
+ "unixVer": "4.61"
928
+ }
929
+ },
930
+ * "mp": {
931
+ * "weixin": {
932
+ * "hostVer": "√",
933
+ * "uniVer": "√",
934
+ * "unixVer": "4.41"
935
+ * },
936
+ * "alipay": {
937
+ * "hostVer": "√",
938
+ * "uniVer": "√",
939
+ * "unixVer": "x"
940
+ * },
941
+ * "baidu": {
942
+ * "hostVer": "√",
943
+ * "uniVer": "√",
944
+ * "unixVer": "x"
945
+ * },
946
+ * "toutiao": {
947
+ * "hostVer": "√",
948
+ * "uniVer": "√",
949
+ * "unixVer": "x"
950
+ * },
951
+ * "lark": {
952
+ * "hostVer": "√",
953
+ * "uniVer": "√",
954
+ * "unixVer": "x"
955
+ * },
956
+ * "qq": {
957
+ * "hostVer": "√",
958
+ * "uniVer": "√",
959
+ * "unixVer": "x"
960
+ * },
961
+ * "kuaishou": {
962
+ * "hostVer": "√",
963
+ * "uniVer": "√",
964
+ * "unixVer": "x"
965
+ * },
966
+ * "jd": {
967
+ * "hostVer": "√",
968
+ * "uniVer": "√",
969
+ * "unixVer": "x"
970
+ * }
971
+ * },
972
+ "web": {
973
+ "uniVer": "√",
974
+ "unixVer": "4.0"
975
+ }
976
+ }
977
+ * @example
978
+ ```typescript
979
+ var requestTask = uni.request({
980
+ url: 'http://192.168.12.106:8080/postHalo', //仅为示例,并非真实接口地址。
981
+ complete: ()=> {}
982
+ });
983
+ requestTask.abort();
984
+ ```
985
+ */
986
+ abort(): void
987
+ }
988
+
989
+ //===============================上传==================================
990
+
991
+
992
+ export type UploadFile = (options: UploadFileOptions) => UploadTask;
993
+ export type UploadFileOptionFiles = {
994
+ /**
995
+ * multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。
996
+ * @defaultValue "file"
997
+ * @uniPlatform
998
+ {
999
+ "app": {
1000
+ "android": {
1001
+ "osVer": "5.0",
1002
+ "uniVer": "√",
1003
+ "uniUtsPlugin": "3.91",
1004
+ "unixVer": "3.91",
1005
+ "unixUtsPlugin": "3.91"
1006
+ },
1007
+ "ios": {
1008
+ "osVer": "12.0",
1009
+ "uniVer": "√",
1010
+ "uniUtsPlugin": "4.11",
1011
+ "unixVer": "4.11",
1012
+ "unixUtsPlugin": "4.11"
1013
+ },
1014
+ "harmony": {
1015
+ "osVer": "3.0",
1016
+ "uniVer": "4.23",
1017
+ "unixVer": "4.61"
1018
+ }
1019
+ },
1020
+ * "mp": {
1021
+ * "weixin": {
1022
+ * "hostVer": "√",
1023
+ * "uniVer": "√",
1024
+ * "unixVer": "4.41"
1025
+ * },
1026
+ * "alipay": {
1027
+ * "hostVer": "√",
1028
+ * "uniVer": "√",
1029
+ * "unixVer": "x"
1030
+ * },
1031
+ * "baidu": {
1032
+ * "hostVer": "√",
1033
+ * "uniVer": "√",
1034
+ * "unixVer": "x"
1035
+ * },
1036
+ * "toutiao": {
1037
+ * "hostVer": "√",
1038
+ * "uniVer": "√",
1039
+ * "unixVer": "x"
1040
+ * },
1041
+ * "lark": {
1042
+ * "hostVer": "√",
1043
+ * "uniVer": "√",
1044
+ * "unixVer": "x"
1045
+ * },
1046
+ * "qq": {
1047
+ * "hostVer": "√",
1048
+ * "uniVer": "√",
1049
+ * "unixVer": "x"
1050
+ * },
1051
+ * "kuaishou": {
1052
+ * "hostVer": "√",
1053
+ * "uniVer": "√",
1054
+ * "unixVer": "x"
1055
+ * },
1056
+ * "jd": {
1057
+ * "hostVer": "√",
1058
+ * "uniVer": "√",
1059
+ * "unixVer": "x"
1060
+ * }
1061
+ * },
1062
+ "web": {
1063
+ "uniVer": "√",
1064
+ "unixVer": "4.0"
1065
+ }
1066
+ }
1067
+ */
1068
+ name?: string | null,
1069
+ /**
1070
+ * 要上传文件资源的路径
1071
+ * @uniPlatform
1072
+ {
1073
+ "app": {
1074
+ "android": {
1075
+ "osVer": "5.0",
1076
+ "uniVer": "√",
1077
+ "uniUtsPlugin": "3.91",
1078
+ "unixVer": "3.91",
1079
+ "unixUtsPlugin": "3.91"
1080
+ },
1081
+ "ios": {
1082
+ "osVer": "12.0",
1083
+ "uniVer": "√",
1084
+ "uniUtsPlugin": "4.11",
1085
+ "unixVer": "4.11",
1086
+ "unixUtsPlugin": "4.11"
1087
+ },
1088
+ "harmony": {
1089
+ "osVer": "3.0",
1090
+ "uniVer": "4.23",
1091
+ "unixVer": "4.61"
1092
+ }
1093
+ },
1094
+ * "mp": {
1095
+ * "weixin": {
1096
+ * "hostVer": "√",
1097
+ * "uniVer": "√",
1098
+ * "unixVer": "4.41"
1099
+ * },
1100
+ * "alipay": {
1101
+ * "hostVer": "√",
1102
+ * "uniVer": "√",
1103
+ * "unixVer": "x"
1104
+ * },
1105
+ * "baidu": {
1106
+ * "hostVer": "√",
1107
+ * "uniVer": "√",
1108
+ * "unixVer": "x"
1109
+ * },
1110
+ * "toutiao": {
1111
+ * "hostVer": "√",
1112
+ * "uniVer": "√",
1113
+ * "unixVer": "x"
1114
+ * },
1115
+ * "lark": {
1116
+ * "hostVer": "√",
1117
+ * "uniVer": "√",
1118
+ * "unixVer": "x"
1119
+ * },
1120
+ * "qq": {
1121
+ * "hostVer": "√",
1122
+ * "uniVer": "√",
1123
+ * "unixVer": "x"
1124
+ * },
1125
+ * "kuaishou": {
1126
+ * "hostVer": "√",
1127
+ * "uniVer": "√",
1128
+ * "unixVer": "x"
1129
+ * },
1130
+ * "jd": {
1131
+ * "hostVer": "√",
1132
+ * "uniVer": "√",
1133
+ * "unixVer": "x"
1134
+ * }
1135
+ * },
1136
+ "web": {
1137
+ "uniVer": "x",
1138
+ "unixVer": "x"
1139
+ }
1140
+ }
1141
+ */
1142
+ uri: string,
1143
+ /**
1144
+ * 要上传的文件对象
1145
+ * @uniPlatform
1146
+ {
1147
+ "app": {
1148
+ "android": {
1149
+ "osVer": "5.0",
1150
+ "uniVer": "√",
1151
+ "uniUtsPlugin": "3.91",
1152
+ "unixVer": "3.91",
1153
+ "unixUtsPlugin": "3.91"
1154
+ },
1155
+ "ios": {
1156
+ "osVer": "12.0",
1157
+ "uniVer": "√",
1158
+ "uniUtsPlugin": "4.11",
1159
+ "unixVer": "4.11",
1160
+ "unixUtsPlugin": "4.11"
1161
+ },
1162
+ "harmony": {
1163
+ "osVer": "x",
1164
+ "uniVer": "x",
1165
+ "unixVer": "x"
1166
+ }
1167
+ },
1168
+ * "mp": {
1169
+ * "weixin": {
1170
+ * "hostVer": "√",
1171
+ * "uniVer": "√",
1172
+ * "unixVer": "4.41"
1173
+ * },
1174
+ * "alipay": {
1175
+ * "hostVer": "√",
1176
+ * "uniVer": "√",
1177
+ * "unixVer": "x"
1178
+ * },
1179
+ * "baidu": {
1180
+ * "hostVer": "√",
1181
+ * "uniVer": "√",
1182
+ * "unixVer": "x"
1183
+ * },
1184
+ * "toutiao": {
1185
+ * "hostVer": "√",
1186
+ * "uniVer": "√",
1187
+ * "unixVer": "x"
1188
+ * },
1189
+ * "lark": {
1190
+ * "hostVer": "√",
1191
+ * "uniVer": "√",
1192
+ * "unixVer": "x"
1193
+ * },
1194
+ * "qq": {
1195
+ * "hostVer": "√",
1196
+ * "uniVer": "√",
1197
+ * "unixVer": "x"
1198
+ * },
1199
+ * "kuaishou": {
1200
+ * "hostVer": "√",
1201
+ * "uniVer": "√",
1202
+ * "unixVer": "x"
1203
+ * },
1204
+ * "jd": {
1205
+ * "hostVer": "√",
1206
+ * "uniVer": "√",
1207
+ * "unixVer": "x"
1208
+ * }
1209
+ * },
1210
+ "web": {
1211
+ "uniVer": "√",
1212
+ "unixVer": "4.0"
1213
+ }
1214
+ }
1215
+ */
1216
+ file?: any | null
1217
+ };
1218
+ export type UploadFileSuccess = {
1219
+ /**
1220
+ * 开发者服务器返回的数据
1221
+ * @uniPlatform
1222
+ {
1223
+ "app": {
1224
+ "android": {
1225
+ "osVer": "5.0",
1226
+ "uniVer": "√",
1227
+ "uniUtsPlugin": "3.91",
1228
+ "unixVer": "3.91",
1229
+ "unixUtsPlugin": "3.91"
1230
+ },
1231
+ "ios": {
1232
+ "osVer": "12.0",
1233
+ "uniVer": "√",
1234
+ "uniUtsPlugin": "4.11",
1235
+ "unixVer": "4.11",
1236
+ "unixUtsPlugin": "4.11"
1237
+ },
1238
+ "harmony": {
1239
+ "osVer": "3.0",
1240
+ "uniVer": "4.23",
1241
+ "unixVer": "4.61"
1242
+ }
1243
+ },
1244
+ * "mp": {
1245
+ * "weixin": {
1246
+ * "hostVer": "√",
1247
+ * "uniVer": "√",
1248
+ * "unixVer": "4.41"
1249
+ * },
1250
+ * "alipay": {
1251
+ * "hostVer": "√",
1252
+ * "uniVer": "√",
1253
+ * "unixVer": "x"
1254
+ * },
1255
+ * "baidu": {
1256
+ * "hostVer": "√",
1257
+ * "uniVer": "√",
1258
+ * "unixVer": "x"
1259
+ * },
1260
+ * "toutiao": {
1261
+ * "hostVer": "√",
1262
+ * "uniVer": "√",
1263
+ * "unixVer": "x"
1264
+ * },
1265
+ * "lark": {
1266
+ * "hostVer": "√",
1267
+ * "uniVer": "√",
1268
+ * "unixVer": "x"
1269
+ * },
1270
+ * "qq": {
1271
+ * "hostVer": "√",
1272
+ * "uniVer": "√",
1273
+ * "unixVer": "x"
1274
+ * },
1275
+ * "kuaishou": {
1276
+ * "hostVer": "√",
1277
+ * "uniVer": "√",
1278
+ * "unixVer": "x"
1279
+ * },
1280
+ * "jd": {
1281
+ * "hostVer": "√",
1282
+ * "uniVer": "√",
1283
+ * "unixVer": "x"
1284
+ * }
1285
+ * },
1286
+ "web": {
1287
+ "uniVer": "√",
1288
+ "unixVer": "4.0"
1289
+ }
1290
+ }
1291
+ */
1292
+ data: string,
1293
+ /**
1294
+ * 开发者服务器返回的 HTTP 状态码
1295
+ * @uniPlatform
1296
+ {
1297
+ "app": {
1298
+ "android": {
1299
+ "osVer": "5.0",
1300
+ "uniVer": "√",
1301
+ "uniUtsPlugin": "3.91",
1302
+ "unixVer": "3.91",
1303
+ "unixUtsPlugin": "3.91"
1304
+ },
1305
+ "ios": {
1306
+ "osVer": "12.0",
1307
+ "uniVer": "√",
1308
+ "uniUtsPlugin": "4.11",
1309
+ "unixVer": "4.11",
1310
+ "unixUtsPlugin": "4.11"
1311
+ },
1312
+ "harmony": {
1313
+ "osVer": "3.0",
1314
+ "uniVer": "4.23",
1315
+ "unixVer": "4.61"
1316
+ }
1317
+ },
1318
+ * "mp": {
1319
+ * "weixin": {
1320
+ * "hostVer": "√",
1321
+ * "uniVer": "√",
1322
+ * "unixVer": "4.41"
1323
+ * },
1324
+ * "alipay": {
1325
+ * "hostVer": "√",
1326
+ * "uniVer": "√",
1327
+ * "unixVer": "x"
1328
+ * },
1329
+ * "baidu": {
1330
+ * "hostVer": "√",
1331
+ * "uniVer": "√",
1332
+ * "unixVer": "x"
1333
+ * },
1334
+ * "toutiao": {
1335
+ * "hostVer": "√",
1336
+ * "uniVer": "√",
1337
+ * "unixVer": "x"
1338
+ * },
1339
+ * "lark": {
1340
+ * "hostVer": "√",
1341
+ * "uniVer": "√",
1342
+ * "unixVer": "x"
1343
+ * },
1344
+ * "qq": {
1345
+ * "hostVer": "√",
1346
+ * "uniVer": "√",
1347
+ * "unixVer": "x"
1348
+ * },
1349
+ * "kuaishou": {
1350
+ * "hostVer": "√",
1351
+ * "uniVer": "√",
1352
+ * "unixVer": "x"
1353
+ * },
1354
+ * "jd": {
1355
+ * "hostVer": "√",
1356
+ * "uniVer": "√",
1357
+ * "unixVer": "x"
1358
+ * }
1359
+ * },
1360
+ "web": {
1361
+ "uniVer": "√",
1362
+ "unixVer": "4.0"
1363
+ }
1364
+ }
1365
+ */
1366
+ statusCode: number
1367
+ };
1368
+ export type UploadFileSuccessCallback = (result: UploadFileSuccess) => void;
1369
+ /**
1370
+ * 上传文件失败的错误回调参数
1371
+ */
1372
+ export interface UploadFileFail extends IUniError {
1373
+ errCode: RequestErrorCode
1374
+ };
1375
+ export type UploadFileFailCallback = (result: UploadFileFail) => void;
1376
+
1377
+ export type UploadFileCompleteCallback = (result: any) => void;
1378
+ export type UploadFileOptions = {
1379
+ /**
1380
+ * 开发者服务器 url
1381
+ * @uniPlatform
1382
+ {
1383
+ "app": {
1384
+ "android": {
1385
+ "osVer": "5.0",
1386
+ "uniVer": "√",
1387
+ "uniUtsPlugin": "3.91",
1388
+ "unixVer": "3.91",
1389
+ "unixUtsPlugin": "3.91"
1390
+ },
1391
+ "ios": {
1392
+ "osVer": "12.0",
1393
+ "uniVer": "√",
1394
+ "uniUtsPlugin": "4.11",
1395
+ "unixVer": "4.11",
1396
+ "unixUtsPlugin": "4.11"
1397
+ },
1398
+ "harmony": {
1399
+ "osVer": "3.0",
1400
+ "uniVer": "4.23",
1401
+ "unixVer": "4.61"
1402
+ }
1403
+ },
1404
+ * "mp": {
1405
+ * "weixin": {
1406
+ * "hostVer": "√",
1407
+ * "uniVer": "√",
1408
+ * "unixVer": "4.41"
1409
+ * },
1410
+ * "alipay": {
1411
+ * "hostVer": "√",
1412
+ * "uniVer": "√",
1413
+ * "unixVer": "x"
1414
+ * },
1415
+ * "baidu": {
1416
+ * "hostVer": "√",
1417
+ * "uniVer": "√",
1418
+ * "unixVer": "x"
1419
+ * },
1420
+ * "toutiao": {
1421
+ * "hostVer": "√",
1422
+ * "uniVer": "√",
1423
+ * "unixVer": "x"
1424
+ * },
1425
+ * "lark": {
1426
+ * "hostVer": "√",
1427
+ * "uniVer": "√",
1428
+ * "unixVer": "x"
1429
+ * },
1430
+ * "qq": {
1431
+ * "hostVer": "√",
1432
+ * "uniVer": "√",
1433
+ * "unixVer": "x"
1434
+ * },
1435
+ * "kuaishou": {
1436
+ * "hostVer": "√",
1437
+ * "uniVer": "√",
1438
+ * "unixVer": "x"
1439
+ * },
1440
+ * "jd": {
1441
+ * "hostVer": "√",
1442
+ * "uniVer": "√",
1443
+ * "unixVer": "x"
1444
+ * }
1445
+ * },
1446
+ "web": {
1447
+ "uniVer": "√",
1448
+ "unixVer": "4.0"
1449
+ }
1450
+ }
1451
+ */
1452
+ url: string,
1453
+ /**
1454
+ * 要上传文件资源的路径, 支持uni.env
1455
+ * @defaultValue null
1456
+ * @uniPlatform
1457
+ {
1458
+ "app": {
1459
+ "android": {
1460
+ "osVer": "5.0",
1461
+ "uniVer": "√",
1462
+ "uniUtsPlugin": "3.91",
1463
+ "unixVer": "3.91",
1464
+ "unixUtsPlugin": "3.91"
1465
+ },
1466
+ "ios": {
1467
+ "osVer": "12.0",
1468
+ "uniVer": "√",
1469
+ "uniUtsPlugin": "4.11",
1470
+ "unixVer": "4.11",
1471
+ "unixUtsPlugin": "4.11"
1472
+ },
1473
+ "harmony": {
1474
+ "osVer": "3.0",
1475
+ "uniVer": "4.23",
1476
+ "unixVer": "4.61"
1477
+ }
1478
+ },
1479
+ * "mp": {
1480
+ * "weixin": {
1481
+ * "hostVer": "√",
1482
+ * "uniVer": "√",
1483
+ * "unixVer": "4.41"
1484
+ * },
1485
+ * "alipay": {
1486
+ * "hostVer": "√",
1487
+ * "uniVer": "√",
1488
+ * "unixVer": "x"
1489
+ * },
1490
+ * "baidu": {
1491
+ * "hostVer": "√",
1492
+ * "uniVer": "√",
1493
+ * "unixVer": "x"
1494
+ * },
1495
+ * "toutiao": {
1496
+ * "hostVer": "√",
1497
+ * "uniVer": "√",
1498
+ * "unixVer": "x"
1499
+ * },
1500
+ * "lark": {
1501
+ * "hostVer": "√",
1502
+ * "uniVer": "√",
1503
+ * "unixVer": "x"
1504
+ * },
1505
+ * "qq": {
1506
+ * "hostVer": "√",
1507
+ * "uniVer": "√",
1508
+ * "unixVer": "x"
1509
+ * },
1510
+ * "kuaishou": {
1511
+ * "hostVer": "√",
1512
+ * "uniVer": "√",
1513
+ * "unixVer": "x"
1514
+ * },
1515
+ * "jd": {
1516
+ * "hostVer": "√",
1517
+ * "uniVer": "√",
1518
+ * "unixVer": "x"
1519
+ * }
1520
+ * },
1521
+ "web": {
1522
+ "uniVer": "√",
1523
+ "unixVer": "4.0"
1524
+ }
1525
+ }
1526
+ */
1527
+ filePath?: string | null,
1528
+ /**
1529
+ * 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
1530
+ * @defaultValue null
1531
+ * @uniPlatform
1532
+ {
1533
+ "app": {
1534
+ "android": {
1535
+ "osVer": "5.0",
1536
+ "uniVer": "√",
1537
+ "uniUtsPlugin": "3.91",
1538
+ "unixVer": "3.91",
1539
+ "unixUtsPlugin": "3.91"
1540
+ },
1541
+ "ios": {
1542
+ "osVer": "12.0",
1543
+ "uniVer": "√",
1544
+ "uniUtsPlugin": "4.11",
1545
+ "unixVer": "4.11",
1546
+ "unixUtsPlugin": "4.11"
1547
+ },
1548
+ "harmony": {
1549
+ "osVer": "3.0",
1550
+ "uniVer": "4.23",
1551
+ "unixVer": "4.61"
1552
+ }
1553
+ },
1554
+ * "mp": {
1555
+ * "weixin": {
1556
+ * "hostVer": "√",
1557
+ * "uniVer": "√",
1558
+ * "unixVer": "4.41"
1559
+ * },
1560
+ * "alipay": {
1561
+ * "hostVer": "√",
1562
+ * "uniVer": "√",
1563
+ * "unixVer": "x"
1564
+ * },
1565
+ * "baidu": {
1566
+ * "hostVer": "√",
1567
+ * "uniVer": "√",
1568
+ * "unixVer": "x"
1569
+ * },
1570
+ * "toutiao": {
1571
+ * "hostVer": "√",
1572
+ * "uniVer": "√",
1573
+ * "unixVer": "x"
1574
+ * },
1575
+ * "lark": {
1576
+ * "hostVer": "√",
1577
+ * "uniVer": "√",
1578
+ * "unixVer": "x"
1579
+ * },
1580
+ * "qq": {
1581
+ * "hostVer": "√",
1582
+ * "uniVer": "√",
1583
+ * "unixVer": "x"
1584
+ * },
1585
+ * "kuaishou": {
1586
+ * "hostVer": "√",
1587
+ * "uniVer": "√",
1588
+ * "unixVer": "x"
1589
+ * },
1590
+ * "jd": {
1591
+ * "hostVer": "√",
1592
+ * "uniVer": "√",
1593
+ * "unixVer": "x"
1594
+ * }
1595
+ * },
1596
+ "web": {
1597
+ "uniVer": "√",
1598
+ "unixVer": "4.0"
1599
+ }
1600
+ }
1601
+ */
1602
+ name?: string | null,
1603
+ /**
1604
+ * 需要上传的文件列表。
1605
+ * @defaultValue null
1606
+ * @uniPlatform
1607
+ {
1608
+ "app": {
1609
+ "android": {
1610
+ "osVer": "5.0",
1611
+ "uniVer": "√",
1612
+ "uniUtsPlugin": "3.91",
1613
+ "unixVer": "3.91",
1614
+ "unixUtsPlugin": "3.91"
1615
+ },
1616
+ "ios": {
1617
+ "osVer": "12.0",
1618
+ "uniVer": "√",
1619
+ "uniUtsPlugin": "4.11",
1620
+ "unixVer": "4.11",
1621
+ "unixUtsPlugin": "4.11"
1622
+ },
1623
+ "harmony": {
1624
+ "osVer": "3.0",
1625
+ "uniVer": "4.23",
1626
+ "unixVer": "4.61"
1627
+ }
1628
+ },
1629
+ * "mp": {
1630
+ * "weixin": {
1631
+ * "hostVer": "√",
1632
+ * "uniVer": "√",
1633
+ * "unixVer": "4.41"
1634
+ * },
1635
+ * "alipay": {
1636
+ * "hostVer": "√",
1637
+ * "uniVer": "√",
1638
+ * "unixVer": "x"
1639
+ * },
1640
+ * "baidu": {
1641
+ * "hostVer": "√",
1642
+ * "uniVer": "√",
1643
+ * "unixVer": "x"
1644
+ * },
1645
+ * "toutiao": {
1646
+ * "hostVer": "√",
1647
+ * "uniVer": "√",
1648
+ * "unixVer": "x"
1649
+ * },
1650
+ * "lark": {
1651
+ * "hostVer": "√",
1652
+ * "uniVer": "√",
1653
+ * "unixVer": "x"
1654
+ * },
1655
+ * "qq": {
1656
+ * "hostVer": "√",
1657
+ * "uniVer": "√",
1658
+ * "unixVer": "x"
1659
+ * },
1660
+ * "kuaishou": {
1661
+ * "hostVer": "√",
1662
+ * "uniVer": "√",
1663
+ * "unixVer": "x"
1664
+ * },
1665
+ * "jd": {
1666
+ * "hostVer": "√",
1667
+ * "uniVer": "√",
1668
+ * "unixVer": "x"
1669
+ * }
1670
+ * },
1671
+ "web": {
1672
+ "uniVer": "√",
1673
+ "unixVer": "4.0"
1674
+ }
1675
+ }
1676
+ */
1677
+ files?: (UploadFileOptionFiles[]) | null,
1678
+ /**
1679
+ * HTTP 请求 Header, header 中不能设置 Referer
1680
+ * @defaultValue null
1681
+ * @uniPlatform
1682
+ {
1683
+ "app": {
1684
+ "android": {
1685
+ "osVer": "5.0",
1686
+ "uniVer": "√",
1687
+ "uniUtsPlugin": "3.91",
1688
+ "unixVer": "3.91",
1689
+ "unixUtsPlugin": "3.91"
1690
+ },
1691
+ "ios": {
1692
+ "osVer": "12.0",
1693
+ "uniVer": "√",
1694
+ "uniUtsPlugin": "4.11",
1695
+ "unixVer": "4.11",
1696
+ "unixUtsPlugin": "4.11"
1697
+ },
1698
+ "harmony": {
1699
+ "osVer": "3.0",
1700
+ "uniVer": "4.23",
1701
+ "unixVer": "4.61"
1702
+ }
1703
+ },
1704
+ * "mp": {
1705
+ * "weixin": {
1706
+ * "hostVer": "√",
1707
+ * "uniVer": "√",
1708
+ * "unixVer": "4.41"
1709
+ * },
1710
+ * "alipay": {
1711
+ * "hostVer": "√",
1712
+ * "uniVer": "√",
1713
+ * "unixVer": "x"
1714
+ * },
1715
+ * "baidu": {
1716
+ * "hostVer": "√",
1717
+ * "uniVer": "√",
1718
+ * "unixVer": "x"
1719
+ * },
1720
+ * "toutiao": {
1721
+ * "hostVer": "√",
1722
+ * "uniVer": "√",
1723
+ * "unixVer": "x"
1724
+ * },
1725
+ * "lark": {
1726
+ * "hostVer": "√",
1727
+ * "uniVer": "√",
1728
+ * "unixVer": "x"
1729
+ * },
1730
+ * "qq": {
1731
+ * "hostVer": "√",
1732
+ * "uniVer": "√",
1733
+ * "unixVer": "x"
1734
+ * },
1735
+ * "kuaishou": {
1736
+ * "hostVer": "√",
1737
+ * "uniVer": "√",
1738
+ * "unixVer": "x"
1739
+ * },
1740
+ * "jd": {
1741
+ * "hostVer": "√",
1742
+ * "uniVer": "√",
1743
+ * "unixVer": "x"
1744
+ * }
1745
+ * },
1746
+ "web": {
1747
+ "uniVer": "√",
1748
+ "unixVer": "4.0"
1749
+ }
1750
+ }
1751
+ */
1752
+ header?: UTSJSONObject | null,
1753
+ /**
1754
+ * HTTP 请求中其他额外的 form data
1755
+ * @defaultValue null
1756
+ * @uniPlatform
1757
+ {
1758
+ "app": {
1759
+ "android": {
1760
+ "osVer": "5.0",
1761
+ "uniVer": "√",
1762
+ "uniUtsPlugin": "3.91",
1763
+ "unixVer": "3.91",
1764
+ "unixUtsPlugin": "3.91"
1765
+ },
1766
+ "ios": {
1767
+ "osVer": "12.0",
1768
+ "uniVer": "√",
1769
+ "uniUtsPlugin": "4.11",
1770
+ "unixVer": "4.11",
1771
+ "unixUtsPlugin": "4.11"
1772
+ },
1773
+ "harmony": {
1774
+ "osVer": "3.0",
1775
+ "uniVer": "4.23",
1776
+ "unixVer": "4.61"
1777
+ }
1778
+ },
1779
+ * "mp": {
1780
+ * "weixin": {
1781
+ * "hostVer": "√",
1782
+ * "uniVer": "√",
1783
+ * "unixVer": "4.41"
1784
+ * },
1785
+ * "alipay": {
1786
+ * "hostVer": "√",
1787
+ * "uniVer": "√",
1788
+ * "unixVer": "x"
1789
+ * },
1790
+ * "baidu": {
1791
+ * "hostVer": "√",
1792
+ * "uniVer": "√",
1793
+ * "unixVer": "x"
1794
+ * },
1795
+ * "toutiao": {
1796
+ * "hostVer": "√",
1797
+ * "uniVer": "√",
1798
+ * "unixVer": "x"
1799
+ * },
1800
+ * "lark": {
1801
+ * "hostVer": "√",
1802
+ * "uniVer": "√",
1803
+ * "unixVer": "x"
1804
+ * },
1805
+ * "qq": {
1806
+ * "hostVer": "√",
1807
+ * "uniVer": "√",
1808
+ * "unixVer": "x"
1809
+ * },
1810
+ * "kuaishou": {
1811
+ * "hostVer": "√",
1812
+ * "uniVer": "√",
1813
+ * "unixVer": "x"
1814
+ * },
1815
+ * "jd": {
1816
+ * "hostVer": "√",
1817
+ * "uniVer": "√",
1818
+ * "unixVer": "x"
1819
+ * }
1820
+ * },
1821
+ "web": {
1822
+ "uniVer": "√",
1823
+ "unixVer": "4.0"
1824
+ }
1825
+ }
1826
+ */
1827
+ formData?: UTSJSONObject | null,
1828
+ /**
1829
+ * 超时时间,单位 ms
1830
+ * @defaultValue 120000
1831
+ * @uniPlatform
1832
+ {
1833
+ "app": {
1834
+ "android": {
1835
+ "osVer": "5.0",
1836
+ "uniVer": "√",
1837
+ "uniUtsPlugin": "3.91",
1838
+ "unixVer": "3.91",
1839
+ "unixUtsPlugin": "3.91"
1840
+ },
1841
+ "ios": {
1842
+ "osVer": "12.0",
1843
+ "uniVer": "√",
1844
+ "uniUtsPlugin": "4.11",
1845
+ "unixVer": "4.11",
1846
+ "unixUtsPlugin": "4.11"
1847
+ },
1848
+ "harmony": {
1849
+ "osVer": "3.0",
1850
+ "uniVer": "4.23",
1851
+ "unixVer": "4.61"
1852
+ }
1853
+ },
1854
+ * "mp": {
1855
+ * "weixin": {
1856
+ * "hostVer": "√",
1857
+ * "uniVer": "√",
1858
+ * "unixVer": "4.41"
1859
+ * },
1860
+ * "alipay": {
1861
+ * "hostVer": "√",
1862
+ * "uniVer": "√",
1863
+ * "unixVer": "x"
1864
+ * },
1865
+ * "baidu": {
1866
+ * "hostVer": "√",
1867
+ * "uniVer": "√",
1868
+ * "unixVer": "x"
1869
+ * },
1870
+ * "toutiao": {
1871
+ * "hostVer": "√",
1872
+ * "uniVer": "√",
1873
+ * "unixVer": "x"
1874
+ * },
1875
+ * "lark": {
1876
+ * "hostVer": "√",
1877
+ * "uniVer": "√",
1878
+ * "unixVer": "x"
1879
+ * },
1880
+ * "qq": {
1881
+ * "hostVer": "√",
1882
+ * "uniVer": "√",
1883
+ * "unixVer": "x"
1884
+ * },
1885
+ * "kuaishou": {
1886
+ * "hostVer": "√",
1887
+ * "uniVer": "√",
1888
+ * "unixVer": "x"
1889
+ * },
1890
+ * "jd": {
1891
+ * "hostVer": "√",
1892
+ * "uniVer": "√",
1893
+ * "unixVer": "x"
1894
+ * }
1895
+ * },
1896
+ "web": {
1897
+ "uniVer": "√",
1898
+ "unixVer": "4.0"
1899
+ }
1900
+ }
1901
+ */
1902
+ timeout?: number | null,
1903
+ /**
1904
+ * 成功返回的回调函数
1905
+ * @defaultValue null
1906
+ */
1907
+ success?: UploadFileSuccessCallback | null,
1908
+ /**
1909
+ * 失败的回调函数
1910
+ * @defaultValue null
1911
+ */
1912
+ fail?: UploadFileFailCallback | null,
1913
+ /**
1914
+ * 结束的回调函数(调用成功、失败都会执行)
1915
+ * @defaultValue null
1916
+ */
1917
+ complete?: UploadFileCompleteCallback | null
1918
+ };
1919
+ export type OnProgressUpdateResult = {
1920
+ /**
1921
+ * 上传进度百分比
1922
+ * @uniPlatform
1923
+ {
1924
+ "app": {
1925
+ "android": {
1926
+ "osVer": "5.0",
1927
+ "uniVer": "√",
1928
+ "uniUtsPlugin": "3.91",
1929
+ "unixVer": "3.91",
1930
+ "unixUtsPlugin": "3.91"
1931
+ },
1932
+ "ios": {
1933
+ "osVer": "12.0",
1934
+ "uniVer": "√",
1935
+ "uniUtsPlugin": "4.11",
1936
+ "unixVer": "4.11",
1937
+ "unixUtsPlugin": "4.11"
1938
+ },
1939
+ "harmony": {
1940
+ "osVer": "3.0",
1941
+ "uniVer": "4.23",
1942
+ "unixVer": "4.61"
1943
+ }
1944
+ },
1945
+ * "mp": {
1946
+ * "weixin": {
1947
+ * "hostVer": "√",
1948
+ * "uniVer": "√",
1949
+ * "unixVer": "4.41"
1950
+ * },
1951
+ * "alipay": {
1952
+ * "hostVer": "√",
1953
+ * "uniVer": "√",
1954
+ * "unixVer": "x"
1955
+ * },
1956
+ * "baidu": {
1957
+ * "hostVer": "√",
1958
+ * "uniVer": "√",
1959
+ * "unixVer": "x"
1960
+ * },
1961
+ * "toutiao": {
1962
+ * "hostVer": "√",
1963
+ * "uniVer": "√",
1964
+ * "unixVer": "x"
1965
+ * },
1966
+ * "lark": {
1967
+ * "hostVer": "√",
1968
+ * "uniVer": "√",
1969
+ * "unixVer": "x"
1970
+ * },
1971
+ * "qq": {
1972
+ * "hostVer": "√",
1973
+ * "uniVer": "√",
1974
+ * "unixVer": "x"
1975
+ * },
1976
+ * "kuaishou": {
1977
+ * "hostVer": "√",
1978
+ * "uniVer": "√",
1979
+ * "unixVer": "x"
1980
+ * },
1981
+ * "jd": {
1982
+ * "hostVer": "√",
1983
+ * "uniVer": "√",
1984
+ * "unixVer": "x"
1985
+ * }
1986
+ * },
1987
+ "web": {
1988
+ "uniVer": "√",
1989
+ "unixVer": "4.0"
1990
+ }
1991
+ }
1992
+ */
1993
+ progress: number,
1994
+ /**
1995
+ * 已经上传的数据长度,单位 Bytes
1996
+ * @uniPlatform
1997
+ {
1998
+ "app": {
1999
+ "android": {
2000
+ "osVer": "5.0",
2001
+ "uniVer": "√",
2002
+ "uniUtsPlugin": "3.91",
2003
+ "unixVer": "3.91",
2004
+ "unixUtsPlugin": "3.91"
2005
+ },
2006
+ "ios": {
2007
+ "osVer": "12.0",
2008
+ "uniVer": "√",
2009
+ "uniUtsPlugin": "4.11",
2010
+ "unixVer": "4.11",
2011
+ "unixUtsPlugin": "4.11"
2012
+ },
2013
+ "harmony": {
2014
+ "osVer": "3.0",
2015
+ "uniVer": "4.23",
2016
+ "unixVer": "4.61"
2017
+ }
2018
+ },
2019
+ * "mp": {
2020
+ * "weixin": {
2021
+ * "hostVer": "√",
2022
+ * "uniVer": "√",
2023
+ * "unixVer": "4.41"
2024
+ * },
2025
+ * "alipay": {
2026
+ * "hostVer": "√",
2027
+ * "uniVer": "√",
2028
+ * "unixVer": "x"
2029
+ * },
2030
+ * "baidu": {
2031
+ * "hostVer": "√",
2032
+ * "uniVer": "√",
2033
+ * "unixVer": "x"
2034
+ * },
2035
+ * "toutiao": {
2036
+ * "hostVer": "√",
2037
+ * "uniVer": "√",
2038
+ * "unixVer": "x"
2039
+ * },
2040
+ * "lark": {
2041
+ * "hostVer": "√",
2042
+ * "uniVer": "√",
2043
+ * "unixVer": "x"
2044
+ * },
2045
+ * "qq": {
2046
+ * "hostVer": "√",
2047
+ * "uniVer": "√",
2048
+ * "unixVer": "x"
2049
+ * },
2050
+ * "kuaishou": {
2051
+ * "hostVer": "√",
2052
+ * "uniVer": "√",
2053
+ * "unixVer": "x"
2054
+ * },
2055
+ * "jd": {
2056
+ * "hostVer": "√",
2057
+ * "uniVer": "√",
2058
+ * "unixVer": "x"
2059
+ * }
2060
+ * },
2061
+ "web": {
2062
+ "uniVer": "√",
2063
+ "unixVer": "4.0"
2064
+ }
2065
+ }
2066
+ */
2067
+ totalBytesSent: number,
2068
+ /**
2069
+ * 预期需要上传的数据总长度,单位 Bytes
2070
+ * @uniPlatform
2071
+ {
2072
+ "app": {
2073
+ "android": {
2074
+ "osVer": "5.0",
2075
+ "uniVer": "√",
2076
+ "uniUtsPlugin": "3.91",
2077
+ "unixVer": "3.91",
2078
+ "unixUtsPlugin": "3.91"
2079
+ },
2080
+ "ios": {
2081
+ "osVer": "12.0",
2082
+ "uniVer": "√",
2083
+ "uniUtsPlugin": "4.11",
2084
+ "unixVer": "4.11",
2085
+ "unixUtsPlugin": "4.11"
2086
+ },
2087
+ "harmony": {
2088
+ "osVer": "3.0",
2089
+ "uniVer": "4.23",
2090
+ "unixVer": "4.61"
2091
+ }
2092
+ },
2093
+ * "mp": {
2094
+ * "weixin": {
2095
+ * "hostVer": "√",
2096
+ * "uniVer": "√",
2097
+ * "unixVer": "4.41"
2098
+ * },
2099
+ * "alipay": {
2100
+ * "hostVer": "√",
2101
+ * "uniVer": "√",
2102
+ * "unixVer": "x"
2103
+ * },
2104
+ * "baidu": {
2105
+ * "hostVer": "√",
2106
+ * "uniVer": "√",
2107
+ * "unixVer": "x"
2108
+ * },
2109
+ * "toutiao": {
2110
+ * "hostVer": "√",
2111
+ * "uniVer": "√",
2112
+ * "unixVer": "x"
2113
+ * },
2114
+ * "lark": {
2115
+ * "hostVer": "√",
2116
+ * "uniVer": "√",
2117
+ * "unixVer": "x"
2118
+ * },
2119
+ * "qq": {
2120
+ * "hostVer": "√",
2121
+ * "uniVer": "√",
2122
+ * "unixVer": "x"
2123
+ * },
2124
+ * "kuaishou": {
2125
+ * "hostVer": "√",
2126
+ * "uniVer": "√",
2127
+ * "unixVer": "x"
2128
+ * },
2129
+ * "jd": {
2130
+ * "hostVer": "√",
2131
+ * "uniVer": "√",
2132
+ * "unixVer": "x"
2133
+ * }
2134
+ * },
2135
+ "web": {
2136
+ "uniVer": "√",
2137
+ "unixVer": "4.0"
2138
+ }
2139
+ }
2140
+ */
2141
+ totalBytesExpectedToSend: number
2142
+ };
2143
+
2144
+ export type UploadFileProgressUpdateCallback = (result: OnProgressUpdateResult) => void
2145
+ export interface UploadTask {
2146
+ /**
2147
+ * 中断上传任务。
2148
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
2149
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
2150
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
2151
+ * @uniPlatform
2152
+ {
2153
+ "app": {
2154
+ "android": {
2155
+ "osVer": "5.0",
2156
+ "uniVer": "√",
2157
+ "uniUtsPlugin": "3.91",
2158
+ "unixVer": "3.91",
2159
+ "unixUtsPlugin": "3.91"
2160
+ },
2161
+ "ios": {
2162
+ "osVer": "12.0",
2163
+ "uniVer": "√",
2164
+ "uniUtsPlugin": "4.11",
2165
+ "unixVer": "4.11",
2166
+ "unixUtsPlugin": "4.11"
2167
+ },
2168
+ "harmony": {
2169
+ "osVer": "3.0",
2170
+ "uniVer": "4.23",
2171
+ "unixVer": "4.61"
2172
+ }
2173
+ },
2174
+ * "mp": {
2175
+ * "weixin": {
2176
+ * "hostVer": "√",
2177
+ * "uniVer": "√",
2178
+ * "unixVer": "4.41"
2179
+ * },
2180
+ * "alipay": {
2181
+ * "hostVer": "√",
2182
+ * "uniVer": "√",
2183
+ * "unixVer": "x"
2184
+ * },
2185
+ * "baidu": {
2186
+ * "hostVer": "√",
2187
+ * "uniVer": "√",
2188
+ * "unixVer": "x"
2189
+ * },
2190
+ * "toutiao": {
2191
+ * "hostVer": "√",
2192
+ * "uniVer": "√",
2193
+ * "unixVer": "x"
2194
+ * },
2195
+ * "lark": {
2196
+ * "hostVer": "√",
2197
+ * "uniVer": "√",
2198
+ * "unixVer": "x"
2199
+ * },
2200
+ * "qq": {
2201
+ * "hostVer": "√",
2202
+ * "uniVer": "√",
2203
+ * "unixVer": "x"
2204
+ * },
2205
+ * "kuaishou": {
2206
+ * "hostVer": "√",
2207
+ * "uniVer": "√",
2208
+ * "unixVer": "x"
2209
+ * },
2210
+ * "jd": {
2211
+ * "hostVer": "√",
2212
+ * "uniVer": "√",
2213
+ * "unixVer": "x"
2214
+ * }
2215
+ * },
2216
+ "web": {
2217
+ "uniVer": "√",
2218
+ "unixVer": "4.0"
2219
+ }
2220
+ }
2221
+ * @example
2222
+ ```typescript
2223
+ var uploadTask = uni.uploadFile({
2224
+ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,并非真实接口地址。
2225
+ complete: ()=> {}
2226
+ });
2227
+ uploadTask.abort();
2228
+ ```
2229
+ */
2230
+ abort(): void,
2231
+ /**
2232
+ * 监听上传进度变化。
2233
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
2234
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
2235
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
2236
+ * @uniPlatform
2237
+ {
2238
+ "app": {
2239
+ "android": {
2240
+ "osVer": "5.0",
2241
+ "uniVer": "√",
2242
+ "uniUtsPlugin": "3.91",
2243
+ "unixVer": "3.91",
2244
+ "unixUtsPlugin": "3.91"
2245
+ },
2246
+ "ios": {
2247
+ "osVer": "12.0",
2248
+ "uniVer": "√",
2249
+ "uniUtsPlugin": "4.11",
2250
+ "unixVer": "4.11",
2251
+ "unixUtsPlugin": "4.11"
2252
+ },
2253
+ "harmony": {
2254
+ "osVer": "3.0",
2255
+ "uniVer": "4.23",
2256
+ "unixVer": "4.61"
2257
+ }
2258
+ },
2259
+ * "mp": {
2260
+ * "weixin": {
2261
+ * "hostVer": "√",
2262
+ * "uniVer": "√",
2263
+ * "unixVer": "4.41"
2264
+ * },
2265
+ * "alipay": {
2266
+ * "hostVer": "√",
2267
+ * "uniVer": "√",
2268
+ * "unixVer": "x"
2269
+ * },
2270
+ * "baidu": {
2271
+ * "hostVer": "√",
2272
+ * "uniVer": "√",
2273
+ * "unixVer": "x"
2274
+ * },
2275
+ * "toutiao": {
2276
+ * "hostVer": "√",
2277
+ * "uniVer": "√",
2278
+ * "unixVer": "x"
2279
+ * },
2280
+ * "lark": {
2281
+ * "hostVer": "√",
2282
+ * "uniVer": "√",
2283
+ * "unixVer": "x"
2284
+ * },
2285
+ * "qq": {
2286
+ * "hostVer": "√",
2287
+ * "uniVer": "√",
2288
+ * "unixVer": "x"
2289
+ * },
2290
+ * "kuaishou": {
2291
+ * "hostVer": "√",
2292
+ * "uniVer": "√",
2293
+ * "unixVer": "x"
2294
+ * },
2295
+ * "jd": {
2296
+ * "hostVer": "√",
2297
+ * "uniVer": "√",
2298
+ * "unixVer": "x"
2299
+ * }
2300
+ * },
2301
+ "web": {
2302
+ "uniVer": "√",
2303
+ "unixVer": "4.0"
2304
+ }
2305
+ }
2306
+ * @example
2307
+ ```typescript
2308
+ uploadTask.onProgressUpdate((res) => {
2309
+ console.log('上传进度' + res.progress);
2310
+ console.log('已经上传的数据长度' + res.totalBytesSent);
2311
+ console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend);
2312
+ });
2313
+ ```
2314
+ */
2315
+ onProgressUpdate(callback: UploadFileProgressUpdateCallback): void,
2316
+ };
2317
+
2318
+ //===============================下载==================================
2319
+
2320
+ export type DownloadFile = (options: DownloadFileOptions) => DownloadTask;
2321
+ export type DownloadFileSuccess = {
2322
+ /**
2323
+ * 临时文件路径,下载后的文件会存储到一个临时文件
2324
+ * @uniPlatform
2325
+ {
2326
+ "app": {
2327
+ "android": {
2328
+ "osVer": "5.0",
2329
+ "uniVer": "√",
2330
+ "uniUtsPlugin": "3.91",
2331
+ "unixVer": "3.91",
2332
+ "unixUtsPlugin": "3.91"
2333
+ },
2334
+ "ios": {
2335
+ "osVer": "12.0",
2336
+ "uniVer": "√",
2337
+ "uniUtsPlugin": "4.11",
2338
+ "unixVer": "4.11",
2339
+ "unixUtsPlugin": "4.11"
2340
+ },
2341
+ "harmony": {
2342
+ "osVer": "3.0",
2343
+ "uniVer": "4.23",
2344
+ "unixVer": "4.61"
2345
+ }
2346
+ },
2347
+ * "mp": {
2348
+ * "weixin": {
2349
+ * "hostVer": "√",
2350
+ * "uniVer": "√",
2351
+ * "unixVer": "4.41"
2352
+ * },
2353
+ * "alipay": {
2354
+ * "hostVer": "√",
2355
+ * "uniVer": "√",
2356
+ * "unixVer": "x"
2357
+ * },
2358
+ * "baidu": {
2359
+ * "hostVer": "√",
2360
+ * "uniVer": "√",
2361
+ * "unixVer": "x"
2362
+ * },
2363
+ * "toutiao": {
2364
+ * "hostVer": "√",
2365
+ * "uniVer": "√",
2366
+ * "unixVer": "x"
2367
+ * },
2368
+ * "lark": {
2369
+ * "hostVer": "√",
2370
+ * "uniVer": "√",
2371
+ * "unixVer": "x"
2372
+ * },
2373
+ * "qq": {
2374
+ * "hostVer": "√",
2375
+ * "uniVer": "√",
2376
+ * "unixVer": "x"
2377
+ * },
2378
+ * "kuaishou": {
2379
+ * "hostVer": "√",
2380
+ * "uniVer": "√",
2381
+ * "unixVer": "x"
2382
+ * },
2383
+ * "jd": {
2384
+ * "hostVer": "√",
2385
+ * "uniVer": "√",
2386
+ * "unixVer": "x"
2387
+ * }
2388
+ * },
2389
+ "web": {
2390
+ "uniVer": "√",
2391
+ "unixVer": "4.0"
2392
+ }
2393
+ }
2394
+ */
2395
+ tempFilePath: string,
2396
+ /**
2397
+ * 开发者服务器返回的 HTTP 状态码
2398
+ * @uniPlatform
2399
+ {
2400
+ "app": {
2401
+ "android": {
2402
+ "osVer": "5.0",
2403
+ "uniVer": "√",
2404
+ "uniUtsPlugin": "3.91",
2405
+ "unixVer": "3.91",
2406
+ "unixUtsPlugin": "3.91"
2407
+ },
2408
+ "ios": {
2409
+ "osVer": "12.0",
2410
+ "uniVer": "√",
2411
+ "uniUtsPlugin": "4.11",
2412
+ "unixVer": "4.11",
2413
+ "unixUtsPlugin": "4.11"
2414
+ },
2415
+ "harmony": {
2416
+ "osVer": "3.0",
2417
+ "uniVer": "4.23",
2418
+ "unixVer": "4.61"
2419
+ }
2420
+ },
2421
+ * "mp": {
2422
+ * "weixin": {
2423
+ * "hostVer": "√",
2424
+ * "uniVer": "√",
2425
+ * "unixVer": "4.41"
2426
+ * },
2427
+ * "alipay": {
2428
+ * "hostVer": "√",
2429
+ * "uniVer": "√",
2430
+ * "unixVer": "x"
2431
+ * },
2432
+ * "baidu": {
2433
+ * "hostVer": "√",
2434
+ * "uniVer": "√",
2435
+ * "unixVer": "x"
2436
+ * },
2437
+ * "toutiao": {
2438
+ * "hostVer": "√",
2439
+ * "uniVer": "√",
2440
+ * "unixVer": "x"
2441
+ * },
2442
+ * "lark": {
2443
+ * "hostVer": "√",
2444
+ * "uniVer": "√",
2445
+ * "unixVer": "x"
2446
+ * },
2447
+ * "qq": {
2448
+ * "hostVer": "√",
2449
+ * "uniVer": "√",
2450
+ * "unixVer": "x"
2451
+ * },
2452
+ * "kuaishou": {
2453
+ * "hostVer": "√",
2454
+ * "uniVer": "√",
2455
+ * "unixVer": "x"
2456
+ * },
2457
+ * "jd": {
2458
+ * "hostVer": "√",
2459
+ * "uniVer": "√",
2460
+ * "unixVer": "x"
2461
+ * }
2462
+ * },
2463
+ "web": {
2464
+ "uniVer": "√",
2465
+ "unixVer": "4.0"
2466
+ }
2467
+ }
2468
+ */
2469
+ statusCode: number
2470
+ };
2471
+ export type DownloadFileSuccessCallback = (result: DownloadFileSuccess) => void;
2472
+ /**
2473
+ * 下载文件失败的错误回调参数
2474
+ */
2475
+ export interface DownloadFileFail extends IUniError {
2476
+ errCode: RequestErrorCode
2477
+ };
2478
+ export type DownloadFileFailCallback = (result: DownloadFileFail) => void;
2479
+ export type DownloadFileComplete = any;
2480
+ export type DownloadFileCompleteCallback = (result: DownloadFileComplete) => void;
2481
+ export type DownloadFileOptions = {
2482
+ /**
2483
+ * 下载资源的 url
2484
+ * @uniPlatform
2485
+ {
2486
+ "app": {
2487
+ "android": {
2488
+ "osVer": "5.0",
2489
+ "uniVer": "√",
2490
+ "uniUtsPlugin": "3.91",
2491
+ "unixVer": "3.91",
2492
+ "unixUtsPlugin": "3.91"
2493
+ },
2494
+ "ios": {
2495
+ "osVer": "12.0",
2496
+ "uniVer": "√",
2497
+ "uniUtsPlugin": "4.11",
2498
+ "unixVer": "4.11",
2499
+ "unixUtsPlugin": "4.11"
2500
+ },
2501
+ "harmony": {
2502
+ "osVer": "3.0",
2503
+ "uniVer": "4.23",
2504
+ "unixVer": "4.61"
2505
+ }
2506
+ },
2507
+ * "mp": {
2508
+ * "weixin": {
2509
+ * "hostVer": "√",
2510
+ * "uniVer": "√",
2511
+ * "unixVer": "4.41"
2512
+ * },
2513
+ * "alipay": {
2514
+ * "hostVer": "√",
2515
+ * "uniVer": "√",
2516
+ * "unixVer": "x"
2517
+ * },
2518
+ * "baidu": {
2519
+ * "hostVer": "√",
2520
+ * "uniVer": "√",
2521
+ * "unixVer": "x"
2522
+ * },
2523
+ * "toutiao": {
2524
+ * "hostVer": "√",
2525
+ * "uniVer": "√",
2526
+ * "unixVer": "x"
2527
+ * },
2528
+ * "lark": {
2529
+ * "hostVer": "√",
2530
+ * "uniVer": "√",
2531
+ * "unixVer": "x"
2532
+ * },
2533
+ * "qq": {
2534
+ * "hostVer": "√",
2535
+ * "uniVer": "√",
2536
+ * "unixVer": "x"
2537
+ * },
2538
+ * "kuaishou": {
2539
+ * "hostVer": "√",
2540
+ * "uniVer": "√",
2541
+ * "unixVer": "x"
2542
+ * },
2543
+ * "jd": {
2544
+ * "hostVer": "√",
2545
+ * "uniVer": "√",
2546
+ * "unixVer": "x"
2547
+ * }
2548
+ * },
2549
+ "web": {
2550
+ "uniVer": "√",
2551
+ "unixVer": "4.0"
2552
+ }
2553
+ }
2554
+ */
2555
+ url: string,
2556
+ /**
2557
+ * HTTP 请求 Header,header 中不能设置 Referer
2558
+ * @defaultValue null
2559
+ * @uniPlatform
2560
+ {
2561
+ "app": {
2562
+ "android": {
2563
+ "osVer": "5.0",
2564
+ "uniVer": "√",
2565
+ "uniUtsPlugin": "3.91",
2566
+ "unixVer": "3.91",
2567
+ "unixUtsPlugin": "3.91"
2568
+ },
2569
+ "ios": {
2570
+ "osVer": "12.0",
2571
+ "uniVer": "√",
2572
+ "uniUtsPlugin": "4.11",
2573
+ "unixVer": "4.11",
2574
+ "unixUtsPlugin": "4.11"
2575
+ }
2576
+ },
2577
+ * "mp": {
2578
+ * "weixin": {
2579
+ * "hostVer": "√",
2580
+ * "uniVer": "√",
2581
+ * "unixVer": "4.41"
2582
+ * },
2583
+ * "alipay": {
2584
+ * "hostVer": "√",
2585
+ * "uniVer": "√",
2586
+ * "unixVer": "x"
2587
+ * },
2588
+ * "baidu": {
2589
+ * "hostVer": "√",
2590
+ * "uniVer": "√",
2591
+ * "unixVer": "x"
2592
+ * },
2593
+ * "toutiao": {
2594
+ * "hostVer": "√",
2595
+ * "uniVer": "√",
2596
+ * "unixVer": "x"
2597
+ * },
2598
+ * "lark": {
2599
+ * "hostVer": "√",
2600
+ * "uniVer": "√",
2601
+ * "unixVer": "x"
2602
+ * },
2603
+ * "qq": {
2604
+ * "hostVer": "√",
2605
+ * "uniVer": "√",
2606
+ * "unixVer": "x"
2607
+ * },
2608
+ * "kuaishou": {
2609
+ * "hostVer": "√",
2610
+ * "uniVer": "√",
2611
+ * "unixVer": "x"
2612
+ * },
2613
+ * "jd": {
2614
+ * "hostVer": "√",
2615
+ * "uniVer": "√",
2616
+ * "unixVer": "x"
2617
+ * }
2618
+ * }
2619
+ }
2620
+ */
2621
+ header?: UTSJSONObject | null,
2622
+ /**
2623
+ * 指定文件下载路径
2624
+ * 支持相对路径与绝对路径,例:
2625
+ * `/imgs/pic.png`、`/storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/temp/imgs/pic.png`
2626
+ * 并且支持指定下载目录,例:
2627
+ * `/imgs/`
2628
+ * 支持uni.env的平台兼容性:Android自3.9开始支持uni.env,iOS自4.13开始支持uni.env
2629
+ * @defaultValue null
2630
+ * @uniPlatform
2631
+ {
2632
+ "app": {
2633
+ "android": {
2634
+ "osVer": "5.0",
2635
+ "uniVer": "√",
2636
+ "uniUtsPlugin": "3.91",
2637
+ "unixVer": "3.91",
2638
+ "unixUtsPlugin": "3.91"
2639
+ },
2640
+ "ios": {
2641
+ "osVer": "12.0",
2642
+ "uniVer": "√",
2643
+ "uniUtsPlugin": "4.11",
2644
+ "unixVer": "4.11",
2645
+ "unixUtsPlugin": "4.11"
2646
+ },
2647
+ "harmony": {
2648
+ "osVer": "3.0",
2649
+ "uniVer": "4.23",
2650
+ "unixVer": "4.61"
2651
+ }
2652
+ },
2653
+ * "mp": {
2654
+ * "weixin": {
2655
+ * "hostVer": "√",
2656
+ * "uniVer": "√",
2657
+ * "unixVer": "4.41"
2658
+ * },
2659
+ * "alipay": {
2660
+ * "hostVer": "√",
2661
+ * "uniVer": "√",
2662
+ * "unixVer": "x"
2663
+ * },
2664
+ * "baidu": {
2665
+ * "hostVer": "√",
2666
+ * "uniVer": "√",
2667
+ * "unixVer": "x"
2668
+ * },
2669
+ * "toutiao": {
2670
+ * "hostVer": "√",
2671
+ * "uniVer": "√",
2672
+ * "unixVer": "x"
2673
+ * },
2674
+ * "lark": {
2675
+ * "hostVer": "√",
2676
+ * "uniVer": "√",
2677
+ * "unixVer": "x"
2678
+ * },
2679
+ * "qq": {
2680
+ * "hostVer": "√",
2681
+ * "uniVer": "√",
2682
+ * "unixVer": "x"
2683
+ * },
2684
+ * "kuaishou": {
2685
+ * "hostVer": "√",
2686
+ * "uniVer": "√",
2687
+ * "unixVer": "x"
2688
+ * },
2689
+ * "jd": {
2690
+ * "hostVer": "√",
2691
+ * "uniVer": "√",
2692
+ * "unixVer": "x"
2693
+ * }
2694
+ * },
2695
+ "web": {
2696
+ "uniVer": "√",
2697
+ "unixVer": "4.0"
2698
+ }
2699
+ }
2700
+ */
2701
+ filePath?: string | null,
2702
+ /**
2703
+ * 超时时间,单位 ms
2704
+ * @defaultValue 120000
2705
+ * @uniPlatform
2706
+ {
2707
+ "app": {
2708
+ "android": {
2709
+ "osVer": "5.0",
2710
+ "uniVer": "√",
2711
+ "uniUtsPlugin": "3.91",
2712
+ "unixVer": "3.91",
2713
+ "unixUtsPlugin": "3.91"
2714
+ },
2715
+ "ios": {
2716
+ "osVer": "12.0",
2717
+ "uniVer": "√",
2718
+ "uniUtsPlugin": "4.11",
2719
+ "unixVer": "4.11",
2720
+ "unixUtsPlugin": "4.11"
2721
+ },
2722
+ "harmony": {
2723
+ "osVer": "3.0",
2724
+ "uniVer": "4.23",
2725
+ "unixVer": "4.61"
2726
+ }
2727
+ },
2728
+ * "mp": {
2729
+ * "weixin": {
2730
+ * "hostVer": "√",
2731
+ * "uniVer": "√",
2732
+ * "unixVer": "4.41"
2733
+ * },
2734
+ * "alipay": {
2735
+ * "hostVer": "√",
2736
+ * "uniVer": "√",
2737
+ * "unixVer": "x"
2738
+ * },
2739
+ * "baidu": {
2740
+ * "hostVer": "√",
2741
+ * "uniVer": "√",
2742
+ * "unixVer": "x"
2743
+ * },
2744
+ * "toutiao": {
2745
+ * "hostVer": "√",
2746
+ * "uniVer": "√",
2747
+ * "unixVer": "x"
2748
+ * },
2749
+ * "lark": {
2750
+ * "hostVer": "√",
2751
+ * "uniVer": "√",
2752
+ * "unixVer": "x"
2753
+ * },
2754
+ * "qq": {
2755
+ * "hostVer": "√",
2756
+ * "uniVer": "√",
2757
+ * "unixVer": "x"
2758
+ * },
2759
+ * "kuaishou": {
2760
+ * "hostVer": "√",
2761
+ * "uniVer": "√",
2762
+ * "unixVer": "x"
2763
+ * },
2764
+ * "jd": {
2765
+ * "hostVer": "√",
2766
+ * "uniVer": "√",
2767
+ * "unixVer": "x"
2768
+ * }
2769
+ * },
2770
+ "web": {
2771
+ "uniVer": "√",
2772
+ "unixVer": "4.0"
2773
+ }
2774
+ }
2775
+ */
2776
+ timeout?: number | null,
2777
+ /**
2778
+ * 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'}
2779
+ * @defaultValue null
2780
+ */
2781
+ success?: DownloadFileSuccessCallback | null,
2782
+ /**
2783
+ * 失败的回调函数
2784
+ * @defaultValue null
2785
+ */
2786
+ fail?: DownloadFileFailCallback | null,
2787
+ /**
2788
+ * 结束的回调函数(调用成功、失败都会执行)
2789
+ * @defaultValue null
2790
+ */
2791
+ complete?: DownloadFileCompleteCallback | null
2792
+ };
2793
+ export type OnProgressDownloadResult = {
2794
+ /**
2795
+ * 下载进度百分比
2796
+ * @uniPlatform
2797
+ {
2798
+ "app": {
2799
+ "android": {
2800
+ "osVer": "5.0",
2801
+ "uniVer": "√",
2802
+ "uniUtsPlugin": "3.91",
2803
+ "unixVer": "3.91",
2804
+ "unixUtsPlugin": "3.91"
2805
+ },
2806
+ "ios": {
2807
+ "osVer": "12.0",
2808
+ "uniVer": "√",
2809
+ "uniUtsPlugin": "4.11",
2810
+ "unixVer": "4.11",
2811
+ "unixUtsPlugin": "4.11"
2812
+ },
2813
+ "harmony": {
2814
+ "osVer": "3.0",
2815
+ "uniVer": "4.23",
2816
+ "unixVer": "4.61"
2817
+ }
2818
+ },
2819
+ * "mp": {
2820
+ * "weixin": {
2821
+ * "hostVer": "√",
2822
+ * "uniVer": "√",
2823
+ * "unixVer": "4.41"
2824
+ * },
2825
+ * "alipay": {
2826
+ * "hostVer": "√",
2827
+ * "uniVer": "√",
2828
+ * "unixVer": "x"
2829
+ * },
2830
+ * "baidu": {
2831
+ * "hostVer": "√",
2832
+ * "uniVer": "√",
2833
+ * "unixVer": "x"
2834
+ * },
2835
+ * "toutiao": {
2836
+ * "hostVer": "√",
2837
+ * "uniVer": "√",
2838
+ * "unixVer": "x"
2839
+ * },
2840
+ * "lark": {
2841
+ * "hostVer": "√",
2842
+ * "uniVer": "√",
2843
+ * "unixVer": "x"
2844
+ * },
2845
+ * "qq": {
2846
+ * "hostVer": "√",
2847
+ * "uniVer": "√",
2848
+ * "unixVer": "x"
2849
+ * },
2850
+ * "kuaishou": {
2851
+ * "hostVer": "√",
2852
+ * "uniVer": "√",
2853
+ * "unixVer": "x"
2854
+ * },
2855
+ * "jd": {
2856
+ * "hostVer": "√",
2857
+ * "uniVer": "√",
2858
+ * "unixVer": "x"
2859
+ * }
2860
+ * },
2861
+ "web": {
2862
+ "uniVer": "√",
2863
+ "unixVer": "4.0"
2864
+ }
2865
+ }
2866
+ */
2867
+ progress: number,
2868
+ /**
2869
+ * 已经下载的数据长度,单位 Bytes
2870
+ * @uniPlatform
2871
+ {
2872
+ "app": {
2873
+ "android": {
2874
+ "osVer": "5.0",
2875
+ "uniVer": "√",
2876
+ "uniUtsPlugin": "3.91",
2877
+ "unixVer": "3.91",
2878
+ "unixUtsPlugin": "3.91"
2879
+ },
2880
+ "ios": {
2881
+ "osVer": "12.0",
2882
+ "uniVer": "√",
2883
+ "uniUtsPlugin": "4.11",
2884
+ "unixVer": "4.11",
2885
+ "unixUtsPlugin": "4.11"
2886
+ },
2887
+ "harmony": {
2888
+ "osVer": "3.0",
2889
+ "uniVer": "4.23",
2890
+ "unixVer": "4.61"
2891
+ }
2892
+ },
2893
+ * "mp": {
2894
+ * "weixin": {
2895
+ * "hostVer": "√",
2896
+ * "uniVer": "√",
2897
+ * "unixVer": "4.41"
2898
+ * },
2899
+ * "alipay": {
2900
+ * "hostVer": "√",
2901
+ * "uniVer": "√",
2902
+ * "unixVer": "x"
2903
+ * },
2904
+ * "baidu": {
2905
+ * "hostVer": "√",
2906
+ * "uniVer": "√",
2907
+ * "unixVer": "x"
2908
+ * },
2909
+ * "toutiao": {
2910
+ * "hostVer": "√",
2911
+ * "uniVer": "√",
2912
+ * "unixVer": "x"
2913
+ * },
2914
+ * "lark": {
2915
+ * "hostVer": "√",
2916
+ * "uniVer": "√",
2917
+ * "unixVer": "x"
2918
+ * },
2919
+ * "qq": {
2920
+ * "hostVer": "√",
2921
+ * "uniVer": "√",
2922
+ * "unixVer": "x"
2923
+ * },
2924
+ * "kuaishou": {
2925
+ * "hostVer": "√",
2926
+ * "uniVer": "√",
2927
+ * "unixVer": "x"
2928
+ * },
2929
+ * "jd": {
2930
+ * "hostVer": "√",
2931
+ * "uniVer": "√",
2932
+ * "unixVer": "x"
2933
+ * }
2934
+ * },
2935
+ "web": {
2936
+ "uniVer": "√",
2937
+ "unixVer": "4.0"
2938
+ }
2939
+ }
2940
+ */
2941
+ totalBytesWritten: number,
2942
+ /**
2943
+ * 预期需要下载的数据总长度,单位 Bytes
2944
+ * @uniPlatform
2945
+ {
2946
+ "app": {
2947
+ "android": {
2948
+ "osVer": "5.0",
2949
+ "uniVer": "√",
2950
+ "uniUtsPlugin": "3.91",
2951
+ "unixVer": "3.91",
2952
+ "unixUtsPlugin": "3.91"
2953
+ },
2954
+ "ios": {
2955
+ "osVer": "12.0",
2956
+ "uniVer": "√",
2957
+ "uniUtsPlugin": "4.11",
2958
+ "unixVer": "4.11",
2959
+ "unixUtsPlugin": "4.11"
2960
+ },
2961
+ "harmony": {
2962
+ "osVer": "3.0",
2963
+ "uniVer": "4.23",
2964
+ "unixVer": "4.61"
2965
+ }
2966
+ },
2967
+ * "mp": {
2968
+ * "weixin": {
2969
+ * "hostVer": "√",
2970
+ * "uniVer": "√",
2971
+ * "unixVer": "4.41"
2972
+ * },
2973
+ * "alipay": {
2974
+ * "hostVer": "√",
2975
+ * "uniVer": "√",
2976
+ * "unixVer": "x"
2977
+ * },
2978
+ * "baidu": {
2979
+ * "hostVer": "√",
2980
+ * "uniVer": "√",
2981
+ * "unixVer": "x"
2982
+ * },
2983
+ * "toutiao": {
2984
+ * "hostVer": "√",
2985
+ * "uniVer": "√",
2986
+ * "unixVer": "x"
2987
+ * },
2988
+ * "lark": {
2989
+ * "hostVer": "√",
2990
+ * "uniVer": "√",
2991
+ * "unixVer": "x"
2992
+ * },
2993
+ * "qq": {
2994
+ * "hostVer": "√",
2995
+ * "uniVer": "√",
2996
+ * "unixVer": "x"
2997
+ * },
2998
+ * "kuaishou": {
2999
+ * "hostVer": "√",
3000
+ * "uniVer": "√",
3001
+ * "unixVer": "x"
3002
+ * },
3003
+ * "jd": {
3004
+ * "hostVer": "√",
3005
+ * "uniVer": "√",
3006
+ * "unixVer": "x"
3007
+ * }
3008
+ * },
3009
+ "web": {
3010
+ "uniVer": "√",
3011
+ "unixVer": "4.0"
3012
+ }
3013
+ }
3014
+ */
3015
+ totalBytesExpectedToWrite: number
3016
+ };
3017
+ export type DownloadFileProgressUpdateCallback = (result: OnProgressDownloadResult) => void;
3018
+ export interface DownloadTask {
3019
+ /**
3020
+ * 中断下载任务
3021
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
3022
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
3023
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
3024
+ * @uniPlatform
3025
+ {
3026
+ "app": {
3027
+ "android": {
3028
+ "osVer": "5.0",
3029
+ "uniVer": "√",
3030
+ "uniUtsPlugin": "3.91",
3031
+ "unixVer": "3.91",
3032
+ "unixUtsPlugin": "3.91"
3033
+ },
3034
+ "ios": {
3035
+ "osVer": "12.0",
3036
+ "uniVer": "√",
3037
+ "uniUtsPlugin": "4.11",
3038
+ "unixVer": "4.11",
3039
+ "unixUtsPlugin": "4.11"
3040
+ },
3041
+ "harmony": {
3042
+ "osVer": "3.0",
3043
+ "uniVer": "4.23",
3044
+ "unixVer": "4.61"
3045
+ }
3046
+ },
3047
+ * "mp": {
3048
+ * "weixin": {
3049
+ * "hostVer": "√",
3050
+ * "uniVer": "√",
3051
+ * "unixVer": "4.41"
3052
+ * },
3053
+ * "alipay": {
3054
+ * "hostVer": "√",
3055
+ * "uniVer": "√",
3056
+ * "unixVer": "x"
3057
+ * },
3058
+ * "baidu": {
3059
+ * "hostVer": "√",
3060
+ * "uniVer": "√",
3061
+ * "unixVer": "x"
3062
+ * },
3063
+ * "toutiao": {
3064
+ * "hostVer": "√",
3065
+ * "uniVer": "√",
3066
+ * "unixVer": "x"
3067
+ * },
3068
+ * "lark": {
3069
+ * "hostVer": "√",
3070
+ * "uniVer": "√",
3071
+ * "unixVer": "x"
3072
+ * },
3073
+ * "qq": {
3074
+ * "hostVer": "√",
3075
+ * "uniVer": "√",
3076
+ * "unixVer": "x"
3077
+ * },
3078
+ * "kuaishou": {
3079
+ * "hostVer": "√",
3080
+ * "uniVer": "√",
3081
+ * "unixVer": "x"
3082
+ * },
3083
+ * "jd": {
3084
+ * "hostVer": "√",
3085
+ * "uniVer": "√",
3086
+ * "unixVer": "x"
3087
+ * }
3088
+ * },
3089
+ "web": {
3090
+ "uniVer": "√",
3091
+ "unixVer": "4.0"
3092
+ }
3093
+ }
3094
+ * @example
3095
+ ```typescript
3096
+ var downloadTask = uni.downloadFile({
3097
+ url: 'https://www.example.com/file/test', //仅为示例,并非真实接口地址。
3098
+ complete: ()=> {}
3099
+ });
3100
+ downloadTask.abort();
3101
+ ```
3102
+ */
3103
+ abort(): void,
3104
+ /**
3105
+ * 监听下载进度变化。
3106
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
3107
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
3108
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
3109
+ * @uniPlatform
3110
+ {
3111
+ "app": {
3112
+ "android": {
3113
+ "osVer": "5.0",
3114
+ "uniVer": "√",
3115
+ "uniUtsPlugin": "3.91",
3116
+ "unixVer": "3.91",
3117
+ "unixUtsPlugin": "3.91"
3118
+ },
3119
+ "ios": {
3120
+ "osVer": "12.0",
3121
+ "uniVer": "√",
3122
+ "uniUtsPlugin": "4.11",
3123
+ "unixVer": "4.11",
3124
+ "unixUtsPlugin": "4.11"
3125
+ },
3126
+ "harmony": {
3127
+ "osVer": "3.0",
3128
+ "uniVer": "4.23",
3129
+ "unixVer": "4.61"
3130
+ }
3131
+ },
3132
+ * "mp": {
3133
+ * "weixin": {
3134
+ * "hostVer": "√",
3135
+ * "uniVer": "√",
3136
+ * "unixVer": "4.41"
3137
+ * },
3138
+ * "alipay": {
3139
+ * "hostVer": "√",
3140
+ * "uniVer": "√",
3141
+ * "unixVer": "x"
3142
+ * },
3143
+ * "baidu": {
3144
+ * "hostVer": "√",
3145
+ * "uniVer": "√",
3146
+ * "unixVer": "x"
3147
+ * },
3148
+ * "toutiao": {
3149
+ * "hostVer": "√",
3150
+ * "uniVer": "√",
3151
+ * "unixVer": "x"
3152
+ * },
3153
+ * "lark": {
3154
+ * "hostVer": "√",
3155
+ * "uniVer": "√",
3156
+ * "unixVer": "x"
3157
+ * },
3158
+ * "qq": {
3159
+ * "hostVer": "√",
3160
+ * "uniVer": "√",
3161
+ * "unixVer": "x"
3162
+ * },
3163
+ * "kuaishou": {
3164
+ * "hostVer": "√",
3165
+ * "uniVer": "√",
3166
+ * "unixVer": "x"
3167
+ * },
3168
+ * "jd": {
3169
+ * "hostVer": "√",
3170
+ * "uniVer": "√",
3171
+ * "unixVer": "x"
3172
+ * }
3173
+ * },
3174
+ "web": {
3175
+ "uniVer": "√",
3176
+ "unixVer": "4.0"
3177
+ }
3178
+ }
3179
+ * @example
3180
+ ```typescript
3181
+ downloadTask.onProgressUpdate((res) => {
3182
+ console.log('下载进度' + res.progress);
3183
+ console.log('已经下载的数据长度' + res.totalBytesWritten);
3184
+ console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite);
3185
+ });
3186
+ ```
3187
+ */
3188
+ onProgressUpdate(callback: DownloadFileProgressUpdateCallback): void,
3189
+ };
3190
+
3191
+ export type ConfigMTLS = (options: ConfigMTLSOptions) => void;
3192
+ export type Certificate = {
3193
+ /**
3194
+ * 对应请求的域名(注意:不要协议部分)
3195
+ */
3196
+ host: string,
3197
+ /**
3198
+ * 客户端证书(服务器端需要验证客户端证书时需要配置此项,格式要求请参考下面的证书格式说明,注意 iOS 平台客户端证书只支持 .p12 类型的证书。HarmonyOS Next 上是证书路径 [文档](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-http-V5#clientcert11))
3199
+ */
3200
+ client?: string | null,
3201
+ /**
3202
+ * 客户端证书对应的密码(客户端证书存在时必须配置此项。HarmonyOS Next 上是证书秘钥的密码 [文档](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-http-V5#clientcert11))
3203
+ */
3204
+ clientPassword?: string | null,
3205
+ /**
3206
+ * 证书秘钥的路径,只支持 HarmonyOS Next
3207
+ *
3208
+ * @uniPlatform
3209
+ {
3210
+ "app": {
3211
+ "android": {
3212
+ "osVer": "x",
3213
+ "uniVer": "x",
3214
+ "unixVer": "x"
3215
+ },
3216
+ "ios": {
3217
+ "osVer": "x",
3218
+ "uniVer": "x",
3219
+ "unixVer": "x"
3220
+ },
3221
+ "harmony": {
3222
+ "osVer": "3.0",
3223
+ "uniVer": "4.23",
3224
+ "unixVer": "4.61"
3225
+ }
3226
+ },
3227
+ "web": {
3228
+ "uniVer": "x",
3229
+ "unixVer": "x"
3230
+ }
3231
+ }
3232
+ */
3233
+ keyPath?: string | null,
3234
+ /**
3235
+ * 服务器端证书(客户端需要对服务器端证书做校验时需要配置此项,格式要求请参考下面的证书格式说明,注意 iOS 平台服务器端证书只支持 .cer 类型的证书。HarmonyOS Next 不支持)
3236
+ *
3237
+ * @uniPlatform {
3238
+ {
3239
+ "app": {
3240
+ "android": {
3241
+ "osVer": "4.4",
3242
+ "uniVer": "3.2.7",
3243
+ "unixVer": "x"
3244
+ },
3245
+ "ios": {
3246
+ "osVer": "10.0",
3247
+ "uniVer": "3.2.7",
3248
+ "unixVer": "x"
3249
+ },
3250
+ "harmony": {
3251
+ "osVer": "x",
3252
+ "uniVer": "x",
3253
+ "unixVer": "x"
3254
+ }
3255
+ },
3256
+ "web": {
3257
+ "uniVer": "x",
3258
+ "unixVer": "x"
3259
+ }
3260
+ }
3261
+ */
3262
+ server?: (string[]) | null
3263
+ };
3264
+ export type ConfigMTLSSuccess = {
3265
+ /**
3266
+ * 成功返回 0,失败返回相应 code 码
3267
+ */
3268
+ code: number
3269
+ };
3270
+ export type ConfigMTLSSuccessCallback = (result: ConfigMTLSSuccess) => void;
3271
+ export type ConfigMTLSFail = {
3272
+ /**
3273
+ * 成功返回 0,失败返回相应 code 码
3274
+ */
3275
+ code: number
3276
+ };
3277
+ export type ConfigMTLSFailCallback = (result: ConfigMTLSFail) => void;
3278
+ export type ConfigMTLSComplete = any;
3279
+ export type ConfigMTLSCompleteCallback = (result: ConfigMTLSComplete) => void;
3280
+ export type ConfigMTLSOptions = {
3281
+ /**
3282
+ * 资源url
3283
+ */
3284
+ certificates: Certificate[],
3285
+ /**
3286
+ * 成功返回的回调函数
3287
+ */
3288
+ success?: ConfigMTLSSuccessCallback | null,
3289
+ /**
3290
+ * 失败的回调函数
3291
+ */
3292
+ fail?: ConfigMTLSFailCallback | null,
3293
+ /**
3294
+ * 结束的回调函数(调用成功、失败都会执行)
3295
+ */
3296
+ complete?: ConfigMTLSCompleteCallback | null
3297
+ }
3298
+
3299
+ export interface Uni {
3300
+ /**
3301
+ * 发起网络请求。
3302
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/request.html
3303
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/request.html
3304
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/request.html
3305
+ * @inline
3306
+ * @reified
3307
+ * @uniPlatform
3308
+ {
3309
+ "app": {
3310
+ "android": {
3311
+ "osVer": "4.4",
3312
+ "uniVer": "√",
3313
+ "uniUtsPlugin": "3.91",
3314
+ "unixVer": "3.91",
3315
+ "unixUtsPlugin": "3.91"
3316
+ },
3317
+ "ios": {
3318
+ "osVer": "12.0",
3319
+ "uniVer": "√",
3320
+ "uniUtsPlugin": "4.11",
3321
+ "unixVer": "4.11",
3322
+ "unixUtsPlugin": "4.11"
3323
+ },
3324
+ "harmony": {
3325
+ "osVer": "3.0",
3326
+ "uniVer": "4.23",
3327
+ "unixVer": "4.61"
3328
+ }
3329
+ },
3330
+ * "mp": {
3331
+ * "weixin": {
3332
+ * "hostVer": "√",
3333
+ * "uniVer": "√",
3334
+ * "unixVer": "4.41"
3335
+ * },
3336
+ * "alipay": {
3337
+ * "hostVer": "√",
3338
+ * "uniVer": "√",
3339
+ * "unixVer": "x"
3340
+ * },
3341
+ * "baidu": {
3342
+ * "hostVer": "√",
3343
+ * "uniVer": "√",
3344
+ * "unixVer": "x"
3345
+ * },
3346
+ * "toutiao": {
3347
+ * "hostVer": "√",
3348
+ * "uniVer": "√",
3349
+ * "unixVer": "x"
3350
+ * },
3351
+ * "lark": {
3352
+ * "hostVer": "√",
3353
+ * "uniVer": "√",
3354
+ * "unixVer": "x"
3355
+ * },
3356
+ * "qq": {
3357
+ * "hostVer": "√",
3358
+ * "uniVer": "√",
3359
+ * "unixVer": "x"
3360
+ * },
3361
+ * "kuaishou": {
3362
+ * "hostVer": "√",
3363
+ * "uniVer": "√",
3364
+ * "unixVer": "x"
3365
+ * },
3366
+ * "jd": {
3367
+ * "hostVer": "√",
3368
+ * "uniVer": "√",
3369
+ * "unixVer": "x"
3370
+ * }
3371
+ * },
3372
+ "web": {
3373
+ "uniVer": "√",
3374
+ "unixVer": "4.0"
3375
+ }
3376
+ }
3377
+ * @example
3378
+ ```typescript
3379
+ uni.request({
3380
+ url: "http://192.168.12.106:8080/postHalo",
3381
+ dataType: "json",
3382
+ responseType: "json",
3383
+ method: "POST",
3384
+ data: {
3385
+ platform: "ios",
3386
+ },
3387
+ // header: {
3388
+ // "Content-Type": "application/json",
3389
+ // },
3390
+ timeout: 6000,
3391
+ sslVerify: false,
3392
+ withCredentials: false,
3393
+ firstIpv4: false,
3394
+ success(res) {
3395
+ console.log("success :", res.data);
3396
+ },
3397
+ fail(e) {
3398
+ console.log(e);
3399
+ },
3400
+ complete(res) {
3401
+ console.log("complete :", res);
3402
+ },
3403
+ });
3404
+ ```
3405
+ */
3406
+ request<T>(param: RequestOptions<T>): RequestTask;
3407
+ /**
3408
+ * 将本地资源上传到开发者服务器。
3409
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
3410
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
3411
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/upload-file.html
3412
+ * @uniPlatform
3413
+ {
3414
+ "app": {
3415
+ "android": {
3416
+ "osVer": "4.4",
3417
+ "uniVer": "√",
3418
+ "uniUtsPlugin": "3.91",
3419
+ "unixVer": "3.91",
3420
+ "unixUtsPlugin": "3.91"
3421
+ },
3422
+ "ios": {
3423
+ "osVer": "12.0",
3424
+ "uniVer": "√",
3425
+ "uniUtsPlugin": "x",
3426
+ "unixVer": "4.11",
3427
+ "unixUtsPlugin": "4.11"
3428
+ },
3429
+ "harmony": {
3430
+ "osVer": "3.0",
3431
+ "uniVer": "4.23",
3432
+ "unixVer": "4.61"
3433
+ }
3434
+ },
3435
+ * "mp": {
3436
+ * "weixin": {
3437
+ * "hostVer": "√",
3438
+ * "uniVer": "√",
3439
+ * "unixVer": "4.41"
3440
+ * },
3441
+ * "alipay": {
3442
+ * "hostVer": "√",
3443
+ * "uniVer": "√",
3444
+ * "unixVer": "x"
3445
+ * },
3446
+ * "baidu": {
3447
+ * "hostVer": "√",
3448
+ * "uniVer": "√",
3449
+ * "unixVer": "x"
3450
+ * },
3451
+ * "toutiao": {
3452
+ * "hostVer": "√",
3453
+ * "uniVer": "√",
3454
+ * "unixVer": "x"
3455
+ * },
3456
+ * "lark": {
3457
+ * "hostVer": "√",
3458
+ * "uniVer": "√",
3459
+ * "unixVer": "x"
3460
+ * },
3461
+ * "qq": {
3462
+ * "hostVer": "√",
3463
+ * "uniVer": "√",
3464
+ * "unixVer": "x"
3465
+ * },
3466
+ * "kuaishou": {
3467
+ * "hostVer": "√",
3468
+ * "uniVer": "√",
3469
+ * "unixVer": "x"
3470
+ * },
3471
+ * "jd": {
3472
+ * "hostVer": "√",
3473
+ * "uniVer": "√",
3474
+ * "unixVer": "x"
3475
+ * }
3476
+ * },
3477
+ "web": {
3478
+ "uniVer": "√",
3479
+ "unixVer": "4.0"
3480
+ }
3481
+ }
3482
+ * @example
3483
+ ```typescript
3484
+ uni.uploadFile({
3485
+ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,非真实的接口地址
3486
+ filePath: "/static/logo.png",
3487
+ name: 'file',
3488
+ formData: {
3489
+ 'user': 'test'
3490
+ },
3491
+ success: (uploadFileRes) => {
3492
+ console.log(uploadFileRes.data);
3493
+ }
3494
+ });
3495
+ ```
3496
+ */
3497
+ uploadFile(options: UploadFileOptions): UploadTask;
3498
+ /**
3499
+ * 下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。
3500
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
3501
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
3502
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/download-file.html
3503
+ * @uniPlatform
3504
+ {
3505
+ "app": {
3506
+ "android": {
3507
+ "osVer": "4.4",
3508
+ "uniVer": "√",
3509
+ "uniUtsPlugin": "3.91",
3510
+ "unixVer": "3.91",
3511
+ "unixUtsPlugin": "3.91"
3512
+ },
3513
+ "ios": {
3514
+ "osVer": "12.0",
3515
+ "uniVer": "√",
3516
+ "uniUtsPlugin": "x",
3517
+ "unixVer": "4.11",
3518
+ "unixUtsPlugin": "4.11"
3519
+ },
3520
+ "harmony": {
3521
+ "osVer": "3.0",
3522
+ "uniVer": "4.23",
3523
+ "unixVer": "4.61"
3524
+ }
3525
+ },
3526
+ * "mp": {
3527
+ * "weixin": {
3528
+ * "hostVer": "√",
3529
+ * "uniVer": "√",
3530
+ * "unixVer": "4.41"
3531
+ * },
3532
+ * "alipay": {
3533
+ * "hostVer": "√",
3534
+ * "uniVer": "√",
3535
+ * "unixVer": "x"
3536
+ * },
3537
+ * "baidu": {
3538
+ * "hostVer": "√",
3539
+ * "uniVer": "√",
3540
+ * "unixVer": "x"
3541
+ * },
3542
+ * "toutiao": {
3543
+ * "hostVer": "√",
3544
+ * "uniVer": "√",
3545
+ * "unixVer": "x"
3546
+ * },
3547
+ * "lark": {
3548
+ * "hostVer": "√",
3549
+ * "uniVer": "√",
3550
+ * "unixVer": "x"
3551
+ * },
3552
+ * "qq": {
3553
+ * "hostVer": "√",
3554
+ * "uniVer": "√",
3555
+ * "unixVer": "x"
3556
+ * },
3557
+ * "kuaishou": {
3558
+ * "hostVer": "√",
3559
+ * "uniVer": "√",
3560
+ * "unixVer": "x"
3561
+ * },
3562
+ * "jd": {
3563
+ * "hostVer": "√",
3564
+ * "uniVer": "√",
3565
+ * "unixVer": "x"
3566
+ * }
3567
+ * },
3568
+ "web": {
3569
+ "uniVer": "√",
3570
+ "unixVer": "4.0"
3571
+ }
3572
+ }
3573
+ * @example
3574
+ ```typescript
3575
+ uni.downloadFile({
3576
+ url: "http://192.168.12.106:8080/downloadfile",
3577
+ success(e) {
3578
+ console.log("success111 :", e);
3579
+ }
3580
+ });
3581
+ ```
3582
+ */
3583
+ downloadFile(options: DownloadFileOptions): DownloadTask;
3584
+ /**
3585
+ * 配置自签名证书
3586
+ *
3587
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/request.html#configmtls
3588
+ * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/request/request.html#configmtls
3589
+ *
3590
+ * @uniPlatform
3591
+ {
3592
+ "app": {
3593
+ "android": {
3594
+ "osVer": "4.4",
3595
+ "uniVer": "3.2.7",
3596
+ "uniUtsPlugin": "x",
3597
+ "unixVer": "x",
3598
+ "unixUtsPlugin": "x"
3599
+ },
3600
+ "ios": {
3601
+ "osVer": "10.0",
3602
+ "uniVer": "3.2.7",
3603
+ "uniUtsPlugin": "x",
3604
+ "unixVer": "x",
3605
+ "unixUtsPlugin": "x"
3606
+ },
3607
+ "harmony": {
3608
+ "osVer": "3.0",
3609
+ "uniVer": "4.31",
3610
+ "unixVer": "4.61"
3611
+ }
3612
+ },
3613
+ "web": {
3614
+ "uniVer": "x",
3615
+ "unixVer": "x"
3616
+ }
3617
+ }
3618
+ */
3619
+ configMTLS(options: ConfigMTLSOptions): void;
3620
+ }