|
@@ -65,7 +65,8 @@ export default function({
|
|
|
}, ...args)
|
|
}, ...args)
|
|
|
},
|
|
},
|
|
|
onerror: () => {}, // 请求错误钩子函数集合
|
|
onerror: () => {}, // 请求错误钩子函数集合
|
|
|
- file(method, url, data, header, reqIntercept, resIntercept) {
|
|
|
|
|
|
|
+ file(method, url, data, header, reqIntercept=true, resIntercept=true) {
|
|
|
|
|
+ console.log(data);
|
|
|
let timer, // timer 检测超时定时器
|
|
let timer, // timer 检测超时定时器
|
|
|
requestTask, // requestTask 网络请求 task 对象
|
|
requestTask, // requestTask 网络请求 task 对象
|
|
|
aborted = false, // aborted 请求是否已被取消
|
|
aborted = false, // aborted 请求是否已被取消
|
|
@@ -91,8 +92,10 @@ export default function({
|
|
|
await this.onerror(method, url, data, '网络请求失败:主动取消')
|
|
await this.onerror(method, url, data, '网络请求失败:主动取消')
|
|
|
return reject('网络请求失败:主动取消')
|
|
return reject('网络请求失败:主动取消')
|
|
|
}
|
|
}
|
|
|
|
|
+ console.log(body);
|
|
|
requestTask = uni[method]({
|
|
requestTask = uni[method]({
|
|
|
- url: url[0] === '/' ? baseURL + url : url,
|
|
|
|
|
|
|
+ // url: url[0] === '/' ? baseURL + url : url,
|
|
|
|
|
+ url: baseURL + url,
|
|
|
name: data.name,
|
|
name: data.name,
|
|
|
header,
|
|
header,
|
|
|
filePath: data.filePath,
|
|
filePath: data.filePath,
|
|
@@ -137,7 +140,7 @@ export default function({
|
|
|
}) // 如果调用 cancel 方法,返回 _watcher.cancel 方法
|
|
}) // 如果调用 cancel 方法,返回 _watcher.cancel 方法
|
|
|
},
|
|
},
|
|
|
request(method, url, data, header, reqIntercept=true, resIntercept=true) {
|
|
request(method, url, data, header, reqIntercept=true, resIntercept=true) {
|
|
|
- console.log(header);
|
|
|
|
|
|
|
+
|
|
|
let timer, // timer 检测超时定时器
|
|
let timer, // timer 检测超时定时器
|
|
|
requestTask, // requestTask 网络请求 task 对象
|
|
requestTask, // requestTask 网络请求 task 对象
|
|
|
aborted = false, // aborted 请求是否已被取消
|
|
aborted = false, // aborted 请求是否已被取消
|